xref: /PHP-7.3/ext/standard/tests/array/bug77669.phpt (revision 9ad9cc71)
1--TEST--
2Bug #77669: Crash in extract() when overwriting extracted array
3--FILE--
4<?php
5
6function test($mode) {
7    $foo = [];
8    $foo["foo"] = 42;
9    $foo["bar"] = 24;
10    extract($foo, $mode, "");
11    $prefix_foo = [];
12    $prefix_foo["foo"] = 42;
13    $prefix_foo["bar"] = 24;
14    extract($prefix_foo, $mode, "prefix");
15}
16
17test(EXTR_OVERWRITE);
18test(EXTR_SKIP);
19test(EXTR_IF_EXISTS);
20test(EXTR_PREFIX_SAME);
21test(EXTR_PREFIX_ALL);
22test(EXTR_PREFIX_INVALID);
23test(EXTR_PREFIX_IF_EXISTS);
24test(EXTR_REFS | EXTR_OVERWRITE);
25test(EXTR_REFS | EXTR_SKIP);
26test(EXTR_REFS | EXTR_IF_EXISTS);
27test(EXTR_REFS | EXTR_PREFIX_SAME);
28test(EXTR_REFS | EXTR_PREFIX_ALL);
29test(EXTR_REFS | EXTR_PREFIX_INVALID);
30test(EXTR_REFS | EXTR_PREFIX_IF_EXISTS);
31
32?>
33===DONE===
34--EXPECT--
35===DONE===
36