• Resolved Arno Kools

    (@arno-kools)


    The export function gives the following error in PHP 8:

    Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, string given in …../plugins/wp-all-export/libraries/XmlCsvExport.php:764

    It does work in php 7(.4)

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Arno Kools

    (@arno-kools)

    I checked the code at line 764:
    if (is_array($field) and (isset($field['auto']) or (! in_array('product', $post['cpt']) || !\class_exists('WooCommerce')))) {

    For the time being I’ve edited it to:
    if (is_array($field) and (isset($field['auto']) or (! (isset($post['cpt']) && is_array($post['cpt']) && in_array('product', $post['cpt'])) || !\class_exists('WooCommerce')))) {

    With the additional check if $post[‘cpt’] exists and is an array, the export works in PHP 8

    Thread Starter Arno Kools

    (@arno-kools)

    WP All Export
    Version 1.3.2

    Plugin Author WP All Import

    (@wpallimport)

    Hey @arno-kools,

    With the additional check if $post[‘cpt’] exists and is an array, the export works in PHP 8

    Thank you for the report and the proposed fix. I’ve reported this to our developer and I’ll follow up here once I know more.

    Plugin Author WP All Import

    (@wpallimport)

    Hi @arno-kools,

    We plan to have a fix for this in the next release of the plugin. Thanks again for the report.

    Thread Starter Arno Kools

    (@arno-kools)

    That’s great. Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘TypeError in PHP 8’ is closed to new replies.