• Resolved rodrigoduarte

    (@rodrigoduarte)


    Hi, when I edit, or add a product on the admin dashboard, I get the following error:

    Fatal error: Uncaught TypeError: explode(): Argument #2 ($string) must be of type string, array given in /var/www/html/wp-admin/includes/template.php:1326 Stack trace: #0 /var/www/html/wp-admin/includes/template.php(1326): explode(‘,’, Array) #1 /var/www/html/wp-admin/edit-form-advanced.php(716): do_meta_boxes(Object(WP_Screen), ‘side’, Object(WP_Post)) #2 /var/www/html/wp-admin/post-new.php(75): require(‘/var/www/html/w…’) #3 {main} thrown in /var/www/html/wp-admin/includes/template.php on line 1326

    I solved this problem by downgrading the PHP version, however I am looking for a more long-term fix.

    All the plugins, themes and WordPress are up to date.

    Thanks in advance for the help.

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Support Zubair Zahid (woo-hc)

    (@doublezed2)

    Hello rodrigoduarte,

    Thanks for contacting WooCommerce support.

    I understand you are facing a fatal error when trying to edit or add a product.
    You were able to fix this by downgrading the PHP version.

    May I ask which PHP version was causing the issue and which did not?

    To help you, I’d like to understand more about your server setup.
    This will help me recreate the problem on my test site and find out what is causing it.

    Could you please send me a copy of your site’s System Status Report?
    You can find it via WooCommerce > Status.
    Select Get system report and then Copy for support.

    Once you’ve done that, you can paste the text in https://gist.github.com
    After that, you can paste the Gist link here in your reply.

    Looking forward to your response. ??

    Thread Starter rodrigoduarte

    (@rodrigoduarte)

    Here the link for gist: https://gist.github.com/B0linhaaa/ebc3fde6f0c57e29e2570866f4e624ea.

    Thanks for help!

    Hey, @rodrigoduarte!

    Thanks for sharing the SSR.

    Your WooCommerce version is out dated, please update it to the most recent version, 9.2.3. And please check if your theme and other plugins have updates available.

    I also see your database is outdated. This can cause a lot of issues on the website.

    Please update it by either following the warning message a the top of the page on WooCommerce area of the dashboard or going to WooCommerce > Status > Tools > Update Database.

    Be sure you have a good backup in place of your full site and database. You can ask your host for backup functionality or you can consider using a service like Jetpack. If something goes wrong, you will be able to restore it.

    After this, please check if the issue continues.

    If it does, can you please confirm for us which PHP version you were using when the issue happened?
    I see on the SSR that you are currently using 7.4.33, so I believe this is the one that is working, correct?

    Looking forward to your reply.

    Have a wonderful day!

    Thread Starter rodrigoduarte

    (@rodrigoduarte)

    The report I sent to you earlier was from the production website. We are waiting for a better solution for this problem to proceed with the updates.

    Here is the report from the test environment, in wich I updated all the plugins: https://gist.github.com/B0linhaaa/4f59b02525e705646165160fd34f677d.

    Hey, @rodrigoduarte!

    Thanks for sharing the updated report.

    I see you are using PHP 8.2

    My test website is currently running PHP 8.2 too and I was not able to replicate the issue.

    Can you please run a conflict test to see if something external is interfering with this?

    To test, you’ll first want to change the theme on your site to Storefront, then check to see if the issue is still present. If that resolves the issue, you’ll want to get in touch with your theme’s developer and see if they have an update or fix for you.

    If changing the theme doesn’t help, you’ll want to deactivate all plugins except for WooCommerce and take a look. If that fixes the problem, re-enable the other plugins one by one (gradually), checking after each, to see where the issue is coming from.

    — Be sure you have a good backup in place of your full site and database. You can ask your host for backup functionality or you can consider using a service like Jetpack. If something goes wrong, you will be able to restore it.

    You can find more about this in this guide.

    Please let us know about your findings.

    Have a wonderful day!

    Thread Starter rodrigoduarte

    (@rodrigoduarte)

    I desactivate all plugins except WooCommerce and change theme but the issue continue, i sent to you a new report to you see: https://gist.github.com/B0linhaaa/3cb515787691059140ce3203f63f822e

    Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @rodrigoduarte

    The error you’re encountering results from a type mismatch in the PHP function ‘explode()’. It expects a string as the second argument but gets an array instead. This could be due to a conflict with a plugin or a theme.

    While downgrading PHP is a short-term solution, it’s not ideal for long-term security and performance. May I know which PHP version you had this error in?

    Additionally, can you please enable WordPress debugging? This can provide more detailed error messages.

    Furthermore, while the error persists even with the default theme, there could be a problem with your WooCommerce files. Try reinstalling WooCommerce and check whether it makes any difference.

    Let us know how that goes. Looking forward to helping you.

    Thread Starter rodrigoduarte

    (@rodrigoduarte)

    Hello, the error that appears to me is this:

    Fatal error: Uncaught TypeError: explode(): Argument #2 ($string) must be of type string, array given in /var/www/html/wp-admin/includes/template.php:1326 Stack trace: #0 /var/www/html/wp-admin/includes/template.php(1326): explode(‘,’, Array) #1 /var/www/html/wp-admin/edit-form-advanced.php(716): do_meta_boxes(Object(WP_Screen), ‘side’, Object(WP_Post)) #2 /var/www/html/wp-admin/post.php(206): require(‘/var/www/html/w…’) #3 {main} thrown in?/var/www/html/wp-admin/includes/template.php?on line?1326

    Also, I have already tried reinstalling WooCommerce and the problem persists.

    Plugin Support omarfpg a11n

    (@omarfpg)

    Hi @rodrigoduarte,

    Thank you for the additional details. I understand this is happening to you on your Staging site with PHP 8.2 and the latest version of WooCommerce (9.2.3) and using a default theme like Twenty Twenty-Four. Even reinstalling WooCommerce on this staging site isn’t resolving the issue.

    To continue troubleshooting this, please, head over to WooCommerce → Status → Tools, and do the following:

    • WooCommerce transients – Clear
    • Expired transients – Clear
    • Clear template cache – Clear
    • Capabilities – Reset Capabilities
    • Clear customer sessions -Clear

    Next, please clear your browser and site cache and let us know if the issue persists. Additionally, please let us know if you’ve made any modifications to the product edit page through any third-party plugin or code snippets. Maybe any custom ACF you’re using there?

    Please, keep us posted.

    Thanks!
    -OP

    Thread Starter rodrigoduarte

    (@rodrigoduarte)

    Hello,

    Thank you, but after trying this, I have the same error without ACF installed.

    Plugin Support ckadenge (woo-hc)

    (@ckadenge)

    Hi @rodrigoduarte,

    Thank you, but after trying this, I have the same error without ACF installed.

    After disabling ACF from your store, were you able to clear your browser and the following under WooCommerce → Status → Tools?

    • WooCommerce transients – Clear
    • Expired transients – Clear
    • Clear template cache – Clear
    • Capabilities – Reset Capabilities
    • Clear customer sessions -Clear

    Thread Starter rodrigoduarte

    (@rodrigoduarte)

    Hello,

    Yes, first I disabled the ACF and then I made the step of the list you shared and the problem persists.

    Thank You!

    Hi @rodrigoduarte,

    Looking into the origin of the error it looks to be that there is some unexpected data in the user meta ( meta-box-order_product ).
    This stores the order of the meta boxes of the product edit screen. You could reset this by moving the metaboxes around on the product edit screen using the ( up/down arrows ) and than saving the product to see if it removes the error ( of-course with only WooCommerce enabled ).

    When you do move the metaboxes around it may be helpful to look at the admin-ajax.php network request in your browser console and see what it passes as the data. It may contain something like:

    order[side]: submitdiv,postimagediv,woocommerce-product-images,tagsdiv-product_tag,product_catdiv
    order[normal]: woocommerce-product-data,slugdiv,postexcerpt,commentsdiv
    order[advanced]:

    Lastly, if neither of the above address or highlight the issue. You could create a new user and see if updating the product with the new user does work correctly.

    Thanks and hope this helps

    Thread Starter rodrigoduarte

    (@rodrigoduarte)

    Hello,

    Thank you for this fix, it worked.

    Hey, @rodrigoduarte!

    I’m glad to know the issue was fixed! ??

    I’m going to close this thread now, okay?

    Please let us know if there’s anything else we can do to help or if you have any questions.

    Have a wonderful day!

Viewing 15 replies - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.