#36612 [Opn->WFx]: implode of a object array don't call __toString()

From: Date: Sat, 04 Mar 2006 19:10:35 +0000
Subject: #36612 [Opn->WFx]: implode of a object array don't call __toString()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-93913@lists.php.net to get a copy of this message
ID: 36612 Updated by: helly@php.net Reported By: tobias dot buschor at relationpage dot ch -Status: Open +Status: Wont fix Bug Type: Feature/Change Request -Operating System: windows +Operating System: * -PHP Version: 5.1.2 +PHP Version: 5.1.* New Comment: Won't change in 5.1, aybe in 5.2 and already fixed in head (to become 6) Previous Comments: ------------------------------------------------------------------------ [2006-03-04 19:57:19] tobias dot buschor at relationpage dot ch 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 this bug report at http://bugs.php.net/?id=36612&edit=1

« previous php.bugs (#93913) next »