xref: /PHP-8.1/Zend/tests/bug33996.phpt (revision f8d79582)
1--TEST--
2Bug #33996 (No information given for fatal error on passing invalid value to typed argument)
3--INI--
4error_reporting=8191
5--FILE--
6<?php
7class Foo
8{
9    // nothing
10}
11
12function FooTest(Foo $foo)
13{
14    echo "Hello!";
15}
16
17function NormalTest($a)
18{
19    echo "Hi!";
20}
21
22try {
23    NormalTest();
24} catch (Throwable $e) {
25    echo "Exception: " . $e->getMessage() . "\n";
26}
27try {
28    FooTest();
29} catch (Throwable $e) {
30    echo "Exception: " . $e->getMessage() . "\n";
31}
32FooTest(new Foo());
33?>
34--EXPECTF--
35Exception: Too few arguments to function NormalTest(), 0 passed in %sbug33996.php on line 18 and exactly 1 expected
36Exception: Too few arguments to function FooTest(), 0 passed in %sbug33996.php on line 23 and exactly 1 expected
37Hello!
38