1--TEST-- 2Test glob() function: error conditions 3--FILE-- 4<?php 5/* Prototype: array glob ( string $pattern [, int $flags] ); 6 Description: Find pathnames matching a pattern 7*/ 8 9$file_path = dirname(__FILE__); 10 11// temp dir created 12mkdir("$file_path/glob_error"); 13// temp file created 14$fp = fopen("$file_path/glob_error/wonder12345", "w"); 15fclose($fp); 16 17echo "*** Testing glob() : error conditions ***\n"; 18 19echo "-- Testing glob() with unexpected no. of arguments --\n"; 20var_dump( glob() ); // args < expected 21var_dump( glob(dirname(__FILE__)."/glob_error/wonder12345", GLOB_ERR, 3) ); // args > expected 22 23echo "\n-- Testing glob() with invalid arguments --\n"; 24var_dump( glob(dirname(__FILE__)."/glob_error/wonder12345", '') ); 25var_dump( glob(dirname(__FILE__)."/glob_error/wonder12345", "string") ); 26 27echo "Done\n"; 28?> 29--CLEAN-- 30<?php 31// temp file deleted 32unlink(dirname(__FILE__)."/glob_error/wonder12345"); 33// temp dir deleted 34rmdir(dirname(__FILE__)."/glob_error"); 35?> 36--EXPECTF-- 37*** Testing glob() : error conditions *** 38-- Testing glob() with unexpected no. of arguments -- 39 40Warning: glob() expects at least 1 parameter, 0 given in %s on line %d 41NULL 42 43Warning: glob() expects at most 2 parameters, 3 given in %s on line %d 44NULL 45 46-- Testing glob() with invalid arguments -- 47 48Warning: glob() expects parameter 2 to be int, string given in %s on line %d 49NULL 50 51Warning: glob() expects parameter 2 to be int, string given in %s on line %d 52NULL 53Done 54