ID:               47070
 Updated by:       j...@php.net
 Reported By:      darrel dot opry at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Streams related
 Operating System: Ubuntu 8.10
 PHP Version:      5.2.8
 New Comment:

RTFM: http://www.php.net/fopen  (look for explanation what PHP expects
the filename parameter to look like...you can put as many RFCs here, but
it's never said anywhere that fopen() expects some RFCs style scheme..
:)


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

[2009-01-12 03:01:10] darrel dot opry at gmail dot com

Description:
------------
php_stream_locate_url_wrapper fails without authority section.

If a URL is not in the Common Internet Scheme Syntax
(scheme://<<user>:<pass>@>host<:port>/url-path) the scheme is not be
located properly. So URLs of scheme:relative/path and
scheme:/absolute/path will not be handled by the registered user defined
stream wrapper.

see http://www.ietf.org/rfc/rfc1738.txt for URL specific syntax.

see section 3 of
http://labs.apache.org/webarch/uri/rfc/rfc3986.html#intro for URI
syntax.

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

class wrapper {
  function stream_open() {
    print_r(func_get_args());
    return TRUE;
  }
}

stream_wrapper_register('public', 'wrapper');

fopen('public:path/file.txt', 'r+');
fopen('public:/path/file.txt', 'r+');
fopen('public://path/file.txt', 'r+');


Expected result:
----------------
I expect wrapper::stream_open to be called and fopen to print_r the
function arguments.

Array
(
    [0] => public:path/file.txt
    [1] => r+
    [2] => 4
    [3] => 
)
Array
(
    [0] => public:/path/file.txt
    [1] => r+
    [2] => 4
    [3] => 
)
Array
(
    [0] => public://path/file.txt
    [1] => r+
    [2] => 4
    [3] => 
)

Actual result:
--------------
Warning: fopen(public:path/file.txt): failed to open stream: No such
file or directory in
/home/dopry/public_html/drupal-media/sites/default/modules/media/resource/test.php
on line 13

Warning: fopen(public:/path/file.txt): failed to open stream: No such
file or directory in
/home/dopry/public_html/drupal-media/sites/default/modules/media/resource/test.php
on line 14
Array
(
    [0] => public://path/file.txt
    [1] => r+
    [2] => 4
    [3] => 
)



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


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

Reply via email to