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

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

Closed
addison74 opened this issue Feb 8, 2024 · 2 comments · Fixed by #3827

Comments

@addison74
Copy link
Contributor

addison74 commented Feb 8, 2024

OpenMage 20.3.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

@addison74
Copy link
Contributor Author

This issue involves several files that need to be modified.

In the Profiles page, this one with the grid, if we press the [Add New Profile] we get the error mentioned in the initial post. In the closed PR you changed the file correctly

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

Line 95

        if ($value === null) {
            return $default;
        }

With this change, we get the page where we can create a new profile. If we fill in the "Name" and press any of the [Save] buttons, another error will appear at the top

Deprecated functionality: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/app/code/core/Mage/Dataflow/Model/Profile.php on line 89

screen

@addison74
Copy link
Contributor Author

I would fix that deprecated error as follows

/app/code/core/Mage/Dataflow/Model/Profile.php
Line 89

BEFORE

        if (strlen($actionsXML) < 0 &&

AFTER

        if (strlen($actionsXML ?? '') < 0 &&

The two changes seem to solve this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant