Warning: Invalid argument supplied for foreach() in lib/Zend/Locale/Format.php on line 853

Posted . Visible to the public.

PHP Version 7.4.7 OpenMage 1.9.4.5

if ($day !== false) {
    $parse[$day]   = 'd';
    if (!empty($options['locale']) && ($options['locale'] !== 'root') &&
        (!is_object($options['locale']) || ((string) $options['locale'] !== 'root'))) {
        // erase day string
            $daylist = Zend_Locale_Data::getList($options['locale'], 'day');
        foreach($daylist as $key => $name) {
            if (iconv_strpos($number, $name) !== false) {
                $number = str_replace($name, "EEEE", $number);
                break;
            }
        }
    }
}

Line 853 is foreach($daylist as $key => $name) {. The warning is because Zend_Locale_Data::getList() returns non-array. In fact, it is returning

a:7:{s:3:"sun";s:6:"Sunday";s:3:"mon";s:6:"Monday";s:3:"tue";s:7:"Tuesday";s:3:"wed";s:9:"Wednesday";s:3:"thu";s:8:"Thursday";s:3:"fri";s:6:"Friday";s:3:"sat";s:8:"Saturday";}

This is due to buggy new features introduced in PR #918 Show archive.org snapshot . ~~The fix is simply restoring the original lib/Zend/Locale/Data.php~~

This is fixed in PR #979 Show archive.org snapshot .

kiatng
Last edit
kiatng
Tags
Posted by kiatng to OpenMage (2020-06-12 03:10)