php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72885 flatfile: dba_fetch() fails to read replaced entry
Submitted: 2016-08-18 20:39 UTC Modified: -
From: cmb@php.net Assigned:
Status: Closed Package: DBM/DBA related
PHP Version: 7.1Git-2016-08-18 (Git) OS: Windows
Private report: No CVE-ID: None
 [2016-08-18 20:39 UTC] cmb@php.net
Description:
------------
When a flatfile database is opened in 'c' mode, fetching an entry
after having replaced it returns the old value. Note, that the
return value of dba_replace() is correct, i.e. the entry has
indeed been updated.

This issue occurs only on Windows, but not on Linux.



Test script:
---------------
<?php

$filename = __DIR__ . DIRECTORY_SEPARATOR . 'test.txt';

if (file_exists($filename)) unlink($filename);

$db = dba_open($filename, 'c', 'flatfile');
dba_insert('foo', 'bar', $db);
var_dump(dba_replace('foo', 'baz', $db));
var_dump(dba_fetch('foo', $db));
dba_close($db);


Expected result:
----------------
bool(true)
string(3) "baz"


Actual result:
--------------
bool(true)
string(3) "bar"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-05-27 20:54 UTC] ab@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=36b5ab15f4ee2b783dd67f72d6530c15337b6652
Log: Fixed bug #72885 flatfile: dba_fetch() fails to read replaced entry
 [2017-05-27 20:54 UTC] ab@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 08:01:29 2024 UTC