Skip to content

Commit d8703cc

Browse files
committed
Add workaround for PHP 8.3 displaying true instead of bool
1 parent 0a9769d commit d8703cc

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

tests/func_015.phpt

+5
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ foreach (['', (object) [], '1234', 4.5, true, new \DateTimeImmutable(), new \Dat
3535
} catch (TypeError $e) {
3636
$message = $e->getMessage();
3737

38+
if (PHP_VERSION_ID >= 80300) {
39+
// PHP 8.3+ outputs "true given" instead of "bool given".
40+
$message = str_replace('true given', 'bool given', $message);
41+
}
42+
3843
// Workaround exception message not including type in PHP 7 so the same test can be used for both.
3944
if (PHP_MAJOR_VERSION === 7) {
4045
$message = str_replace('N/A given', var_type($input).' given', $message);

tests/func_016.phpt

+5
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ foreach (['', (object) [], '1234', 4.5, true, new \DateTimeImmutable(), new \Dat
3535
} catch (TypeError $e) {
3636
$message = $e->getMessage();
3737

38+
if (PHP_VERSION_ID >= 80300) {
39+
// PHP 8.3+ outputs "true given" instead of "bool given".
40+
$message = str_replace('true given', 'bool given', $message);
41+
}
42+
3843
// Workaround exception message not including type in PHP 7 so the same test can be used for both.
3944
if (PHP_MAJOR_VERSION === 7) {
4045
$message = str_replace('N/A given', var_type($input).' given', $message);

tests/func_017.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ timecop_scale\(\)( expects parameter 1 to be|: Argument #1 \(\$scale\) must be o
2424
timecop_scale\(\)( expects parameter 1 to be|: Argument #1 \(\$scale\) must be of type) (integer|int), (object|stdClass) given
2525
timecop_scale\(\)( expects parameter 1 to be|: Argument #1 \(\$scale\) must be of type) (integer|int), string given
2626
timecop_scale\(\)( expects parameter 1 to be|: Argument #1 \(\$scale\) must be of type) (integer|int), float given
27-
timecop_scale\(\)( expects parameter 1 to be|: Argument #1 \(\$scale\) must be of type) (integer|int), (bool|boolean) given
27+
timecop_scale\(\)( expects parameter 1 to be|: Argument #1 \(\$scale\) must be of type) (integer|int), (bool|boolean|true) given
2828
bool\(false\)

0 commit comments

Comments
 (0)