xref: /PHP-7.3/Zend/tests/bug47320.phpt (revision c277ebc6)
1--TEST--
2Bug #47320 ($php_errormsg out of scope in functions)
3--INI--
4display_errors=0
5track_errors=1
6--FILE--
7<?php
8if (!@substr('no 2nd parameter')) {
9    echo '$php_errormsg in global: ' . $php_errormsg . "\n";
10}
11
12function foo() {
13    if (!@strpos('no 2nd parameter')) {
14        echo '$php_errormsg in function: ' . $php_errormsg . "\n";
15
16        echo '$GLOBALS[php_errormsg] in function: ' .
17                $GLOBALS['php_errormsg'] . "\n";
18    }
19}
20
21foo();
22?>
23--EXPECT--
24$php_errormsg in global: substr() expects at least 2 parameters, 1 given
25$php_errormsg in function: strpos() expects at least 2 parameters, 1 given
26$GLOBALS[php_errormsg] in function: substr() expects at least 2 parameters, 1 given
27