php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41390 stream_wrapper_register() and underscore in $protocol
Submitted: 2007-05-14 21:39 UTC Modified: 2007-05-15 13:04 UTC
From: wiesemann@php.net Assigned:
Status: Closed Package: Streams related
PHP Version: 5.2.2 OS: WinXP SP2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: wiesemann@php.net
New email:
PHP Version: OS:

 

 [2007-05-14 21:39 UTC] wiesemann@php.net
Description:
------------
When I use underscores in $protocol parameter for stream_wrapper_register(), I get an error telling me that PHP was "Unable to register wrapper class ...". In main/streams/userspace. this error is thrown and one can find the comment "/* Should never happen */" above it.

Either the comment is wrong or there should be a check for the validity of the protocal name.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-05-15 03:12 UTC] scottmac@php.net
A protocol has to be A-Z 0-9 so an underscore isn't valid and is the cause of the error.

See php_register_url_stream_wrapper in main/streams/streams.c
 [2007-05-15 07:35 UTC] wiesemann@php.net
In php_register_url_stream_wrapper the protocal is checked, in my case it isn't checked. And "Should never happen" is a rather bogus comment for a case that actually does happen, isn't it?
 [2007-05-15 12:20 UTC] scottmac@php.net
The comment is most likely wrong, the call fails because php_register_url_stream_wrapper_volatile returns FAILURE.

The reason it returns FAILURE because php_register_url_stream_wrapper_volatile then runs php_stream_wrapper_scheme_validate which fails because the protocol isn't /^[a-zA-Z0-9+.-]+$/

The error could well be clarified.
 [2007-05-15 13:04 UTC] scottmac@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 00:01:28 2024 UTC