Bug #64919 [Fbk->NoF]: SplFileObject::__toString is not used when casting as string
| From: | php-bugs at lists dot php dot net | Date: | Sun, 05 Apr 2015 04:22:19 +0000 |
| Subject: | Bug #64919 [Fbk->NoF]: SplFileObject::__toString is not used when casting as string | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-191822@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64919&edit=1
ID: 64919
Updated by: php-bugs@lists.php.net
Reported by: stof at notk dot org
Summary: SplFileObject::__toString is not used when casting as
string
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: SPL related
PHP Version: 5.4.15
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2015-03-25 22:06:54] danack@php.net
I believe this was fixed by the fix to https://bugs.php.net/bug.php?id=64023. I cannot
reproduce on PHP 5.4.9
I realise that the version listed on the bug report is 5.4.15 - however testing the repro case in http://3v4l.org/9HuIJ seems to indicate that it was fixed in 5.4.7.
Can you update the issue if you think it still is an issue.
------------------------------------------------------------------------
[2013-05-24 14:37:42] stof at notk dot org
It might be related to https://bugs.php.net/bug.php?id=64023
------------------------------------------------------------------------
[2013-05-24 14:36:26] stof at notk dot org
Description:
------------
The doc documents SplFileObject::__toString as being an alias for SplFileObject::current.
When calling __toString explicitly, this indeed works (and can return an array when READ_CSV is
used, which seems confusing)
But when casting a SplFileObject to a string, it will return the path to the file, like for the
SplFileInfo parent class.
Test script:
---------------
$tempFile = new \SplTempFileObject();
$tempFile->fwrite('foobar-');
$tempFile->rewind();
echo (string) $tempFile;
echo PHP_EOL;
echo $tempFile->__toString();
Expected result:
----------------
Result according to the doc:
foobar-
foobar-
Actual result:
--------------
php://temp
foobar-
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64919&edit=1