woocommerce / woocommerce-product-tables-feature-plugin

Implements new data-stores and moves product data into custom tables, with a new, normalised data structure.
GNU General Public License v3.0
192 stars 32 forks source link

PHP Warning #114

Closed robin-scott closed 6 years ago

robin-scott commented 6 years ago

Giving this a whirl on some large databases to test, and seeing some PHP warnings (PHP 7.2) coming out:

Warning: Invalid argument supplied for foreach() in /wp-content/plugins/woocommerce-product-tables-feature-plugin-1.0-beta-1/includes/class-wc-product-tables-migrate-data.php on line 397

Opening issue here to resolve.

robin-scott commented 6 years ago

Line 397 in this release is:

foreach ( $default_attributes as $default_attr ) {

Also getting similar warning for line 427 which is also:

foreach ( $default_attributes as $default_attr ) {

I think the issue will be related to the lack of default attributes in here.

Also seeing this for line 85, which is a different, but similar:

foreach ( $downloadable_files as $download_key => $downloadable_file ) {

It may be related to client data here, but warning is not so verbose. Looks like we are running a for each which does not apply (or should not apply) in this migration process.

robin-scott commented 6 years ago

I need to test this on another dataset to narrow this down, and will also get a look through the relevant file here and adjust it to get this data migrating correctly. BTW this is a large products db with a lot of variable products in it, sent to test all the edge and corner cases :)

kloon commented 6 years ago

Downloads one has been fixed in #112 Will fix the attributes one as well now.

robin-scott commented 6 years ago

Too fast for me... I was raising this to close it here :)