com php-src: Restored the original (php-5) behavior of convert_to_cstring(). It was broken in php 7 by mistake and caused problems in ext/pgsql/t
ests/bug46408.phpt.: Zend/zend_operators. c
| From: | Dmitry Stogov | Date: | Wed, 07 Oct 2015 01:26:26 +0000 |
| Subject: | com php-src: Restored the original (php-5) behavior of convert_to_cstring(). It was broken in php 7 by mistake and caused problems in ext/pgsql/t ests/bug46408.phpt.: Zend/zend_operators. c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-89318@lists.php.net to get a copy of this message | ||
Commit: b8b335c492f87178ab18ca34f928051bc1b65934
Author: Dmitry Stogov <dmitry@zend.com> Wed, 7 Oct 2015 04:26:26 +0300
Parents: 91588a98be7a8640f3511e8fbae67d8dd7c2e53f
Branches: PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b8b335c492f87178ab18ca34f928051bc1b65934
Log:
Restored the original (php-5) behavior of convert_to_cstring(). It was broken in php7 by mistake and
caused problems in ext/pgsql/tests/bug46408.phpt.
Bugs:
https://bugs.php.net/46408
Changed paths:
M Zend/zend_operators.c
Diff:
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index 2345e0b..f2378d8 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -492,7 +492,16 @@ try_again:
ZEND_API void ZEND_FASTCALL _convert_to_cstring(zval *op ZEND_FILE_LINE_DC) /* {{{ */
{
- _convert_to_string(op ZEND_FILE_LINE_CC);
+ double dval;
+ if (Z_TYPE_P(op) == IS_DOUBLE) {
+ zend_string *str;
+ double dval = Z_DVAL_P(op);
+
+ str = zend_strpprintf(0, "%.*H", (int) EG(precision), dval);
+ ZVAL_NEW_STR(op, str);
+ } else {
+ _convert_to_string(op ZEND_FILE_LINE_CC);
+ }
}
/* }}} */