Doc #65269 [Asn->Csd]: SplFileObject::__construct() throws LogicException as well

From: Date: Wed, 26 Jun 2019 08:00:11 +0000
Subject: Doc #65269 [Asn->Csd]: SplFileObject::__construct() throws LogicException as well
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-16774@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=65269&edit=1

 ID:                 65269
 Updated by:         salathe@php.net
 Reported by:        benjamin dot morel at gmail dot com
 Summary:            SplFileObject::__construct() throws LogicException
                     as well
-Status:             Assigned
+Status:             Closed
 Type:               Documentation Problem
 Package:            Documentation problem
 Operating System:   N/A
 PHP Version:        Irrelevant
 Assigned To:        salathe
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of nikic
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=a609fed7da9bfe11fb9c03e448281279f74b660b
Log: Fix bug #65269: SplFileObject::__construct() throws LogicException as well


Previous Comments:
------------------------------------------------------------------------
[2019-06-26 07:56:16] nikic@php.net

Automatic comment from SVN on behalf of nikic
Revision: http://svn.php.net/viewvc/?view=revision&revision=347670
Log: Fix bug #65269: SplFileObject::__construct() throws LogicException as well

Fix for [bug 65269](https://bugs.php.net/bug.php?id=65269).

Patch by BenMorel.

Closes GH-3.

------------------------------------------------------------------------
[2017-10-24 09:21:03] salathe@php.net

Re-assigning to me to keep visibility.

------------------------------------------------------------------------
[2013-07-16 12:15:09] benjamin dot morel at gmail dot com

Description:
------------
The documentation page for SplFileObject::__construct():
http://uk1.php.net/manual/en/splfileobject.construct.php

Says:
Throws a RuntimeException if the filename cannot be opened.

Which is true as long as the file does not exist.
However, the test script below shows that when $filename is a directory, it's 
actually a LogicException that's thrown.

The documentation thus needs to be changed as follows:

Throws a RuntimeException if the filename cannot be opened.
Throws a LogicException if the filename is a directory.

Test script:
---------------
new SplFileObject('.');

Expected result:
----------------
RuntimeException

Actual result:
--------------
LogicException: Cannot use SplFileObject with directories


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=65269&edit=1


Thread (4 messages)

« previous php.doc.bugs (#16774) next »