-
Couldn't load subscription status.
- Fork 8k
Closed as not planned
Description
Description
The following code:
<?php
try {
assert(false);
} catch (\Throwable $e) {
var_dump($e->getCode());
}Resulted in this output:
int(1)
But I expected this output instead:
int(0)
If I can read the C code correctly, the code is set in https://github.com/php/php-src/blob/php-8.4.4/ext/standard/assert.c#L231 by E_ERROR.
I belive this is a leftover from the times when the assertion was not an exception, but an error instead.
I belive the code should be 0/default value as any other php-src exceptions. Also because of E_ERROR has no meaninful value nor other value is thrown.
online repro: https://3v4l.org/ODLg0
PHP Version
any
Operating System
any