php-src/Zend/tests/exception_020.phpt
Máté Kocsis fbe30592d6
Improve type error messages when an object is given
From now on, we always display the given object's type instead of just reporting "object".
Additionally, make the format of return type errors match the format of argument errors.

Closes GH-5625
2020-05-26 19:06:19 +02:00

16 lines
498 B
PHP

--TEST--
Test that the original class name is present in the error out when extending ErrorException
--FILE--
<?php
class MyErrorException extends ErrorException{}
throw new MyErrorException(new stdClass);
?>
--EXPECTF--
Fatal error: Uncaught TypeError: ErrorException::__construct(): Argument #1 ($message) must be of type string, stdClass given in %s:%d
Stack trace:
#0 %sexception_020.php(%d): ErrorException->__construct(Object(stdClass))
#1 {main}
thrown in %sexception_020.php on line %d