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