ZF-3754: Zend_Validate_Abstract throws an notice when an array is defined in a validator class

Issue Type: Bug Created: 2008-07-25T03:58:48.000+0000 Last Updated: 2008-11-13T14:10:03.000+0000 Status: Resolved Fix version(s): - 1.7.0 (17/Nov/08)

Reporter: Thomas Weidner (thomas) Assignee: Thomas Weidner (thomas) Tags: - Zend_Validate

Related issues: - ZF-3756



When a validator class is created which uses internally an array then a notice is thrown:

<pre class="highlight">
Notice: Array to string conversion in .....\Zend Framework\library\Zend\Validate\Abstract.php on line 205
Call Stack 
1 0.0017 81016 {main}( ) ..\index2.php:0 
2 0.0659 425640 Zend_File_Transfer_Adapter_Abstract->isValid( ) ..\index2.php:10 
3 0.0726 464664 Zend_Validate_File_Extension->isValid( ) ..\Abstract.php:170 
4 0.0727 465248 Zend_Validate_Abstract->_error( ) ..\Extension.php:138 
5 0.0727 465664 Zend_Validate_Abstract->_createMessage( ) ..\Abstract.php:225 
6 0.0735 466760 str_replace ( ) ..\Abstract.php:205 

The class itself works as expected and validates correct but the notice should be supressed. PHP 5.2.5, Windows XP,

As this behaviour showed up while working on the new Zend_File_Transfer component I raised the priority to critical. This behaviour should be fixed / cleared before 1.6.RC2.


Posted by Hugo HAMON (emacs) on 2008-07-25T06:27:51.000+0000

The bugfix is to replace this line (205) :

$message = str_replace("%$ident%", $this->$property, $message);

by this one :

$message = str_replace("%$ident%", (string)$this->$property, $message);

Posted by Thomas Weidner (thomas) on 2008-11-07T01:38:25.000+0000

Fixed with r12359.

Posted by Wil Sinclair (wil) on 2008-11-13T14:10:03.000+0000

Changing issues in preparation for the 1.7.0 release.

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.