Skip to content

Commit

Permalink
Add workaround for PHP 8.3 adding true type
Browse files Browse the repository at this point in the history
  • Loading branch information
cs278 committed Nov 6, 2023
1 parent 0a9769d commit 08fe3cf
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/func_015.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ foreach (['', (object) [], '1234', 4.5, true, new \DateTimeImmutable(), new \Dat
} catch (TypeError $e) {
$message = $e->getMessage();

if (PHP_VERSION_ID >= 80300) {
// PHP 8.3+ outputs "true given" instead of "bool given".
$message = str_replace('true given', 'bool given', $message);
}

// Workaround exception message not including type in PHP 7 so the same test can be used for both.
if (PHP_MAJOR_VERSION === 7) {
$message = str_replace('N/A given', var_type($input).' given', $message);
Expand Down

0 comments on commit 08fe3cf

Please sign in to comment.