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

From: Date: Tue, 24 Oct 2017 09:21:03 +0000
Subject: Doc #65269 [Opn->Asn]: SplFileObject::__construct() throws LogicException as well
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-15161@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:             Open
+Status:             Assigned
 Type:               Documentation Problem
 Package:            Documentation problem
 Operating System:   N/A
 PHP Version:        Irrelevant
-Assigned To:        
+Assigned To:        salathe
 Block user comment: N
 Private report:     N

 New Comment:

Re-assigning to me to keep visibility.


Previous Comments:
------------------------------------------------------------------------
[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 (#15161) next »