php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65708 dba functions cast $key param to string in-place, bypassing copy on write
Submitted: 2013-09-19 10:23 UTC Modified: 2013-09-22 23:54 UTC
From: gary_whittles at hotmail dot com Assigned: aharvey (profile)
Status: Closed Package: DBM/DBA related
PHP Version: 5.5Git-2013-09-19 (Git) OS: Fedora 17
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: gary_whittles at hotmail dot com
New email:
PHP Version: OS:

 

 [2013-09-19 10:23 UTC] gary_whittles at hotmail dot com
Description:
------------
Calling dba functions (e.g. dba_exists/dba_insert) with a non-string key causes 
the key to be cast to a string.  This also affects any variables that are copies 
of the key variable.

This seems to be independent of database type - tested with db4 and flatfile 
databases.

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

$db = dba_open('/tmp/testdb', 'c', 'flatfile');

$i = 1; //use integer key
$j = $i; //copy by value

echo gettype($i)."\n";
echo gettype($j)."\n";

dba_exists($i, $db);

echo gettype($i)."\n";
echo gettype($j)."\n";


Expected result:
----------------
integer
integer
integer
integer


Actual result:
--------------
integer
integer
string
string


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-09-22 23:54 UTC] aharvey@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: aharvey
 [2013-09-22 23:54 UTC] aharvey@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

Commit:
https://github.com/php/php-src/commit/30e0442c549bd20288ca8754daa0cdf24d98f055
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 16:01:33 2024 UTC