xref: /PHP-8.1/Zend/tests/bug70689.phpt (revision f8d79582)
1--TEST--
2Bug #70689 (Exception handler does not work as expected)
3--FILE--
4<?php
5
6function foo($foo) {
7    echo "Executing foo\n";
8}
9
10set_error_handler(function($errno, $errstr) {
11    throw new Exception($errstr);
12});
13
14try {
15    foo();
16} catch (Exception $e) {
17    echo $e->getMessage(), "\n";
18}
19
20?>
21--EXPECTF--
22Fatal error: Uncaught ArgumentCountError: Too few arguments to function foo(), 0 passed in %sbug70689.php on line 12 and exactly 1 expected in %sbug70689.php:3
23Stack trace:
24#0 %sbug70689.php(12): foo()
25#1 {main}
26  thrown in %sbug70689.php on line 3
27