com php-src: Merge branch 'PHP-7.0': ext/reflection/php_refle ction.c ext/reflection/tests/ReflectionClass_export_arr ay_bug72222.phpt

From: Date: Wed, 13 Jul 2016 19:52:40 +0000
Subject: com php-src: Merge branch 'PHP-7.0': ext/reflection/php_refle ction.c ext/reflection/tests/ReflectionClass_export_arr ay_bug72222.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-93000@lists.php.net to get a copy of this message
Commit: 981b94e0cf969749deb87c9b67ab6540ace4ad82 Author: Nikita Popov <nikic@php.net> Wed, 13 Jul 2016 21:48:22 +0200 Parents: e6f04d4c8e9adf24ecb9c8d5d2aaf33d311d64be 57c998361957fec8a58b4ea6a9bc49887395db93 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=981b94e0cf969749deb87c9b67ab6540ace4ad82 Log: Merge branch 'PHP-7.0' Changed paths: MM ext/reflection/php_reflection.c AM ext/reflection/tests/ReflectionClass_export_array_bug72222.phpt Diff: diff --cc ext/reflection/php_reflection.c index ebc34e9,964e7a9..0c9a8db --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@@ -454,11 -450,11 +454,10 @@@ static void _class_string(string *str, string_printf(str, "%s - Constants [%d] {\n", indent, count); if (count > 0) { zend_string *key; - zval *value; + zend_class_constant *c; - ZEND_HASH_FOREACH_STR_KEY_VAL(&ce->constants_table, key, value) { - zval_update_constant_ex(value, 1, NULL); - _const_string(str, ZSTR_VAL(key), value, indent); + ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->constants_table, key, c) { - zval_update_constant_ex(&c->value, c->ce); + _class_const_string(str, ZSTR_VAL(key), c, ZSTR_VAL(sub_indent.buf)); } ZEND_HASH_FOREACH_END(); } string_printf(str, "%s }\n", indent); @@@ -631,24 -631,6 +634,29 @@@ static void _const_string(string *str, } /* }}} */ +/* {{{ _class_const_string */ +static void _class_const_string(string *str, char *name, zend_class_constant *c, char *indent) +{ + char *visibility = zend_visibility_string(Z_ACCESS_FLAGS(c->value)); - zend_string *value_str; + char *type; + + zval_update_constant_ex(&c->value, c->ce); - value_str = zval_get_string(&c->value); + type = zend_zval_type_name(&c->value); + - string_printf(str, "%sConstant [ %s %s %s ] { %s }\n", - indent, visibility, type, name, ZSTR_VAL(value_str)); ++ if (Z_TYPE(c->value) == IS_ARRAY) { ++ string_printf(str, "%sConstant [ %s %s %s ] { Array }\n", ++ indent, visibility, type, name); ++ } else { ++ zend_string *value_str = zval_get_string(&c->value); ++ ++ string_printf(str, "%sConstant [ %s %s %s ] { %s }\n", ++ indent, visibility, type, name, ZSTR_VAL(value_str)); + - zend_string_release(value_str); ++ zend_string_release(value_str); ++ } +} +/* }}} */ + /* {{{ _get_recv_opcode */ static zend_op* _get_recv_op(zend_op_array *op_array, uint32_t offset) { diff --cc ext/reflection/tests/ReflectionClass_export_array_bug72222.phpt index 0000000,e64dc97..9ccc285 mode 000000,100644..100644 --- a/ext/reflection/tests/ReflectionClass_export_array_bug72222.phpt +++ b/ext/reflection/tests/ReflectionClass_export_array_bug72222.phpt @@@ -1,0 -1,31 +1,31 @@@ + --TEST-- + ReflectionClass::export() - array constants + --FILE-- + <?php + Class A { + const A = 8; + const B = ["a", "b"]; + } + ReflectionClass::export("A"); + ?> + --EXPECTF-- + Class [ <user> class A ] { + @@ %s 2-5 + + - Constants [2] { - Constant [ integer A ] { 8 } - Constant [ array B ] { Array } ++ Constant [ public integer A ] { 8 } ++ Constant [ public array B ] { Array } + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [0] { + } + }

« previous php.cvs (#93000) next »