php-src/Zend/tests/exception_018.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
437 B
PHP

--TEST--
Testing throw exception doesn't crash with wrong params, variant 1
--FILE--
<?php
class Hello extends Exception {}
throw new Hello(new stdClass);
?>
--EXPECTF--
Fatal error: Uncaught TypeError: Exception::__construct(): Argument #1 ($message) must be of type string, stdClass given in %s:%d
Stack trace:
#0 %sexception_018.php(%d): Exception->__construct(Object(stdClass))
#1 {main}
thrown in %sexception_018.php on line %d