Wasn't there some talk about this not being very good idea?
Anyway, adding stuff like this in a bugfix release is not
something I'd allow right now..
--Jani
On Thu, 24 Nov 2005, Sebastian Bergmann wrote:
sebastian Thu Nov 24 00:07:28 2005 EDT
Modified files: (Branch: PHP_5_1)
/php-src NEWS
/ZendEngine2 zend_builtin_functions.c zend_builtin_functions.h
zend_exceptions.c
Log:
MFH: Add an additional field $frame['object'] to the result array of
debug_backtrace() that contains a reference to the respective object when the
frame was called from an object.
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.2027.2.218&r2=1.2027.2.219&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.218 php-src/NEWS:1.2027.2.219
--- php-src/NEWS:1.2027.2.218 Wed Nov 23 15:53:30 2005
+++ php-src/NEWS Thu Nov 24 00:07:25 2005
@@ -1,7 +1,9 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2006, PHP 5.1.1
-
+- Added an additional field $frame['object'] to the result array of
+ debug_backtrace() that contains a reference to the respective object when the
+ frame was called from an object. (Sebastian)
24 Nov 2005, PHP 5.1
- Added support for class constants and static members for internal classes.
(Dmitry, Michael Wallner)
http://cvs.php.net/diff.php/ZendEngine2/zend_builtin_functions.c?r1=1.277.2.5&r2=1.277.2.6&ty=u
Index: ZendEngine2/zend_builtin_functions.c
diff -u ZendEngine2/zend_builtin_functions.c:1.277.2.5
ZendEngine2/zend_builtin_functions.c:1.277.2.6
--- ZendEngine2/zend_builtin_functions.c:1.277.2.5 Fri Sep 16 13:05:06 2005
+++ ZendEngine2/zend_builtin_functions.c Thu Nov 24 00:07:27 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_builtin_functions.c,v 1.277.2.5 2005/09/16 17:05:06 tony2001 Exp
$ */
+/* $Id: zend_builtin_functions.c,v 1.277.2.6 2005/11/24 05:07:27 sebastian Exp
$ */
#include "zend.h"
#include "zend_API.h"
@@ -1813,7 +1813,7 @@
/* }}} */
-ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last
TSRMLS_DC)
+ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last,
int provide_object TSRMLS_DC)
{
zend_execute_data *ptr, *skip;
int lineno;
@@ -1913,6 +1913,11 @@
add_assoc_string_ex(stack_frame, "class",
sizeof("class"), class_name, dup);
}
+ if (provide_object) {
+ add_assoc_zval_ex(stack_frame, "object",
sizeof("object"), ptr->object);
+ ptr->object->refcount++;
+ }
+
add_assoc_string_ex(stack_frame, "type", sizeof("type"),
"->", 1);
} else if (ptr->function_state.function->common.scope) {
add_assoc_string_ex(stack_frame, "class",
sizeof("class"), ptr->function_state.function->common.scope->name, 1);
@@ -1994,7 +1999,7 @@
ZEND_WRONG_PARAM_COUNT();
}
- zend_fetch_debug_backtrace(return_value, 1 TSRMLS_CC);
+ zend_fetch_debug_backtrace(return_value, 1, 1 TSRMLS_CC);
}
/* }}} */
http://cvs.php.net/diff.php/ZendEngine2/zend_builtin_functions.h?r1=1.17&r2=1.17.2.1&ty=u
Index: ZendEngine2/zend_builtin_functions.h
diff -u ZendEngine2/zend_builtin_functions.h:1.17
ZendEngine2/zend_builtin_functions.h:1.17.2.1
--- ZendEngine2/zend_builtin_functions.h:1.17 Wed Aug 3 09:30:48 2005
+++ ZendEngine2/zend_builtin_functions.h Thu Nov 24 00:07:28 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_builtin_functions.h,v 1.17 2005/08/03 13:30:48 sniper Exp $ */
+/* $Id: zend_builtin_functions.h,v 1.17.2.1 2005/11/24 05:07:28 sebastian Exp
$ */
#ifndef ZEND_BUILTIN_FUNCTIONS_H
#define ZEND_BUILTIN_FUNCTIONS_H
@@ -25,7 +25,7 @@
int zend_startup_builtin_functions(TSRMLS_D);
BEGIN_EXTERN_C()
-ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last
TSRMLS_DC);
+ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last,
int provide_object TSRMLS_DC);
END_EXTERN_C()
#endif /* ZEND_BUILTIN_FUNCTIONS_H */
http://cvs.php.net/diff.php/ZendEngine2/zend_exceptions.c?r1=1.79.2.1&r2=1.79.2.2&ty=u
Index: ZendEngine2/zend_exceptions.c
diff -u ZendEngine2/zend_exceptions.c:1.79.2.1
ZendEngine2/zend_exceptions.c:1.79.2.2
--- ZendEngine2/zend_exceptions.c:1.79.2.1 Tue Aug 16 06:49:25 2005
+++ ZendEngine2/zend_exceptions.c Thu Nov 24 00:07:28 2005
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_exceptions.c,v 1.79.2.1 2005/08/16 10:49:25 dmitry Exp $ */
+/* $Id: zend_exceptions.c,v 1.79.2.2 2005/11/24 05:07:28 sebastian Exp $ */
#include "zend.h"
#include "zend_API.h"
@@ -92,7 +92,7 @@
ALLOC_ZVAL(trace);
trace->is_ref = 0;
trace->refcount = 0;
- zend_fetch_debug_backtrace(trace, skip_top_traces TSRMLS_CC);
+ zend_fetch_debug_backtrace(trace, skip_top_traces, 0 TSRMLS_CC);
zend_update_property_string(default_exception_ce, &obj, "file",
sizeof("file")-1, zend_get_executed_filename(TSRMLS_C) TSRMLS_CC);
zend_update_property_long(default_exception_ce, &obj, "line",
sizeof("line")-1, zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC);
--
Give me your money at @ <http://pecl.php.net/wishlist.php/sniper>
Donating money may make me happier and friendlier for a limited period!
Death to all 4 letter abbreviations starting with P!
--
Zend Engine CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
|