ID: 44124 User updated by: [EMAIL PROTECTED] -Summary: Options passed to stream_open is always 5 Reported By: [EMAIL PROTECTED] Status: Open Bug Type: Streams related Operating System: Irrelevant PHP Version: 5.2.5 New Comment:
Update: When passing 0 to the fopen() as option, 4 is received. Previous Comments: ------------------------------------------------------------------------ [2008-02-14 23:08:57] [EMAIL PROTECTED] 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 this bug report at http://bugs.php.net/?id=44124&edit=1