File tree Expand file tree Collapse file tree 2 files changed +49
-3
lines changed Expand file tree Collapse file tree 2 files changed +49
-3
lines changed Original file line number Diff line number Diff line change @@ -1284,9 +1284,9 @@ PHP_FUNCTION(dba_list)
12841284
12851285 zval * zv ;
12861286 ZEND_HASH_MAP_FOREACH_VAL (& DBA_G (connections ), zv ) {
1287- dba_info * info = Z_DBA_INFO_P (zv );
1288- if (info ) {
1289- add_next_index_str (return_value , zend_string_copy (info -> path ));
1287+ dba_connection * connection = Z_DBA_CONNECTION_P (zv );
1288+ if (connection -> info ) {
1289+ add_index_str (return_value , connection -> std . handle , zend_string_copy (connection -> info -> path ));
12901290 }
12911291 } ZEND_HASH_FOREACH_END ();
12921292}
Original file line number Diff line number Diff line change 1+ --TEST--
2+ GH-16990 (dba_list() is now zero-indexed instead of using resource ids)
3+ --EXTENSIONS--
4+ dba
5+ --CONFLICTS--
6+ dba
7+ --SKIPIF--
8+ <?php
9+ require_once __DIR__ . '/setup/setup_dba_tests.inc ' ;
10+ check_skip ('flatfile ' );
11+ ?>
12+ --FILE--
13+ <?php
14+
15+ require_once (__DIR__ .'/test.inc ' );
16+
17+ $ foo1 = new stdClass ();
18+
19+ $ db_filename1 = __DIR__ .'/test1.dbm ' ;
20+ $ db1 = dba_open ($ db_filename1 , 'c ' , 'flatfile ' );
21+ if (!$ db1 ) {
22+ var_dump ("Database file creation failed " );
23+ }
24+
25+ $ foo2 = new stdClass ();
26+
27+ $ db_filename2 = __DIR__ .'/test2.dbm ' ;
28+ $ db2 = dba_open ($ db_filename2 , 'c ' , 'flatfile ' );
29+ if (!$ db2 ) {
30+ var_dump ("Database file creation failed " );
31+ }
32+
33+ var_dump (dba_list ());
34+ ?>
35+ --CLEAN--
36+ <?php
37+ @unlink (__DIR__ .'/test1.dbm ' );
38+ @unlink (__DIR__ .'/test2.dbm ' );
39+ ?>
40+ --EXPECTF--
41+ array(2) {
42+ [2]=>
43+ string(%d) "%s%etest1.dbm"
44+ [4]=>
45+ string(%d) "%s%etest2.dbm"
46+ }
You can’t perform that action at this time.
0 commit comments