ZF-4463: Object of class stdClass could not be converted to string in Zend\Validate\Abstract.php

Issue Type: Bug Created: 2008-10-03T06:27:11.000+0000 Last Updated: 2008-12-21T06:37:53.000+0000 Status: Resolved Fix version(s): - 1.7.2 (23/Dec/08)

Reporter: Krzysztof Wasniowski (krzysiek) Assignee: Alexander Veremyev (alexander) Tags: - Zend_Validate

Related issues: Attachments:


Passing an object as an argument to isValid method causes "Catchable fatal error" fired in Zend_Validate_Abstract class on line 205.

Example: $validateBools = new Zend_Validate_InArray(array( true, false, 'true', 'false', '1', '0', 't', 'f'), true); var_dump($validateBools->isValid(new stdClass()));

Result: Catchable fatal error: Object of class stdClass could not be converted to string in Zend/Validate/Abstract.php on line 205

Expected Result: bool(false)


Posted by Thomas Weidner (thomas) on 2008-12-09T07:04:13.000+0000

Fixed with r13114

Posted by Alexander Veremyev (alexander) on 2008-12-16T10:19:54.000+0000

It seems it's not actually an issue.

stdClass objects can't be converted to strings. Try:

<pre class="highlight">
$obj = new stdClass();
echo (string)$obj;

Fix causes another problem - [ZF-5232].

Posted by Alexander Veremyev (alexander) on 2008-12-18T07:28:10.000+0000


Have you found an issue?

See the Overview section for more details.


© 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.