if (*newstream == NULL)
return PHP_STREAM_FAILED;
+#if ZEND_DEBUG
+ (*newstream)->open_filename = origstream->open_filename;
+ (*newstream)->open_lineno = origstream->open_lineno;
+#endif
+
if (php_stream_copy_to_stream(origstream, *newstream, PHP_STREAM_COPY_ALL) == 0) {
php_stream_close(*newstream);
*newstream = NULL;
ret->chunk_size = FG(def_chunk_size);
ret->readbuf_type = IS_STRING;
+#if ZEND_DEBUG
+ ret->open_filename = __zend_orig_filename ? __zend_orig_filename : __zend_filename;
+ ret->open_lineno = __zend_orig_lineno ? __zend_orig_lineno : __zend_lineno;
+#endif
+
if (FG(auto_detect_line_endings)) {
ret->flags |= PHP_STREAM_FLAG_DETECT_EOL;
}
* as leaked; it will log a warning, but lets help it out and display what kind
* of stream it was. */
char *leakinfo;
- spprintf(&leakinfo, 0, __FILE__ "(%d) : Stream of type '%s' %p (path:%s) was not closed\n", __LINE__, stream->ops->label, stream, stream->orig_path);
+ spprintf(&leakinfo, 0, __FILE__ "(%d) : Stream of type '%s' %p (path:%s) was not closed (opened in %s on line %d)\n", __LINE__, stream->ops->label, stream, stream->orig_path, stream->open_filename, stream->open_lineno);
if (stream->orig_path) {
pefree(stream->orig_path, stream->is_persistent);
}
copy_of_path = pestrdup(path, persistent);
stream->orig_path = copy_of_path;
+#if ZEND_DEBUG
+ stream->open_filename = __zend_orig_filename ? __zend_orig_filename : __zend_filename;
+ stream->open_lineno = __zend_orig_lineno ? __zend_orig_lineno : __zend_lineno;
+#endif
}
if (stream != NULL && (options & STREAM_MUST_SEEK)) {