php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #63282 Documented value for SplFileObject::SKIP_EMPTY does not match real value
Submitted: 2012-10-15 20:00 UTC Modified: 2012-11-12 22:39 UTC
From: jsmith at jssm dot com Assigned: salathe (profile)
Status: Closed Package: SPL related
PHP Version: 5.3.17 OS: Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jsmith at jssm dot com
New email:
PHP Version: OS:

 

 [2012-10-15 20:00 UTC] 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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-11-12 22:35 UTC] salathe@php.net
Automatic comment from SVN on behalf of salathe
Revision: http://svn.php.net/viewvc/?view=revision&amp;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-11-12 22:39 UTC] salathe@php.net
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.
 [2012-11-12 22:39 UTC] salathe@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: salathe
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 06:01:32 2025 UTC