diff options
| author | Lars Strojny <lstrojny@php.net> | 2013-01-14 21:23:52 +0100 |
|---|---|---|
| committer | Lars Strojny <lstrojny@php.net> | 2013-01-14 21:23:52 +0100 |
| commit | 92965b033afa098945d18080203de1595084d1ac (patch) | |
| tree | f625e43c3c30c482c6bf007afab38f8802515122 /Zend/zend_operators.c | |
| parent | 785e66adb536d40a26e4813e6b4ad96b2fdbef43 (diff) | |
| download | php-git-92965b033afa098945d18080203de1595084d1ac.tar.gz | |
Bug #46408: Fix double formatting for PostgreSQL bound parameters
Diffstat (limited to 'Zend/zend_operators.c')
| -rw-r--r-- | Zend/zend_operators.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index bccccd96be..274893c70a 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -572,6 +572,24 @@ ZEND_API void convert_to_boolean(zval *op) /* {{{ */ } /* }}} */ +ZEND_API void _convert_to_cstring(zval *op ZEND_FILE_LINE_DC) /* {{{ */ +{ + double dval; + switch (Z_TYPE_P(op)) { + case IS_DOUBLE: { + TSRMLS_FETCH(); + dval = Z_DVAL_P(op); + Z_STRLEN_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "%.*H", (int) EG(precision), dval); + /* %H already handles removing trailing zeros from the fractional part, yay */ + break; + } + default: + return _convert_to_string(op); + } + Z_TYPE_P(op) = IS_STRING; +} +/* }}} */ + ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */ { long lval; |
