Doc #63282 [Opn->Csd]: Documented value for SplFileObject::SKIP_EMPTY does not match real value
| From: | salathe@php.net | Date: | Mon, 12 Nov 2012 22:39:54 +0000 |
| Subject: | Doc #63282 [Opn->Csd]: Documented value for SplFileObject::SKIP_EMPTY does not match real value | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-9102@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63282&edit=1
ID: 63282
Updated by: salathe@php.net
Reported by: jsmith at jssm dot com
Summary: Documented value for SplFileObject::SKIP_EMPTY does
not match real value
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: SPL related
Operating System: Windows
PHP Version: 5.3.17
-Assigned To:
+Assigned To: salathe
Block user comment: N
Private report: N
New Comment:
The fix for this bug has been committed.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
Documentation of the SKIP_EMPTY value change, and a note about READ_AHEAD, has
been added.
Previous Comments:
------------------------------------------------------------------------
[2012-11-12 22:35:08] salathe@php.net
Automatic comment from SVN on behalf of salathe
Revision: http://svn.php.net/viewvc/?view=revision&revision=328339
Log: Corrects the documented value for the SplFileObject::SKIP_EMPTY constant. (doc #63282)
salathe: also added changelog entry for SKIP_EMPTY
--
Provided by Niel Archer (niel.archer@gmail.com)
------------------------------------------------------------------------
[2012-10-15 20:00:24] jsmith at jssm dot com
Description:
------------
The class synopsis for SplFileObject
(http://www.php.net/manual/en/class.splfileobject.php#splfileobject.synopsis)
indicates that the SKIP_EMPTY constant is defined with the value of 6.
I have included a PHPUnit test case showing that the SKIP_EMPTY constant does
not match the value listed in the documentation.
The value of the SplFileObject::SKIP_EMPTY constant changed in PHP 5.3.8 from 6
to 4 (https://bugs.php.net/bug.php?id=55807) and the problem still remains. It
was noticed and a new bug report was opened for the problem it caused
(https://bugs.php.net/bug.php?id=61032).
Ideally, the constant should be restored to its old value of 6. Another
acceptable choice is to update the documentation so that the constant is
accurately documented in addition to adding a note to the SKIP_EMPTY constant
indicating that it requires the READ_AHEAD flag to also be set in order to
function.
Test script:
---------------
class SplFileObjectTest extends PHPUnit_Framework_TestCase
{
public function testConstants()
{
// constants taken from http://www.php.net/manual/en/class.splfileobject.php#splfileobject.synopsis
$this->assertEquals(1, SplFileObject::DROP_NEW_LINE);
$this->assertEquals(2, SplFileObject::READ_AHEAD);
$this->assertEquals(6, SplFileObject::SKIP_EMPTY); // <- THIS ONE FAILS
$this->assertEquals(8, SplFileObject::READ_CSV);
}
}
Expected result:
----------------
Ideally, all the assertions pass.
Actual result:
--------------
PHPUnit_Framework_ExpectationFailedException : Failed asserting that 4 matches
expected 6.
Expected :6
Actual :4
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63282&edit=1