php-src/ext/spl/tests/bug77024.phpt
Craig Duncan 91c6fb881e Fix #77024: SplFileObject::__toString() may return array
- Correct the behaviour of casting spl files to strings
- Add a test for Bug 77024
2019-04-28 00:44:48 +02:00

25 lines
461 B
PHP

--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