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

Fix unserialization error when saving dataflow advanced profile. #1484

Merged

Conversation

kiatng
Copy link
Contributor

@kiatng kiatng commented Mar 4, 2021

Description (*)

For advanced profile, gui_data in table dataflow_profile is always null. So, in _afterload(),

protected function _afterLoad()
{
$guiData = '';
if (is_string($this->getGuiData())) {
try {
$guiData = Mage::helper('core/unserializeArray')
->unserialize($this->getGuiData());
} catch (Exception $e) {
Mage::logException($e);
}
}
$this->setGuiData($guiData);
parent::_afterLoad();
}

gui_data is set to empty string.

Now, in _afterSave(), we have

protected function _afterSave()
{
if (is_string($this->getGuiData())) {
try {
$guiData = Mage::helper('core/unserializeArray')
->unserialize($this->getGuiData());
$this->setGuiData($guiData);
} catch (Exception $e) {
Mage::logException($e);
}
}

It will try to unserialize the empty string gui_data and throw the following:

Exception: Error during unserialization in ./lib/Unserialize/Parser.php:60
Stack trace:
#0 ./app/code/core/Mage/Core/Helper/UnserializeArray.php(44): Unserialize_Parser->unserialize('')
#1 ./app/code/core/Mage/Dataflow/Model/Profile.php(152): Mage_Core_Helper_UnserializeArray->unserialize('')
#2 ./app/code/core/Mage/Core/Model/Abstract.php(317): Mage_Dataflow_Model_Profile->_afterSave()

which is logged in ./var/log/exception.log

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes OpenMage/magento-lts#<issue_number>

Manual testing scenarios (*)

  1. Go to backend > > System > Dataflow Advanced Profiles
  2. Save an existing profle.
  3. Error is logged in ./var/log/exception.log

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All automated tests passed successfully (all builds are green)

@github-actions github-actions bot added the Component: Dataflow Relates to Mage_Dataflow label Mar 4, 2021
@fballiano
Copy link
Contributor

let's merge this ;-)

@Flyingmana Flyingmana merged commit e83c915 into OpenMage:1.9.4.x Apr 29, 2021
@github-actions
Copy link
Contributor

Unit Test Results

1 files  ±0  1 suites  ±0   0s ⏱️ ±0s
0 tests ±0  0 ✔️ ±0  0 💤 ±0  0 ❌ ±0 
2 runs  ±0  2 ✔️ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit e83c915. ± Comparison against base commit 0e2f81d.

@kiatng kiatng deleted the dataflow_profile_unserialization_error branch February 27, 2023 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Dataflow Relates to Mage_Dataflow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants