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: Verified +Status: Closed Type: Bug Package: SPL related Operating System: Linux PHP Version: Irrelevant Assigned To: cataphract Block user comment: N Private report: N New Comment: Automatic comment on behalf of glo...@nebm.ist.utl.pt Revision: http://git.php.net/?p=php-src.git;a=commit;h=aa0adce47d9b8ead59efede63a769e395e27bcd5 Log: Fix bug #64023 (__toString() & SplFileInfo) Previous Comments: ------------------------------------------------------------------------ [2013-01-19 15:54:43] cataphr...@php.net Fix: https://github.com/cataphract/php-src/compare/bug64023 ------------------------------------------------------------------------ [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