xref: /PHP-8.1/Zend/tests/bug33771.phpt (revision f8d79582)
1--TEST--
2Bug #33771 (error_reporting falls to 0 when @ was used inside try/catch block)
3--FILE--
4<?php
5
6error_reporting(E_ALL);
7
8var_dump(error_reporting());
9
10function make_exception()
11{
12    throw new Exception();
13}
14
15function make_exception_and_change_err_reporting()
16{
17    error_reporting(E_ALL & ~E_NOTICE);
18    throw new Exception();
19}
20
21
22try {
23    @make_exception();
24} catch (Exception $e) {}
25
26var_dump(error_reporting());
27
28try {
29    @make_exception_and_change_err_reporting();
30} catch (Exception $e) {}
31
32var_dump(error_reporting());
33
34echo "Done\n";
35?>
36--EXPECT--
37int(32767)
38int(32767)
39int(32759)
40Done
41