cvs: ZendEngine2 / zend_builtin_functions.c /tests bug39445.phpt
| From: | Dmitry Stogov | Date: | Wed, 15 Nov 2006 16:05:26 +0000 |
| Subject: | cvs: ZendEngine2 / zend_builtin_functions.c /tests bug39445.phpt | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-5409@lists.php.net to get a copy of this message | ||
dmitry Wed Nov 15 16:05:26 2006 UTC
Modified files:
/ZendEngine2 zend_builtin_functions.c
/ZendEngine2/tests bug39445.phpt
Log:
Fixed bug #39445 (Calling debug_backtrace() in the __toString() function produces a crash)
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_builtin_functions.c?r1=1.331&r2=1.332&diff_format=u
Index: ZendEngine2/zend_builtin_functions.c
diff -u ZendEngine2/zend_builtin_functions.c:1.331 ZendEngine2/zend_builtin_functions.c:1.332
--- ZendEngine2/zend_builtin_functions.c:1.331 Wed Oct 18 16:34:25 2006
+++ ZendEngine2/zend_builtin_functions.c Wed Nov 15 16:05:26 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_builtin_functions.c,v 1.331 2006/10/18 16:34:25 johannes Exp $ */
+/* $Id: zend_builtin_functions.c,v 1.332 2006/11/15 16:05:26 dmitry Exp $ */
#include "zend.h"
#include "zend_API.h"
@@ -1755,7 +1755,9 @@
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 {
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug39445.phpt?r1=1.1&r2=1.2&diff_format=u
Index: ZendEngine2/tests/bug39445.phpt
diff -u /dev/null ZendEngine2/tests/bug39445.phpt:1.2
--- /dev/null Wed Nov 15 16:05:26 2006
+++ ZendEngine2/tests/bug39445.phpt Wed Nov 15 16:05:26 2006
@@ -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