mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.4'
* PHP-8.4: Fix GH-16990 "dba_list() is now zero-indexed instead of using resource ids"
This commit is contained in:
@@ -1284,9 +1284,9 @@ PHP_FUNCTION(dba_list)
|
||||
|
||||
zval *zv;
|
||||
ZEND_HASH_MAP_FOREACH_VAL(&DBA_G(connections), zv) {
|
||||
dba_info *info = Z_DBA_INFO_P(zv);
|
||||
if (info) {
|
||||
add_next_index_str(return_value, zend_string_copy(info->path));
|
||||
dba_connection *connection = Z_DBA_CONNECTION_P(zv);
|
||||
if (connection->info) {
|
||||
add_index_str(return_value, connection->std.handle, zend_string_copy(connection->info->path));
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
}
|
||||
|
||||
46
ext/dba/tests/gh16990.phpt
Normal file
46
ext/dba/tests/gh16990.phpt
Normal file
@@ -0,0 +1,46 @@
|
||||
--TEST--
|
||||
GH-16990 (dba_list() is now zero-indexed instead of using resource ids)
|
||||
--EXTENSIONS--
|
||||
dba
|
||||
--CONFLICTS--
|
||||
dba
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once __DIR__ . '/setup/setup_dba_tests.inc';
|
||||
check_skip('flatfile');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once(__DIR__ .'/test.inc');
|
||||
|
||||
$foo1 = new stdClass();
|
||||
|
||||
$db_filename1 = __DIR__.'/test1.dbm';
|
||||
$db1 = dba_open($db_filename1, 'c', 'flatfile');
|
||||
if (!$db1) {
|
||||
var_dump("Database file creation failed");
|
||||
}
|
||||
|
||||
$foo2 = new stdClass();
|
||||
|
||||
$db_filename2 = __DIR__.'/test2.dbm';
|
||||
$db2 = dba_open($db_filename2, 'c', 'flatfile');
|
||||
if (!$db2) {
|
||||
var_dump("Database file creation failed");
|
||||
}
|
||||
|
||||
var_dump(dba_list());
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(__DIR__.'/test1.dbm');
|
||||
@unlink(__DIR__.'/test2.dbm');
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(2) {
|
||||
[2]=>
|
||||
string(%d) "%s%etest1.dbm"
|
||||
[4]=>
|
||||
string(%d) "%s%etest2.dbm"
|
||||
}
|
||||
Reference in New Issue
Block a user