xref: /PHP-8.1/ext/spl/tests/bug77024.phpt (revision 91c6fb88)
1--TEST--
2Bug #77024 SplFileObject::__toString() may return array
3--FILE--
4<?php
5
6$file = new SplTempFileObject;
7$file->fputcsv(['foo', 'bar', 'baz']);
8$file->rewind();
9$file->setFlags(SplFileObject::READ_CSV);
10echo $file . "\n";
11
12$tmp = tempnam(sys_get_temp_dir(), "php-tests-");
13file_put_contents($tmp, "line1\nline2\nline3\n");
14$file = new SplFileObject($tmp);
15$file->rewind();
16echo $file . "\n";
17unset($file);
18unlink($tmp);
19
20?>
21--EXPECT--
22foo,bar,baz
23
24line1
25