There is no date part in ... lib / Zend / Date.php (1078) on many backend pages after changing the server configuration

After some unpublished changes made by our client’s hosting company, we get a lot of errors around magento date formatting, as well as gaps in many admin screens (type of customer order, clients, index management and others).

In the report folder log I get:

a:5:{i:0;s:44:"No date part in '2012-09-03 19:36:17' found.";i:1;s:6218:"#0 /public_html/sp/lib/Zend/Date.php(1078): Zend_Date->_calculate('set', '2012-09-03 19:3...', 'yyyy-MM-dd HH:m...', 'pt_BR') #1 /public_html/sp/lib/Zend/Date.php(197): Zend_Date->set('2012-09-03 19:3...', 'yyyy-MM-dd HH:m...', 'pt_BR') #2 /public_html/sp/app/code/core/Mage/Core/Model/Locale.php(478): Zend_Date->__construct('2012-09-03 19:3...', 'yyyy-MM-dd HH:m...', Object(Zend_Locale)) #3 /public_html/sp/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Datetime.php(81): Mage_Core_Model_Locale->date('2012-09-03 19:3...', 'yyyy-MM-dd HH:m...') #4 /public_html/sp/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column.php(128): Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Datetime->render(Object(Mage_Index_Model_Process)) #5 /public_html/sp/app/design/adminhtml/default/casadosaber/template/widget/grid.phtml(161): Mage_Adminhtml_Block_Widget_Grid_Column->getRowField(Object(Mage_Index_Model_Process)) #6 /public_html/sp/app/code/core/Mage/Core/Block/Template.php(235): include('/public_html/s...') #7 /public_html/sp/app/code/core/Mage/Core/Block/Template.php(266): Mage_Core_Block_Template->fetchView('adminhtml/defau...') #8 /public_html/sp/app/code/core/Mage/Core/Block/Template.php(280): Mage_Core_Block_Template->renderView() #9 /public_html/sp/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml() #10 /public_html/sp/app/code/core/Mage/Core/Block/Abstract.php(758): Mage_Adminhtml_Block_Template->_toHtml() #11 /public_html/sp/app/code/core/Mage/Core/Block/Abstract.php(525): Mage_Core_Block_Abstract->toHtml() #12 /public_html/sp/app/code/core/Mage/Core/Block/Abstract.php(476): Mage_Core_Block_Abstract->_getChildHtml('grid', true) #13 /public_html/sp/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Container.php(70): Mage_Core_Block_Abstract->getChildHtml('grid') #14 /public_html/sp/app/design/adminhtml/default/default/template/widget/grid/container.phtml(36): Mage_Adminhtml_Block_Widget_Grid_Container->getGridHtml() #15 /public_html/sp/app/code/core/Mage/Core/Block/Template.php(235): include('/home/storage/5...') #16 /public_html/sp/app/code/core/Mage/Core/Block/Template.php(266): Mage_Core_Block_Template->fetchView('adminhtml/defau...') #17 /public_html/sp/app/code/core/Mage/Core/Block/Template.php(280): Mage_Core_Block_Template->renderView() #18 /public_html/sp/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml() #19 /public_html/sp/app/code/core/Mage/Adminhtml/Block/Widget/Container.php(295): Mage_Adminhtml_Block_Template->_toHtml() #20 /public_html/sp/app/code/core/Mage/Core/Block/Abstract.php(758): Mage_Adminhtml_Block_Widget_Container->_toHtml() #21 /public_html/sp/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml() #22 /public_html/sp/app/code/core/Mage/Core/Block/Abstract.php(758): Mage_Core_Block_Text_List->_toHtml() #23 /public_html/sp/app/code/core/Mage/Core/Block/Abstract.php(525): Mage_Core_Block_Abstract->toHtml() #24 /public_html/sp/app/code/core/Mage/Core/Block/Abstract.php(476): Mage_Core_Block_Abstract->_getChildHtml('content', true) #25 /public_html/sp/app/design/adminhtml/default/default/template/page.phtml(74): Mage_Core_Block_Abstract->getChildHtml('content') #26 /public_html/sp/app/code/core/Mage/Core/Block/Template.php(235): include('/home/storage/5...') #27 /public_html/sp/app/code/core/Mage/Core/Block/Template.php(266): Mage_Core_Block_Template->fetchView('adminhtml/defau...') #28 /public_html/sp/app/code/core/Mage/Core/Block/Template.php(280): Mage_Core_Block_Template->renderView() #29 /public_html/sp/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml() #30 /public_html/sp/app/code/core/Mage/Core/Block/Abstract.php(758): Mage_Adminhtml_Block_Template->_toHtml() #31 /public_html/sp/app/code/core/Mage/Core/Model/Layout.php(529): Mage_Core_Block_Abstract->toHtml() #32 /public_html/sp/app/code/core/Mage/Core/Controller/Varien/Action.php(391): Mage_Core_Model_Layout->getOutput() #33 /public_html/sp/app/code/core/Mage/Index/controllers/Adminhtml/ProcessController.php(55): Mage_Core_Controller_Varien_Action->renderLayout() #34 /public_html/sp/app/code/core/Mage/Core/Controller/Varien/Action.php(420): Mage_Index_Adminhtml_ProcessController->listAction() #35 /public_html/sp/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(253): Mage_Core_Controller_Varien_Action->dispatch('list') #36 /public_html/sp/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http)) #37 /public_html/sp/app/code/core/Mage/Core/Model/App.php(340): Mage_Core_Controller_Varien_Front->dispatch() #38 /public_html/sp/app/Mage.php(630): Mage_Core_Model_App->run(Array) #39 /public_html/sp/index.php(84): Mage::run('', 'store') #40 {main}";s:3:"url";s:39:"/sp/index.php/cs_mg_admin/process/list/";s:11:"script_name";s:13:"/sp/index.php";s:4:"skin";s:5:"admin";} 

