Skip Navigation

[Resolved] User and Post Forms not working after upgrading to PHP 8.1

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

This topic contains 12 replies, has 3 voices.

Last updated by Christopher Amirian 1 year, 12 months ago.

Assisted by: Christopher Amirian.

Author
Posts
#2488607

I am trying to:

Prior to upgrading to PHP 8 this process worked with no issue:

Parent Post type: Job
Child Post: Application

Job contains a User registration form - Candidate completes this form to register and is then directed to completing an Application through a create post form. Most of the user details are copied over to the Application. When user submits application the application is stored as a child post of the associated Job - Application post is saved as "Application - Post ID".

Since upgrading to PHP 8 a new user is registered but when they are directed to the application post form the following appears: "There has been a critical error on this website."

It looks like an application of sorts has been created but instead of being saved as "Application - Post ID" they are saved as "Application". The child applications are not being stored to the parent job.

The error log is stating:

[Tue Oct 18 03:34:17.623358 2022] [proxy_fcgi:error] [pid 7073:tid 140036636882688] [client 90.198.158.51:39100] AH01071: Got error 'PHP message: PHP Warning: Invalid argument supplied for foreach() in /var/www/vhosts/housing-ombudsman-careers.org.uk/public_html/2021/wp-content/plugins/wp-views/backend/Models/ContentTemplate/UsagePostType.php on line 141', referer: hidden link

#2489231

Hello,

I can login into your website, where and how can I see the PHP error you mentioned above, please provide detail steps to reproduce the same problem, thanks

#2489325

Hi Luo,

Many thanks for looking into this.

The issue takes place on job posts - I have created a dummy job for you to test: hidden link

To apply on the job you need to be logged out - Admin's do not have access to make an application.

The application is two stages. 1st stage is to register as a candidate (a create user form). 2nd stage is to complete the application submitting a personal statement. (a create child post form for "Job" post type). The 2nd stage also takes inputted user registration data to add to a number of hidden fields.

Once registered as a "Candidate" user you should be able to see the jobs you have applied for at hidden link

#2491093

Thanks for the details, you are using highly customized content template and post forms, I have tried these in your website:
1) Create a post form for creating new "Application" post
hidden link

2) Test it in frontend:
hidden link

Fill and submit this form, I see the error message:
There has been a critical error on this website.

Since you did not provide FTP access, so I can not get the PHP debug logs from your website, please provide a copy of your website in below private message box, you can put the package files in your own google drive disk, share the link only, I need to test and debug it in my localhost, thanks
https://toolset.com/faq/provide-supporters-copy-site/

#2491121
#2491659

The package file link you provided above is not valid, I have to install duplicator plugin in your website, and try to export the package file from your website, will update here if find anything.

#2492655

Sorry Luo, my client is asking if they can post a job today. Do you have everything you need to duplicate the site? I can provide you Plesk server log ins if that helps instead?

#2492657
#2492663

Unfortunately, it fails to export your website with duplicator plugin, it fails to export the files, please provide a copy of your website files(zip archive)in below private message box, you can put the package files in your own google drive disk, share the link only, I need to test and debug it in my localhost.

#2492687
#2492719

Hi Luo do you have what you need to replicate the site? My client is desperate to get a new job live so will need to revert to PHP7.

#2493479

Thanks for the details, I am downloading the duplicator package files, will update here if find anything

#2495953

Hi Luo,

Were you OK in duplicating the site/problem?

#2498229

Hi Luo,

Sorry to chase but our clients hosting company is switching all the PHP over to PHP 8 on 21 November so they are naturally pressing us on this. Are you able to give me an update please?

Thank you

#2500829

Christopher Amirian
Supporter

Languages: English (English )

Screen Shot 2022-11-21 at 18.06.49.png

Hi there,

This is Christopher working on this ticket while Luo is off.

I downloaded the package and used the simple form that Luo created with PHP 8.1 and it worked with no issue.

So maybe it is related to the system that you use regarding the coding of custom settings?

Would you please test that on your installation? If that is the case, then it might be something related to the code that you use on your system that your dev team needs to check.

The best way is to do it using the pure Toolset and not additional code to see if it works that way or not.

- IMPORTANT STEP! Create a backup of your website.
- Switch to the default theme such as "TwentyTwenty" by going to "WordPress Dashboard > Appearance > themes".
- Go to "WordPress Dashboard > Plugins" and deactivate all plugins except Toolset and its add-ons.
- Check if you can still recreate the issue.
- If not, re-activate your plugins one by one and check the issue each time to find out the plugin that causes the problem.

For me it works with plugins enabled and with the default theme (not the theme you use)