summaryrefslogtreecommitdiff
path: root/ext/reflection/php_reflection.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2015-06-30 04:05:24 +0300
committerDmitry Stogov <dmitry@zend.com>2015-06-30 04:05:24 +0300
commit4a2e40bb861bc3cf5fb6863e57486ed60316e97c (patch)
tree6579660b282fdd1bc50095e48d702913a0b6aa97 /ext/reflection/php_reflection.c
parent8cce5b2641fb91c3073018b59f6f044b843041a8 (diff)
downloadphp-git-4a2e40bb861bc3cf5fb6863e57486ed60316e97c.tar.gz
Use ZSTR_ API to access zend_string elements (this is just renaming without semantick changes).
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r--ext/reflection/php_reflection.c214
1 files changed, 107 insertions, 107 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 5c7f26a9fa..0a65d60d21 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -127,8 +127,8 @@ static void string_init(string *str)
{
str->buf= zend_string_alloc(1024, 0);
str->alloced = 1024;
- str->buf->val[0] = '\0';
- str->buf->len = 0;
+ ZSTR_VAL(str->buf)[0] = '\0';
+ ZSTR_LEN(str->buf) = 0;
}
static string *string_printf(string *str, const char *format, ...)
@@ -140,15 +140,15 @@ static string *string_printf(string *str, const char *format, ...)
va_start(arg, format);
len = zend_vspprintf(&s_tmp, 0, format, arg);
if (len) {
- register size_t nlen = (str->buf->len + 1 + len + (1024 - 1)) & ~(1024 - 1);
+ register size_t nlen = (ZSTR_LEN(str->buf) + 1 + len + (1024 - 1)) & ~(1024 - 1);
if (str->alloced < nlen) {
- size_t old_len = str->buf->len;
+ size_t old_len = ZSTR_LEN(str->buf);
str->alloced = nlen;
str->buf = zend_string_extend(str->buf, str->alloced, 0);
- str->buf->len = old_len;
+ ZSTR_LEN(str->buf) = old_len;
}
- memcpy(str->buf->val + str->buf->len, s_tmp, len + 1);
- str->buf->len += len;
+ memcpy(ZSTR_VAL(str->buf) + ZSTR_LEN(str->buf), s_tmp, len + 1);
+ ZSTR_LEN(str->buf) += len;
}
efree(s_tmp);
va_end(arg);
@@ -157,23 +157,23 @@ static string *string_printf(string *str, const char *format, ...)
static string *string_write(string *str, char *buf, size_t len)
{
- register size_t nlen = (str->buf->len + 1 + len + (1024 - 1)) & ~(1024 - 1);
+ register size_t nlen = (ZSTR_LEN(str->buf) + 1 + len + (1024 - 1)) & ~(1024 - 1);
if (str->alloced < nlen) {
- size_t old_len = str->buf->len;
+ size_t old_len = ZSTR_LEN(str->buf);
str->alloced = nlen;
str->buf = zend_string_extend(str->buf, str->alloced, 0);
- str->buf->len = old_len;
+ ZSTR_LEN(str->buf) = old_len;
}
- memcpy(str->buf->val + str->buf->len, buf, len);
- str->buf->len += len;
- str->buf->val[str->buf->len] = '\0';
+ memcpy(ZSTR_VAL(str->buf) + ZSTR_LEN(str->buf), buf, len);
+ ZSTR_LEN(str->buf) += len;
+ ZSTR_VAL(str->buf)[ZSTR_LEN(str->buf)] = '\0';
return str;
}
static string *string_append(string *str, string *append)
{
- if (append->buf->len > 0) {
- string_write(str, append->buf->val, append->buf->len);
+ if (ZSTR_LEN(append->buf) > 0) {
+ string_write(str, ZSTR_VAL(append->buf), ZSTR_LEN(append->buf));
}
return str;
}
@@ -419,28 +419,28 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
}
string_printf(str, "class ");
}
- string_printf(str, "%s", ce->name->val);
+ string_printf(str, "%s", ZSTR_VAL(ce->name));
if (ce->parent) {
- string_printf(str, " extends %s", ce->parent->name->val);
+ string_printf(str, " extends %s", ZSTR_VAL(ce->parent->name));
}
if (ce->num_interfaces) {
uint32_t i;
if (ce->ce_flags & ZEND_ACC_INTERFACE) {
- string_printf(str, " extends %s", ce->interfaces[0]->name->val);
+ string_printf(str, " extends %s", ZSTR_VAL(ce->interfaces[0]->name));
} else {
- string_printf(str, " implements %s", ce->interfaces[0]->name->val);
+ string_printf(str, " implements %s", ZSTR_VAL(ce->interfaces[0]->name));
}
for (i = 1; i < ce->num_interfaces; ++i) {
- string_printf(str, ", %s", ce->interfaces[i]->name->val);
+ string_printf(str, ", %s", ZSTR_VAL(ce->interfaces[i]->name));
}
}
string_printf(str, " ] {\n");
/* The information where a class is declared is only available for user classes */
if (ce->type == ZEND_USER_CLASS) {
- string_printf(str, "%s @@ %s %d-%d\n", indent, ce->info.user.filename->val,
+ string_printf(str, "%s @@ %s %d-%d\n", indent, ZSTR_VAL(ce->info.user.filename),
ce->info.user.line_start, ce->info.user.line_end);
}
@@ -455,7 +455,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
ZEND_HASH_FOREACH_STR_KEY_VAL(&ce->constants_table, key, value) {
zval_update_constant_ex(value, 1, NULL);
- _const_string(str, key->val, value, indent);
+ _const_string(str, ZSTR_VAL(key), value, indent);
} ZEND_HASH_FOREACH_END();
}
string_printf(str, "%s }\n", indent);
@@ -484,7 +484,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop) {
if ((prop->flags & ZEND_ACC_STATIC) && !(prop->flags & ZEND_ACC_SHADOW)) {
- _property_string(str, prop, NULL, sub_indent.buf->val);
+ _property_string(str, prop, NULL, ZSTR_VAL(sub_indent.buf));
}
} ZEND_HASH_FOREACH_END();
}
@@ -517,7 +517,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
&& ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce))
{
string_printf(str, "\n");
- _function_string(str, mptr, ce, sub_indent.buf->val);
+ _function_string(str, mptr, ce, ZSTR_VAL(sub_indent.buf));
}
} ZEND_HASH_FOREACH_END();
} else {
@@ -535,7 +535,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop) {
if (!(prop->flags & (ZEND_ACC_STATIC|ZEND_ACC_SHADOW))) {
- _property_string(str, prop, NULL, sub_indent.buf->val);
+ _property_string(str, prop, NULL, ZSTR_VAL(sub_indent.buf));
}
} ZEND_HASH_FOREACH_END();
}
@@ -552,10 +552,10 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
if (properties && zend_hash_num_elements(properties)) {
ZEND_HASH_FOREACH_STR_KEY(properties, prop_name) {
- if (prop_name && prop_name->len && prop_name->val[0]) { /* skip all private and protected properties */
+ if (prop_name && ZSTR_LEN(prop_name) && ZSTR_VAL(prop_name)[0]) { /* skip all private and protected properties */
if (!zend_hash_exists(&ce->properties_info, prop_name)) {
count++;
- _property_string(&dyn, NULL, prop_name->val, sub_indent.buf->val);
+ _property_string(&dyn, NULL, ZSTR_VAL(prop_name), ZSTR_VAL(sub_indent.buf));
}
}
} ZEND_HASH_FOREACH_END();
@@ -582,18 +582,18 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
if ((mptr->common.fn_flags & ZEND_ACC_STATIC) == 0
&& ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce))
{
- size_t len = mptr->common.function_name->len;
+ size_t len = ZSTR_LEN(mptr->common.function_name);
/* Do not display old-style inherited constructors */
if ((mptr->common.fn_flags & ZEND_ACC_CTOR) == 0
|| mptr->common.scope == ce
|| !key
- || zend_binary_strcasecmp(key->val, key->len, mptr->common.function_name->val, len) == 0)
+ || zend_binary_strcasecmp(ZSTR_VAL(key), ZSTR_LEN(key), ZSTR_VAL(mptr->common.function_name), len) == 0)
{
zend_function *closure;
/* see if this is a closure */
if (ce == zend_ce_closure && obj && (len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
- && memcmp(mptr->common.function_name->val, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
+ && memcmp(ZSTR_VAL(mptr->common.function_name), ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
&& (closure = zend_get_closure_invoke_method(Z_OBJ_P(obj))) != NULL)
{
mptr = closure;
@@ -601,7 +601,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
closure = NULL;
}
string_printf(&dyn, "\n");
- _function_string(&dyn, mptr, ce, sub_indent.buf->val);
+ _function_string(&dyn, mptr, ce, ZSTR_VAL(sub_indent.buf));
count++;
_free_function(closure);
}
@@ -631,7 +631,7 @@ static void _const_string(string *str, char *name, zval *value, char *indent)
zend_string *value_str = zval_get_string(value);
string_printf(str, "%s Constant [ %s %s ] { %s }\n",
- indent, type, name, value_str->val);
+ indent, type, name, ZSTR_VAL(value_str));
zend_string_release(value_str);
}
@@ -670,7 +670,7 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg
(fptr->type == ZEND_INTERNAL_FUNCTION &&
!(fptr->common.fn_flags & ZEND_ACC_USER_ARG_INFO)) ?
((zend_internal_arg_info*)arg_info)->class_name :
- arg_info->class_name->val);
+ ZSTR_VAL(arg_info->class_name));
if (arg_info->allow_null) {
string_printf(str, "or NULL ");
}
@@ -691,7 +691,7 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg
(fptr->type == ZEND_INTERNAL_FUNCTION &&
!(fptr->common.fn_flags & ZEND_ACC_USER_ARG_INFO)) ?
((zend_internal_arg_info*)arg_info)->name :
- arg_info->name->val);
+ ZSTR_VAL(arg_info->name));
} else {
string_printf(str, "$param%d", offset);
}
@@ -724,7 +724,7 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg
string_write(str, "Array", sizeof("Array")-1);
} else {
zend_string *zv_str = zval_get_string(&zv);
- string_write(str, zv_str->val, zv_str->len);
+ string_write(str, ZSTR_VAL(zv_str), ZSTR_LEN(zv_str));
zend_string_release(zv_str);
}
zval_ptr_dtor(&zv);
@@ -782,7 +782,7 @@ static void _function_closure_string(string *str, zend_function *fptr, char* ind
string_printf(str, "%s- Bound Variables [%d] {\n", indent, zend_hash_num_elements(static_variables));
i = 0;
ZEND_HASH_FOREACH_STR_KEY(static_variables, key) {
- string_printf(str, "%s Variable #%d [ $%s ]\n", indent, i++, key->val);
+ string_printf(str, "%s Variable #%d [ $%s ]\n", indent, i++, ZSTR_VAL(key));
} ZEND_HASH_FOREACH_END();
string_printf(str, "%s}\n", indent);
}
@@ -801,7 +801,7 @@ static void _function_string(string *str, zend_function *fptr, zend_class_entry
* swallowed, leading to an unaligned comment.
*/
if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.doc_comment) {
- string_printf(str, "%s%s\n", indent, fptr->op_array.doc_comment->val);
+ string_printf(str, "%s%s\n", indent, ZSTR_VAL(fptr->op_array.doc_comment));
}
string_write(str, indent, strlen(indent));
@@ -816,21 +816,21 @@ static void _function_string(string *str, zend_function *fptr, zend_class_entry
if (scope && fptr->common.scope) {
if (fptr->common.scope != scope) {
- string_printf(str, ", inherits %s", fptr->common.scope->name->val);
+ string_printf(str, ", inherits %s", ZSTR_VAL(fptr->common.scope->name));
} else if (fptr->common.scope->parent) {
- lc_name_len = fptr->common.function_name->len;
+ lc_name_len = ZSTR_LEN(fptr->common.function_name);
lc_name = zend_string_alloc(lc_name_len, 0);
- zend_str_tolower_copy(lc_name->val, fptr->common.function_name->val, lc_name_len);
+ zend_str_tolower_copy(ZSTR_VAL(lc_name), ZSTR_VAL(fptr->common.function_name), lc_name_len);
if ((overwrites = zend_hash_find_ptr(&fptr->common.scope->parent->function_table, lc_name)) != NULL) {
if (fptr->common.scope != overwrites->common.scope) {
- string_printf(str, ", overwrites %s", overwrites->common.scope->name->val);
+ string_printf(str, ", overwrites %s", ZSTR_VAL(overwrites->common.scope->name));
}
}
efree(lc_name);
}
}
if (fptr->common.prototype && fptr->common.prototype->common.scope) {
- string_printf(str, ", prototype %s", fptr->common.prototype->common.scope->name->val);
+ string_printf(str, ", prototype %s", ZSTR_VAL(fptr->common.prototype->common.scope->name));
}
if (fptr->common.fn_flags & ZEND_ACC_CTOR) {
string_printf(str, ", ctor");
@@ -874,20 +874,20 @@ static void _function_string(string *str, zend_function *fptr, zend_class_entry
if (fptr->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE) {
string_printf(str, "&");
}
- string_printf(str, "%s ] {\n", fptr->common.function_name->val);
+ string_printf(str, "%s ] {\n", ZSTR_VAL(fptr->common.function_name));
/* The information where a function is declared is only available for user classes */
if (fptr->type == ZEND_USER_FUNCTION) {
string_printf(str, "%s @@ %s %d - %d\n", indent,
- fptr->op_array.filename->val,
+ ZSTR_VAL(fptr->op_array.filename),
fptr->op_array.line_start,
fptr->op_array.line_end);
}
string_init(&param_indent);
string_printf(&param_indent, "%s ", indent);
if (fptr->common.fn_flags & ZEND_ACC_CLOSURE) {
- _function_closure_string(str, fptr, param_indent.buf->val);
+ _function_closure_string(str, fptr, ZSTR_VAL(param_indent.buf));
}
- _function_parameter_string(str, fptr, param_indent.buf->val);
+ _function_parameter_string(str, fptr, ZSTR_VAL(param_indent.buf));
string_free(&param_indent);
if (fptr->op_array.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
string_printf(str, " %s- Return [ ", indent);
@@ -896,7 +896,7 @@ static void _function_string(string *str, zend_function *fptr, zend_class_entry
(fptr->type == ZEND_INTERNAL_FUNCTION &&
!(fptr->common.fn_flags & ZEND_ACC_USER_ARG_INFO)) ?
((zend_internal_arg_info*)(fptr->common.arg_info - 1))->class_name :
- fptr->common.arg_info[-1].class_name->val);
+ ZSTR_VAL(fptr->common.arg_info[-1].class_name));
if (fptr->common.arg_info[-1].allow_null) {
string_printf(str, "or NULL ");
}
@@ -962,7 +962,7 @@ static int _extension_ini_string(zval *el, int num_args, va_list args, zend_hash
char *comma = "";
if (number == ini_entry->module_number) {
- string_printf(str, " %sEntry [ %s <", indent, ini_entry->name->val);
+ string_printf(str, " %sEntry [ %s <", indent, ZSTR_VAL(ini_entry->name));
if (ini_entry->modifiable == ZEND_INI_ALL) {
string_printf(str, "ALL");
} else {
@@ -980,9 +980,9 @@ static int _extension_ini_string(zval *el, int num_args, va_list args, zend_hash
}
string_printf(str, "> ]\n");
- string_printf(str, " %s Current = '%s'\n", indent, ini_entry->value ? ini_entry->value->val : "");
+ string_printf(str, " %s Current = '%s'\n", indent, ini_entry->value ? ZSTR_VAL(ini_entry->value) : "");
if (ini_entry->modified) {
- string_printf(str, " %s Default = '%s'\n", indent, ini_entry->orig_value ? ini_entry->orig_value->val : "");
+ string_printf(str, " %s Default = '%s'\n", indent, ini_entry->orig_value ? ZSTR_VAL(ini_entry->orig_value) : "");
}
string_printf(str, " %s}\n", indent);
}
@@ -1000,7 +1000,7 @@ static int _extension_class_string(zval *el, int num_args, va_list args, zend_ha
if ((ce->type == ZEND_INTERNAL_CLASS) && ce->info.internal.module && !strcasecmp(ce->info.internal.module->name, module->name)) {
/* dump class if it is not an alias */
- if (!zend_binary_strcasecmp(ce->name->val, ce->name->len, hash_key->key->val, hash_key->key->len)) {
+ if (!zend_binary_strcasecmp(ZSTR_VAL(ce->name), ZSTR_LEN(ce->name), ZSTR_VAL(hash_key->key), ZSTR_LEN(hash_key->key))) {
string_printf(str, "\n");
_class_string(str, ce, NULL, indent);
(*num_classes)++;
@@ -1019,7 +1019,7 @@ static int _extension_const_string(zval *el, int num_args, va_list args, zend_ha
int *num_classes = va_arg(args, int*);
if (constant->module_number == module->module_number) {
- _const_string(str, constant->name->val, &constant->value, indent);
+ _const_string(str, ZSTR_VAL(constant->name), &constant->value, indent);
(*num_classes)++;
}
return ZEND_HASH_APPLY_KEEP;
@@ -1078,7 +1078,7 @@ static void _extension_string(string *str, zend_module_entry *module, char *inde
string str_ini;
string_init(&str_ini);
zend_hash_apply_with_arguments(EG(ini_directives), (apply_func_args_t) _extension_ini_string, 3, &str_ini, indent, module->module_number);
- if (str_ini.buf->len > 0) {
+ if (ZSTR_LEN(str_ini.buf) > 0) {
string_printf(str, "\n - INI {\n");
string_append(str, &str_ini);
string_printf(str, "%s }\n", indent);
@@ -1127,7 +1127,7 @@ static void _extension_string(string *str, zend_module_entry *module, char *inde
string_init(&sub_indent);
string_printf(&sub_indent, "%s ", indent);
string_init(&str_classes);
- zend_hash_apply_with_arguments(EG(class_table), (apply_func_args_t) _extension_class_string, 4, &str_classes, sub_indent.buf->val, module, &num_classes);
+ zend_hash_apply_with_arguments(EG(class_table), (apply_func_args_t) _extension_class_string, 4, &str_classes, ZSTR_VAL(sub_indent.buf), module, &num_classes);
if (num_classes) {
string_printf(str, "\n - Classes [%d] {", num_classes);
string_append(str, &str_classes);
@@ -1202,7 +1202,7 @@ static void reflection_extension_factory(zval *object, const char *name_str)
struct _zend_module_entry *module;
lcname = zend_string_alloc(name_len, 0);
- zend_str_tolower_copy(lcname->val, name_str, name_len);
+ zend_str_tolower_copy(ZSTR_VAL(lcname), name_str, name_len);
module = zend_hash_find_ptr(&module_registry, lcname);
zend_string_free(lcname);
if (!module) {
@@ -1544,7 +1544,7 @@ ZEND_METHOD(reflection, export)
}
if (Z_TYPE(retval) == IS_UNDEF) {
- php_error_docref(NULL, E_WARNING, "%s::__toString() did not return anything", Z_OBJCE_P(object)->name->val);
+ php_error_docref(NULL, E_WARNING, "%s::__toString() did not return anything", ZSTR_VAL(Z_OBJCE_P(object)->name));
RETURN_FALSE;
}
@@ -1952,7 +1952,7 @@ ZEND_METHOD(reflection_function, invoke)
if (result == FAILURE) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Invocation of function %s() failed", fptr->common.function_name->val);
+ "Invocation of function %s() failed", ZSTR_VAL(fptr->common.function_name));
return;
}
@@ -2017,7 +2017,7 @@ ZEND_METHOD(reflection_function, invokeArgs)
if (result == FAILURE) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Invocation of function %s() failed", fptr->common.function_name->val);
+ "Invocation of function %s() failed", ZSTR_VAL(fptr->common.function_name));
return;
}
@@ -2411,7 +2411,7 @@ ZEND_METHOD(reflection_parameter, __construct)
} else if ((fptr = zend_hash_str_find_ptr(&ce->function_table, lcname, lcname_len)) == NULL) {
efree(lcname);
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Method %s::%s() does not exist", ce->name->val, Z_STRVAL_P(method));
+ "Method %s::%s() does not exist", ZSTR_VAL(ce->name), Z_STRVAL_P(method));
return;
}
efree(lcname);
@@ -2427,7 +2427,7 @@ ZEND_METHOD(reflection_parameter, __construct)
is_closure = 1;
} else if ((fptr = zend_hash_str_find_ptr(&ce->function_table, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME))) == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Method %s::%s() does not exist", ce->name->val, ZEND_INVOKE_FUNC_NAME);
+ "Method %s::%s() does not exist", ZSTR_VAL(ce->name), ZEND_INVOKE_FUNC_NAME);
return;
}
}
@@ -2478,7 +2478,7 @@ ZEND_METHOD(reflection_parameter, __construct)
} else {
for (i = 0; i < num_args; i++) {
if (arg_info[i].name) {
- if (strcmp(arg_info[i].name->val, Z_STRVAL_P(parameter)) == 0) {
+ if (strcmp(ZSTR_VAL(arg_info[i].name), Z_STRVAL_P(parameter)) == 0) {
position= i;
break;
}
@@ -2629,8 +2629,8 @@ ZEND_METHOD(reflection_parameter, getClass)
class_name = ((zend_internal_arg_info*)param->arg_info)->class_name;
class_name_len = strlen(class_name);
} else {
- class_name = param->arg_info->class_name->val;
- class_name_len = param->arg_info->class_name->len;
+ class_name = ZSTR_VAL(param->arg_info->class_name);
+ class_name_len = ZSTR_LEN(param->arg_info->class_name);
}
if (0 == zend_binary_strcasecmp(class_name, class_name_len, "self", sizeof("self")- 1)) {
ce = param->fptr->common.scope;
@@ -3099,7 +3099,7 @@ ZEND_METHOD(reflection_method, __construct)
} else if ((mptr = zend_hash_str_find_ptr(&ce->function_table, lcname, name_len)) == NULL) {
efree(lcname);
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Method %s::%s() does not exist", ce->name->val, name_str);
+ "Method %s::%s() does not exist", ZSTR_VAL(ce->name), name_str);
return;
}
efree(lcname);
@@ -3192,13 +3192,13 @@ ZEND_METHOD(reflection_method, invoke)
if (mptr->common.fn_flags & ZEND_ACC_ABSTRACT) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Trying to invoke abstract method %s::%s()",
- mptr->common.scope->name->val, mptr->common.function_name->val);
+ ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name));
} else {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Trying to invoke %s method %s::%s() from scope %s",
mptr->common.fn_flags & ZEND_ACC_PROTECTED ? "protected" : "private",
- mptr->common.scope->name->val, mptr->common.function_name->val,
- Z_OBJCE_P(getThis())->name->val);
+ ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name),
+ ZSTR_VAL(Z_OBJCE_P(getThis())->name));
}
return;
}
@@ -3252,7 +3252,7 @@ ZEND_METHOD(reflection_method, invoke)
if (result == FAILURE) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Invocation of method %s::%s() failed", mptr->common.scope->name->val, mptr->common.function_name->val);
+ "Invocation of method %s::%s() failed", ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name));
return;
}
@@ -3292,13 +3292,13 @@ ZEND_METHOD(reflection_method, invokeArgs)
if (mptr->common.fn_flags & ZEND_ACC_ABSTRACT) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Trying to invoke abstract method %s::%s()",
- mptr->common.scope->name->val, mptr->common.function_name->val);
+ ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name));
} else {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Trying to invoke %s method %s::%s() from scope %s",
mptr->common.fn_flags & ZEND_ACC_PROTECTED ? "protected" : "private",
- mptr->common.scope->name->val, mptr->common.function_name->val,
- Z_OBJCE_P(getThis())->name->val);
+ ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name),
+ ZSTR_VAL(Z_OBJCE_P(getThis())->name));
}
return;
}
@@ -3326,7 +3326,7 @@ ZEND_METHOD(reflection_method, invokeArgs)
efree(params);
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Trying to invoke non static method %s::%s() without an object",
- mptr->common.scope->name->val, mptr->common.function_name->val);
+ ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name));
return;
}
@@ -3371,7 +3371,7 @@ ZEND_METHOD(reflection_method, invokeArgs)
if (result == FAILURE) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Invocation of method %s::%s() failed", mptr->common.scope->name->val, mptr->common.function_name->val);
+ "Invocation of method %s::%s() failed", ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name));
return;
}
@@ -3644,7 +3644,7 @@ ZEND_METHOD(reflection_method, getPrototype)
if (!mptr->common.prototype) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Method %s::%s does not have a prototype", intern->ce->name->val, mptr->common.function_name->val);
+ "Method %s::%s does not have a prototype", ZSTR_VAL(intern->ce->name), ZSTR_VAL(mptr->common.function_name));
return;
}
@@ -3829,7 +3829,7 @@ ZEND_METHOD(reflection_class, getStaticPropertyValue)
ZVAL_COPY(return_value, def_value);
} else {
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Class %s does not have a property named %s", ce->name->val, name->val);
+ "Class %s does not have a property named %s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
}
return;
} else {
@@ -3860,7 +3860,7 @@ ZEND_METHOD(reflection_class, setStaticPropertyValue)
variable_ptr = zend_std_get_static_property(ce, name, 1);
if (!variable_ptr) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Class %s does not have a property named %s", ce->name->val, name->val);
+ "Class %s does not have a property named %s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
return;
}
zval_ptr_dtor(variable_ptr);
@@ -4132,11 +4132,11 @@ ZEND_METHOD(reflection_class, getMethod)
static void _addmethod(zend_function *mptr, zend_class_entry *ce, zval *retval, zend_long filter, zval *obj)
{
zval method;
- size_t len = mptr->common.function_name->len;
+ size_t len = ZSTR_LEN(mptr->common.function_name);
zend_function *closure;
if (mptr->common.fn_flags & filter) {
if (ce == zend_ce_closure && obj && (len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
- && memcmp(mptr->common.function_name->val, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
+ && memcmp(ZSTR_VAL(mptr->common.function_name), ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
&& (closure = zend_get_closure_invoke_method(Z_OBJ_P(obj))) != NULL)
{
mptr = closure;
@@ -4269,20 +4269,20 @@ ZEND_METHOD(reflection_class, getProperty)
return;
}
}
- str_name = name->val;
- str_name_len = name->len;
- if ((tmp = strstr(name->val, "::")) != NULL) {
- classname_len = tmp - name->val;
+ str_name = ZSTR_VAL(name);
+ str_name_len = ZSTR_LEN(name);
+ if ((tmp = strstr(ZSTR_VAL(name), "::")) != NULL) {
+ classname_len = tmp - ZSTR_VAL(name);
classname = zend_string_alloc(classname_len, 0);
- zend_str_tolower_copy(classname->val, name->val, classname_len);
- classname->val[classname_len] = '\0';
- str_name_len = name->len - (classname_len + 2);
+ zend_str_tolower_copy(ZSTR_VAL(classname), ZSTR_VAL(name), classname_len);
+ ZSTR_VAL(classname)[classname_len] = '\0';
+ str_name_len = ZSTR_LEN(name) - (classname_len + 2);
str_name = tmp + 2;
ce2 = zend_lookup_class(classname);
if (!ce2) {
if (!EG(exception)) {
- zend_throw_exception_ex(reflection_exception_ptr, -1, "Class %s does not exist", classname->val);
+ zend_throw_exception_ex(reflection_exception_ptr, -1, "Class %s does not exist", ZSTR_VAL(classname));
}
zend_string_release(classname);
return;
@@ -4290,7 +4290,7 @@ ZEND_METHOD(reflection_class, getProperty)
zend_string_release(classname);
if (!instanceof_function(ce, ce2)) {
- zend_throw_exception_ex(reflection_exception_ptr, -1, "Fully qualified property name %s::%s does not specify a base class of %s", ce2->name->val, str_name, ce->name->val);
+ zend_throw_exception_ex(reflection_exception_ptr, -1, "Fully qualified property name %s::%s does not specify a base class of %s", ZSTR_VAL(ce2->name), str_name, ZSTR_VAL(ce->name));
return;
}
ce = ce2;
@@ -4340,7 +4340,7 @@ static int _adddynproperty(zval *ptr, int num_args, va_list args, zend_hash_key
return 0;
}
- if (hash_key->key->val[0] == '\0') {
+ if (ZSTR_VAL(hash_key->key)[0] == '\0') {
return 0; /* non public cannot be dynamic */
}
@@ -4629,7 +4629,7 @@ ZEND_METHOD(reflection_class, newInstance)
zend_fcall_info_cache fcc;
if (!(constructor->common.fn_flags & ZEND_ACC_PUBLIC)) {
- zend_throw_exception_ex(reflection_exception_ptr, 0, "Access to non-public constructor of class %s", ce->name->val);
+ zend_throw_exception_ex(reflection_exception_ptr, 0, "Access to non-public constructor of class %s", ZSTR_VAL(ce->name));
zval_dtor(return_value);
RETURN_NULL();
}
@@ -4665,12 +4665,12 @@ ZEND_METHOD(reflection_class, newInstance)
zval_ptr_dtor(&params[i]);
}
if (ret == FAILURE) {
- php_error_docref(NULL, E_WARNING, "Invocation of %s's constructor failed", ce->name->val);
+ php_error_docref(NULL, E_WARNING, "Invocation of %s's constructor failed", ZSTR_VAL(ce->name));
zval_dtor(return_value);
RETURN_NULL();
}
} else if (ZEND_NUM_ARGS()) {
- zend_throw_exception_ex(reflection_exception_ptr, 0, "Class %s does not have a constructor, so you cannot pass any constructor arguments", ce->name->val);
+ zend_throw_exception_ex(reflection_exception_ptr, 0, "Class %s does not have a constructor, so you cannot pass any constructor arguments", ZSTR_VAL(ce->name));
}
}
/* }}} */
@@ -4686,7 +4686,7 @@ ZEND_METHOD(reflection_class, newInstanceWithoutConstructor)
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->create_object != NULL && ce->ce_flags & ZEND_ACC_FINAL) {
- zend_throw_exception_ex(reflection_exception_ptr, 0, "Class %s is an internal class marked as final that cannot be instantiated without invoking its constructor", ce->name->val);
+ zend_throw_exception_ex(reflection_exception_ptr, 0, "Class %s is an internal class marked as final that cannot be instantiated without invoking its constructor", ZSTR_VAL(ce->name));
return;
}
@@ -4733,7 +4733,7 @@ ZEND_METHOD(reflection_class, newInstanceArgs)
zend_fcall_info_cache fcc;
if (!(constructor->common.fn_flags & ZEND_ACC_PUBLIC)) {
- zend_throw_exception_ex(reflection_exception_ptr, 0, "Access to non-public constructor of class %s", ce->name->val);
+ zend_throw_exception_ex(reflection_exception_ptr, 0, "Access to non-public constructor of class %s", ZSTR_VAL(ce->name));
zval_dtor(return_value);
RETURN_NULL();
}
@@ -4773,12 +4773,12 @@ ZEND_METHOD(reflection_class, newInstanceArgs)
}
if (ret == FAILURE) {
zval_ptr_dtor(&retval);
- php_error_docref(NULL, E_WARNING, "Invocation of %s's constructor failed", ce->name->val);
+ php_error_docref(NULL, E_WARNING, "Invocation of %s's constructor failed", ZSTR_VAL(ce->name));
zval_dtor(return_value);
RETURN_NULL();
}
} else if (argc) {
- zend_throw_exception_ex(reflection_exception_ptr, 0, "Class %s does not have a constructor, so you cannot pass any constructor arguments", ce->name->val);
+ zend_throw_exception_ex(reflection_exception_ptr, 0, "Class %s does not have a constructor, so you cannot pass any constructor arguments", ZSTR_VAL(ce->name));
}
}
/* }}} */
@@ -4898,9 +4898,9 @@ ZEND_METHOD(reflection_class, getTraitAliases)
if (ce->trait_aliases[i]->alias) {
- mname = zend_string_alloc(cur_ref->ce->name->len + cur_ref->method_name->len + 2, 0);
- snprintf(mname->val, mname->len + 1, "%s::%s", cur_ref->ce->name->val, cur_ref->method_name->val);
- add_assoc_str_ex(return_value, ce->trait_aliases[i]->alias->val, ce->trait_aliases[i]->alias->len, mname);
+ mname = zend_string_alloc(ZSTR_LEN(cur_ref->ce->name) + ZSTR_LEN(cur_ref->method_name) + 2, 0);
+ snprintf(ZSTR_VAL(mname), ZSTR_LEN(mname) + 1, "%s::%s", ZSTR_VAL(cur_ref->ce->name), ZSTR_VAL(cur_ref->method_name));
+ add_assoc_str_ex(return_value, ZSTR_VAL(ce->trait_aliases[i]->alias), ZSTR_LEN(ce->trait_aliases[i]->alias), mname);
}
i++;
}
@@ -5014,7 +5014,7 @@ ZEND_METHOD(reflection_class, implementsInterface)
if (!(interface_ce->ce_flags & ZEND_ACC_INTERFACE)) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Interface %s is a Class", interface_ce->name->val);
+ "Interface %s is a Class", ZSTR_VAL(interface_ce->name));
return;
}
RETURN_BOOL(instanceof_function(ce, interface_ce));
@@ -5226,7 +5226,7 @@ ZEND_METHOD(reflection_property, __construct)
}
}
if (dynam_prop == 0) {
- zend_throw_exception_ex(reflection_exception_ptr, 0, "Property %s::$%s does not exist", ce->name->val, name_str);
+ zend_throw_exception_ex(reflection_exception_ptr, 0, "Property %s::$%s does not exist", ZSTR_VAL(ce->name), name_str);
return;
}
}
@@ -5386,7 +5386,7 @@ ZEND_METHOD(reflection_property, getValue)
if (!(ref->prop.flags & (ZEND_ACC_PUBLIC | ZEND_ACC_IMPLICIT_PUBLIC)) && intern->ignore_visibility == 0) {
name = _default_load_entry(getThis(), "name", sizeof("name")-1);
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Cannot access non-public member %s::%s", intern->ce->name->val, Z_STRVAL_P(name));
+ "Cannot access non-public member %s::%s", ZSTR_VAL(intern->ce->name), Z_STRVAL_P(name));
return;
}
@@ -5395,7 +5395,7 @@ ZEND_METHOD(reflection_property, getValue)
return;
}
if (Z_TYPE(CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset]) == IS_UNDEF) {
- php_error_docref(NULL, E_ERROR, "Internal error: Could not find the property %s::%s", intern->ce->name->val, ref->prop.name->val);
+ php_error_docref(NULL, E_ERROR, "Internal error: Could not find the property %s::%s", ZSTR_VAL(intern->ce->name), ZSTR_VAL(ref->prop.name));
/* Bails out */
}
ZVAL_DUP(return_value, &CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset]);
@@ -5432,7 +5432,7 @@ ZEND_METHOD(reflection_property, setValue)
if (!(ref->prop.flags & ZEND_ACC_PUBLIC) && intern->ignore_visibility == 0) {
name = _default_load_entry(getThis(), "name", sizeof("name")-1);
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Cannot access non-public member %s::%s", intern->ce->name->val, Z_STRVAL_P(name));
+ "Cannot access non-public member %s::%s", ZSTR_VAL(intern->ce->name), Z_STRVAL_P(name));
return;
}
@@ -5447,7 +5447,7 @@ ZEND_METHOD(reflection_property, setValue)
}
if (Z_TYPE(CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset]) == IS_UNDEF) {
- php_error_docref(NULL, E_ERROR, "Internal error: Could not find the property %s::%s", intern->ce->name->val, ref->prop.name->val);
+ php_error_docref(NULL, E_ERROR, "Internal error: Could not find the property %s::%s", ZSTR_VAL(intern->ce->name), ZSTR_VAL(ref->prop.name));
/* Bails out */
}
variable_ptr = &CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset];
@@ -5772,7 +5772,7 @@ static int add_extension_class(zval *zv, int num_args, va_list args, zend_hash_k
if ((ce->type == ZEND_INTERNAL_CLASS) && ce->info.internal.module && !strcasecmp(ce->info.internal.module->name, module->name)) {
zend_string *name;
- if (zend_binary_strcasecmp(ce->name->val, ce->name->len, hash_key->key->val, hash_key->key->len)) {
+ if (zend_binary_strcasecmp(ZSTR_VAL(ce->name), ZSTR_LEN(ce->name), ZSTR_VAL(hash_key->key), ZSTR_LEN(hash_key->key))) {
/* This is an class alias, use alias name */
name = hash_key->key;
} else {
@@ -5879,7 +5879,7 @@ ZEND_METHOD(reflection_extension, getDependencies)
}
relation = zend_string_alloc(len, 0);
- snprintf(relation->val, relation->len + 1, "%s%s%s%s%s",
+ snprintf(ZSTR_VAL(relation), ZSTR_LEN(relation) + 1, "%s%s%s%s%s",
rel_type,
dep->rel ? " " : "",
dep->rel ? dep->rel : "",
@@ -6551,7 +6551,7 @@ static void _reflection_write_property(zval *object, zval *member, zval *value,
|| (Z_STRLEN_P(member) == sizeof("class") - 1 && !memcmp(Z_STRVAL_P(member), "class", sizeof("class")))))
{
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Cannot set read-only property %s::$%s", Z_OBJCE_P(object)->name->val, Z_STRVAL_P(member));
+ "Cannot set read-only property %s::$%s", ZSTR_VAL(Z_OBJCE_P(object)->name), Z_STRVAL_P(member));
}
else
{