buffers.
When selecting for read, the streams are examined; if any of them have
pending read data, no actual select(2) call is performed; instead the
streams with buffered data are returned; just like a regular select
call.
Prevent erroneous warning in stream_select when obtaining the fd.
php_stream_gets is now a macro which calls php_stream_get_line. The latter
has an option argument to return the number of bytes in the line.
Functions like fgetcsv(), fgetss() can be made binary safe by calling
php_stream_get_line directly.
# HEADS UP: You will need to make clean after updating your CVS, as the
# binary signature has changed.
second and subsequent events.
Implement very simple recursion protection for user streams written
like this:
class urlEncodeStream {
var $fp = NULL;
function stream_open($path, $mode, $options, &$opened_path)
{
$this->fp = fopen($path, $mode); // <-- this recurses infinitely
return is_resource($this->fp);
}
}
file_register_wrapper('urlencode', 'urlEncodeStream');
$fp = fopen('urlencode:///tmp/outputfile.txt', 'w');
Noticed by: Yasuo.
Eliminate similar code from network.c.
Implement fgets equivalent at the streams level, which can detect
the mac, dos and unix line endings and handle them appropriately.
The default behaviour is unix (and dos) line endings.
An ini option to control this behaviour will follow.
# Don't forget to make clean!
# I've done some testing but would appreciate feedback from
# people with scripts/extensions that seek around a lot.
@ php.ini or via a stream context. (Sterling)
The stream context is untested, but it should/could work :) Either way it
doesn't make the rest of the code bad. Wez -- please take a looksie for me
:)
Filters can be stacked onto a stream; more details will follow in docs and
on php-dev.
Implement "string.rot13" filter
Allows the following script:
$fp = fopen("file.txt", "r");
stream_filter_prepend($fp, "string.rot13");
// File contents will be subject to a rot13 transformation before
// being output.
fpassthru($fp);
fclose($fp);
php_stream_set_option which can be used in a similar way as ioctl()
to set options for streams.
Current options include buffering and blocking support.
o Buffer control is support for stdio based streams.
o Blocking/non-blocking is supported for stdio and socket based streams.