From: Antony Dovgal Date: Thu, 15 Mar 2007 16:44:12 +0000 (+0000) Subject: fix #40815 (using strings like "class::func" and static methods in set_exception_hand... X-Git-Tag: php-5.2.2RC1~142 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=79ed194a64a93275d680947f20d3da3e6875d548;p=php fix #40815 (using strings like "class::func" and static methods in set_exception_handler() might result in crash) --- diff --git a/Zend/tests/bug40815.phpt b/Zend/tests/bug40815.phpt new file mode 100644 index 0000000000..6f7477a9eb --- /dev/null +++ b/Zend/tests/bug40815.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #40815 (using strings like "class::func" and static methods in set_exception_handler() might result in crash). +--FILE-- + +--EXPECTF-- +foo diff --git a/Zend/zend.c b/Zend/zend.c index 87342e2a46..88601eab4e 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -1146,6 +1146,9 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co zval_ptr_dtor(&retval2); } } else { + if (!EG(exception)) { + EG(exception) = old_exception; + } zend_exception_error(EG(exception) TSRMLS_CC); } efree(params); diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 95efb309e8..2fb02c421a 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -750,7 +750,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS fname = Z_STRVAL_P(fci->function_name); fname_len = Z_STRLEN_P(fci->function_name); - if (calling_scope && (colon = strstr(fname, "::")) != NULL) { + if ((colon = strstr(fname, "::")) != NULL) { int clen = colon - fname; int mlen = fname_len - clen - 2; zend_class_entry **pce, *ce_child = NULL;