Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- Bug #77024 SplFileObject::__toString() may return array --FILE-- <?php $file = n..

Decoded Output download

--TEST--
Bug #77024 SplFileObject::__toString() may return array
--FILE--
<?php

$file = new SplTempFileObject;
$file->fputcsv(['foo', 'bar', 'baz']);
$file->rewind();
$file->setFlags(SplFileObject::READ_CSV);
echo $file . "
";

$tmp = tempnam(sys_get_temp_dir(), "php-tests-");
file_put_contents($tmp, "line1
line2
line3
");
$file = new SplFileObject($tmp);
$file->rewind();
echo $file . "
";
unset($file);
unlink($tmp);

?>
--EXPECT--
foo,bar,baz

line1

Did this file decode correctly?

Original Code

--TEST--
Bug #77024 SplFileObject::__toString() may return array
--FILE--
<?php

$file = new SplTempFileObject;
$file->fputcsv(['foo', 'bar', 'baz']);
$file->rewind();
$file->setFlags(SplFileObject::READ_CSV);
echo $file . "\n";

$tmp = tempnam(sys_get_temp_dir(), "php-tests-");
file_put_contents($tmp, "line1\nline2\nline3\n");
$file = new SplFileObject($tmp);
$file->rewind();
echo $file . "\n";
unset($file);
unlink($tmp);

?>
--EXPECT--
foo,bar,baz

line1

Function Calls

None

Variables

None

Stats

MD5 1e432cc20852fe555ea9b27b31b122e7
Eval Count 0
Decode Time 68 ms