Bug #71514 [Opn]: Bad dba_replace condition because of Zend MM wrong use
| From: | aurelien dot dudouit at corp dot ovh dot com | Date: | Thu, 11 Feb 2016 10:05:26 +0000 |
| Subject: | Bug #71514 [Opn]: Bad dba_replace condition because of Zend MM wrong use | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-199161@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
User updated by: aurelien dot dudouit at corp dot ovh dot com
Reported by: aurelien dot dudouit at corp dot ovh dot com
Summary: Bad dba_replace condition because of Zend MM wrong
use
Status: Open
Type: Bug
Package: DBM/DBA related
-PHP Version: 5.6.17
+PHP Version: 5.6.18
Block user comment: N
Private report: N
New Comment:
Reflected onto latest 5.6 release (5.6.18).
Previous Comments:
------------------------------------------------------------------------
[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