]> granicus.if.org Git - php/commitdiff
fix crash when invalid exception arguments passed
authorAnatol Belski <ab@php.net>
Wed, 17 Jun 2015 22:14:57 +0000 (00:14 +0200)
committerAnatol Belski <ab@php.net>
Wed, 17 Jun 2015 22:14:57 +0000 (00:14 +0200)
Zend/zend_exceptions.c

index cf18084ff5be2685555d5b2da4b54ff37e58af13..75259c397eb92b17c01625295f378193bdba4699 100644 (file)
@@ -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;
        }