Skip to content

Commit c4fe37b

Browse files
committed
Merge branch 'PHP-5.5'
Conflicts: NEWS
2 parents 7a31692 + dc495bb commit c4fe37b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1305
-131
lines changed

NEWS

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3-
<<<<<<< HEAD
43
?? ??? 201?, PHP 5.6.0
54

65
<<< NOTE: Insert NEWS from last stable release here prior to actual release! >>>

Zend/zend_operators.c

+18
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,24 @@ ZEND_API void convert_to_boolean(zval *op) /* {{{ */
572572
}
573573
/* }}} */
574574

575+
ZEND_API void _convert_to_cstring(zval *op ZEND_FILE_LINE_DC) /* {{{ */
576+
{
577+
double dval;
578+
switch (Z_TYPE_P(op)) {
579+
case IS_DOUBLE: {
580+
TSRMLS_FETCH();
581+
dval = Z_DVAL_P(op);
582+
Z_STRLEN_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "%.*H", (int) EG(precision), dval);
583+
/* %H already handles removing trailing zeros from the fractional part, yay */
584+
break;
585+
}
586+
default:
587+
_convert_to_string(op ZEND_FILE_LINE_CC);
588+
}
589+
Z_TYPE_P(op) = IS_STRING;
590+
}
591+
/* }}} */
592+
575593
ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */
576594
{
577595
long lval;

Zend/zend_operators.h

+2
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ ZEND_API int increment_function(zval *op1);
301301
ZEND_API int decrement_function(zval *op2);
302302

303303
ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC);
304+
ZEND_API void _convert_to_cstring(zval *op ZEND_FILE_LINE_DC);
304305
ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC);
305306
ZEND_API void convert_to_long(zval *op);
306307
ZEND_API void convert_to_double(zval *op);
@@ -314,6 +315,7 @@ ZEND_API void multi_convert_to_double_ex(int argc, ...);
314315
ZEND_API void multi_convert_to_string_ex(int argc, ...);
315316
ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2);
316317
ZEND_API int add_string_to_string(zval *result, const zval *op1, const zval *op2);
318+
#define convert_to_cstring(op) if ((op)->type != IS_STRING) { _convert_to_cstring((op) ZEND_FILE_LINE_CC); }
317319
#define convert_to_string(op) if ((op)->type != IS_STRING) { _convert_to_string((op) ZEND_FILE_LINE_CC); }
318320

319321
ZEND_API double zend_string_to_double(const char *number, zend_uint length);

0 commit comments

Comments
 (0)