Skip Navigation

[Resolved] Error Code Thrown on Form Submit…

This support ticket is created 2 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Tagged: 

This topic contains 4 replies, has 2 voices.

Last updated by shawnW-3 2 years, 5 months ago.

Assisted by: Waqar.

Author
Posts
#2382325
deprecated-errors.png

PLEASE - Assign this ticket to a supporter with in 8 Hours of the US Central Timezone to improve response frequency.
This site is IP restricted. We will need the supporter to provide their IP address so we can whitelist it before they can access it.

Fatal error: Uncaught TypeError: array_intersect(): Argument #1 ($array) must be of type array, string given in /home/ ... /wp-content/plugins/wp-views/application/controllers/cache/views/invalidator.php:274 Stack trace: #0 /home/ ... /wp-content/plugins/wp-views/application/controllers/cache/views/invalidator.php(274): array_intersect('', Array) #1 /home/ ... /wp-content/plugins/wp-views/application/controllers/cache/views/invalidator.php(217): OTGS\Toolset\Views\Controller\Cache\Views\Invalidator->invalidate_cache_per_domain('posts', Array) #2 /home/ ... /wp-includes/class-wp-hook.php(307): OTGS\Toolset\Views\Controller\Cache\Views\Invalidator->should_invalidate_cache('') #3 /home/ ... /wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array) #4 /home/ ... /wp-includes/plugin.php(476): WP_Hook->do_action(Array) #5 /home/ ... /wp-includes/load.php(1102): do_action('shutdown') #6 [internal function]: shutdown_action_hook() #7 {main} thrown in /home/ ... /wp-content/plugins/wp-views/application/controllers/cache/views/invalidator.php on line 274

I am trying to:
Originally I got the error
Warning: array_intersect(): Expected parameter 1 to be an array, string given in ... /wp-content/plugins/wp-views/application/controllers/cache/views/invalidator.php on line 274

I decided to update everything to see if that fixed the issue. It did not, but it gave us the bigger error at the top.
This is PHP 8.0.18 with WP v6

I have another ticket right now which concerns a certain form not updating URLs.
Per support in that ticket I had already tried disabling Permalink Manager Lite as well as ALL custom PHP in my settings panel.
That issue has not yet been resolved.

I should note that the previous ticket was submitted for our Test Site, while this ticket is for the Dev Site. I was NOT able to replicate this issue (Dev) on the Test site.
This site (Dev) is running PHP 8.0.18, while Test is running PHP 8.1.5

The reason they're running different versions is that Test had no apparent issues upgrading to 8.1, while dev through the errors captured in the screenshot attached.

Link to a page where the issue can be seen:
hidden link (form at the bottom)

I expected to see:
No errors

Instead, I got:
The above error

#2383587

Hi,

Thank you for contacting us and I'd be happy to assist.

Due to the nature of this error and IP restriction, it will be more efficient, if you could share a clone/snapshot of the website, where this error can be seen. This will allow us to troubleshoot this on a test server and will reduce the time in back-and-forth communication.
( ref: https://toolset.com/faq/provide-supporters-copy-site/ )

Note: If it is a large website, you can exclude the media (uploads) folder from the package, to reduce the size.

As for the other ticket, the information provided by Luo is correct and let me explain this, from a different angle:

1. It is a WordPress thing that if you'll try to create a page/post with the same name/title, it will be created, but to keep the slugs unique, it will append numbers ( -1, -2, -3, ..... ) at the end of the subsequent slugs.

You can confirm this behavior, by creating 3 posts or pages, with the same name "Test" on a test website, without any plugins.

2. Your assumption that Toolset Form without the title field will generate a unique title each time, is not correct. The automatic title is generated using the IP address of the user submitting the form, so if the same IP address is used again to submit the form, the generated title would be exactly the same too. However, as explained in point 1, the expected/default behavior is that the slugs of the generated posts will have incremental numbers appended at the end.

Again, you can confirm this behavior by using a Toolset Form on a test website, without using any other third-party plugin or custom code.

3. If on your website, yours and Luo's test confirm that only when the "Permalink Manager Lite" plugin is active, generated posts are saving the same slugs for multiple posts, then that means that this plugin is interfering with the WordPress default behavior of maintaining the unique slugs (point 1) and you can consult its official support and documentation, to see if it can be made to respect the unique slugs rule.

4. In case, the "Permalink Manager Lite" plugin doesn't have any option to respect the WordPress default behavior of maintaining the unique slugs and you absolutely need to keep that plugin, then you should end your reliance on the Toolset's automatically generated post titles and slugs. On the form's submission, you can use the "cred_save_data" hook ( ref: https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data ) to set a custom and unique post title and slugs, which can be a combination of, for example, user's ID + Post ID + current time stamp, etc.

You'll find an example of a code snippet to set a custom post title and slug on form submission, in this support thread:
https://toolset.com/forums/topic/after-editing-the-title-field-in-a-form-make-sure-slug-is-updated-accordingly/#post-2257177

I hope this helps and I'm setting your next reply as private.

regards,
Waqar

#2384513

Thank you for sharing the duplicator package and I've downloaded and deployed it on my test server.

I'll be running some tests and will share the findings, as soon as this testing completes.

Thank you for your patience.

#2385347

Thank you for waiting.

During troubleshooting on your website's clone, I noticed that the cache for one of the views "Series Parent Description" ( ID: 154124 ) was stuck in an invalid state.

Please go to WP Admin -> Toolset -> Views and use the clear cache button next to this view. After this, the error you mentioned, will be fixed.

#2385613

My issue is resolved now. How strange though. I wasn't doing anything involving that View and out of nowhere it started having caching problems?

I'm now going to see if the URL issue is fixed with Permalink Manager on...
Even though test.ddaudio.com wasn't throwing this error, "Clean Cache" is suggested on the same view...

AND, Yes!

With Permalink Manager Lite reactivated, after clearing the cache on that one view, the domain is no longer being overwritten with the same URL.

I don't understand how this is related, but I also don't understand how this error was throwing on a page the view didn't appear in for a form submission when that form didn't contain the view or any fields associated with that view.

I'll close out the ticket with Luo because the URLs are generating correctly WITH Permalink Manager active after using this fix.

I never requested support from Permalink Manager because I wanted to resolve these issues first, so I have nothing to close out on their end.