php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39850 SplFileObject contradictory "failed to open stream: Success"
Submitted: 2006-12-16 07:08 UTC Modified: 2006-12-18 14:56 UTC
From: judas dot iscariote at gmail dot com Assigned: tony2001
Status: Closed Package: Filesystem function related
PHP Version: 5CVS-2006-12-16 (CVS) OS: Linux 64bit
Private report: No CVE-ID:
 [2006-12-16 07:08 UTC] judas dot iscariote at gmail dot com
Description:
------------
A funny Exception is raised by SplFileObject on certain special situation.

Reproduce code:
---------------
<?php

//yes, get_included_files() is important for the test !!
if(count(get_included_files()) === 1) {

    // yes, **wrong** (mistyped) wrapper.
    $stdout = new SplFileObject('php://stdoutd', 'wb');
}
?>

Expected result:
----------------
PHP Fatal error:  Uncaught exception 'RuntimeException' with message 'SplFileObject::__construct(php://stdoutd): failed to open stream: (Invalid Wrapper ? , File not found ?  or something ;) )

Actual result:
--------------
PHP Fatal error:  Uncaught exception 'RuntimeException' with message 'SplFileObject::__construct(php://stdoutd): failed to open stream: **Success**

or in other cases without the get_included_files() call I get 
"Inappropriate ioctl for device" (!!)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-18 11:08 UTC] tony2001@php.net
I got a patch, but I want to hear what Ilia thinks about it first..
http://tony2001.phpclub.net/dev/tmp/bug39850.diff
 [2006-12-18 14:56 UTC] tony2001@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 17 09:02:29 2014 UTC