centos 6.7+ php7
login page
error] 16549#0: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught TypeError: Argument 1 passed to iterator_to_array() must implement interface Traversable, null given in /usr/share/nginx/magento2/vendor/magento/framework/View/Element/Html/Calendar.php:72
Stack trace:
#0 /usr/share/nginx/magento2/vendor/magento/framework/View/Element/Html/Calendar.php(72): iterator_to_array(NULL)
#1 /usr/share/nginx/magento2/vendor/magento/framework/View/Element/AbstractBlock.php(659): Magento\Framework\View\Element\Html\Calendar->_toHtml()
#2 /usr/share/nginx/magento2/vendor/magento/framework/View/Layout.php(542): Magento\Framework\View\Element\AbstractBlock->toHtml()
#3 /usr/share/nginx/magento2/vendor/magento/framework/View/Layout.php(518): Magento\Framework\View\Layout->_renderBlock('head.calendar')
#4 /usr/share/nginx/magento2/var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('head.calendar')
#5 /usr/share/nginx/magento2/vendor/magento/framework/View/Layout.php(472): Magent" while reading response header from upstream,
I traced the source code.
protected function _toHtml()
{
$localeData = (new DataBundle())->get($this->_localeResolver->getLocale());
// get days names
$daysData = $localeData['calendar']['gregorian']['dayNames'];
$this->assign(
'days',
[
'wide' => $this->encoder->encode(array_values(iterator_to_array($daysData['format']['wide']))),
'abbreviated' => $this->encoder->encode(
array_values(iterator_to_array($daysData['format']['abbreviated']))
),
]
);
in the source code, the $this->_localeResolver->getLocale() return zh_Hant_TW and the $localeData is null
This is not Magento's bug, but same in Japanese & Korean.
It's caused by libICU and PHP.
Please read my gist.
If you can change your Linux distribution from RHEL clones to Ubuntu, this issue will be resolved.
Internal issue MAGETWO-60828
Hi @woei66
Fix for MAGETWO-60828 is merged to develop branch, closing the issue.
Thank you.
Hi @alena-marchenko, please do explain the following: how does a bunch of commits in develop branch helps merchabts running the last released version (2.1.7 at the moment)? How can one benefit from this fix?
Wouldn't it be logical to keep the issue open until the fix is present in an official release?
/vendor/magento/framework/View/Element/Html/Calendar.php
Fine 88 line
array_values(iterator_to_array($monthsData['format']['abbreviated']))
array_values(
iterator_to_array(
null !== $monthsData->get('format')->get('abbreviated')
? $monthsData['format']['abbreviated']
: $monthsData['format']['wide']
)
https://github.com/magento/magento2/commit/c7e5edbf719e9de98bf0d15f7e36a6f0887a1601
This issue is fixed now on branch 'develop' (Magento v2.2.0) but is still present on '2.1-develop' (Magento v2.1.7)
Hi @TomashKhamlai
Could you please have this issue reopened until the issue is released for 2.1.x ?
BTW, Is there an internal ticket scheduling a backport to 2.1.x ?
Yes, I understand the issue but what should I do now to remove this error.
error: Fatal error: Uncaught TypeError: Argument 1 passed to iterator_to_array() must implement interface Traversable, null given in /home/rozander/public_html/epicdashcam.com/vendor/magento/framework/View/Element/Html/Calendar.php:86 Stack trace: #0 /home/rozander/public_html/epicdashcam.com/vendor/magento/framework/View/Element/Html/Calendar.php(86): iterator_to_array(NULL) #1 /home/rozander/public_html/epicdashcam.com/vendor/magento/framework/View/Element/AbstractBlock.php(659): Magento\Framework\View\Element\Html\Calendar->_toHtml() #2 /home/rozander/public_html/epicdashcam.com/vendor/magento/framework/View/Layout.php(542): Magento\Framework\View\Element\AbstractBlock->toHtml() #3 /home/rozander/public_html/epicdashcam.com/vendor/magento/framework/View/Layout.php(518): Magento\Framework\View\Layout->_renderBlock('head.calendar') #4 /home/rozander/public_html/epicdashcam.com/var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('head.calendar') #5 /home/rozand in /home/rozander/public_html/epicdashcam.com/vendor/magento/framework/View/Element/Html/Calendar.php on line 86
Now, I cannot come into backend because of this issue. how would I solve this issue anyhow that can be a patch or something else but how would I solve this issue?
Hello @sneh-tidbit!
What version of Magento is currently installed on your server?
I have reported this issue in here
https://github.com/magento/magento2/issues/14068
This issue is not solved.
vendor/magento/framework/View/ElementHtml/Calendar.php line 75 caused the same error.