com php-src: Merge branch 'PHP-7.1': ext/reflection/php_refle ction.c
| From: | Xinchen Hui | Date: | Wed, 31 May 2017 05:12:24 +0000 |
| Subject: | com php-src: Merge branch 'PHP-7.1': ext/reflection/php_refle ction.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-97964@lists.php.net to get a copy of this message | ||
Commit: bfd35512bb795f0b4f83c1c857acca7e6e552f6f
Author: Xinchen Hui <laruence@gmail.com> Wed, 31 May 2017 13:12:24 +0800
Parents: 32200e0b699bbbaa26415e7266ab1ed3e0a783ba 741769d9337d9c211f3a106f6f171b889d5b70bf
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=bfd35512bb795f0b4f83c1c857acca7e6e552f6f
Log:
Merge branch 'PHP-7.1'
* PHP-7.1:
Update NEWS
Fixed bug #74673 (Segfault when cast Reflection object to string with undefined constant)
Conflicts:
ext/reflection/php_reflection.c
Bugs:
https://bugs.php.net/74673
Changed paths:
MM ext/reflection/php_reflection.c
Diff:
diff --cc ext/reflection/php_reflection.c
index b8c984a,db7056e..3e5af0d
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@@ -379,10 -467,13 +379,13 @@@ static void _class_string(smart_str *st
zend_class_constant *c;
ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->constants_table, key, c) {
- _class_const_string(str, ZSTR_VAL(key), c, ZSTR_VAL(sub_indent.buf));
+ _class_const_string(str, ZSTR_VAL(key), c, ZSTR_VAL(sub_indent));
+ if (UNEXPECTED(EG(exception))) {
+ return;
+ }
} ZEND_HASH_FOREACH_END();
}
- string_printf(str, "%s }\n", indent);
+ smart_str_append_printf(str, "%s }\n", indent);
/* Static properties */
/* counting static properties */
@@@ -635,27 -733,30 +638,30 @@@ static void _parameter_string(smart_st
if (precv && precv->opcode == ZEND_RECV_INIT && precv->op2_type !=
IS_UNUSED) {
zval zv;
- string_write(str, " = ", sizeof(" = ")-1);
+ smart_str_appends(str, " = ");
ZVAL_DUP(&zv, RT_CONSTANT(&fptr->op_array, precv->op2));
- zval_update_constant_ex(&zv, fptr->common.scope);
+ if (UNEXPECTED(zval_update_constant_ex(&zv, fptr->common.scope) == FAILURE)) {
+ zval_ptr_dtor(&zv);
+ return;
+ }
if (Z_TYPE(zv) == IS_TRUE) {
- string_write(str, "true", sizeof("true")-1);
+ smart_str_appends(str, "true");
} else if (Z_TYPE(zv) == IS_FALSE) {
- string_write(str, "false", sizeof("false")-1);
+ smart_str_appends(str, "false");
} else if (Z_TYPE(zv) == IS_NULL) {
- string_write(str, "NULL", sizeof("NULL")-1);
+ smart_str_appends(str, "NULL");
} else if (Z_TYPE(zv) == IS_STRING) {
- string_write(str, "'", sizeof("'")-1);
- string_write(str, Z_STRVAL(zv), MIN(Z_STRLEN(zv), 15));
+ smart_str_appendc(str, '\'');
+ smart_str_appendl(str, Z_STRVAL(zv), MIN(Z_STRLEN(zv), 15));
if (Z_STRLEN(zv) > 15) {
- string_write(str, "...", sizeof("...")-1);
+ smart_str_appends(str, "...");
}
- string_write(str, "'", sizeof("'")-1);
+ smart_str_appendc(str, '\'');
} else if (Z_TYPE(zv) == IS_ARRAY) {
- string_write(str, "Array", sizeof("Array")-1);
+ smart_str_appends(str, "Array");
} else {
zend_string *zv_str = zval_get_string(&zv);
- string_write(str, ZSTR_VAL(zv_str), ZSTR_LEN(zv_str));
+ smart_str_append(str, zv_str);
zend_string_release(zv_str);
}
zval_ptr_dtor(&zv);