mirror of
https://github.com/php/php-src.git
synced 2026-03-25 00:32:23 +01:00
Both the documentation and the stubs state that this method is supposed to return false on failure. However, if the line read (rather than the getcsv operation) fails, it would incorrectly return null instead.
39 lines
566 B
PHP
39 lines
566 B
PHP
--TEST--
|
|
SplFileObject::fgetcsv default path
|
|
--FILE--
|
|
<?php
|
|
$fp = fopen('SplFileObject__fgetcsv1.csv', 'w+');
|
|
fputcsv($fp, array(
|
|
'field1',
|
|
'field2',
|
|
'field3',
|
|
5
|
|
));
|
|
fclose($fp);
|
|
|
|
$fo = new SplFileObject('SplFileObject__fgetcsv1.csv');
|
|
var_dump($fo->fgetcsv());
|
|
var_dump($fo->fgetcsv());
|
|
var_dump($fo->fgetcsv());
|
|
?>
|
|
--CLEAN--
|
|
<?php
|
|
unlink('SplFileObject__fgetcsv1.csv');
|
|
?>
|
|
--EXPECT--
|
|
array(4) {
|
|
[0]=>
|
|
string(6) "field1"
|
|
[1]=>
|
|
string(6) "field2"
|
|
[2]=>
|
|
string(6) "field3"
|
|
[3]=>
|
|
string(1) "5"
|
|
}
|
|
array(1) {
|
|
[0]=>
|
|
NULL
|
|
}
|
|
bool(false)
|