Issues

ZF-5131: Zend_Date::setLocale() casts locale object to string which fails in PHP <5.2

Description

Zend_Date::setLocale() casts the given locale to a string before assigning it to the private $_locale member, ie.


$this->_locale = (string) $locale;

In PHP versions prior to 5.2 (such as that shipped with RHEL5), casting an object to a string returns something like "Object id #xx" as the magic __toString() method fails to execute in such instances.

I'm not sure what other ZF components fail to work correctly in PHP <5.2 however the choice to use a cast rather than an explicit method call strikes me as rather odd. I can't tell what type of member $_locale is meant to be (its docblock is missing) but the requirement appears to be for a string. In that case, why not at least make this part more portable and use something like


$this->_locale = $locale->toString();

This is the only thing I've noticed so far preventing us from upgrading to 1.7.

Comments

The minimum requirements for ZF >= 1.7 are 5.2.4... for ZF < 1.7 are 5.1.4