php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #65269 SplFileObject::__construct() throws LogicException as well
Submitted: 2013-07-16 12:15 UTC Modified: 2017-10-24 09:21 UTC
Votes:2
Avg. Score:4.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: benjamin dot morel at gmail dot com Assigned: salathe (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: N/A
Private report: No CVE-ID: None
 [2013-07-16 12:15 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-07-16 13:50 UTC] salathe@php.net
-Assigned To: +Assigned To: salathe
 [2017-10-24 08:02 UTC] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: salathe +Assigned To:
 [2017-10-24 09:21 UTC] salathe@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: salathe
 [2017-10-24 09:21 UTC] salathe@php.net
Re-assigning to me to keep visibility.
 [2019-06-26 07:56 UTC] 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.
 [2019-06-26 08:00 UTC] salathe@php.net
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
 [2019-06-26 08:00 UTC] salathe@php.net
-Status: Assigned +Status: Closed
 [2020-02-07 06:04 UTC] phpdocbot@php.net
Automatic comment on behalf of nikic
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=81a88c05eb0070a21e21840e31fa1f22b36e7bc7
Log: Fix bug #65269: SplFileObject::__construct() throws LogicException as well
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 14:01:28 2024 UTC