helly Mon Jan 15 22:19:33 2007 UTC
Modified files:
/php-src/main php_streams.h
/php-src/main/streams cast.c streams.c
Log:
- Help streams debugging
http://cvs.php.net/viewvc.cgi/php-src/main/php_streams.h?r1=1.121&r2=1.122&diff_format=u
Index: php-src/main/php_streams.h
diff -u php-src/main/php_streams.h:1.121 php-src/main/php_streams.h:1.122
--- php-src/main/php_streams.h:1.121 Wed Jan 10 22:43:17 2007
+++ php-src/main/php_streams.h Mon Jan 15 22:19:33 2007
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_streams.h,v 1.121 2007/01/10 22:43:17 pollita Exp $ */
+/* $Id: php_streams.h,v 1.122 2007/01/15 22:19:33 helly Exp $ */
#ifndef PHP_STREAMS_H
#define PHP_STREAMS_H
@@ -225,7 +225,12 @@
int eof;
+#if ZEND_DEBUG
+ char *open_filename;
+ uint open_lineno;
+#endif
}; /* php_stream */
+
/* state definitions when closing down; these are private to streams.c */
#define PHP_STREAM_FCLOSE_NONE 0
#define PHP_STREAM_FCLOSE_FDOPEN 1
http://cvs.php.net/viewvc.cgi/php-src/main/streams/cast.c?r1=1.16&r2=1.17&diff_format=u
Index: php-src/main/streams/cast.c
diff -u php-src/main/streams/cast.c:1.16 php-src/main/streams/cast.c:1.17
--- php-src/main/streams/cast.c:1.16 Mon Jan 1 09:29:35 2007
+++ php-src/main/streams/cast.c Mon Jan 15 22:19:33 2007
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: cast.c,v 1.16 2007/01/01 09:29:35 sebastian Exp $ */
+/* $Id: cast.c,v 1.17 2007/01/15 22:19:33 helly Exp $ */
#define _GNU_SOURCE
#include "php.h"
@@ -327,6 +327,11 @@
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;
http://cvs.php.net/viewvc.cgi/php-src/main/streams/streams.c?r1=1.144&r2=1.145&diff_format=u
Index: php-src/main/streams/streams.c
diff -u php-src/main/streams/streams.c:1.144
php-src/main/streams/streams.c:1.145
--- php-src/main/streams/streams.c:1.144 Mon Jan 15 17:06:52 2007
+++ php-src/main/streams/streams.c Mon Jan 15 22:19:33 2007
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streams.c,v 1.144 2007/01/15 17:06:52 tony2001 Exp $ */
+/* $Id: streams.c,v 1.145 2007/01/15 22:19:33 helly Exp $ */
#define _GNU_SOURCE
#include "php.h"
@@ -241,6 +241,11 @@
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;
}
@@ -384,7 +389,7 @@
* 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);
@@ -2376,6 +2381,10 @@
}
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)) {
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php