PHP Deprecated: Required parameter $attribute_name

I updated PHP from 7.4 to 8.0 (why? I have no idea) and I get the following error when running an import via cron. CS-Cart v4.16.2.

PHP Deprecated: Required parameter $attribute_name follows optional parameter $element_name in /home/user/domains/domain.com/public_html/app/addons/advanced_import/Tygh/Addons/AdvancedImport/Readers/Xml.php on line 635 PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 69632 bytes) in /home/user/domains/domain.com/public_html/app/functions/fn.fs.php on line 1186

Edit: This error also occurs in admin if you select the particular import for editting but it can be run manually by just selecting import from the main screen at dispatch=import_presets.manage&object_type=products

I thought I had waited long enough to get the bugs worked out and I am very surprised nobody else has run into/reported this issue.

To get around this, in app/addons/advanced_import/Tygh/Addons/AdvancedImport/Readers/Xml.php on line 635

Find:
protected function getAtrributeSelector($element_name = '', $attribute_name, $attribute_value = null)

Replace with:
protected function getAtrributeSelector($attribute_name, $element_name = '', $attribute_value = null)

I haven’t fully tested but it does not throw the error.

2 Likes

Thanks for sharing!

The necessary changes are already included in the upcoming version 4.17.1.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.