1--TEST--
2Test compact() function: ensure compact() doesn't pick up variables declared outside of current scope.
3--FILE--
4<?php
5echo "*** Testing compact() : usage variations  - variables outside of current scope ***\n";
6
7$a = 'main.a';
8$b = 'main.b';
9
10function f() {
11    $b = 'f.b';
12    $c = 'f.c';
13    var_dump(compact('a','b','c'));
14    var_dump(compact(array('a','b','c')));
15}
16
17f();
18
19?>
20--EXPECTF--
21*** Testing compact() : usage variations  - variables outside of current scope ***
22
23Warning: compact(): Undefined variable $a in %s on line %d
24array(2) {
25  ["b"]=>
26  string(3) "f.b"
27  ["c"]=>
28  string(3) "f.c"
29}
30
31Warning: compact(): Undefined variable $a in %s on line %d
32array(2) {
33  ["b"]=>
34  string(3) "f.b"
35  ["c"]=>
36  string(3) "f.c"
37}
38