Bug #71514 [Ver->Csd]: Bad dba_replace condition because of wrong API usage
| From: | cmb@php.net | Date: | Thu, 25 Aug 2016 15:00:59 +0000 |
| Subject: | Bug #71514 [Ver->Csd]: Bad dba_replace condition because of wrong API usage | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-203546@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71514&edit=1
ID: 71514
Updated by: cmb@php.net
Reported by: aurelien dot dudouit at corp dot ovh dot com
Summary: Bad dba_replace condition because of wrong API usage
-Status: Verified
+Status: Closed
Type: Bug
Package: DBM/DBA related
PHP Version: 5.6.18
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=bd8112afe076cd975fbfcf82b659f6420317de70
Log: Fix #71514: Bad dba_replace condition because of wrong API usage
Previous Comments:
------------------------------------------------------------------------
[2016-02-11 10:05:24] aurelien dot dudouit at corp dot ovh dot com
Reflected onto latest 5.6 release (5.6.18).
------------------------------------------------------------------------
[2016-02-03 15:46:09] aurelien dot dudouit at corp dot ovh dot com
Description:
------------
dba_replace fails, ending in 'Could not copy group [x - x] to temporary stream' because of
a bad condition.
php_stream_copy_to_stream() has been replaced since 5.5 with php_stream_copy_to_stream_ex() without
updating the conditions into which it's been enclosed; the newer function returns SUCCESS which
is set to 0, hence the following check isn't valid anymore because it's expecting non-zero
value (size_t):
if (!php_stream_copy_to_stream_ex(...)) {
It's been fixed in PHP7.0:
if (SUCCESS != php_stream_copy_to_stream_ex(...)) {
A patch has already been proposed two years ago, see: http://git.php.net/?p=php-src.git;a=commit;h=9e309a2d10d9696d047ecb442
Test script:
---------------
<?php
$db = dba_open("foo.inifile", 'c', 'inifile');
dba_insert('foo', 'value1', $db);
dba_replace('foo', 'value2', $db);
echo dba_fetch('foo', $db);
dba_close($db);
?>
Expected result:
----------------
All PHP versions >=5.3:
value2
Actual result:
--------------
PHP5.6 and PHP5.5:
value1
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71514&edit=1