1--TEST-- 2DBA argument tests 3--EXTENSIONS-- 4dba 5--CONFLICTS-- 6dba 7--SKIPIF-- 8<?php 9require_once(__DIR__ .'/skipif.inc'); 10die("info $HND handler used"); 11?> 12--FILE-- 13<?php 14require_once(__DIR__ .'/test.inc'); 15echo "database handler: $handler\n"; 16var_dump(dba_open($db_file, 'n')); 17 18echo '=== Invalid arguments dba_open() ===', \PHP_EOL; 19var_dump(dba_open($db_file, 'n', 'bogus')); 20 21try { 22 var_dump(dba_open('', 'nq')); 23} catch (\ValueError $e) { 24 echo $e->getMessage(), \PHP_EOL; 25} 26try { 27 var_dump(dba_open($db_file, '')); 28} catch (\ValueError $e) { 29 echo $e->getMessage(), \PHP_EOL; 30} 31try { 32 var_dump(dba_open($db_file, 'nq', '')); 33} catch (\ValueError $e) { 34 echo $e->getMessage(), \PHP_EOL; 35} 36 37 38try { 39 var_dump(dba_open($db_file, 'q')); 40} catch (\ValueError $e) { 41 echo $e->getMessage(), \PHP_EOL; 42} 43try { 44 var_dump(dba_open($db_file, 'nq')); 45} catch (\ValueError $e) { 46 echo $e->getMessage(), \PHP_EOL; 47} 48try { 49 var_dump(dba_open($db_file, 'rdq')); 50} catch (\ValueError $e) { 51 echo $e->getMessage(), \PHP_EOL; 52} 53try { 54 var_dump(dba_open($db_file, 'n-t')); 55} catch (\ValueError $e) { 56 echo $e->getMessage(), \PHP_EOL; 57} 58 59try { 60 var_dump(dba_open($db_file, 'r', $handler, 0o644, -10)); 61} catch (\ValueError $e) { 62 echo $e->getMessage(), \PHP_EOL; 63} 64 65echo '=== Invalid arguments dba_popen() ===', \PHP_EOL; 66var_dump(dba_popen($db_file, 'n', 'bogus')); 67 68try { 69 var_dump(dba_popen('', 'nq')); 70} catch (\ValueError $e) { 71 echo $e->getMessage(), \PHP_EOL; 72} 73try { 74 var_dump(dba_popen($db_file, '')); 75} catch (\ValueError $e) { 76 echo $e->getMessage(), \PHP_EOL; 77} 78try { 79 var_dump(dba_popen($db_file, 'nq', '')); 80} catch (\ValueError $e) { 81 echo $e->getMessage(), \PHP_EOL; 82} 83 84 85try { 86 var_dump(dba_popen($db_file, 'q')); 87} catch (\ValueError $e) { 88 echo $e->getMessage(), \PHP_EOL; 89} 90try { 91 var_dump(dba_popen($db_file, 'nq')); 92} catch (\ValueError $e) { 93 echo $e->getMessage(), \PHP_EOL; 94} 95try { 96 var_dump(dba_popen($db_file, 'rdq')); 97} catch (\ValueError $e) { 98 echo $e->getMessage(), \PHP_EOL; 99} 100try { 101 var_dump(dba_popen($db_file, 'n-t')); 102} catch (\ValueError $e) { 103 echo $e->getMessage(), \PHP_EOL; 104} 105 106try { 107 var_dump(dba_popen($db_file, 'r', $handler, 0o644, -10)); 108} catch (\ValueError $e) { 109 echo $e->getMessage(), \PHP_EOL; 110} 111?> 112--CLEAN-- 113<?php 114require(__DIR__ .'/clean.inc'); 115?> 116--EXPECTF-- 117database handler: flatfile 118object(Dba\Connection)#%d (%d) { 119} 120=== Invalid arguments dba_open() === 121 122Warning: dba_open(): Handler "bogus" is not available in %s on line %d 123bool(false) 124dba_open(): Argument #1 ($path) must not be empty 125dba_open(): Argument #2 ($mode) must not be empty 126dba_open(): Argument #3 ($handler) must not be empty 127dba_open(): Argument #2 ($mode) first character must be one of "r", "w", "c", or "n" 128dba_open(): Argument #2 ($mode) second character must be one of "d", "l", "-", or "t" 129dba_open(): Argument #2 ($mode) third character must be "t" 130dba_open(): Argument #2 ($mode) cannot combine mode "-" (no lock) and "t" (test lock) 131dba_open(): Argument #5 ($map_size) must be greater than or equal to 0 132=== Invalid arguments dba_popen() === 133 134Warning: dba_popen(): Handler "bogus" is not available in %s on line %d 135bool(false) 136dba_popen(): Argument #1 ($path) must not be empty 137dba_popen(): Argument #2 ($mode) must not be empty 138dba_popen(): Argument #3 ($handler) must not be empty 139dba_popen(): Argument #2 ($mode) first character must be one of "r", "w", "c", or "n" 140dba_popen(): Argument #2 ($mode) second character must be one of "d", "l", "-", or "t" 141dba_popen(): Argument #2 ($mode) third character must be "t" 142dba_popen(): Argument #2 ($mode) cannot combine mode "-" (no lock) and "t" (test lock) 143dba_popen(): Argument #5 ($map_size) must be greater than or equal to 0 144