Skip Navigation

[Resolved] Can't update a person and get a wordpress Update Failed error

This thread is resolved. Here is a description of the problem and solution.

Problem:
When the customer tries to update a person's records using Toolset, they get an "update failed" message and a fatal error Uncaught TypeError: array_diff on toolset-blocks/backend/Services/ViewParsingService.php
Solution:
This is likely caused by inconsistencies in the DB. More specifically, the meta field _wpv_contains_gutenberg_views in postmeta should contain only empty values or arrays, if there's a plain number in there this error can happen.

You can check it using:

SELECT * FROM `wp_postmeta` WHERE meta_key='_wpv_contains_gutenberg_views'

And eventually apply the needed patch.

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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Sao_Paulo (GMT-03:00)

This topic contains 7 replies, has 2 voices.

Last updated by markO-13 8 months, 3 weeks ago.

Assisted by: Mateus Getulio.

Author
Posts
#2685606

When I try update a person's records using Toolset, I get an "update failed" message. And then this is in the email I receive:

Error Details
=============
An error of type E_ERROR was caused in line 178 of the file /var/www/wp-content/plugins/toolset-blocks/backend/Services/ViewParsingService.php. Error message: Uncaught TypeError: array_diff(): Argument #1 ($array) must be of type array, int given in /var/www/wp-content/plugins/toolset-blocks/backend/Services/ViewParsingService.php:178
Stack trace:
#0 /var/www/wp-content/plugins/toolset-blocks/backend/Services/ViewParsingService.php(178): array_diff(706, Array)
#1 /var/www/wp-includes/class-wp-hook.php(324): OTGS\Toolset\Views\Services\ViewParsingService->scan_for_view_block_usage(1299, Object(WP_Post), true)
#2 /var/www/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#3 /var/www/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#4 /var/www/wp-includes/post.php(4762): do_action('save_post', 1299, Object(WP_Post), true)
#5 /var/www/wp-includes/post.php(4864): wp_insert_post(Array, false, true)
#6 /var/www/wp-includes/post.php(3634): wp_update_post(Array)
#7 /var/www/wp-admin/edit.php(131): wp_trash_post(1299)
#8 {main}
thrown

Please can someone advise?

#2685660

Mateus Getulio
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello there.

Looking for similar cases I found one where the culprit was an issue in the database records: https://toolset.com/forums/topic/php-fatal-error-uncaught-typeerror-array_diff-argument-1-array-must-be/#post-2525675

I can see in the error logs that the issue seems to be coming from post ID 1299.

Can you check post ID 1299 in the database to see if this record is corrupted or has inconsistent data similar to the ticket above?

Thank you, please let us know.

#2686067

Thanks - Struggling to figure out which is Post 1299. I think I did find the right one; I deleted it, tried to update a record and it worked. But then I went to update another record and it didn't work again

#2686083

Mateus Getulio
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello,

In order for me to debug this issue, can you please share the steps in order for me to reproduce this error?

I would also like to request temporary access (wp-admin and FTP) to your site to take better look at the issue. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

Our Debugging Procedures

I will be checking various settings in the backend to see if the issue can be resolved. Although I won't be making changes that affect the live site, it is still good practice to backup the site before providing us access. In the event that we do need to debug the site further, I will duplicate the site and work in a separate, local development environment to avoid affecting the live site.

Privacy and Security Policy

We have strict policies regarding privacy and access to your information. Please see:
https://toolset.com/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

**IMPORTANT**

- Please make a backup of site files and database before providing us access.
- If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this: hidden link

Please, let me know if you need any additional details. Have a nice day.

#2686269

Mateus Getulio
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello there,

Thank you for sharing that information.

I'd like to ask permission to make a copy/staging version of your site where I can debug this closely without affecting the live site.

I'll make sure to delete this copy as soon as we get this issue fixed.

I'm afraid of debugging directly on the live site and cause issues to your visitors. Also, it is important to test a different setup as part of the troubleshooting.

I'm also struggling to access the database, the files I upload via file manager plugin are not accessible afterwards.

Thank you, please let us know.
Mateus

#2686271

Hi Mateus

That's perfectly fine, thank you!

#2686325

Mateus Getulio
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

All right, I checked it and the issue is indeed similar to https://toolset.com/forums/topic/php-fatal-error-uncaught-typeerror-array_diff-argument-1-array-must-be/#post-2525675

For example, I tried updating the person 'Winnie Zinyoka' of ID 3213.

I ran a search in the postmeta and found this:

SELECT * FROM `wp_ptns56j12c_postmeta` WHERE meta_key='_wpv_contains_gutenberg_views' AND post_id=3213;

Then I noticed that the field '_wpv_contains_gutenberg_views' was a number instead of an array. Upon further review, many records in the postmeta table had this value = 706;

To fix it in my local copy, I ran this command:

update wp_ptns56j12c_postmeta 
set  meta_value = '[706]'
where meta_value = '706';

After that, I was no longer able to replicate the issue.

Can you please make a full backup of your site and run the SQL command above to fix this issue?

Also, please make sure to update your Toolset plugins, I see some of them are outdated:

- Go to Plugins > Add New
- Click on "Commercial"
- Click on 'Check again' and when the page reloads select every Toolset plugin in red and update them

Thank you, please let us know how that goes.
Mateus

#2686487

Thank you this is amazing! It works. now I have a new query I haven't been able to resolve by watching the Youtube videos but I'll add a new ticket. Thank you

#2686488

Thank you this is amazing! It works. now I have a new query I haven't been able to resolve by watching the Youtube videos but I'll add a new ticket. Thank you