mirror of
https://github.com/php/php-src.git
synced 2025-01-05 18:33:56 +08:00
91c6fb881e
- Correct the behaviour of casting spl files to strings - Add a test for Bug 77024
25 lines
461 B
PHP
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
|