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

Currency symbol not saved with fatal PHP error #1318

Closed
jouriy opened this issue Nov 23, 2020 · 2 comments · Fixed by #1319
Closed

Currency symbol not saved with fatal PHP error #1318

jouriy opened this issue Nov 23, 2020 · 2 comments · Fixed by #1319
Labels

Comments

@jouriy
Copy link
Contributor

jouriy commented Nov 23, 2020

Preconditions (*)

  1. OpenMage v19.4.8

Steps to reproduce (*)

  1. Login to backend and navigate to System > Manage Currency > Symbols
  2. Click on Save Currency Symbols button
  3. Notice fatal error logged in PHP error log, currency symbol is not saved.

Expected result (*)

  1. "Custom currency symbols were applied successfully." success notification message should be shown after saving currency symbol.

Actual result (*)

  1. Fatal PHP error logged:
    PHP Fatal error: Uncaught Error: Call to a member function addSuccess() on bool in app/code/core/Mage/CurrencySymbol/controllers/Adminhtml/System/CurrencysymbolController.php:72
    Stack trace:
    #0 app/code/core/Mage/Core/Controller/Varien/Action.php(437): Mage_CurrencySymbol_Adminhtml_System_CurrencysymbolController->saveAction()
    SUPEE-3762 Prevent showing install page after refresing SOAP index #1 app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(262): Mage_Core_Controller_Varien_Action->dispatch('save')
    SUPEE-1533 - Addresses two potential remote code execution exploits #2 app/code/core/Mage/Core/Controller/Varien/Front.php(192): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
    SUPEE-3941 - Addresses extension-related issues #3 app/code/core/Mage/Core/Model/App.php(381): Mage_Core_Controller_Varien_Front->dispatch()
    SUPEE-4291/4334 - This patch addresses the USPS API changes #4 app/Mage.php(729): Mage_Core_Model_App->run(Array)
    Variable name corrected #5 index.php(78): Mage::run('', 'store')
    Missing variables and functions added #6 {main}
    thrown in /srv/www/app/code/core/Mage/CurrencySymbol/controllers/Adminhtml/System/CurrencysymbolController.php on line 72
@jouriy jouriy added the bug label Nov 23, 2020
@jouriy
Copy link
Contributor Author

jouriy commented Nov 23, 2020

reason is reference to
Mage::getSingleton('connect/session')->addSuccess() call on line 72 in app/code/core/Mage/CurrencySymbol/controllers/Adminhtml/System/CurrencysymbolController.php instead of Mage::getSingleton('adminhtml/session')->addSuccess()
PR will follow.

@addison74
Copy link
Contributor

This error is pretty strange. I found the same code in Magento CE 1.9.2.4 . When I saved the currency symbols in backend I got the alert message "Custom currency symbols were applies successfully." In PHP log I did not find any error recorded and I set display_errors to E_ALL.

In my case this function provided the right result based on the alert message:

    public function saveAction()
    {
        $symbolsDataArray = $this->getRequest()->getParam('custom_currency_symbol', null);
        if (is_array($symbolsDataArray)) {
            foreach ($symbolsDataArray as &$symbolsData) {
                $symbolsData = Mage::helper('adminhtml')->stripTags($symbolsData);
            }
        }

        try {
            Mage::getModel('currencysymbol/system_currencysymbol')->setCurrencySymbolsData($symbolsDataArray);
            Mage::getSingleton('connect/session')->addSuccess(
                Mage::helper('currencysymbol')->__('Custom currency symbols were applied successfully.')
            );
        } catch (Exception $e) {
            Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
        }

        $this->_redirectReferer();
    }

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

Successfully merging a pull request may close this issue.

3 participants