ZF-5077: Object of class Zend_Locale to string conversion

Issue Type: Unit Tests: Problem Created: 2008-11-26T13:32:10.000+0000 Last Updated: 2008-12-01T13:50:45.000+0000 Status: Resolved Fix version(s): - 1.7.1 (01/Dec/08)

Reporter: Alexander Veremyev (alexander) Assignee: Thomas Weidner (thomas) Tags: - Zend_Locale

Related issues: - ZF-5030



The issue is originaly reported by Ilya Gruzinov (see [ZF-4992]).

This is reproducible with 1.7.0. version, but only on php <5.2(i test on 5.1.6)

php LocaleTest.php

PHPUnit 3.3.5 by Sebastian Bergmann.


Time: 4 seconds

There were 2 errors: {panel} 1) testObjectCreation(Zend_LocaleTest) Object of class Zend_Locale to string conversion /tmp/ZendFramework-1.7.0/library/Zend/Locale.php:885 /tmp/ZendFramework-1.7.0/library/Zend/Locale.php:189

  1. testIsLocale(Zend_LocaleTest) Object of class Zend_Locale to string conversion /tmp/ZendFramework-1.7.0/library/Zend/Locale.php:885 /tmp/ZendFramework-1.7.0/library/Zend/Locale.php:732

FAILURES! Tests: 28, Assertions: 171, Errors: 2. {panel}

I think next lines can explain where mistake: […] :

It is worth noting that before PHP 5.2.0 the __toString method was only called when it was directly combined with echo() or print(). Since PHP 5.2.0, it is called in any string context (e.g. in printf() with %s modifier) but not in other types contexts (e.g. with %d modifier). Since PHP 5.2.0, converting objects without __toString method to string would cause E_RECOVERABLE_ERROR.


Posted by Thomas Weidner (thomas) on 2008-11-26T13:50:09.000+0000

I think this issue is already fixed in trunk/branch... Line 885 is a require_once call which does no string conversion.

And any given Zend_Locale instance will be forced to string at line 846/847 by calling toString on the instance.

Can you please test it against trunk. I can not reproduce it on Windows with 5.1.4

Posted by Ilya Gruzinov (shagren) on 2008-11-27T07:16:37.000+0000

Trunk now:

Time: 4 seconds

There was 1 failure:

  1. testIsLocale(Zend_LocaleTest) Failed asserting that is true.

FAILURES! Tests: 29, Assertions: 189, Failures: 1.

Posted by Thomas Weidner (thomas) on 2008-11-27T07:21:03.000+0000

Ilva: This failure is ZF-4992

Please to not throw together different issues. This is useless and make only more work as it should.

And it just raises the time we need for fixing.

Posted by Thomas Weidner (thomas) on 2008-11-27T07:22:39.000+0000

So you are no longer getting the failure of this issue in your environment on trunk ? Is that correct ?

Then this issue can be closed and we can work on ZF-4992

Posted by Ilya Gruzinov (shagren) on 2008-11-27T07:44:30.000+0000

Yes, it is correct. This issue can be closed.

Posted by Wil Sinclair (wil) on 2008-12-01T13:50:45.000+0000

Updating these issues to mark them resolved for 1.7.1.

Have you found an issue?

See the Overview section for more details.


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

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