Bug #71514 [NEW]: Bad dba_replace condition because of Zend MM wrong use
| From: | aurelien dot dudouit at corp dot ovh dot com | Date: | Wed, 03 Feb 2016 15:46:14 +0000 |
| Subject: | Bug #71514 [NEW]: Bad dba_replace condition because of Zend MM wrong use | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-199026@lists.php.net to get a copy of this message | ||
From: aurelien dot dudouit at corp dot ovh dot com
Operating system:
PHP version: 5.6.17
Package: DBM/DBA related
Bug Type: Bug
Bug description:Bad dba_replace condition because of Zend MM wrong use
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 bug report at https://bugs.php.net/bug.php?id=71514&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71514&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71514&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71514&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71514&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71514&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71514&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71514&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71514&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71514&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71514&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71514&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71514&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71514&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71514&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71514&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71514&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71514&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71514&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71514&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71514&r=mysqlcfg