Browse Source
Tidy up some user stream code.
Tidy up some user stream code.
Add a small test case (not yet complete).migration/unlabaled-1.1.2
2 changed files with 68 additions and 10 deletions
@ -0,0 +1,51 @@ |
|||
--TEST-- |
|||
User-space streams |
|||
--FILE-- |
|||
<?php |
|||
# vim600:syn=php: |
|||
|
|||
class uselessstream { |
|||
} |
|||
|
|||
class mystream { |
|||
|
|||
function mystream() |
|||
{ |
|||
echo "MYSTREAM: constructor called!\n"; |
|||
} |
|||
|
|||
var $path; |
|||
var $mode; |
|||
var $options; |
|||
|
|||
function stream_open($path, $mode, $options, &$opened_path) |
|||
{ |
|||
$this->path = $path; |
|||
$this->mode = $mode; |
|||
$this->options = $options; |
|||
return true; |
|||
} |
|||
|
|||
} |
|||
|
|||
if (@file_register_wrapper("bogus", "class_not_exist")) |
|||
die("Registered a non-existant class!!!???"); |
|||
|
|||
if (!file_register_wrapper("test", "mystream")) |
|||
die("test wrapper registration failed"); |
|||
if (!file_register_wrapper("bogon", "uselessstream")) |
|||
die("bogon wrapper registration failed"); |
|||
|
|||
echo "Registered\n"; |
|||
|
|||
$b = @fopen("bogon://url", "rb"); |
|||
if (is_resource($b)) |
|||
die("Opened a bogon??"); |
|||
|
|||
$fp = fopen("test://url", "rb"); |
|||
if (!is_resource($fp)) |
|||
die("Failed to open resource"); |
|||
|
|||
?> |
|||
--EXPECT-- |
|||
Registered |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue