mirror of
https://github.com/php/php-src.git
synced 2024-11-25 19:05:31 +08:00
Fix strval to use __toString if necessary
This commit is contained in:
parent
4efbb35067
commit
15e1d817be
@ -180,14 +180,24 @@ PHP_FUNCTION(floatval)
|
||||
PHP_FUNCTION(strval)
|
||||
{
|
||||
pval **num;
|
||||
zval expr_copy;
|
||||
int use_copy;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
*return_value = **num;
|
||||
zval_copy_ctor(return_value);
|
||||
convert_to_string(return_value);
|
||||
|
||||
zend_make_printable_zval(return_value, &expr_copy, &use_copy);
|
||||
if (use_copy) {
|
||||
*return_value = expr_copy;
|
||||
INIT_PZVAL(return_value);
|
||||
zval_copy_ctor(return_value);
|
||||
zval_dtor(&expr_copy);
|
||||
} else {
|
||||
zval_copy_ctor(return_value);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user