php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70825 Cannot fetch multiple values with group in ini file
Submitted: 2015-10-31 19:26 UTC Modified: 2016-08-25 16:51 UTC
From: gmblar+php at gmail dot com Assigned: cmb (profile)
Status: Closed Package: DBM/DBA related
PHP Version: 7.0.0RC6 OS: MacOS X 10.11.1
Private report: No CVE-ID: None
 [2015-10-31 19:26 UTC] 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"



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-08-25 16:50 UTC] cmb@php.net
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
 [2016-08-25 16:50 UTC] cmb@php.net
-Status: Open +Status: Closed
 [2016-08-25 16:51 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2016-08-25 16:51 UTC] cmb@php.net
The fix for this bug has been committed.

Thank you for the report, and for helping us make PHP better.
 [2016-10-17 10:09 UTC] bwoebi@php.net
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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 10:01:26 2024 UTC