#36612 [NEW]: implode of a object array don't call __toString()
| From: | tobias dot buschor at relationpage dot ch | Date: | Sat, 04 Mar 2006 18:57:20 +0000 |
| Subject: | #36612 [NEW]: implode of a object array don't call __toString() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-93912@lists.php.net to get a copy of this message | ||
From: tobias dot buschor at relationpage dot ch
Operating system: windows
PHP version: 5.1.2
PHP Bug Type: Feature/Change Request
Bug description: implode of a object array don't call __toString()
Description:
------------
I think it's better, if the implode() function call the __toString()
method of a array width objects.
Reproduce code:
---------------
class obj{
function __construct($name){
$this->name = $name;
}
function __toString(){
return $this->name;
}
}
$arry = array();
$arry[] = new obj('first');
$arry[] = new obj('second');
$arry[] = new obj('onemore');
echo implode(', ', $arry);
Expected result:
----------------
first, second, onemore
Actual result:
--------------
Object, Object, Object
--
Edit bug report at http://bugs.php.net/?id=36612&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36612&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36612&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36612&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36612&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=36612&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36612&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36612&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36612&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36612&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36612&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=36612&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=36612&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36612&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36612&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36612&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36612&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36612&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36612&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36612&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36612&r=mysqlcfg