File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ --TEST--
2+ dba_insert should correctly handle numeric array-like keys (php_dba_make_key)
3+ --EXTENSIONS--
4+ dba
5+ --SKIPIF--
6+ <?php
7+ require_once __DIR__ . '/setup/setup_dba_tests.inc ' ;
8+ check_skip_any ();
9+ ?>
10+ --FILE--
11+ <?php
12+ require_once __DIR__ . '/setup/setup_dba_tests.inc ' ;
13+ $ name = 'array_keys_db.db ' ;
14+
15+ $ db = get_any_db ($ name );
16+
17+ /* insert using numeric keys */
18+ $ a = [];
19+ $ a [1 ] = 'blah ' ;
20+ $ a [0 ] = 'foo ' ;
21+ dba_insert ($ a , "abc " , $ db );
22+
23+ echo dba_fetch ($ a , $ db ) . PHP_EOL ;
24+
25+ $ a = [];
26+ $ a [0 ] = 'foo ' ;
27+ $ a ['bar ' ] = 'baz ' ;
28+
29+ dba_insert ($ a , "mixed " , $ db );
30+ echo dba_fetch ($ a , $ db ) . PHP_EOL ;
31+
32+ $ a = [];
33+ $ a [2 ] = 'abc ' ;
34+ $ a [0 ] = 'foo ' ;
35+ dba_insert ($ a , "value " , $ db );
36+ echo dba_fetch ($ a , $ db ) . PHP_EOL ;
37+
38+ dba_close ($ db );
39+ echo "OK \n" ;
40+ ?>
41+ --CLEAN--
42+ <?php
43+ require_once __DIR__ . '/setup/setup_dba_tests.inc ' ;
44+ $ db_name = 'array_keys_db.db ' ;
45+ cleanup_standard_db ($ db_name );
46+ ?>
47+ --EXPECTF--
48+ Using handler: "%s"
49+ abc
50+ mixed
51+ value
52+ OK
You can’t perform that action at this time.
0 commit comments