Re: file_register_wrapper not binary safe?

From: Date: Thu, 05 Sep 2002 18:06:47 +0000
Subject: Re: file_register_wrapper not binary safe?
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-87970@lists.php.net to get a copy of this message
Hi Steve, > $content='foo'.chr(0).'bar'; > echo strlen( file_get_contents ('variable://'.$content) ); > results a length of 3 instead of 7. A URL cannot have a NUL character in it (it violates the spec/RFC). You should urlencode the content before concat-ing it with the variable:// part and then urldecode it in your stream_open function. However, local files should still have their names interpreted "binary-safely". > Also when stream_read results more bytes as file_get_contents or another > command > requested, php results a segfault. Oops; I'll take a look at this over the weekend. It's possibly because your stream_read function is not returning false when there are no more bytes to be read, but the stream wrapper should handle this a little more gracefully! I'm sorry the docs aren't so great for this stuff yet; they're on my TODO. --Wez.

« previous php.dev (#87970) next »