Edit report at https://bugs.php.net/bug.php?id=64023&edit=1
ID: 64023 Updated by: cataphr...@php.net Reported by: php at lightning dot hu Summary: Overloading __toString() in SplFileInfo has no effect -Status: Open +Status: Verified Type: Bug Package: SPL related Operating System: Linux PHP Version: Irrelevant Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2013-01-18 15:24:39] php at lightning dot hu Description: ------------ When I overload the __toString() magic method in the SplFileInfo class or in one of it's derivatives it does not work if I concatenate the object with a string. See the example for a simple demonstration. Test script: --------------- class A extends \SplFileInfo { public function __toString() {return ' -expected- ';} } $a = new A('/'); // Works echo $a, $a->__toString(), $a->__toString() . ''; // Does not work - outputs parent::__toString() echo $a . ''; Expected result: ---------------- -expected- -expected- -expected- / ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=64023&edit=1