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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: gmblar+php at gmail dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Thu Jan 30 19:01:29 2025 UTC