From:             stof at notk dot org
Operating system: 
PHP version:      5.4.15
Package:          SPL related
Bug Type:         Bug
Bug description:SplFileObject::__toString is not used when casting as string

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 bug report at https://bugs.php.net/bug.php?id=64919&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=64919&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=64919&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=64919&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=64919&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=64919&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=64919&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=64919&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=64919&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=64919&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=64919&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=64919&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=64919&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=64919&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64919&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=64919&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=64919&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=64919&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64919&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=64919&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=64919&r=mysqlcfg

Reply via email to