Doc #65269 [Asn->Opn]: SplFileObject::__construct() throws LogicException as well
Edit report at https://bugs.php.net/bug.php?id=65269&edit=1
ID: 65269
Updated by: kalle@php.net
Reported by: benjamin dot morel at gmail dot com
Summary: SplFileObject::__construct() throws LogicException
as well
-Status: Assigned
+Status: Open
Type: Documentation Problem
Package: Documentation problem
Operating System: N/A
PHP Version: Irrelevant
-Assigned To: salathe
+Assigned To:
Block user comment: N
Private report: N
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)