Bug #64023 [Ver->Csd]: Overloading __toString() in SplFileInfo has no effect
| From: | cataphract@php.net | Date: | Wed, 23 Jan 2013 12:30:53 +0000 |
| Subject: | Bug #64023 [Ver->Csd]: Overloading __toString() in SplFileInfo has no effect | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-176194@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64023&edit=1
ID: 64023
Updated by: cataphract@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 glopes@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] cataphract@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