Commit: fd0b3ea663431b7adaedde11668fbc0b6ba07494
Author: Xinchen Hui <larue...@php.net> Wed, 19 Sep 2012 19:40:59
+0800
Parents: 6752f38ccca37213865f330a2f0dc49d834dc92e
Branches: PHP-5.3
Link:
http://git.php.net/?p=php-src.git;a=commitdiff;h=fd0b3ea663431b7adaedde11668fbc0b6ba07494
Log:
Fixed bug #61442 (exception threw in __autoload can not be catched)
Bugs:
https://bugs.php.net/61442
Changed paths:
M NEWS
A Zend/tests/bug61442.phpt
M Zend/zend_vm_def.h
M Zend/zend_vm_execute.h
diff --git a/NEWS b/NEWS
index 181e66d..787d76d 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,8 @@ PHP
NEWS
some builtin classes). (Laruence)
. Fixed bug #61767 (Shutdown functions not called in certain error
situation). (Dmitry)
+ . Fixed bug #61442 (exception threw in __autoload can not be catched).
+ (Laruence)
. Fixed bug #60909 (custom error handler throwing Exception + fatal error
= no shutdown function). (Dmitry)
diff --git a/Zend/tests/bug61442.phpt b/Zend/tests/bug61442.phpt
new file mode 100644
index 0000000..3af534f
--- /dev/null
+++ b/Zend/tests/bug61442.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Bug #61442 (exception threw in __autoload can not be catched)
+--FILE--
+<?php
+function __autoload($name) {
+ throw new Exception("Unable to load $name");
+}
+
+try {
+ $obj = new NonLoadableClass();
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+try {
+ $obj = NonLoadableClass::a();
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+try {
+ $obj = NonLoadableClass::UNDEFINED_CONST;
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+--EXPECTF--
+string(31) "Unable to load NonLoadableClass"
+string(31) "Unable to load NonLoadableClass"
+string(31) "Unable to load NonLoadableClass"
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 34020fb..22d77dd 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -1990,6 +1990,9 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL,
CONST|VAR, CONST|TMP|VAR|UNUS
if (OP1_TYPE == IS_CONST) {
/* no function found. try a static method in class */
ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant),
Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC);
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ ZEND_VM_CONTINUE();
+ }
if (!ce) {
zend_error_noreturn(E_ERROR, "Class '%s' not found",
Z_STRVAL(opline->op1.u.constant));
}
@@ -3043,6 +3046,9 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT,
VAR|CONST|UNUSED, CONST)
if (OP1_TYPE == IS_CONST) {
ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant),
Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC);
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ ZEND_VM_CONTINUE();
+ }
if (!ce) {
zend_error_noreturn(E_ERROR, "Undefined class
constant '%s'", Z_STRVAL(opline->op2.u.constant));
}
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 2889965..1481602 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -2688,6 +2688,9 @@ static int ZEND_FASTCALL
ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER(
if (IS_CONST == IS_CONST) {
/* no function found. try a static method in class */
ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant),
Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC);
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ ZEND_VM_CONTINUE();
+ }
if (!ce) {
zend_error_noreturn(E_ERROR, "Class '%s' not found",
Z_STRVAL(opline->op1.u.constant));
}
@@ -2836,6 +2839,9 @@ static int ZEND_FASTCALL
ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO
if (IS_CONST == IS_CONST) {
ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant),
Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC);
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ ZEND_VM_CONTINUE();
+ }
if (!ce) {
zend_error_noreturn(E_ERROR, "Undefined class
constant '%s'", Z_STRVAL(opline->op2.u.constant));
}
@@ -3259,6 +3265,9 @@ static int ZEND_FASTCALL
ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE
if (IS_CONST == IS_CONST) {
/* no function found. try a static method in class */
ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant),
Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC);
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ ZEND_VM_CONTINUE();
+ }
if (!ce) {
zend_error_noreturn(E_ERROR, "Class '%s' not found",
Z_STRVAL(opline->op1.u.constant));
}
@@ -3725,6 +3734,9 @@ static int ZEND_FASTCALL
ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE
if (IS_CONST == IS_CONST) {
/* no function found. try a static method in class */
ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant),
Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC);
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ ZEND_VM_CONTINUE();
+ }
if (!ce) {
zend_error_noreturn(E_ERROR, "Class '%s' not found",
Z_STRVAL(opline->op1.u.constant));
}
@@ -3947,6 +3959,9 @@ static int ZEND_FASTCALL
ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER
if (IS_CONST == IS_CONST) {
/* no function found. try a static method in class */
ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant),
Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC);
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ ZEND_VM_CONTINUE();
+ }
if (!ce) {
zend_error_noreturn(E_ERROR, "Class '%s' not found",
Z_STRVAL(opline->op1.u.constant));
}
@@ -4381,6 +4396,9 @@ static int ZEND_FASTCALL
ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN
if (IS_CONST == IS_CONST) {
/* no function found. try a static method in class */
ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant),
Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC);
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ ZEND_VM_CONTINUE();
+ }
if (!ce) {
zend_error_noreturn(E_ERROR, "Class '%s' not found",
Z_STRVAL(opline->op1.u.constant));
}
@@ -10498,6 +10516,9 @@ static int ZEND_FASTCALL
ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE
if (IS_VAR == IS_CONST) {
/* no function found. try a static method in class */
ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant),
Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC);
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ ZEND_VM_CONTINUE();
+ }
if (!ce) {
zend_error_noreturn(E_ERROR, "Class '%s' not found",
Z_STRVAL(opline->op1.u.constant));
}
@@ -10646,6 +10667,9 @@ static int ZEND_FASTCALL
ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE
if (IS_VAR == IS_CONST) {
ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant),
Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC);
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ ZEND_VM_CONTINUE();
+ }
if (!ce) {
zend_error_noreturn(E_ERROR, "Undefined class
constant '%s'", Z_STRVAL(opline->op2.u.constant));
}
@@ -12305,6 +12329,9 @@ static int ZEND_FASTCALL
ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND
if (IS_VAR == IS_CONST) {
/* no function found. try a static method in class */
ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant),
Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC);
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ ZEND_VM_CONTINUE();
+ }
if (!ce) {
zend_error_noreturn(E_ERROR, "Class '%s' not found",
Z_STRVAL(opline->op1.u.constant));
}
@@ -14107,6 +14134,9 @@ static int ZEND_FASTCALL
ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND
if (IS_VAR == IS_CONST) {
/* no function found. try a static method in class */
ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant),
Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC);
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ ZEND_VM_CONTINUE();
+ }
if (!ce) {
zend_error_noreturn(E_ERROR, "Class '%s' not found",
Z_STRVAL(opline->op1.u.constant));
}
@@ -15003,6 +15033,9 @@ static int ZEND_FASTCALL
ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z
if (IS_VAR == IS_CONST) {
/* no function found. try a static method in class */
ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant),
Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC);
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ ZEND_VM_CONTINUE();
+ }
if (!ce) {
zend_error_noreturn(E_ERROR, "Class '%s' not found",
Z_STRVAL(opline->op1.u.constant));
}
@@ -16496,6 +16529,9 @@ static int ZEND_FASTCALL
ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_
if (IS_VAR == IS_CONST) {
/* no function found. try a static method in class */
ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant),
Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC);
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ ZEND_VM_CONTINUE();
+ }
if (!ce) {
zend_error_noreturn(E_ERROR, "Class '%s' not found",
Z_STRVAL(opline->op1.u.constant));
}
@@ -17860,6 +17896,9 @@ static int ZEND_FASTCALL
ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC
if (IS_UNUSED == IS_CONST) {
ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant),
Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC);
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ ZEND_VM_CONTINUE();
+ }
if (!ce) {
zend_error_noreturn(E_ERROR, "Undefined class
constant '%s'", Z_STRVAL(opline->op2.u.constant));
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php