From:             [EMAIL PROTECTED]
Operating system: Irrelevant
PHP version:      5.2.5
PHP Bug Type:     Streams related
Bug description:  Options passed to stream_open is always 5

Description:
------------
The $options in stream_open() do not match in any way (or at least in any
documented way) with the options passed to fopen()

BTW: the documentation of fopen() and stream_open() doesn't make any
mention of how the options are passed.

So either a bug, or a major lack of documentation, either way,
STREAM_REPORT_ERRORS cannot be checked for with the information available
on the php.net site.

Tested on: 5.1.4, 5.2.0, 5.2.3 and 5.2.5 on different Windows and Debian.

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

class StreamTest
{
    public function stream_open($path, $mode, $flags, &$opened_path)
    {
        echo 'Received: '.decbin($flags)."\r\n";
        return false;
    }
}

stream_wrapper_register('test', 'StreamTest');


$flags = array(STREAM_USE_PATH, STREAM_REPORT_ERRORS);

echo 'PHP v'.phpversion()."\r\n";
foreach ($flags as $flag) {
    echo 'Passed: '.decbin($flag)."\r\n";
    $fp = @fopen('test://foo', 'r', $flag);
}

?>

Expected result:
----------------
PHP v5.1.4
Passed: 1
Received: 1
Passed: 1000
Received: 1000
Passed: 0
Received: 0

(or at least a OR on the STREAM_* constant and $flags in stream_open would
return TRUE)


Actual result:
--------------
PHP v5.1.4
Passed: 1
Received: 101
Passed: 1000
Received: 101
Passed: 0
Received: 100


-- 
Edit bug report at http://bugs.php.net/?id=44124&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=44124&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=44124&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=44124&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=44124&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=44124&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=44124&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=44124&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=44124&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=44124&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=44124&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=44124&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=44124&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=44124&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=44124&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=44124&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=44124&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=44124&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=44124&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=44124&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=44124&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=44124&r=mysqlcfg

Reply via email to