is based on a temporary file rather than a memory stream.
if (stream != NULL && (options & STREAM_MUST_SEEK)) {
php_stream *newstream;
- switch(php_stream_make_seekable_rel(stream, &newstream, PHP_STREAM_NO_PREFERENCE)) {
+ switch(php_stream_make_seekable_rel(stream, &newstream,
+ (options & STREAM_WILL_CAST)
+ ? PHP_STREAM_PREFER_STDIO : PHP_STREAM_NO_PREFERENCE)) {
case PHP_STREAM_UNCHANGED:
return stream;
case PHP_STREAM_RELEASED: