• Resolved cptkoolbeenz

    (@cptkoolbeenz)


    Plugin version: 13.5.2.2
    WordPress: 6.9.4
    WooCommerce: 10.6.2
    PHP: 8.4

    I’m getting daily PHP warnings (3 entries every cron run, every day) from
    class-get-products.php line 1147 when I have a CSV-format feed configured
    alongside XML feeds:

    PHP Warning: simplexml_load_file():
    /wp-content/uploads/woo-product-feed-pro/csv/[feed]_tmp.csv:1:
    parser error : Start tag expected, ‘<‘ not found
    in classes/class-get-products.php on line 1147

    The CSV file itself generates correctly via woosea_create_csvtxt_feed and
    the feed works fine in Google Merchant Center. The warning is coming from
    woosea_create_xml_feed which is also being called for the same feed object,
    and it tries to simplexml_load_file() the CSV file because the file path is
    constructed from $feed->file_format with no format check before the XML
    reload at line 1147.

    The fix should be straightforward — your plugin already has a private
    helper at line 415 that does exactly the right check:

      private function is_xml_file( $file ) {
          if ( ! file_exists( $file ) ) {
              return false;
          }
          $handle = fopen( $file, 'r' );
          if ( ! $handle ) {
              return false;
          }
          $content = fread( $handle, 200 );
          fclose( $handle );
          $content = ltrim( $content, "\xEF\xBB\xBF" );
          return ( strpos( trim( $content ), '<?xml' ) === 0
                || strpos( trim( $content ), '<' ) === 0 );
      }

    It just isn’t called at line 1147. Wrapping the simplexml_load_file()
    call in $this->is_xml_file( $file ) would skip the XML re-parse for CSV
    and TXT feeds entirely:

      } else {
          if ( $this->is_xml_file( $file ) ) {
              $xml    = simplexml_load_file( $file );
              $aantal = count( $products );
              // ... existing XML-specific manipulation
          } else {
              // Non-XML feed — already written by woosea_create_csvtxt_feed
              $aantal = count( $products );
          }
      }

    Happy to test a fix on staging and confirm the warnings clear. Thanks!

    • This topic was modified 2 days, 18 hours ago by cptkoolbeenz.
Viewing 1 replies (of 1 total)
  • Plugin Support Jeff Alvarez

    (@superlemon1998)

    Hi @cptkoolbeenz ,

    Thanks for the bug report, I’ll raise it up with our developers but I’m afraid I can’t provide any ETAs when a fix will be released for this. I’ll keep you in the loops

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.