Doc #65269 [NEW]: SplFileObject::__construct() throws LogicException as well

From: Date: Tue, 16 Jul 2013 12:15:09 +0000
Subject: Doc #65269 [NEW]: SplFileObject::__construct() throws LogicException as well
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-10080@lists.php.net to get a copy of this message
From:             benjamin dot morel at gmail dot com
Operating system: N/A
PHP version:      Irrelevant
Package:          Documentation problem
Bug Type:         Documentation Problem
Bug description:SplFileObject::__construct() throws LogicException as well

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 bug report at https://bugs.php.net/bug.php?id=65269&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=65269&r=trysnapshot54
Try a snapshot (PHP 5.3):   https://bugs.php.net/fix.php?id=65269&r=trysnapshot53
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=65269&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=65269&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=65269&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=65269&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=65269&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=65269&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=65269&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=65269&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=65269&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=65269&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=65269&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65269&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=65269&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=65269&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=65269&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65269&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=65269&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=65269&r=mysqlcfg



Thread (4 messages)

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