From:             darrel dot opry at gmail dot com
Operating system: Ubuntu 8.10
PHP version:      5.2.8
PHP Bug Type:     Streams related
Bug description:  php_stream_locate_url_wrapper fails without authority section

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

Reply via email to