dba functions cast $key param to string in-place, bypassing copy on write

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

 [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