Issues

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

Issue Type: Improvement Created: 2008-12-01T19:00:25.000+0000 Last Updated: 2008-12-01T23:26:30.000+0000 Status: Resolved Fix version(s): - 1.7.1 (01/Dec/08)

Reporter: Phil Brown (philbrown) Assignee: Thomas Weidner (thomas) Tags: - Zend_Date

  • Zend_Locale

Related issues: Attachments:

Description

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

<pre class="highlight">
$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

<pre class="highlight">
$this->_locale = $locale->toString();

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

Comments

Posted by Thomas Weidner (thomas) on 2008-12-01T23:26:29.000+0000

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

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts