Edit report at https://bugs.php.net/bug.php?id=70825&edit=1
ID: 70825
Updated by: cmb@php.net
Reported by: gmblar+php at gmail dot com
Summary: Cannot fetch multiple values with group in ini file
-Status: Open
+Status: Closed
Type: Bug
Package: DBM/DBA related
Operating System: MacOS X 10.11.1
PHP Version: 7.0.0RC6
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=84512a117789563a64172115c648944538006a69
Log: Fix #70825: Cannot fetch multiple values with group in ini file
Previous Comments:
------------------------------------------------------------------------
[2015-10-31 19:26:48] gmblar+php at gmail dot com
Description:
------------
When use compound keys (group, key) with engine inifile, you cannot read multiple values with skip
value -1.
Test script:
---------------
<?php
$handle = dba_open('/tmp/test1.ini', 'n', 'inifile');
dba_insert('foo', 23, $handle);
dba_insert('foo', 42, $handle);
dba_insert('foo', 1337, $handle);
var_dump(dba_fetch('foo', -1, $handle));
var_dump(dba_fetch('foo', -1, $handle));
var_dump(dba_fetch('foo', -1, $handle));
dba_close($handle);
$handle = dba_open('/tmp/test2.ini', 'n', 'inifile');
dba_insert(['foo', 'bar'], 23, $handle);
dba_insert(['foo', 'bar'], 42, $handle);
dba_insert(['foo', 'bar'], 1337, $handle);
var_dump(dba_fetch(['foo', 'bar'], -1, $handle));
var_dump(dba_fetch(['foo', 'bar'], -1, $handle));
var_dump(dba_fetch(['foo', 'bar'], -1, $handle));
dba_close($handle);
$handle = dba_open('/tmp/test3.ini', 'n', 'inifile');
dba_insert('[foo]bar', 23, $handle);
dba_insert('[foo]bar', 42, $handle);
dba_insert('[foo]bar', 1337, $handle);
var_dump(dba_fetch('[foo]bar', -1, $handle));
var_dump(dba_fetch('[foo]bar', -1, $handle));
var_dump(dba_fetch('[foo]bar', -1, $handle));
dba_close($handle);
$handle = dba_open('/tmp/test4.ini', 'n', 'inifile');
dba_insert('[foo]bar', 23, $handle);
dba_insert('[foo]bar', 42, $handle);
dba_insert('[foo]bar', 1337, $handle);
var_dump(dba_fetch('[foo]bar', 0, $handle));
var_dump(dba_fetch('[foo]bar', 1, $handle));
var_dump(dba_fetch('[foo]bar', 2, $handle));
dba_close($handle);
Expected result:
----------------
string(2) "23"
string(2) "42"
string(4) "1337"
string(2) "23"
string(2) "42"
string(4) "1337"
string(2) "23"
string(2) "42"
string(4) "1337"
string(2) "23"
string(2) "42"
string(4) "1337"
Actual result:
--------------
string(2) "23"
string(2) "42"
string(4) "1337"
string(2) "23"
bool(false)
bool(false)
string(2) "23"
bool(false)
bool(false)
string(2) "23"
string(2) "42"
string(4) "1337"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70825&edit=1