Bug #65708 [Opn->Csd]: dba functions cast $key param to string in-place, bypassing copy on write
| From: | aharvey@php.net | Date: | Sun, 22 Sep 2013 23:54:31 +0000 |
| Subject: | Bug #65708 [Opn->Csd]: dba functions cast $key param to string in-place, bypassing copy on write | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-181745@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=65708&edit=1
ID: 65708
Updated by: aharvey@php.net
Reported by: gary_whittles at hotmail dot com
Summary: dba functions cast $key param to string in-place,
bypassing copy on write
-Status: Open
+Status: Closed
Type: Bug
Package: DBM/DBA related
Operating System: Fedora 17
PHP Version: 5.5Git-2013-09-19 (Git)
-Assigned To:
+Assigned To: aharvey
Block user comment: N
Private report: N
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[2013-09-19 10:23:55] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65708&edit=1