if (return_null) {
*p = NULL;
*pl = 0;
- if (UG(unicode)) {
- *type = IS_UNICODE;
- } else {
- *type = IS_STRING;
- }
+ *type = UG(unicode)?IS_UNICODE:IS_STRING;
break;
}
/* break omitted intentionally */
ZEND_API int add_assoc_unicodel_ex(zval *arg, char *key, uint key_len, void *str, uint length, int duplicate);
ZEND_API int add_assoc_zval_ex(zval *arg, char *key, uint key_len, zval *value);
+#define add_assoc_text_ex(arg, key, key_len, str, duplicate) \
+ if (UG(unicode)) { \
+ add_assoc_unicode_ex(arg, key, key_len, (UChar*)(str), duplicate); \
+ } else { \
+ add_assoc_string_ex(arg, key, key_len, (char*)(str), duplicate); \
+ }
+
+#define add_assoc_textl_ex(arg, key, key_len, str, length, duplicate) \
+ if (UG(unicode)) { \
+ add_assoc_unicodel_ex(arg, key, key_len, (UChar*)(str), length, duplicate); \
+ } else { \
+ add_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, duplicate); \
+ }
+
+#define add_assoc_ascii_string_ex(arg, key, key_len, str, duplicate) \
+ if (UG(unicode)) { \
+ uint length = strlen(str); \
+ UChar *u_str = zend_ascii_to_unicode((str), length+1 ZEND_FILE_LINE_CC); \
+ add_assoc_unicodel_ex(arg, key, key_len, u_str, length, 0); \
+ } else { \
+ add_assoc_string_ex(arg, key, key_len, (char*)(str), duplicate); \
+ }
+
+#define add_assoc_ascii_stringl_ex(arg, key, key_len, str, length, duplicate) \
+ if (UG(unicode)) { \
+ UChar *u_str = zend_ascii_to_unicode((str), (length)+1 ZEND_FILE_LINE_CC); \
+ add_assoc_unicodel_ex(arg, key, key_len, u_str, length, 0); \
+ } else { \
+ add_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, duplicate); \
+ }
+
#define add_assoc_long(__arg, __key, __n) add_assoc_long_ex(__arg, __key, strlen(__key)+1, __n)
#define add_assoc_null(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key) + 1)
#define add_assoc_bool(__arg, __key, __b) add_assoc_bool_ex(__arg, __key, strlen(__key)+1, __b)
#define add_assoc_unicodel(__arg, __key, __str, __length, __duplicate) add_assoc_unicodel_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate)
#define add_assoc_zval(__arg, __key, __value) add_assoc_zval_ex(__arg, __key, strlen(__key)+1, __value)
+#define add_assoc_text(arg, key, str, duplicate) \
+ if (UG(unicode)) { \
+ add_assoc_unicode(arg, key, (UChar*)(str), duplicate); \
+ } else { \
+ add_assoc_string(arg, key, (char*)(str), duplicate); \
+ }
+
+#define add_assoc_textl(arg, key, str, length, duplicate) \
+ if (UG(unicode)) { \
+ add_assoc_unicodel(arg, key, (UChar*)(str), length, duplicate); \
+ } else { \
+ add_assoc_stringl(arg, key, (char*)(str), length, duplicate); \
+ }
+
+#define add_assoc_ascii_string(arg, key, str, duplicate) \
+ if (UG(unicode)) { \
+ uint length = strlen(str); \
+ UChar *u_str = zend_ascii_to_unicode((str), length+1 ZEND_FILE_LINE_CC); \
+ add_assoc_unicodel(arg, key, u_str, length, 0); \
+ } else { \
+ add_assoc_string(arg, key, (char*)(str), duplicate); \
+ }
+
+#define add_assoc_ascii_stringl(arg, key, str, length, duplicate) \
+ if (UG(unicode)) { \
+ UChar *u_str = zend_ascii_to_unicode((str), (length)+1 ZEND_FILE_LINE_CC); \
+ add_assoc_unicodel(arg, key, u_str, length, 0); \
+ } else { \
+ add_assoc_stringl(arg, key, (char*)(str), length, duplicate); \
+ }
+
ZEND_API int add_u_assoc_zval_ex(zval *arg, zend_uchar type, void *key, uint key_len, zval *value);
#define add_u_assoc_zval(__arg, __type, __key, __value) add_u_assoc_zval_ex(__arg, __type, __key, (((__type)==IS_UNICODE)?u_strlen((UChar*)__key):strlen(__key))+1, __value)
ZEND_API int add_index_unicodel(zval *arg, uint idx, UChar *str, uint length, int duplicate);
ZEND_API int add_index_zval(zval *arg, uint index, zval *value);
+#define add_index_text(arg, idx, str, duplicate) \
+ if (UG(unicode)) { \
+ add_index_unicode(arg, idx, (UChar*)(str), duplicate); \
+ } else { \
+ add_index_string(arg, idx, (char*)(str), duplicate); \
+ }
+
+#define add_index_textl(arg, idx, str, length, duplicate) \
+ if (UG(unicode)) { \
+ add_index_unicodel(arg, idx, (UChar*)(str), length, duplicate); \
+ } else { \
+ add_index_stringl(arg, idx, (char*)(str), length, duplicate); \
+ }
+
+#define add_index_ascii_string(arg, idx, str, duplicate) \
+ if (UG(unicode)) { \
+ uint length = strlen(str); \
+ UChar *u_str = zend_ascii_to_unicode((str), length+1 ZEND_FILE_LINE_CC); \
+ add_index_unicodel(arg, idx, u_str, length, 0); \
+ } else { \
+ add_index_string(arg, idx, (char*)(str), duplicate); \
+ }
+
+#define add_index_ascii_stringl(arg, idx, str, length, duplicate) \
+ if (UG(unicode)) { \
+ UChar *u_str = zend_ascii_to_unicode((str), length+1 ZEND_FILE_LINE_CC); \
+ add_index_unicodel(arg, idx, u_str, length, 0); \
+ } else { \
+ add_index_stringl(arg, idx, (char*)(str), length, duplicate); \
+ }
+
ZEND_API int add_next_index_long(zval *arg, long n);
ZEND_API int add_next_index_null(zval *arg);
ZEND_API int add_next_index_bool(zval *arg, int b);
ZEND_API int add_next_index_unicodel(zval *arg, UChar *str, uint length, int duplicate);
ZEND_API int add_next_index_zval(zval *arg, zval *value);
+#define add_next_index_text(arg, str, duplicate) \
+ if (UG(unicode)) { \
+ add_next_index_unicode(arg, (UChar*)(str), duplicate); \
+ } else { \
+ add_next_index_string(arg, (char*)(str), duplicate); \
+ }
+
+#define add_next_index_textl(arg, str, length, duplicate) \
+ if (UG(unicode)) { \
+ add_next_index_unicodel(arg, (UChar*)(str), length, duplicate); \
+ } else { \
+ add_next_index_stringl(arg, (char*)(str), length, duplicate); \
+ }
+
+#define add_next_index_ascii_string(arg, str, duplicate) \
+ if (UG(unicode)) { \
+ uint length = strlen(str); \
+ UChar *u_str = zend_ascii_to_unicode((str), length+1 ZEND_FILE_LINE_CC); \
+ add_next_index_unicodel(arg, u_str, length, 0); \
+ } else { \
+ add_next_index_string(arg, (char*)(str), duplicate); \
+ }
+
+#define add_next_index_ascii_stringl(arg, str, length, duplicate) \
+ if (UG(unicode)) { \
+ UChar *u_str = zend_ascii_to_unicode((str), length+1 ZEND_FILE_LINE_CC); \
+ add_next_index_unicodel(arg, u_str, length, 0); \
+ } else { \
+ add_next_index_stringl(arg, (char*)(str), length, duplicate); \
+ }
+
ZEND_API int add_get_assoc_string_ex(zval *arg, char *key, uint key_len, char *str, void **dest, int duplicate);
ZEND_API int add_get_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, void **dest, int duplicate);
(z)->type = IS_STRING; \
}
+#define ZVAL_ASCII_STRING(z, s, duplicate) \
+ if (UG(unicode)) { \
+ uint length = strlen(s); \
+ UChar *u_str = zend_ascii_to_unicode((s), length+1 ZEND_FILE_LINE_CC); \
+ ZVAL_UNICODEL(z, u_str, length, 0); \
+ } else { \
+ char *__s=(s); \
+ (z)->value.str.len = strlen(__s); \
+ (z)->value.str.val = (duplicate?estrndup(__s, (z)->value.str.len):__s); \
+ (z)->type = IS_STRING; \
+ }
+
+#define ZVAL_ASCII_STRINGL(z, s, l, duplicate) \
+ if (UG(unicode)) { \
+ UChar *u_str = zend_ascii_to_unicode((s), (l)+1 ZEND_FILE_LINE_CC); \
+ ZVAL_UNICODEL(z, u_str, l, 0); \
+ } else { \
+ char *__s=(s); int __l=l; \
+ (z)->value.str.len = __l; \
+ (z)->value.str.val = (duplicate?estrndup(__s, __l):__s); \
+ (z)->type = IS_STRING; \
+ }
+
#define ZVAL_UNICODE(z, u, duplicate) { \
UChar *__u=(u); \
(z)->value.ustr.len = u_strlen(__u); \
(z)->refcount = refcount; \
}
+#define ZVAL_TEXT(z, t, duplicate) \
+ do { \
+ if (UG(unicode)) { \
+ ZVAL_UNICODE(z, t, duplicate); \
+ } else { \
+ ZVAL_STRING(z, t, duplicate); \
+ } \
+ } while (0);
+
+#define ZVAL_TEXTL(z, t, l, duplicate) \
+ do { \
+ if (UG(unicode)) { \
+ ZVAL_UNICODEL(z, t, l, duplicate); \
+ } else { \
+ ZVAL_STRINGL(z, t, l, duplicate); \
+ } \
+ } while (0);
+
+#define ZVAL_EMPTY_TEXT(z) \
+ if (UG(unicode)) { \
+ ZVAL_EMPTY_UNICODE(z); \
+ } else { \
+ ZVAL_EMPTY_STRING(z); \
+ }
+
#define ZVAL_FALSE(z) ZVAL_BOOL(z, 0)
#define ZVAL_TRUE(z) ZVAL_BOOL(z, 1)
#define RETVAL_DOUBLE(d) ZVAL_DOUBLE(return_value, d)
#define RETVAL_STRING(s, duplicate) ZVAL_STRING(return_value, s, duplicate)
#define RETVAL_STRINGL(s, l, duplicate) ZVAL_STRINGL(return_value, s, l, duplicate)
+#define RETVAL_ASCII_STRING(s, duplicate) ZVAL_ASCII_STRING(return_value, s, duplicate)
+#define RETVAL_ASCII_STRINGL(s, l, duplicate) ZVAL_ASCII_STRINGL(return_value, s, l, duplicate)
#define RETVAL_EMPTY_STRING() ZVAL_EMPTY_STRING(return_value)
#define RETVAL_UNICODE(u, duplicate) ZVAL_UNICODE(return_value, u, duplicate)
#define RETVAL_UNICODEL(u, l, duplicate) ZVAL_UNICODEL(return_value, u, l, duplicate)
#define RETVAL_ZVAL(zv, copy, dtor) ZVAL_ZVAL(return_value, zv, copy, dtor)
#define RETVAL_FALSE ZVAL_BOOL(return_value, 0)
#define RETVAL_TRUE ZVAL_BOOL(return_value, 1)
-#define RETVAL_TEXT(t, duplicate) \
- do { \
- if (UG(unicode)) { \
- RETVAL_UNICODE(t, duplicate); \
- } else { \
- RETVAL_STRING(t, duplicate); \
- } \
- } while (0);
-
-#define RETVAL_TEXTL(t, l, duplicate) \
- do { \
- if (UG(unicode)) { \
- RETVAL_UNICODEL(t, l, duplicate); \
- } else { \
- RETVAL_STRINGL(t, l, duplicate); \
- } \
- } while (0);
+#define RETVAL_TEXT(t, duplicate) ZVAL_TEXT(return_value, t, duplicate)
+#define RETVAL_TEXTL(t, l, duplicate) ZVAL_TEXTL(return_value, t, l, duplicate)
#define RETURN_RESOURCE(l) { RETVAL_RESOURCE(l); return; }
#define RETURN_BOOL(b) { RETVAL_BOOL(b); return; }
#define RETURN_TRUE { RETVAL_TRUE; return; }
#define RETURN_TEXT(t, duplicate) { RETVAL_TEXT(t, duplicate); return; }
#define RETURN_TEXTL(t, l, duplicate) { RETVAL_TEXTL(t, l, duplicate); return; }
+#define RETURN_ASCII_STRING(t, duplicate) { RETVAL_ASCII_STRING(t, duplicate); return; }
+#define RETURN_ASCII_STRINGL(t, l, duplicate) { RETVAL_ASCII_STRINGL(t, l, duplicate); return; }
#define SET_VAR_STRING(n, v) { \
{ \
Get the version of the Zend Engine */
ZEND_FUNCTION(zend_version)
{
- RETURN_STRINGL(ZEND_VERSION, sizeof(ZEND_VERSION)-1, 1);
+ RETURN_ASCII_STRINGL(ZEND_VERSION, sizeof(ZEND_VERSION)-1, 1);
}
/* }}} */
break;
default:
- if (UG(unicode)) {
- convert_to_unicode_ex(str);
- RETVAL_LONG(Z_USTRLEN_PP(str));
- } else {
- convert_to_string_ex(str);
- RETVAL_LONG(Z_STRLEN_PP(str));
- }
+ convert_to_text_ex(str);
+ RETVAL_LONG(Z_UNILEN_PP(str));
break;
}
}
break;
}
- if (Z_TYPE_PP(var) != IS_STRING && Z_TYPE_PP(var) != IS_UNICODE) {
- convert_to_string_ex(var);
+ if (Z_TYPE_PP(var) != (UG(unicode)?IS_UNICODE:IS_STRING)) {
+ convert_to_text_ex(var);
}
c.value = **val;
if (!ZEND_NUM_ARGS()) {
if (EG(scope)) {
- if (UG(unicode)) {
- RETURN_UNICODEL((UChar*)EG(scope)->name, EG(scope)->name_length, 1);
- } else {
- RETURN_STRINGL(EG(scope)->name, EG(scope)->name_length, 1);
- }
+ RETURN_TEXTL(EG(scope)->name, EG(scope)->name_length, 1);
} else {
zend_error(E_ERROR, "get_class() called without object from outside a class");
}
dup = zend_get_object_classname(*arg, &name, &name_len TSRMLS_CC);
- if (UG(unicode)) {
- RETURN_UNICODEL((UChar*)name, name_len, 0);
- } else {
- RETURN_STRINGL(name, name_len, 0);
- }
+ RETURN_TEXTL(name, name_len, 0);
}
/* }}} */
if (!ZEND_NUM_ARGS()) {
ce = EG(scope);
if (ce && ce->parent) {
- if (UG(unicode)) {
- RETURN_UNICODEL((UChar*)ce->parent->name, ce->parent->name_length, 1);
- } else {
- RETURN_STRINGL(ce->parent->name, ce->parent->name_length, 1);
- }
+ RETURN_TEXTL(ce->parent->name, ce->parent->name_length, 1);
} else {
RETURN_FALSE;
}
if (Z_TYPE_PP(arg) == IS_OBJECT) {
if (Z_OBJ_HT_PP(arg)->get_class_name
&& Z_OBJ_HT_PP(arg)->get_class_name(*arg, &name, &name_length, 1 TSRMLS_CC) == SUCCESS) {
- if (UG(unicode)) {
- RETURN_UNICODEL((UChar*)name, name_length, 0);
- } else{
- RETURN_STRINGL(name, name_length, 0);
- }
+ RETURN_TEXTL(name, name_length, 0);
} else {
ce = zend_get_class_entry(*arg TSRMLS_CC);
}
- } else if (Z_TYPE_PP(arg) == IS_STRING || Z_TYPE_PP(arg) == IS_UNICODE) {
+ } else if (Z_TYPE_PP(arg) == (UG(unicode)?IS_UNICODE:IS_STRING)) {
zend_class_entry **pce;
if (zend_u_lookup_class(Z_TYPE_PP(arg), Z_UNIVAL_PP(arg), Z_UNILEN_PP(arg), &pce TSRMLS_CC) == SUCCESS) {
}
if (ce && ce->parent) {
- if (UG(unicode)) {
- RETURN_UNICODEL((UChar*)ce->parent->name, ce->parent->name_length, 1);
- } else {
- RETURN_STRINGL(ce->parent->name, ce->parent->name_length, 1);
- }
+ RETURN_TEXTL(ce->parent->name, ce->parent->name_length, 1);
} else {
RETURN_FALSE;
}
ZEND_WRONG_PARAM_COUNT();
}
- if (only_subclass && Z_TYPE_PP(obj) == IS_STRING) {
+ if (only_subclass && Z_TYPE_PP(obj) == (UG(unicode)?IS_UNICODE:IS_STRING)) {
zend_class_entry **the_ce;
if (zend_u_lookup_class(Z_TYPE_PP(obj), Z_UNIVAL_PP(obj), Z_UNILEN_PP(obj), &the_ce TSRMLS_CC) == FAILURE) {
zend_error(E_WARNING, "Unknown class passed as parameter");
RETURN_FALSE;
}
- convert_to_string_ex(class_name);
+ convert_to_text_ex(class_name);
if (zend_u_lookup_class(Z_TYPE_PP(class_name), Z_UNIVAL_PP(class_name), Z_UNILEN_PP(class_name), &ce TSRMLS_CC) == FAILURE) {
retval = 0;
RETURN_FALSE;
}
ce = Z_OBJCE_PP(class);
- } else if (Z_TYPE_PP(class) == IS_STRING || Z_TYPE_PP(class) == IS_UNICODE) {
+ } else if (Z_TYPE_PP(class) == (UG(unicode)?IS_UNICODE:IS_STRING)) {
if (zend_u_lookup_class(Z_TYPE_PP(class), Z_UNIVAL_PP(class), Z_UNILEN_PP(class), &pce TSRMLS_CC) == SUCCESS) {
ce = *pce;
}
|| ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) &&
EG(scope) == mptr->common.scope)))) {
MAKE_STD_ZVAL(method_name);
- if (UG(unicode)) {
- ZVAL_UNICODE(method_name, (UChar*)mptr->common.function_name, 1);
- } else {
- ZVAL_STRING(method_name, mptr->common.function_name, 1);
- }
+ ZVAL_TEXT(method_name, mptr->common.function_name, 1);
zend_hash_next_index_insert(return_value->value.ht, &method_name, sizeof(zval *), NULL);
}
zend_hash_move_forward_ex(&ce->function_table, &pos);
}
if (Z_TYPE_PP(klass) == IS_OBJECT) {
ce = Z_OBJCE_PP(klass);
- } else if (Z_TYPE_PP(klass) == IS_STRING || Z_TYPE_PP(klass) == IS_UNICODE) {
+ } else if (Z_TYPE_PP(klass) == (UG(unicode)?IS_UNICODE:IS_STRING)) {
if (zend_u_lookup_class(Z_TYPE_PP(klass), Z_UNIVAL_PP(klass), Z_UNILEN_PP(klass), &pce TSRMLS_CC) == FAILURE) {
RETURN_FALSE;
}
ZEND_WRONG_PARAM_COUNT();
}
- if (Z_TYPE_PP(property) != IS_UNICODE && (UG(unicode) || (Z_TYPE_PP(property) != IS_STRING))) {
+ if (Z_TYPE_PP(property) != (UG(unicode)?IS_UNICODE:IS_STRING)) {
convert_to_text_ex(property);
}
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &function_name)==FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
- convert_to_string_ex(function_name);
+ convert_to_text_ex(function_name);
lcname = zend_u_str_case_fold(Z_TYPE_PP(function_name), Z_UNIVAL_PP(function_name), Z_UNILEN_PP(function_name), 1, &lcname_len);
retval = (zend_u_hash_find(EG(function_table), Z_TYPE_PP(function_name), lcname, lcname_len+1, (void **)&func) == SUCCESS);
(hash_key->type == IS_UNICODE && hash_key->u.unicode[0] != 0) ||
(hash_key->type == IS_STRING && hash_key->u.string[0] != 0))
&& (comply_mask == (ce->ce_flags & mask))) {
- if (UG(unicode)) {
- add_next_index_unicodel(array, (UChar*)ce->name, ce->name_length, 1);
- } else {
- add_next_index_stringl(array, ce->name, ce->name_length, 1);
- }
+ add_next_index_textl(array, ce->name, ce->name_length, 1);
}
return ZEND_HASH_APPLY_KEEP;
}
function_name_length = strlen(function_name+1)+1;
} while (zend_hash_add(EG(function_table), function_name, function_name_length+1, &new_function, sizeof(zend_function), NULL)==FAILURE);
zend_hash_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME));
- RETURN_STRINGL(function_name, function_name_length, 0);
+ RETVAL_ASCII_STRINGL(function_name, function_name_length, 0);
+ if (UG(unicode)) {
+ efree(function_name);
+ }
} else {
RETURN_FALSE;
}
resource_type = zend_rsrc_list_get_rsrc_type(Z_LVAL_PP(z_resource_type) TSRMLS_CC);
if (resource_type) {
- RETURN_STRING(resource_type, 1);
+ RETURN_ASCII_STRING(resource_type, 1);
} else {
- RETURN_STRING("Unknown", 1);
+ RETURN_ASCII_STRING("Unknown", 1);
}
}
/* }}} */
static int add_extension_info(zend_module_entry *module, void *arg TSRMLS_DC)
{
zval *name_array = (zval *)arg;
- add_next_index_string(name_array, module->name, 1);
+ add_next_index_ascii_string(name_array, module->name, 1);
return 0;
}
function_name = ptr->function_state.function->common.function_name;
if (function_name) {
- if (UG(unicode)) {
- add_assoc_unicode_ex(stack_frame, "function", sizeof("function"), function_name, 1);
- } else {
- add_assoc_string_ex(stack_frame, "function", sizeof("function"), function_name, 1);
- }
+ add_assoc_text_ex(stack_frame, "function", sizeof("function"), function_name, 1);
if (ptr->object && Z_TYPE_P(ptr->object) == IS_OBJECT) {
if (ptr->function_state.function->common.scope) {
- if (UG(unicode)) {
- add_assoc_unicode_ex(stack_frame, "class", sizeof("class"), ptr->function_state.function->common.scope->name, 1);
- } else {
- add_assoc_string_ex(stack_frame, "class", sizeof("class"), ptr->function_state.function->common.scope->name, 1);
- }
+ add_assoc_textl_ex(stack_frame, "class", sizeof("class"), ptr->function_state.function->common.scope->name, ptr->function_state.function->common.scope->name_length, 1);
} else {
zend_uint class_name_len;
int dup;
dup = zend_get_object_classname(ptr->object, &class_name, &class_name_len TSRMLS_CC);
- if (UG(unicode)) {
- add_assoc_unicode_ex(stack_frame, "class", sizeof("class"), class_name, dup);
- } else {
- add_assoc_string_ex(stack_frame, "class", sizeof("class"), class_name, dup);
- }
+ add_assoc_text_ex(stack_frame, "class", sizeof("class"), class_name, dup);
}
- add_assoc_string_ex(stack_frame, "type", sizeof("type"), "->", 1);
+ add_assoc_ascii_string_ex(stack_frame, "type", sizeof("type"), "->", 1);
} else if (ptr->function_state.function->common.scope) {
- if (UG(unicode)) {
- add_assoc_unicode_ex(stack_frame, "class", sizeof("class"), ptr->function_state.function->common.scope->name, 1);
- } else {
- add_assoc_string_ex(stack_frame, "class", sizeof("class"), ptr->function_state.function->common.scope->name, 1);
- }
- add_assoc_string_ex(stack_frame, "type", sizeof("type"), "::", 1);
+ add_assoc_textl_ex(stack_frame, "class", sizeof("class"), ptr->function_state.function->common.scope->name, ptr->function_state.function->common.scope->name_length, 1);
+ add_assoc_ascii_string_ex(stack_frame, "type", sizeof("type"), "::", 1);
}
if ((! ptr->opline) || ((ptr->opline->opcode == ZEND_DO_FCALL_BY_NAME) || (ptr->opline->opcode == ZEND_DO_FCALL))) {
add_assoc_zval_ex(stack_frame, "args", sizeof("args"), arg_array);
}
- add_assoc_string_ex(stack_frame, "function", sizeof("function"), function_name, 1);
+ add_assoc_ascii_string_ex(stack_frame, "function", sizeof("function"), function_name, 1);
}
add_next_index_zval(return_value, stack_frame);
array_init(return_value);
while (func->fname) {
- add_next_index_string(return_value, func->fname, 1);
+ add_next_index_ascii_string(return_value, func->fname, 1);
func++;
}
}
opline.result.u.EA.type = 0;
opline.result.u.var = get_temporary_variable(CG(active_op_array));
opline.op1.op_type = IS_CONST;
- if (UG(unicode)) {
- opline.op1.u.constant.type = IS_UNICODE;
- Z_USTRVAL(opline.op1.u.constant) = eustrndup((UChar*)CG(active_op_array)->vars[result->u.var].name, CG(active_op_array)->vars[result->u.var].name_len);
- Z_USTRLEN(opline.op1.u.constant) = CG(active_op_array)->vars[result->u.var].name_len;
- } else {
- opline.op1.u.constant.type = IS_STRING;
- Z_STRVAL(opline.op1.u.constant) = estrndup(CG(active_op_array)->vars[result->u.var].name, CG(active_op_array)->vars[result->u.var].name_len);
- Z_STRLEN(opline.op1.u.constant) = CG(active_op_array)->vars[result->u.var].name_len;
- }
+ ZVAL_TEXTL(&opline.op1.u.constant,
+ CG(active_op_array)->vars[result->u.var].name,
+ CG(active_op_array)->vars[result->u.var].name_len, 1);
SET_UNUSED(opline.op2);
opline.op2 = *class_znode;
opline.op2.u.EA.type = ZEND_FETCH_STATIC_MEMBER;
opline.result.u.EA.type = 0;
opline.result.u.var = get_temporary_variable(CG(active_op_array));
opline.op1.op_type = IS_CONST;
- if (UG(unicode)) {
- opline.op1.u.constant.type = IS_UNICODE;
- Z_USTRVAL(opline.op1.u.constant) = eustrndup((UChar*)CG(active_op_array)->vars[opline_ptr->op1.u.var].name, CG(active_op_array)->vars[opline_ptr->op1.u.var].name_len);
- Z_USTRLEN(opline.op1.u.constant) = CG(active_op_array)->vars[opline_ptr->op1.u.var].name_len;
- } else {
- opline.op1.u.constant.type = IS_STRING;
- Z_STRVAL(opline.op1.u.constant) = estrndup(CG(active_op_array)->vars[opline_ptr->op1.u.var].name, CG(active_op_array)->vars[opline_ptr->op1.u.var].name_len);
- Z_STRLEN(opline.op1.u.constant) = CG(active_op_array)->vars[opline_ptr->op1.u.var].name_len;
- }
+ ZVAL_TEXTL(&opline.op1.u.constant,
+ CG(active_op_array)->vars[opline_ptr->op1.u.var].name,
+ CG(active_op_array)->vars[opline_ptr->op1.u.var].name_len, 1);
SET_UNUSED(opline.op2);
opline.op2 = *class_znode;
opline.op2.u.EA.type = ZEND_FETCH_STATIC_MEMBER;
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
opline->opcode = ZEND_UNSET_VAR;
opline->op1.op_type = IS_CONST;
- if (UG(unicode)) {
- opline->op1.u.constant.type = IS_UNICODE;
- Z_USTRLEN(opline->op1.u.constant) = CG(active_op_array)->vars[variable->u.var].name_len;
- Z_USTRVAL(opline->op1.u.constant) = eustrndup((UChar*)CG(active_op_array)->vars[variable->u.var].name, CG(active_op_array)->vars[variable->u.var].name_len);
- } else {
- opline->op1.u.constant.type = IS_STRING;
- Z_STRLEN(opline->op1.u.constant) = CG(active_op_array)->vars[variable->u.var].name_len;
- Z_STRVAL(opline->op1.u.constant) = estrndup(CG(active_op_array)->vars[variable->u.var].name, CG(active_op_array)->vars[variable->u.var].name_len);
- }
+ ZVAL_TEXTL(&opline->op1.u.constant,
+ CG(active_op_array)->vars[variable->u.var].name,
+ CG(active_op_array)->vars[variable->u.var].name_len, 1);
SET_UNUSED(opline->op2);
opline->op2.u.EA.type = ZEND_FETCH_LOCAL;
SET_UNUSED(opline->result);
last_op = get_next_op(CG(active_op_array) TSRMLS_CC);
last_op->opcode = ZEND_ISSET_ISEMPTY_VAR;
last_op->op1.op_type = IS_CONST;
- if (UG(unicode)) {
- last_op->op1.u.constant.type = IS_UNICODE;
- Z_USTRLEN(last_op->op1.u.constant) = CG(active_op_array)->vars[variable->u.var].name_len;
- Z_USTRVAL(last_op->op1.u.constant) = eustrndup((UChar*)CG(active_op_array)->vars[variable->u.var].name, CG(active_op_array)->vars[variable->u.var].name_len);
- } else {
- last_op->op1.u.constant.type = IS_STRING;
- Z_STRLEN(last_op->op1.u.constant) = CG(active_op_array)->vars[variable->u.var].name_len;
- Z_STRVAL(last_op->op1.u.constant) = estrndup(CG(active_op_array)->vars[variable->u.var].name, CG(active_op_array)->vars[variable->u.var].name_len);
- }
+ ZVAL_TEXTL(&last_op->op1.u.constant,
+ CG(active_op_array)->vars[variable->u.var].name,
+ CG(active_op_array)->vars[variable->u.var].name_len, 1);
SET_UNUSED(last_op->op2);
last_op->op2.u.EA.type = ZEND_FETCH_LOCAL;
last_op->result.u.var = get_temporary_variable(CG(active_op_array));
if (function_name) {
return function_name;
- } else if (UG(unicode)) {
- return (char*) u_main;
} else {
- return "main";
+ return UG(unicode)?(char*)u_main:"main";
}
}
break;
class_name = CG(active_class_entry)->name;
}
- if (UG(unicode)) {
- if (!class_name) {
- zendlval->value.ustr.len = 0;
- zendlval->value.ustr.val = USTR_MAKE("");
- } else {
- zendlval->value.ustr.len = u_strlen((UChar*)class_name);
- zendlval->value.ustr.val = eustrndup((UChar*)class_name, zendlval->value.ustr.len);
- }
- zendlval->type = IS_UNICODE;
+ if (!class_name) {
+ ZVAL_EMPTY_TEXT(zendlval);
} else {
- if (!class_name) {
- zendlval->value.str.len = 0;
- zendlval->value.str.val = estrndup("", 0);
- } else {
- zendlval->value.str.len = strlen(class_name);
- zendlval->value.str.val = estrndup(class_name, zendlval->value.str.len);
- }
- zendlval->type = IS_STRING;
+ ZVAL_TEXT(zendlval, class_name, 1);
}
return T_CLASS_C;
}
if (!func_name) {
func_name = "";
}
- if (UG(unicode)) {
- if (!func_name) {
- zendlval->value.ustr.len = 0;
- zendlval->value.ustr.val = USTR_MAKE("");
- } else {
- zendlval->value.ustr.len = u_strlen((UChar*)func_name);
- zendlval->value.ustr.val = eustrndup((UChar*)func_name, zendlval->value.ustr.len);
- }
- zendlval->type = IS_UNICODE;
+ if (!func_name) {
+ ZVAL_EMPTY_TEXT(zendlval);
} else {
- if (!func_name) {
- zendlval->value.str.len = 0;
- zendlval->value.str.val = estrndup("", 0);
- } else {
- zendlval->value.str.len = strlen(func_name);
- zendlval->value.str.val = estrndup(func_name, zendlval->value.str.len);
- }
- zendlval->type = IS_STRING;
+ ZVAL_TEXT(zendlval, func_name, 1);
}
return T_FUNC_C;
}
}
-ZEND_API int zend_check_property_access(zend_object *zobj, char *prop_info_name TSRMLS_DC)
+ZEND_API int zend_check_property_access(zend_object *zobj, zend_uchar utype, void *prop_info_name TSRMLS_DC)
{
zend_property_info *property_info;
char *class_name, *prop_name;
zval member;
- zend_uchar utype = UG(unicode)?IS_UNICODE:IS_STRING;
zend_u_unmangle_property_name(utype, prop_info_name, &class_name, &prop_name);
if (utype == IS_UNICODE) {
ALLOC_ZVAL(method_name_ptr);
INIT_PZVAL(method_name_ptr);
- if (UG(unicode)) {
- ZVAL_UNICODE(method_name_ptr, (UChar*)func->function_name, 0); /* no dup - it's a copy */
- } else {
- ZVAL_STRING(method_name_ptr, func->function_name, 0); /* no dup - it's a copy */
- }
+ ZVAL_TEXT(method_name_ptr, func->function_name, 0); /* no dup - it's a copy */
/* __call handler is called with two arguments:
method name
if (!zend_hash_exists(&Z_OBJCE_P(readobj)->function_table, "__tostring", sizeof("__tostring"))) {
return FAILURE;
}
- if (UG(unicode)) {
- ZVAL_UNICODE(&fname, USTR_MAKE("__tostring"), 0);
- } else {
- ZVAL_STRING(&fname, "__tostring", 0);
- }
+ ZVAL_ASCII_STRING(&fname, "__tostring", 0);
if (call_user_function_ex(NULL, &readobj, &fname, &retval, 0, NULL, 0, NULL TSRMLS_CC) == SUCCESS) {
if (UG(unicode)) {
zval_dtor(&fname);
}
if (retval) {
- if (Z_TYPE_P(retval) != IS_STRING && Z_TYPE_P(retval) != IS_UNICODE) {
+ if (Z_TYPE_P(retval) != (UG(unicode)?IS_UNICODE:IS_STRING)) {
zend_error(E_ERROR, "Method %v::__toString() must return a string value", Z_OBJCE_P(readobj)->name);
}
} else {
MAKE_STD_ZVAL(retval);
- ZVAL_STRINGL(retval, "", 0, 1);
+ ZVAL_ASCII_STRINGL(retval, "", 0, 1);
}
*writeobj = *retval;
zval_copy_ctor(writeobj);
ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope);
-ZEND_API int zend_check_property_access(zend_object *zobj, char *prop_info_name TSRMLS_DC);
+ZEND_API int zend_check_property_access(zend_object *zobj, zend_uchar utype, void *prop_info_name TSRMLS_DC);
ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS);
END_EXTERN_C()
zval *name;
MAKE_STD_ZVAL(name);
- if (UG(unicode)) {
- ZVAL_UNICODEL(name, (UChar*)ce->name, ce->name_length, 1);
- } else {
- ZVAL_STRINGL(name, ce->name, ce->name_length, 1);
- }
+ ZVAL_TEXTL(name, ce->name, ce->name_length, 1);
reflection_instanciate(U_CLASS_ENTRY(reflection_class_ptr), object TSRMLS_CC);
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
intern->ptr = ce;
MAKE_STD_ZVAL(name);
if (arg_info->name) {
- if (UG(unicode)) {
- ZVAL_UNICODEL(name, (UChar*)arg_info->name, arg_info->name_len, 1);
- } else {
- ZVAL_STRINGL(name, arg_info->name, arg_info->name_len, 1);
- }
+ ZVAL_TEXTL(name, arg_info->name, arg_info->name_len, 1);
} else {
ZVAL_NULL(name);
}
zval *name;
MAKE_STD_ZVAL(name);
- if (UG(unicode)) {
- ZVAL_UNICODE(name, (UChar*)function->common.function_name, 1);
- } else {
- ZVAL_STRING(name, function->common.function_name, 1);
- }
+ ZVAL_TEXT(name, function->common.function_name, 1);
reflection_instanciate(U_CLASS_ENTRY(reflection_function_ptr), object TSRMLS_CC);
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
MAKE_STD_ZVAL(name);
MAKE_STD_ZVAL(classname);
- if (UG(unicode)) {
- ZVAL_UNICODE(name, (UChar*)method->common.function_name, 1);
- ZVAL_UNICODEL(classname, (UChar*)ce->name, ce->name_length, 1);
- } else {
- ZVAL_STRING(name, method->common.function_name, 1);
- ZVAL_STRINGL(classname, ce->name, ce->name_length, 1);
- }
+ ZVAL_TEXT(name, method->common.function_name, 1);
+ ZVAL_TEXTL(classname, ce->name, ce->name_length, 1);
reflection_instanciate(U_CLASS_ENTRY(reflection_method_ptr), object TSRMLS_CC);
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
intern->ptr = method;
MAKE_STD_ZVAL(name);
MAKE_STD_ZVAL(classname);
- if (UG(unicode)) {
- ZVAL_UNICODE(name, (UChar*)prop_name, 1);
- ZVAL_UNICODEL(classname, (UChar*)ce->name, ce->name_length, 1);
- } else {
- ZVAL_STRING(name, prop_name, 1);
- ZVAL_STRINGL(classname, ce->name, ce->name_length, 1);
- }
+ ZVAL_TEXT(name, prop_name, 1);
+ ZVAL_TEXTL(classname, ce->name, ce->name_length, 1);
reflection_instanciate(U_CLASS_ENTRY(reflection_property_ptr), object TSRMLS_CC);
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
}
efree(lcname);
MAKE_STD_ZVAL(name);
- if (UG(unicode)) {
- ZVAL_UNICODE(name, (UChar*)fptr->common.function_name, 1);
- } else {
- ZVAL_STRING(name, fptr->common.function_name, 1);
- }
+ ZVAL_TEXT(name, fptr->common.function_name, 1);
zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &name, sizeof(zval *), NULL);
intern->ptr = fptr;
intern->free_ptr = 0;
MAKE_STD_ZVAL(name);
if (arg_info[position].name) {
- if (UG(unicode)) {
- ZVAL_UNICODEL(name, (UChar*)arg_info[position].name, arg_info[position].name_len, 1);
- } else {
- ZVAL_STRINGL(name, arg_info[position].name, arg_info[position].name_len, 1);
- }
+ ZVAL_TEXTL(name, arg_info[position].name, arg_info[position].name_len, 1);
} else {
ZVAL_NULL(name);
}
}
MAKE_STD_ZVAL(classname);
- if (UG(unicode)) {
- ZVAL_UNICODEL(classname, (UChar*)ce->name, ce->name_length, 1);
- } else {
- ZVAL_STRINGL(classname, ce->name, ce->name_length, 1);
- }
+ ZVAL_TEXTL(classname, ce->name, ce->name_length, 1);
+
zend_hash_update(Z_OBJPROP_P(object), "class", sizeof("class"), (void **) &classname, sizeof(zval *), NULL);
lcname = zend_u_str_case_fold(type, name_str, name_len, 1, &lcname_len);
efree(lcname);
MAKE_STD_ZVAL(name);
- if (UG(unicode)) {
- ZVAL_UNICODE(name, (UChar*)mptr->common.function_name, 1);
- } else {
- ZVAL_STRING(name, mptr->common.function_name, 1);
- }
+ ZVAL_TEXT(name, mptr->common.function_name, 1);
zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &name, sizeof(zval *), NULL);
intern->ptr = mptr;
intern->free_ptr = 0;
if (Z_TYPE_P(argument) == IS_OBJECT) {
MAKE_STD_ZVAL(classname);
- if (UG(unicode)) {
- ZVAL_UNICODEL(classname, (UChar*)Z_OBJCE_P(argument)->name, Z_OBJCE_P(argument)->name_length, 1);
- } else {
- ZVAL_STRINGL(classname, Z_OBJCE_P(argument)->name, Z_OBJCE_P(argument)->name_length, 1);
- }
+ ZVAL_TEXTL(classname, Z_OBJCE_P(argument)->name, Z_OBJCE_P(argument)->name_length, 1);
zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &classname, sizeof(zval *), NULL);
intern->ptr = Z_OBJCE_P(argument);
if (is_object) {
}
MAKE_STD_ZVAL(classname);
- if (UG(unicode)) {
- ZVAL_UNICODEL(classname, (UChar*)((*ce)->name), (*ce)->name_length, 1);
- } else {
- ZVAL_STRINGL(classname, (*ce)->name, (*ce)->name_length, 1);
- }
+ ZVAL_TEXTL(classname, (*ce)->name, (*ce)->name_length, 1);
zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &classname, sizeof(zval *), NULL);
intern->ptr = *ce;
}
MAKE_STD_ZVAL(classname);
- if (UG(unicode)) {
- ZVAL_UNICODEL(classname, (UChar*)ce->name, ce->name_length, 1);
- } else {
- ZVAL_STRINGL(classname, ce->name, ce->name_length, 1);
- }
+ ZVAL_TEXTL(classname, ce->name, ce->name_length, 1);
zend_hash_update(Z_OBJPROP_P(object), "class", sizeof("class"), (void **) &classname, sizeof(zval *), NULL);
zend_u_unmangle_property_name(UG(unicode)?IS_UNICODE:IS_STRING, property_info->name, &class_name, &prop_name);
MAKE_STD_ZVAL(propname);
- if (UG(unicode)) {
- ZVAL_UNICODE(propname, (UChar*)prop_name, 1);
- } else {
- ZVAL_STRING(propname, prop_name, 1);
- }
+ ZVAL_TEXT(propname, prop_name, 1);
zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &propname, sizeof(zval *), NULL);
reference = (property_reference*) emalloc(sizeof(property_reference));
key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL);
if (key_type != HASH_KEY_NON_EXISTANT &&
- zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS) {
+ zend_check_property_access(zobj, key_type == HASH_KEY_IS_UNICODE?IS_UNICODE:IS_STRING, str_key TSRMLS_CC) == SUCCESS) {
break;
}
zend_hash_move_forward(fe_ht);
key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL);
zend_hash_move_forward(fe_ht);
- } while (key_type == HASH_KEY_NON_EXISTANT || zend_check_property_access(zobj, str_key TSRMLS_CC) != SUCCESS);
+ } while (key_type == HASH_KEY_NON_EXISTANT || zend_check_property_access(zobj, key_type == HASH_KEY_IS_UNICODE?IS_UNICODE:IS_STRING, str_key TSRMLS_CC) != SUCCESS);
if (use_key) {
zend_u_unmangle_property_name(key_type == HASH_KEY_IS_UNICODE?IS_UNICODE:IS_STRING, str_key, &class_name, &prop_name);
if (key_type == HASH_KEY_IS_UNICODE) {
key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL);
if (key_type != HASH_KEY_NON_EXISTANT &&
- zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS) {
+ zend_check_property_access(zobj, key_type == HASH_KEY_IS_UNICODE?IS_UNICODE:IS_STRING, str_key TSRMLS_CC) == SUCCESS) {
break;
}
zend_hash_move_forward(fe_ht);
key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL);
if (key_type != HASH_KEY_NON_EXISTANT &&
- zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS) {
+ zend_check_property_access(zobj, key_type == HASH_KEY_IS_UNICODE?IS_UNICODE:IS_STRING, str_key TSRMLS_CC) == SUCCESS) {
break;
}
zend_hash_move_forward(fe_ht);
key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL);
if (key_type != HASH_KEY_NON_EXISTANT &&
- zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS) {
+ zend_check_property_access(zobj, key_type == HASH_KEY_IS_UNICODE?IS_UNICODE:IS_STRING, str_key TSRMLS_CC) == SUCCESS) {
break;
}
zend_hash_move_forward(fe_ht);
key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL);
zend_hash_move_forward(fe_ht);
- } while (key_type == HASH_KEY_NON_EXISTANT || zend_check_property_access(zobj, str_key TSRMLS_CC) != SUCCESS);
+ } while (key_type == HASH_KEY_NON_EXISTANT || zend_check_property_access(zobj, key_type == HASH_KEY_IS_UNICODE?IS_UNICODE:IS_STRING, str_key TSRMLS_CC) != SUCCESS);
if (use_key) {
zend_u_unmangle_property_name(key_type == HASH_KEY_IS_UNICODE?IS_UNICODE:IS_STRING, str_key, &class_name, &prop_name);
if (key_type == HASH_KEY_IS_UNICODE) {
key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL);
if (key_type != HASH_KEY_NON_EXISTANT &&
- zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS) {
+ zend_check_property_access(zobj, key_type == HASH_KEY_IS_UNICODE?IS_UNICODE:IS_STRING, str_key TSRMLS_CC) == SUCCESS) {
break;
}
zend_hash_move_forward(fe_ht);
zval *name;
MAKE_STD_ZVAL(name);
- if (UG(unicode)) {
- ZVAL_UNICODEL(name, (UChar*)ce->name, ce->name_length, 1);
- } else {
- ZVAL_STRINGL(name, ce->name, ce->name_length, 1);
- }
+ ZVAL_TEXTL(name, ce->name, ce->name_length, 1);
reflection_instanciate(U_CLASS_ENTRY(reflection_class_ptr), object TSRMLS_CC);
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
intern->ptr = ce;
MAKE_STD_ZVAL(name);
if (arg_info->name) {
- if (UG(unicode)) {
- ZVAL_UNICODEL(name, (UChar*)arg_info->name, arg_info->name_len, 1);
- } else {
- ZVAL_STRINGL(name, arg_info->name, arg_info->name_len, 1);
- }
+ ZVAL_TEXTL(name, arg_info->name, arg_info->name_len, 1);
} else {
ZVAL_NULL(name);
}
zval *name;
MAKE_STD_ZVAL(name);
- if (UG(unicode)) {
- ZVAL_UNICODE(name, (UChar*)function->common.function_name, 1);
- } else {
- ZVAL_STRING(name, function->common.function_name, 1);
- }
+ ZVAL_TEXT(name, function->common.function_name, 1);
reflection_instanciate(U_CLASS_ENTRY(reflection_function_ptr), object TSRMLS_CC);
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
MAKE_STD_ZVAL(name);
MAKE_STD_ZVAL(classname);
- if (UG(unicode)) {
- ZVAL_UNICODE(name, (UChar*)method->common.function_name, 1);
- ZVAL_UNICODEL(classname, (UChar*)ce->name, ce->name_length, 1);
- } else {
- ZVAL_STRING(name, method->common.function_name, 1);
- ZVAL_STRINGL(classname, ce->name, ce->name_length, 1);
- }
+ ZVAL_TEXT(name, method->common.function_name, 1);
+ ZVAL_TEXTL(classname, ce->name, ce->name_length, 1);
reflection_instanciate(U_CLASS_ENTRY(reflection_method_ptr), object TSRMLS_CC);
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
intern->ptr = method;
MAKE_STD_ZVAL(name);
MAKE_STD_ZVAL(classname);
- if (UG(unicode)) {
- ZVAL_UNICODE(name, (UChar*)prop_name, 1);
- ZVAL_UNICODEL(classname, (UChar*)ce->name, ce->name_length, 1);
- } else {
- ZVAL_STRING(name, prop_name, 1);
- ZVAL_STRINGL(classname, ce->name, ce->name_length, 1);
- }
+ ZVAL_TEXT(name, prop_name, 1);
+ ZVAL_TEXTL(classname, ce->name, ce->name_length, 1);
reflection_instanciate(U_CLASS_ENTRY(reflection_property_ptr), object TSRMLS_CC);
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
}
efree(lcname);
MAKE_STD_ZVAL(name);
- if (UG(unicode)) {
- ZVAL_UNICODE(name, (UChar*)fptr->common.function_name, 1);
- } else {
- ZVAL_STRING(name, fptr->common.function_name, 1);
- }
+ ZVAL_TEXT(name, fptr->common.function_name, 1);
zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &name, sizeof(zval *), NULL);
intern->ptr = fptr;
intern->free_ptr = 0;
MAKE_STD_ZVAL(name);
if (arg_info[position].name) {
- if (UG(unicode)) {
- ZVAL_UNICODEL(name, (UChar*)arg_info[position].name, arg_info[position].name_len, 1);
- } else {
- ZVAL_STRINGL(name, arg_info[position].name, arg_info[position].name_len, 1);
- }
+ ZVAL_TEXTL(name, arg_info[position].name, arg_info[position].name_len, 1);
} else {
ZVAL_NULL(name);
}
}
MAKE_STD_ZVAL(classname);
- if (UG(unicode)) {
- ZVAL_UNICODEL(classname, (UChar*)ce->name, ce->name_length, 1);
- } else {
- ZVAL_STRINGL(classname, ce->name, ce->name_length, 1);
- }
+ ZVAL_TEXTL(classname, ce->name, ce->name_length, 1);
+
zend_hash_update(Z_OBJPROP_P(object), "class", sizeof("class"), (void **) &classname, sizeof(zval *), NULL);
lcname = zend_u_str_case_fold(type, name_str, name_len, 1, &lcname_len);
efree(lcname);
MAKE_STD_ZVAL(name);
- if (UG(unicode)) {
- ZVAL_UNICODE(name, (UChar*)mptr->common.function_name, 1);
- } else {
- ZVAL_STRING(name, mptr->common.function_name, 1);
- }
+ ZVAL_TEXT(name, mptr->common.function_name, 1);
zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &name, sizeof(zval *), NULL);
intern->ptr = mptr;
intern->free_ptr = 0;
if (Z_TYPE_P(argument) == IS_OBJECT) {
MAKE_STD_ZVAL(classname);
- if (UG(unicode)) {
- ZVAL_UNICODEL(classname, (UChar*)Z_OBJCE_P(argument)->name, Z_OBJCE_P(argument)->name_length, 1);
- } else {
- ZVAL_STRINGL(classname, Z_OBJCE_P(argument)->name, Z_OBJCE_P(argument)->name_length, 1);
- }
+ ZVAL_TEXTL(classname, Z_OBJCE_P(argument)->name, Z_OBJCE_P(argument)->name_length, 1);
zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &classname, sizeof(zval *), NULL);
intern->ptr = Z_OBJCE_P(argument);
if (is_object) {
}
MAKE_STD_ZVAL(classname);
- if (UG(unicode)) {
- ZVAL_UNICODEL(classname, (UChar*)((*ce)->name), (*ce)->name_length, 1);
- } else {
- ZVAL_STRINGL(classname, (*ce)->name, (*ce)->name_length, 1);
- }
+ ZVAL_TEXTL(classname, (*ce)->name, (*ce)->name_length, 1);
zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &classname, sizeof(zval *), NULL);
intern->ptr = *ce;
}
MAKE_STD_ZVAL(classname);
- if (UG(unicode)) {
- ZVAL_UNICODEL(classname, (UChar*)ce->name, ce->name_length, 1);
- } else {
- ZVAL_STRINGL(classname, ce->name, ce->name_length, 1);
- }
+ ZVAL_TEXTL(classname, ce->name, ce->name_length, 1);
zend_hash_update(Z_OBJPROP_P(object), "class", sizeof("class"), (void **) &classname, sizeof(zval *), NULL);
zend_u_unmangle_property_name(UG(unicode)?IS_UNICODE:IS_STRING, property_info->name, &class_name, &prop_name);
MAKE_STD_ZVAL(propname);
- if (UG(unicode)) {
- ZVAL_UNICODE(propname, (UChar*)prop_name, 1);
- } else {
- ZVAL_STRING(propname, prop_name, 1);
- }
+ ZVAL_TEXT(propname, prop_name, 1);
zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &propname, sizeof(zval *), NULL);
reference = (property_reference*) emalloc(sizeof(property_reference));