1--TEST-- 2Test get_browser() function : error functionality 3--INI-- 4browscap={PWD}/browscap.ini 5--FILE-- 6<?php 7/* Prototype : mixed get_browser([string browser_name [, bool return_array]]) 8 * Description: Get information about the capabilities of a browser. 9 * If browser_name is omitted or null, HTTP_USER_AGENT is used. 10 * Returns an object by default; if return_array is true, returns an array. 11 * 12 * Source code: ext/standard/browscap.c 13 * Alias to functions: 14 */ 15 16$browsers = include __DIR__ . DIRECTORY_SEPARATOR . 'browsernames.inc'; 17 18echo "*** Testing get_browser() : error functionality ***\n"; 19 20/* Unknown browser uses defaults. */ 21var_dump( get_browser( 'foobar', true ) ); 22 23/* More than expected arguments */ 24var_dump( get_browser( 'foobar', true, 15 ) ); 25 26/* Some wrong parameters, no HTTP_USER_AGENT set */ 27var_dump( get_browser( null, 'foobar' ) ); 28 29?> 30===DONE=== 31--EXPECTF-- 32*** Testing get_browser() : error functionality *** 33array(34) { 34 ["browser_name_regex"]=> 35 string(6) "~^.*$~" 36 ["browser_name_pattern"]=> 37 string(1) "*" 38 ["browser"]=> 39 string(15) "Default Browser" 40 ["version"]=> 41 string(1) "0" 42 ["majorver"]=> 43 string(1) "0" 44 ["minorver"]=> 45 string(1) "0" 46 ["platform"]=> 47 string(7) "unknown" 48 ["alpha"]=> 49 string(0) "" 50 ["beta"]=> 51 string(0) "" 52 ["win16"]=> 53 string(0) "" 54 ["win32"]=> 55 string(0) "" 56 ["win64"]=> 57 string(0) "" 58 ["frames"]=> 59 string(1) "1" 60 ["iframes"]=> 61 string(0) "" 62 ["tables"]=> 63 string(1) "1" 64 ["cookies"]=> 65 string(0) "" 66 ["backgroundsounds"]=> 67 string(0) "" 68 ["authenticodeupdate"]=> 69 string(1) "0" 70 ["cdf"]=> 71 string(0) "" 72 ["vbscript"]=> 73 string(0) "" 74 ["javaapplets"]=> 75 string(0) "" 76 ["javascript"]=> 77 string(0) "" 78 ["activexcontrols"]=> 79 string(0) "" 80 ["stripper"]=> 81 string(0) "" 82 ["isbanned"]=> 83 string(0) "" 84 ["wap"]=> 85 string(0) "" 86 ["ismobiledevice"]=> 87 string(0) "" 88 ["issyndicationreader"]=> 89 string(0) "" 90 ["crawler"]=> 91 string(0) "" 92 ["css"]=> 93 string(1) "0" 94 ["cssversion"]=> 95 string(1) "0" 96 ["supportscss"]=> 97 string(0) "" 98 ["aol"]=> 99 string(0) "" 100 ["aolversion"]=> 101 string(1) "0" 102} 103 104Warning: get_browser() expects at most 2 parameters, 3 given in %s on line %d 105NULL 106 107Warning: get_browser(): HTTP_USER_AGENT variable is not set, cannot determine user agent name in %s on line %d 108bool(false) 109===DONE=== 110