[php-src] Issue #9929: assert() AssertionError message is not helpful
| From: | oojacoboo | Date: | Fri, 11 Nov 2022 06:37:38 +0000 |
| Subject: | [php-src] Issue #9929: assert() AssertionError message is not helpful | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242791@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9929
Author: oojacoboo
### Description
Currently, the following code:
```php
$foo = new Bar;
assert($foo instanceof Foo);
```
Results in a message from
AssertionError...
> assert($foo instanceof Foo)
This error message really isn't helpful. It doesn't provide you any context into the
variable values or types such that the error can be resolved. It requires manually debugging the
error.
At the very least, I'd suggest that, if an assertion fails, all variables used in the
assertion, at least have their type output in the error message somehow.