diff options
author | Dmitry Stogov <dmitry@php.net> | 2006-11-15 16:05:11 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2006-11-15 16:05:11 +0000 |
commit | 842b1b5a4718b0806b2127f6423f994a06beee03 (patch) | |
tree | d30a9e5ebf3808ee7d45de048d127342b940719f | |
parent | 8619bf83325a3ee1ac21bfe5e71c9c14fd46a51e (diff) | |
download | php-git-842b1b5a4718b0806b2127f6423f994a06beee03.tar.gz |
Fixed bug #39445 (Calling debug_backtrace() in the __toString() function produces a crash)
-rw-r--r-- | NEWS | 2 | ||||
-rwxr-xr-x | Zend/tests/bug39445.phpt | 16 | ||||
-rw-r--r-- | Zend/zend_builtin_functions.c | 4 |
3 files changed, 21 insertions, 1 deletions
@@ -41,6 +41,8 @@ PHP NEWS - Fixed wrong signature initialization in imagepng (Takeshi Abe) - Added optimization for imageline with horizontal and vertial lines (Pierre) - Fixed bug #39454 (Returning a SOAP array segfaults PHP). (Dmitry) +- Fixed bug #39445 (Calling debug_backtrace() in the __toString() function + produces a crash). (Dmitry) - Fixed bug #39414 (Syntax error while compiling with Sun Workshop Complier). (Johannes) - Fixed bug #39398 (Booleans are not automatically translated to integers). diff --git a/Zend/tests/bug39445.phpt b/Zend/tests/bug39445.phpt new file mode 100755 index 0000000000..cf1607f2dd --- /dev/null +++ b/Zend/tests/bug39445.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #39445 (Calling debug_backtrace() in the __toString() function produces a crash) +--FILE-- +<?php +class test { + public function __toString() { + debug_backtrace(); + return 'lowercase'; + } +} + + $test = new test(); + echo strtoupper($test); +?> +--EXPECT-- +LOWERCASE diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 6ae3a0fbd5..b623ea5abf 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -1661,7 +1661,9 @@ static zval *debug_backtrace_get_args(void ***curpos TSRMLS_DC) while (--arg_count >= 0) { arg = (zval **) p++; if (*arg) { - SEPARATE_ZVAL_TO_MAKE_IS_REF(arg); + if ((*arg)->type != IS_OBJECT) { + SEPARATE_ZVAL_TO_MAKE_IS_REF(arg); + } (*arg)->refcount++; add_next_index_zval(arg_array, *arg); } else { |