--- /dev/null
+--TEST--
+Testing throw exception doesn't crash with wrong params, variant 2
+--FILE--
+<?php
+
+class MyErrorException extends ErrorException{}
+throw new MyErrorException(new stdClass);
+
+?>
+--EXPECTF--
+Fatal error: Uncaught Error: Wrong parameters for MyErrorException([string $message [, long $code, [ long $severity, [ string $filename, [ long $lineno [, Throwable $previous = NULL]]]]]]) in %sexception_020.php:%d
+Stack trace:
+#0 %sexception_020.php(%d): ErrorException->__construct(Object(stdClass))
+#1 {main}
+ thrown in %sexception_020.php on line %d
size_t message_len, filename_len;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc, "|sllslO!", &message, &message_len, &code, &severity, &filename, &filename_len, &lineno, &previous, zend_ce_throwable) == FAILURE) {
- zend_error(E_EXCEPTION | E_ERROR, "Wrong parameters for ErrorException([string $message [, long $code, [ long $severity, [ string $filename, [ long $lineno [, Throwable $previous = NULL]]]]]])");
+ zend_class_entry *ce;
+
+ if (execute_data->called_scope) {
+ ce = execute_data->called_scope;
+ } else {
+ ce = error_exception_ce;
+ }
+ zend_error(E_EXCEPTION | E_ERROR, "Wrong parameters for %s([string $message [, long $code, [ long $severity, [ string $filename, [ long $lineno [, Throwable $previous = NULL]]]]]])", ce->name->val);
return;
}