ZF-3756: Notice: Array to string conversion in /home/communs/library/Zend/Validate/Abstract.php on line 210
Description
When using the lastest version of the Zend_File component, I've got a notice error in my XDebug. Below is the code I've tried :
<?php try { $oFileTransfer = new Zend_File_Transfer_Adapter_Http(); $oFileTransfer->addValidators('Extension', 'png')->setDestination(dirname(__FILE__).'/uploads'); $oFileTransfer->receive(); } catch(Zend_Exception $e) { echo '', print_r($oFileTransfer->getMessages()) ,''; } ?>
I'm using an to upload a file. I've tried with an .exe file. The bad extension is well stopped by the validator and the upload process too but I've got this notice in XDebug :
Notice: Array to string conversion in /home/noeweb5/communs/library/Zend/Validate/Abstract.php on line 210
Call Stack
Time Memory Function Location
1 0.0005 67804 {main}( ) ../upload.php:0 2 0.0715 2784324 Zend_File_Transfer_Adapter_Http->receive( ) ../upload.php:38 3 0.0715 2784324 Zend_File_Transfer_Adapter_Abstract->isValid( ) ../Http.php:88 4 0.0716 2785080 Zend_Validate_File_Extension->isValid( ) ../Abstract.php:170 5 0.0717 2785228 Zend_Validate_Abstract->_error( ) ../Extension.php:154 6 0.0717 2785388 Zend_Validate_Abstract->_createMessage( ) ../Abstract.php:231 7 0.0719 2786248 str_replace ( ) ../Abstract.php:210
I think it comes from the $_extension attribute of the Zend_Validate_File_Extension class is an array of valid extension. But at line 210 of the class Zend_Validate_Abstract, the str_replace() function attemps a string value as its second argument.
Comments
Posted by Hugo HAMON (emacs) on 2008-07-25T06:06:53.000+0000
Edit presentation of the sample of code.
Posted by Thomas Weidner (thomas) on 2008-07-25T10:22:49.000+0000
Duplicate issue of ZF-3754
Posted by Thomas Weidner (thomas) on 2008-11-07T01:38:57.000+0000
Fixed with r12359