Inchoo / Inchoo_PHP7

PHP 7 compatibility extension for Magento 1 (DEPRECATED!!)
MIT License
353 stars 112 forks source link

Warning: A non-numeric value encountered in lib/Zend/Locale/Math/PhpMath.php on line 94 #125

Open csdougliss opened 6 years ago

csdougliss commented 6 years ago

This is with Magneto EE 1.14.3.6 running PHP 7.1 with Inchoo PHP 7 module installed - creating a new CMS page in Magento.

Warning: A non-numeric value encountered  in 
lib/Zend/Locale/Math/PhpMath.php on line 94

#0 lib/Zend/Locale/Math/PhpMath.php(94): mageCoreErrorHandler(2, 'A non-numeric v...', '...', 94, Array)
#1 lib/Zend/Locale/Format.php(385): Zend_Locale_Math_PhpMath::Sub('0', '', 0)
#2 lib/Zend/Locale/Format.php(662): Zend_Locale_Format::toNumber('', Array)
#3 lib/Zend/Filter/NormalizedToLocalized.php(106): Zend_Locale_Format::toFloat('', Array)
#4 app/code/core/Mage/Core/Controller/Varien/Action.php(994): Zend_Filter_NormalizedToLocalized->filter('')
#5 app/code/core/Mage/Adminhtml/controllers/Cms/PageController.php(248): Mage_Core_Controller_Varien_Action->_filterDates(Array, Array)
#6 app/code/core/Mage/Adminhtml/controllers/Cms/PageController.php(129): Mage_Adminhtml_Cms_PageController->_filterPostData(Array)
#7 app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_Cms_PageController->saveAction()
#8 app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('save')
#9 app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#10 app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#11 app/Mage.php(691): Mage_Core_Model_App->run(Array)
#12 index.php(109): Mage::run('default', 'store')
#13 {main}
ivanweiler commented 6 years ago

I can't reproduce it but it's most likely that I can't guess right combination :) But I see that PhpMath class isn't used by Zend when bcmath extension is enabled, so enabling bcmath in php could maybe solve the problem?

Related to #97

kiatng commented 6 years ago

I can replicate with a new install of CE 1.9.3.x with _InchooPHP7 2.2.0 on PHP 7.1.13:

admin > CMS > Pages > Edit Page 'Home page' >click Save button > Warning: A non-numeric value encountered in .../lib/Zend/Locale/Math/PhpMath.php on line 94

To fix this, I edited lib/Zend/Locale/Math/PhpMath.php

// at line 92, insert the following
if (empty($op2)) {
    $op2 = 0;
}
kiatng commented 6 years ago

As suggested by @ivanweiler, installing bcmath removed the error:

yum --enablerepo=remi-php71 install php-bcmath

So there is no need to mess with core file.