This could have been done in stream_wrapper_register()
without introducing the slight performance hit on
wrapper registration since anyone registering a wrapper
in an extension should know better.
The important thing is that since locate_wrapper makes
the assumption that all schemes will be /^[a-z0-9+.-]+$/i
Anything which registers them should make the same assumption as well.
Register filters as resources when
instantiated by stream_filter_(ap|pre)pend().
Export php_stream_filter_flush() internal function to wind buffered data
out of a particular filter until consumed by a later filter or sent to
stream->readbuffer or stream->ops->write()
Disables a wrapper (user-defined or built-in) for the life of the request.
Add stream_wrapper_restore()
Restores the wrapper originally defined at the time the request started
to the protocol name mentioned.
Userdefined wrappers were being registered into a global wrapper hash
which can cross threads. Termination of once instance then has the
potential to leave an active stream in another instance with no wrapper
leading to segfault.
using the default socket timeout of 60 seconds before returning the socket
to the calling script. The reason they were using that value is that the
same code is used for feof(), so the fix is allowing the caller to
indicate the timeout value for liveness checks.
A possible remaining issue now is that 0 second timeout[1] for pfsockopen
is possibly too short; it's impossible to specify a sane value for all
possible uses, so maybe we need a stream context or an .ini option to
control this, or maybe use the timeout value that was passed to
pfsockopen().
# [1] by timeout, I mean the time that PHP will wait for data on a
# persistent socket before deciding if a new connection should be made;
# NOT the timeout while waiting for a new connection to be established.
behavior/API is as follows:
1) To close a persistent use php_stream_pclose(), it will close the stream
and remove it from the persistent list.
2) Inside PHP code only explicit fclose() will close persistent streams,
all other actions such as unset() or assigning a value to stream handle
will not.
3) Regular streams can still be closed by either fclose(), unset() or an
assignment of a value to the stream handler.