1--TEST--
2Test extract() function (error conditions)
3--FILE--
4<?php
5
6/* Testing Error Conditions */
7echo "*** Testing Error Conditions ***\n";
8
9/* Invalid second argument ( only 0-6 is valid) */
10$arr = array(1);
11
12try {
13    var_dump( extract($arr, -1) );
14} catch (\ValueError $e) {
15    echo $e->getMessage() . "\n";
16}
17
18try {
19    var_dump( extract($arr, 7 , "wddr") );
20} catch (\ValueError $e) {
21    echo $e->getMessage() . "\n";
22}
23
24/* Two Arguments, second as prefix but without prefix string as third argument */
25try {
26    var_dump( extract($arr,EXTR_PREFIX_IF_EXISTS) );
27} catch (\ValueError $e) {
28    echo $e->getMessage() . "\n";
29}
30
31?>
32--EXPECT--
33*** Testing Error Conditions ***
34extract(): Argument #2 ($flags) must be a valid extract type
35extract(): Argument #2 ($flags) must be a valid extract type
36extract(): Argument #3 ($prefix) is required when using this extract type
37