Bug #66588 [Opn->Ver]: SplFileObject::fgetcsv incorrectly returns a row on premature EOF

From: Date: Fri, 28 Mar 2014 19:51:00 +0000
Subject: Bug #66588 [Opn->Ver]: SplFileObject::fgetcsv incorrectly returns a row on premature EOF
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-184952@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66588&edit=1 ID: 66588 Updated by: levim@php.net Reported by: jameshfisher at gmail dot com Summary: SplFileObject::fgetcsv incorrectly returns a row on premature EOF -Status: Open +Status: Verified Type: Bug Package: SPL related Operating System: Ubuntu 12.04.4 LTS PHP Version: 5.5.8 Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2014-01-27 16:15:23] jameshfisher at gmail dot com Description: ------------ --- From manual page: http://www.php.net/splfileobject.fgetcsv --- Test script: --------------- Assume the file invalid.csv contains: blah,"blah Then run the script below: #!/usr/bin/env php5 <?php $s = new \SplFileObject('invalid.csv'); $r = NULL; while (!$s->eof()) { var_dump($s->fgetcsv(',','"')); } Expected result: ---------------- An error, signalled by FALSE, as described in the documentation for the method: $ ./test.php bool(false) Actual result: -------------- The cell in the file that does not have a closing quotation mark is treated as if EOF is the closing quotation mark. This is not compliant with the RFC: https://tools.ietf.org/html/rfc4180 $ ./test.php array(2) { [0]=> string(4) "blah" [1]=> string(5) "blah " } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=66588&edit=1

« previous php.bugs (#184952) next »