In the environment of Dev, it works well, and until yesterday, when hosting made a lot of changes, it also works there.

We use America / Sao_Paulo as a time zone, and there is no customer in the customer_entity table with NULL values ​​on created_at or updated_at, not in the tables sales_flat_order and sales_flat_order_grid.

I also tried updating the created_at attribute in the eav_attribute table and other things that I saw in this section .

Can anyone help with this?

+4
source share
3 answers

Firstly, thanks to Alan Storm, who helped to find out a practically real problem. I tried to remove "/ u" from this REG EXP, but I realized that Magento and Zend Framework use regular expressions with / u in many places, such as core / string helper and many others.

So, I created PHP with the following code and tried to run it in both environments.

 <?php $number = '2012-08-23 22:15:48'; preg_match_all('/\d+/u', $number, $splitted); echo "<pre>"; var_dump($splitted); echo "</pre>"; 

So, on the problem server, I got a warning ...

Warning: preg_match_all () [function.preg-match-all]: Compilation failed: unknown option bit set at offset -1 in /.../public_html/test.php on line 4 NULL

And in a search on the Internet I found this ( phpinfo reports an incorrect pcre version ), which in a nutshell will tell us to check the PCRE version (in phpinfo ()).

SO ... All this problem is because the PCRE lib version ... is too old in my production environment ... which uses 6.6 06-Feb-2006, while others use 8.xx.

+2
source

Looking at the dump above, your exception message

 "No date part in" 

If you are looking for the Magento codebase, the only place this error message is displayed is in

 #File: lib/Zend/Locale/Format.php $split = false; preg_match_all('/\d+/u', $number, $splitted); if (count($splitted[0]) == 0) { iconv_set_encoding('internal_encoding', $oenc); #require_once 'Zend/Locale/Exception.php'; throw new Zend_Locale_Exception("No date part in '$date' found."); } 

After doing a little research on this function, I'm sure that the pcre_match_all function exists on your server when it runs the following code (you can confirm this using debugging)

 preg_match_all('/\d+/u', '2012-09-03 19:36:17', $splitted); 

This seems counterintuitive, since it has numbers that need to be separated, so something is probably happening, either by modifying PHP or using MySQL, this function receives non-utf8 text, and with the /u option a regular expression cannot parse the string correctly.

If I consulted on this project, I would recommend confirming it with some debugging code (try running the preg_match_all function with plain text and then with the text extracted from your database). Then I yell at the host and tell them to configure their applications so that this does not happen. Then, if that doesn’t work, I will focus on how to convert all the date text in my database into a format that the current configuration understands. Good luck

+7
source

thanks for this, and mainly if some hosting uses secure php with suexec, and I don’t know much, but there is some conflict with PCRE

0
source

Source: https://habr.com/ru/post/1432142/


All Articles