Annotation of embedaddon/php/ext/standard/tests/array/extract_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test extract() function (error conditions)
3: --FILE--
4: <?php
5:
6: /* Testing Error Conditions */
7: echo "*** Testing Error Conditions ***\n";
8:
9: /* Zero Arguments */
10: var_dump( extract() );
11:
12: /* Invalid second argument ( only 0-6 is valid) */
13: $arr = array(1);
14: var_dump( extract($arr, -1 . "wddr") );
15: var_dump( extract($arr, 7 , "wddr") );
16:
17: /* scalar argument */
18: $val = 1;
19: var_dump( extract($val) );
20:
21: /* string argument */
22: $str = "test";
23: var_dump( extract($str) );
24:
25: /* More than valid number of arguments i.e. 3 args */
26: var_dump( extract($arr, EXTR_SKIP, "aa", "ee") );
27:
28: /* Two Arguments, second as prefix but without prefix string as third argument */
29: var_dump( extract($arr,EXTR_PREFIX_IF_EXISTS) );
30:
31: echo "Done\n";
32: ?>
33:
34: --EXPECTF--
35: *** Testing Error Conditions ***
36:
37: Warning: extract() expects at least 1 parameter, 0 given in %s on line %d
38: NULL
39:
40: Notice: A non well formed numeric value encountered in %s on line %d
41:
42: Warning: extract(): Invalid extract type in %s on line %d
43: NULL
44:
45: Warning: extract(): Invalid extract type in %s on line %d
46: NULL
47:
48: Warning: extract() expects parameter 1 to be array, integer given in %s on line %d
49: NULL
50:
51: Warning: extract() expects parameter 1 to be array, string given in %s on line %d
52: NULL
53:
54: Warning: extract() expects at most 3 parameters, 4 given in %s on line %d
55: NULL
56:
57: Warning: extract(): specified extract type requires the prefix parameter in %s on line %d
58: NULL
59: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>