Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed null parameter warning in Mage_ImportExport_Model_Import_Entity_Product::_filterRowData() #4086

Merged
merged 1 commit into from
Jul 7, 2024

Conversation

addison74
Copy link
Contributor

@addison74 addison74 commented Jul 6, 2024

This PR is similar to #4083.

It replaces the callback function '\strlen' with an arrow function (introduced in PHP 7.4) to avoid the error message bellow starting with PHP >8.1

Deprecated functionality: strlen(): Passing null to parameter #1

Initially there were 4 variants, but considering the opinions from PR #4083 I chose the same implementation.

array_filter($VARIABLE, fn ($tmpString) => strlen($tmpString ?? ''))
// $qtys = array_filter($VARIABLE, function ($tmpString) { return strlen($tmpString ?? ''); });
// $qtys = array_filter($VARIABLE, function ($tmpString) { return $tmpString !== NULL && strlen($tmpString); }); => From Drupal Community
// $qtys = @array_filter($VARIABLE, '\strlen');

This PR is similar to #4083. It replaces the callback function '\strlen' with an arrow function (introduced in PHP 7.4) to avoid the error message bellow starting with PHP >8.1

Deprecated functionality: strlen(): Passing null to parameter #1
@github-actions github-actions bot added the Component: ImportExport Relates to Mage_ImportExport label Jul 6, 2024
@fballiano fballiano changed the title Strlen callback function in ImportExport module Fixed null parameter warning in Mage_ImportExport_Model_Import_Entity_Product::_filterRowData() Jul 7, 2024
@fballiano fballiano merged commit 0b27c5f into main Jul 7, 2024
31 checks passed
@fballiano fballiano deleted the ADDISON74-importexport-strlen branch July 7, 2024 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: ImportExport Relates to Mage_ImportExport
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants