com php-src: fix crash when invalid exception arguments passed: Zend/zend_exceptions.c
| From: | Anatol Belski | Date: | Wed, 17 Jun 2015 22:14:57 +0000 |
| Subject: | com php-src: fix crash when invalid exception arguments passed: Zend/zend_exceptions.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-87352@lists.php.net to get a copy of this message | ||
Commit: 57940664a82ae6bf0e0d476e3a39059c5b7576a0
Author: Anatol Belski <ab@php.net> Thu, 18 Jun 2015 00:14:57 +0200
Parents: bfdc9e280515c1639dfe1d81ce6fc225d2cf1bc9
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=57940664a82ae6bf0e0d476e3a39059c5b7576a0
Log:
fix crash when invalid exception arguments passed
Changed paths:
M Zend/zend_exceptions.c
Diff:
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
index cf18084..75259c3 100644
--- a/Zend/zend_exceptions.c
+++ b/Zend/zend_exceptions.c
@@ -243,7 +243,14 @@ ZEND_METHOD(exception, __construct)
int argc = ZEND_NUM_ARGS();
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc, "|SlO!", &message,
&code, &previous, zend_ce_throwable) == FAILURE) {
- zend_error(E_EXCEPTION | E_ERROR, "Wrong parameters for %s([string $message [, long $code [,
Throwable $previous = NULL]]])", base_ce->name->val);
+ zend_class_entry *ce;
+
+ if (execute_data->called_scope) {
+ ce = execute_data->called_scope;
+ } else {
+ ce = zend_get_exception_base(getThis());
+ }
+ zend_error(E_EXCEPTION | E_ERROR, "Wrong parameters for %s([string $message [, long $code [,
Throwable $previous = NULL]]])", ce->name->val);
return;
}