note 44810 rejected from function.stream-get-meta-data by tomsommer
| From: | tomsommer@php.net | Date: | Tue, 17 Aug 2004 12:03:47 +0000 |
| Subject: | note 44810 rejected from function.stream-get-meta-data by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-74806@lists.php.net to get a copy of this message | ||
Note Submitter: S dot Cramatte <contact at zeninteractif dot com>
----
How can I add meta data for a new stream registered with
"stream_wrapper_register" function !
When I call "stream_get_meta_data" on my owns streams wrapper apache crash on my win2k and
linux box!
My mysql stream don't return any meta data ...
class MysqlStream {
var $position;
var $varname;
function stream_open($path, $mode, $options, &$opened_path)
{
$url = parse_url($path);
$this->varname = $url["host"];
$this->position = 0;
return true;
}
function stream_read($count)
{
$ret = substr($GLOBALS[$this->varname], $this->position, $count);
$this->position += strlen($ret);
return $ret;
}
function stream_eof()
{
return $this->position >= strlen($this->varname);
}
stream_wrapper_register("mysql", "MysqlStream")
or die("Failed to register protocol");
$myvar = "";
$fp = fopen("mysql://user:pass@host/database/select * from table", "r+");
stream_get_meta_data($fp); //crash apache here !