-
-
Notifications
You must be signed in to change notification settings - Fork 436
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 a couple of null parameter warnings in the ImportExport module #3818
Conversation
if ($value === null) { | ||
return ''; | ||
} | ||
|
||
return $this->escapeHtml(strlen($value) > 0 ? $value : $default); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot assume $default
is always an empty string.
if ($value === null) { | |
return ''; | |
} | |
return $this->escapeHtml(strlen($value) > 0 ? $value : $default); | |
return $value !== null && $this->escapeHtml(strlen($value) > 0 ? $value : $default); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kiatng true, I also did it in a previous PR but I didn't notice here :-D
I did it in a different way (more similar to the other one, for readability), what do you think?
thanks!!
// Set entered data if was error when we do save | ||
$profile = Mage::registry('current_convert_profile'); | ||
|
||
// set entered data if was error when we do save | ||
$data = Mage::getSingleton('adminhtml/session')->getConvertProfileData(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment should be above $data
as it is related to it:
// Set entered data if was error when we do save | |
$profile = Mage::registry('current_convert_profile'); | |
// set entered data if was error when we do save | |
$data = Mage::getSingleton('adminhtml/session')->getConvertProfileData(true); | |
/** @var Mage_Dataflow_Model_Profile $profile */ | |
$profile = Mage::registry('current_convert_profile'); | |
// Repopulate user input values in the edit form in case of saving error | |
$data = Mage::getSingleton('adminhtml/session')->getConvertProfileData(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think #3811 is unrelated to null deprecation and should be a separate PR should it be a bug. At this point, I am not sure it is. |
app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Wizard.php
Outdated
Show resolved
Hide resolved
I just didn't want to create too many PRs in one go so I thought about merging at least the two that seemed a bit related to each other :-\ |
I just tested this PR. Case 1 Fatal error: Uncaught Error: Call to a member function getId() on null in /var/www/html/app/code/core/Mage/Adminhtml/controllers/System/Convert/ProfileController.php:117
Stack trace:
#0 /var/www/html/app/code/core/Mage/Core/Controller/Varien/Action.php(421): Mage_Adminhtml_System_Convert_ProfileController->editAction()
#1 /var/www/html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(255): Mage_Core_Controller_Varien_Action->dispatch()
#2 /var/www/html/app/code/core/Mage/Core/Controller/Varien/Front.php(181): Mage_Core_Controller_Varien_Router_Standard->match()
#3 /var/www/html/app/code/core/Mage/Core/Model/App.php(358): Mage_Core_Controller_Varien_Front->dispatch()
#4 /var/www/html/app/Mage.php(760): Mage_Core_Model_App->run()
#5 /var/www/html/index.php(56): Mage::run()
#6 {main}
thrown in /var/www/html/app/code/core/Mage/Adminhtml/controllers/System/Convert/ProfileController.php on line 117 Case 2 There are two files affected if this PR is merged. |
I created only one PR since both of the issues about about importexport