#39850 [Opn->Asn]: SplFileObject contradictory "failed to open stream: Success"

From: Date: Mon, 18 Dec 2006 11:08:13 +0000
Subject: #39850 [Opn->Asn]: SplFileObject contradictory "failed to open stream: Success"
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-106484@lists.php.net to get a copy of this message
 ID:               39850
 Updated by:       tony2001@php.net
 Reported By:      judas dot iscariote at gmail dot com
-Status:           Open
+Status:           Assigned
-Bug Type:         SPL related
+Bug Type:         Filesystem function related
 Operating System: Linux 64bit
 PHP Version:      5CVS-2006-12-16 (CVS)
-Assigned To:      
+Assigned To:      tony2001
 New Comment:

I got a patch, but I want to hear what Ilia thinks about it first..
http://tony2001.phpclub.net/dev/tmp/bug39850.diff


Previous Comments:
------------------------------------------------------------------------

[2006-12-16 07:08:35] 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" (!!)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=39850&edit=1


Thread (3 messages)

« previous php.bugs (#106484) next »