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 DataFlow Profiles #3827

Merged
merged 12 commits into from
Feb 27, 2024
Merged

Fixed null parameter warning in DataFlow Profiles #3827

merged 12 commits into from
Feb 27, 2024

Conversation

ADDISON74
Copy link
Contributor

Fix for issue #3810

Test environment

  • OpenMage 20.4.0
  • Magento Sample Pack
  • PHP 8.3
  • MAGE_IS_DEVELOPER_MODE=1

Steps to reproduce this issue

1 - Go to the Backend > System > Import / Export > Dataflow Profiles
2 - Click/Edit on any of the listed profiles. In my case there are 6 profiles

You will get this error

Deprecated functionality: strlen(): Passing null to parameter #1 ($string) of type string is deprecated  in /var/www/html/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Wizard.php on line 95

#0 /var/www/html/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Wizard.php(95): mageCoreErrorHandler()
#1 /var/www/html/app/design/adminhtml/default/default/template/system/convert/profile/wizard.phtml(220): Mage_Adminhtml_Block_System_Convert_Gui_Edit_Tab_Wizard->getValue()
#2 /var/www/html/app/code/core/Mage/Core/Block/Template.php(273): include('...')
#3 /var/www/html/app/code/core/Mage/Core/Block/Template.php(310): Mage_Core_Block_Template->fetchView()
#4 /var/www/html/app/code/core/Mage/Core/Block/Template.php(323): Mage_Core_Block_Template->renderView()
#5 /var/www/html/app/code/core/Mage/Adminhtml/Block/Template.php(67): Mage_Core_Block_Template->_toHtml()
#6 /var/www/html/app/code/core/Mage/Adminhtml/Block/Widget/Container.php(293): Mage_Adminhtml_Block_Template->_toHtml()
#7 /var/www/html/app/code/core/Mage/Core/Block/Abstract.php(926): Mage_Adminhtml_Block_Widget_Container->_toHtml()
#8 /var/www/html/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tabs.php(47): Mage_Core_Block_Abstract->toHtml()
#9 /var/www/html/app/code/core/Mage/Core/Block/Abstract.php(925): Mage_Adminhtml_Block_System_Convert_Gui_Edit_Tabs->_beforeToHtml()
#10 /var/www/html/app/code/core/Mage/Core/Block/Text/List.php(35): Mage_Core_Block_Abstract->toHtml()
#11 /var/www/html/app/code/core/Mage/Core/Block/Abstract.php(926): Mage_Core_Block_Text_List->_toHtml()
#12 /var/www/html/app/code/core/Mage/Core/Block/Abstract.php(643): Mage_Core_Block_Abstract->toHtml()
#13 /var/www/html/app/code/core/Mage/Core/Block/Abstract.php(587): Mage_Core_Block_Abstract->_getChildHtml()
#14 /var/www/html/app/design/adminhtml/default/default/template/page.phtml(47): Mage_Core_Block_Abstract->getChildHtml()
#15 /var/www/html/app/code/core/Mage/Core/Block/Template.php(273): include('...')
#16 /var/www/html/app/code/core/Mage/Core/Block/Template.php(310): Mage_Core_Block_Template->fetchView()
#17 /var/www/html/app/code/core/Mage/Core/Block/Template.php(323): Mage_Core_Block_Template->renderView()
#18 /var/www/html/app/code/core/Mage/Adminhtml/Block/Template.php(67): Mage_Core_Block_Template->_toHtml()
#19 /var/www/html/app/code/core/Mage/Core/Block/Abstract.php(926): Mage_Adminhtml_Block_Template->_toHtml()
#20 /var/www/html/app/code/core/Mage/Core/Model/Layout.php(573): Mage_Core_Block_Abstract->toHtml()
#21 /var/www/html/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
#22 /var/www/html/app/code/core/Mage/Adminhtml/controllers/System/Convert/GuiController.php(103): Mage_Core_Controller_Varien_Action->renderLayout()
#23 /var/www/html/app/code/core/Mage/Core/Controller/Varien/Action.php(421): Mage_Adminhtml_System_Convert_GuiController->editAction()
#24 /var/www/html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(255): Mage_Core_Controller_Varien_Action->dispatch()
#25 /var/www/html/app/code/core/Mage/Core/Controller/Varien/Front.php(181): Mage_Core_Controller_Varien_Router_Standard->match()
#26 /var/www/html/app/code/core/Mage/Core/Model/App.php(358): Mage_Core_Controller_Varien_Front->dispatch()
#27 /var/www/html/app/Mage.php(760): Mage_Core_Model_App->run()
#28 /var/www/html/index.php(56): Mage::run()
#29 {main}

This is the PHP file and the line:

/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Wizard.php on line 95

The same error appears if you click the [Add New Profile] button.

@github-actions github-actions bot added Component: Adminhtml Relates to Mage_Adminhtml Component: Dataflow Relates to Mage_Dataflow labels Feb 12, 2024
@github-actions github-actions bot removed the phpstan label Feb 16, 2024
@fballiano
Copy link
Contributor

mmm I think phpstan doesn't know that strlen can return a negative number :-\

@ADDISON74
Copy link
Contributor Author

@fballiano - Tested a bit. Without changing that code, I guess the only way is to ignore the PHPStran error adding above

// see: https://github.com/phpstan/phpstan/issues/10570
// @phpstan-ignore-next-line

@ADDISON74
Copy link
Contributor Author

@fballiano - I was just about to make the same change. It could not be otherwise in this case.

https://phpstan.org/r/b6ae707a-3861-4efc-b56c-e8d4b86a0ed1

@fballiano
Copy link
Contributor

yep :-) let's see if phpstan accept that instruction also with a comment and I'll directly merge it :-)

@fballiano fballiano changed the title Deprecated functionality - Issue 3810 Fixed null parameter warning in DataFlow Profiles Feb 27, 2024
@fballiano
Copy link
Contributor

all green, I'll consider the past comments as reviews (since the code is the suggested one) and fast forward to merge

@fballiano fballiano merged commit 63293af into OpenMage:main Feb 27, 2024
17 checks passed
@ADDISON74 ADDISON74 deleted the ADDISON74-patch-3810 branch February 27, 2024 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Adminhtml Relates to Mage_Adminhtml Component: Dataflow Relates to Mage_Dataflow phpstan
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecated functionality: strlen(): Passing null to parameter #1 ($string) of type string is deprecated
3 participants