mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
Refactored ZVAL flags usage to simplify various checks (e.g. Z_REFCOUNTED(), candidate for GC, etc)
This commit is contained in:
parent
d8099d0468
commit
76cc99fe60
15
Zend/zend.c
15
Zend/zend.c
@ -236,14 +236,14 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop
|
||||
again:
|
||||
switch (Z_TYPE_P(expr)) {
|
||||
case IS_NULL:
|
||||
Z_STR_P(expr_copy) = STR_EMPTY_ALLOC();
|
||||
ZVAL_EMPTY_STRING(expr_copy);
|
||||
break;
|
||||
case IS_BOOL:
|
||||
if (Z_LVAL_P(expr)) {
|
||||
// TODO: ??? use interned string
|
||||
Z_STR_P(expr_copy) = STR_INIT("1", 1, 0);
|
||||
ZVAL_NEW_STR(expr_copy, STR_INIT("1", 1, 0));
|
||||
} else {
|
||||
Z_STR_P(expr_copy) = STR_EMPTY_ALLOC();
|
||||
ZVAL_EMPTY_STRING(expr_copy);
|
||||
}
|
||||
break;
|
||||
case IS_RESOURCE: {
|
||||
@ -251,13 +251,13 @@ again:
|
||||
int len;
|
||||
|
||||
len = snprintf(buf, sizeof(buf), "Resource id #%ld", Z_RES_HANDLE_P(expr));
|
||||
Z_STR_P(expr_copy) = STR_INIT(buf, len, 0);
|
||||
ZVAL_NEW_STR(expr_copy, STR_INIT(buf, len, 0));
|
||||
}
|
||||
break;
|
||||
case IS_ARRAY:
|
||||
zend_error(E_NOTICE, "Array to string conversion");
|
||||
// TODO: ??? use interned string
|
||||
Z_STR_P(expr_copy) = STR_INIT("Array", sizeof("Array") - 1, 0);
|
||||
ZVAL_NEW_STR(expr_copy, STR_INIT("Array", sizeof("Array") - 1, 0));
|
||||
break;
|
||||
case IS_OBJECT:
|
||||
{
|
||||
@ -293,7 +293,7 @@ again:
|
||||
zval_ptr_dtor(z);
|
||||
}
|
||||
zend_error(EG(exception) ? E_ERROR : E_RECOVERABLE_ERROR, "Object of class %s could not be converted to string", Z_OBJCE_P(expr)->name->val);
|
||||
Z_STR_P(expr_copy) = STR_EMPTY_ALLOC();
|
||||
ZVAL_EMPTY_STRING(expr_copy);
|
||||
}
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
@ -314,7 +314,6 @@ again:
|
||||
convert_to_string(expr_copy);
|
||||
break;
|
||||
}
|
||||
Z_TYPE_P(expr_copy) = IS_STRING;
|
||||
*use_copy = 1;
|
||||
}
|
||||
/* }}} */
|
||||
@ -1165,7 +1164,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
|
||||
#endif
|
||||
va_copy(usr_copy, args);
|
||||
len = zend_vspprintf(&str, 0, format, usr_copy);
|
||||
ZVAL_STR(¶ms[1], STR_INIT(str, len, 0));
|
||||
ZVAL_NEW_STR(¶ms[1], STR_INIT(str, len, 0));
|
||||
efree(str);
|
||||
#ifdef va_copy
|
||||
va_end(usr_copy);
|
||||
|
89
Zend/zend.h
89
Zend/zend.h
@ -653,7 +653,7 @@ END_EXTERN_C()
|
||||
zval *_z1 = (z); \
|
||||
zval *_z2 = (v); \
|
||||
(_z1)->value = (_z2)->value; \
|
||||
Z_TYPE_P(_z1) = Z_TYPE_P(_z2); \
|
||||
Z_TYPE_INFO_P(_z1) = Z_TYPE_INFO_P(_z2); \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_COPY(z, v) \
|
||||
@ -707,7 +707,6 @@ END_EXTERN_C()
|
||||
ZEND_ASSERT(Z_ISREF_P(_z)); \
|
||||
ref = Z_REF_P(_z); \
|
||||
ZVAL_COPY_VALUE(_z, &ref->val); \
|
||||
GC_REMOVE_FROM_BUFFER(ref); \
|
||||
efree(ref); \
|
||||
} while (0)
|
||||
|
||||
@ -719,55 +718,55 @@ END_EXTERN_C()
|
||||
Z_UNSET_ISREF_P(z); \
|
||||
} while (0)
|
||||
|
||||
// TODO: support objects and resources in more optimal way ???
|
||||
#define SEPARATE_ZVAL(zv) do { \
|
||||
zval *_zv = (zv); \
|
||||
if (Z_REFCOUNTED_P(_zv)) { \
|
||||
if (Z_REFCOUNT_P(_zv) > 1) { \
|
||||
if (Z_ISREF_P(_zv)) { \
|
||||
Z_DELREF_P(_zv); \
|
||||
ZVAL_DUP(_zv, Z_REFVAL_P(_zv)); \
|
||||
} else if (Z_TYPE_P(_zv) != IS_OBJECT &&\
|
||||
Z_TYPE_P(_zv) != IS_RESOURCE) { \
|
||||
Z_DELREF_P(_zv); \
|
||||
zval_copy_ctor(_zv); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
#define SEPARATE_ZVAL(zv) do { \
|
||||
zval *_zv = (zv); \
|
||||
if (Z_REFCOUNTED_P(_zv)) { \
|
||||
if (Z_REFCOUNT_P(_zv) > 1) { \
|
||||
if (Z_ISREF_P(_zv)) { \
|
||||
Z_DELREF_P(_zv); \
|
||||
ZVAL_DUP(_zv, Z_REFVAL_P(_zv)); \
|
||||
} else if (Z_TYPE_FLAGS_P(_zv) & IS_TYPE_COPYABLE) { \
|
||||
Z_DELREF_P(_zv); \
|
||||
zval_copy_ctor_func(_zv); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define SEPARATE_ZVAL_IF_NOT_REF(zv) do { \
|
||||
zval *__zv = (zv); \
|
||||
if (!Z_ISREF_P(__zv)) { \
|
||||
SEPARATE_ZVAL(__zv); \
|
||||
} \
|
||||
#define SEPARATE_ZVAL_IF_NOT_REF(zv) do { \
|
||||
zval *_zv = (zv); \
|
||||
if (!Z_ISREF_P(_zv) && \
|
||||
(Z_TYPE_FLAGS_P(_zv) & IS_TYPE_COPYABLE) && \
|
||||
Z_REFCOUNT_P(_zv) > 1) { \
|
||||
Z_DELREF_P(_zv); \
|
||||
zval_copy_ctor_func(_zv); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define SEPARATE_ZVAL_IF_REF(zv) do { \
|
||||
zval *__zv = (zv); \
|
||||
if (Z_ISREF_P(__zv)) { \
|
||||
if (Z_REFCOUNT_P(__zv) == 1) { \
|
||||
ZVAL_UNREF(__zv); \
|
||||
} else { \
|
||||
Z_DELREF_P(__zv); \
|
||||
ZVAL_DUP(__zv, Z_REFVAL_P(__zv)); \
|
||||
} \
|
||||
} \
|
||||
#define SEPARATE_ZVAL_IF_REF(zv) do { \
|
||||
zval *__zv = (zv); \
|
||||
if (Z_ISREF_P(__zv)) { \
|
||||
if (Z_REFCOUNT_P(__zv) == 1) { \
|
||||
ZVAL_UNREF(__zv); \
|
||||
} else { \
|
||||
Z_DELREF_P(__zv); \
|
||||
ZVAL_DUP(__zv, Z_REFVAL_P(__zv)); \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define SEPARATE_ZVAL_TO_MAKE_IS_REF(zv) do { \
|
||||
zval *__zv = (zv); \
|
||||
if (!Z_ISREF_P(__zv)) { \
|
||||
if (!Z_REFCOUNTED_P(__zv) || \
|
||||
Z_REFCOUNT_P(__zv) == 1) { \
|
||||
ZVAL_NEW_REF(__zv, __zv); \
|
||||
} else { \
|
||||
zval ref; \
|
||||
ZVAL_COPY_VALUE(&ref, __zv); \
|
||||
SEPARATE_ZVAL(&ref); \
|
||||
ZVAL_NEW_REF(__zv, &ref); \
|
||||
} \
|
||||
} \
|
||||
#define SEPARATE_ZVAL_TO_MAKE_IS_REF(zv) do { \
|
||||
zval *__zv = (zv); \
|
||||
if (!Z_ISREF_P(__zv)) { \
|
||||
if (!(Z_TYPE_FLAGS_P(__zv) & IS_TYPE_COPYABLE) || \
|
||||
Z_REFCOUNT_P(__zv) == 1) { \
|
||||
ZVAL_NEW_REF(__zv, __zv); \
|
||||
} else { \
|
||||
Z_DELREF_P(__zv); \
|
||||
ZVAL_NEW_REF(__zv, __zv); \
|
||||
zval_copy_ctor_func(Z_REFVAL_P(__zv)); \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define COPY_PZVAL_TO_ZVAL(zv, pzv) \
|
||||
|
@ -285,7 +285,7 @@ static int parse_arg_object_to_string(zval *arg, char **p, int *pl, int type TSR
|
||||
Z_ADDREF_P(z);
|
||||
if(Z_TYPE_P(z) != IS_OBJECT) {
|
||||
zval_dtor(arg);
|
||||
Z_TYPE_P(arg) = IS_NULL;
|
||||
ZVAL_NULL(arg);
|
||||
zend_make_printable_zval(z, arg, &use_copy);
|
||||
if (!use_copy) {
|
||||
ZVAL_ZVAL(arg, z, 1, 1);
|
||||
@ -325,7 +325,7 @@ static int parse_arg_object_to_str(zval *arg, zend_string **str, int type TSRMLS
|
||||
Z_ADDREF_P(z);
|
||||
if(Z_TYPE_P(z) != IS_OBJECT) {
|
||||
zval_dtor(arg);
|
||||
Z_TYPE_P(arg) = IS_NULL;
|
||||
ZVAL_NULL(arg);
|
||||
zend_make_printable_zval(z, arg, &use_copy);
|
||||
if (!use_copy) {
|
||||
ZVAL_ZVAL(arg, z, 1, 1);
|
||||
@ -1112,7 +1112,7 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destro
|
||||
static int zval_update_class_constant(zval *pp, int is_static, int offset TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
ZVAL_DEREF(pp);
|
||||
if (IS_CONSTANT_TYPE(Z_TYPE_P(pp))) {
|
||||
if (Z_TYPE_FLAGS_P(pp) & IS_TYPE_CONSTANT) {
|
||||
zend_class_entry **scope = EG(in_execution)?&EG(scope):&CG(active_class_entry);
|
||||
|
||||
if ((*scope)->parent) {
|
||||
@ -3670,7 +3670,7 @@ ZEND_API int zend_declare_property_string(zend_class_entry *ce, const char *name
|
||||
{
|
||||
zval property;
|
||||
|
||||
ZVAL_STR(&property, STR_INIT(value, strlen(value), ce->type & ZEND_INTERNAL_CLASS));
|
||||
ZVAL_NEW_STR(&property, STR_INIT(value, strlen(value), ce->type & ZEND_INTERNAL_CLASS));
|
||||
return zend_declare_property(ce, name, name_length, &property, access_type TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
@ -3679,7 +3679,7 @@ ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, const char *nam
|
||||
{
|
||||
zval property;
|
||||
|
||||
ZVAL_STR(&property, STR_INIT(value, value_len, ce->type & ZEND_INTERNAL_CLASS));
|
||||
ZVAL_NEW_STR(&property, STR_INIT(value, value_len, ce->type & ZEND_INTERNAL_CLASS));
|
||||
return zend_declare_property(ce, name, name_length, &property, access_type TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
@ -3731,7 +3731,7 @@ ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, const cha
|
||||
{
|
||||
zval constant;
|
||||
|
||||
ZVAL_STR(&constant, STR_INIT(value, value_length, ce->type & ZEND_INTERNAL_CLASS));
|
||||
ZVAL_NEW_STR(&constant, STR_INIT(value, value_length, ce->type & ZEND_INTERNAL_CLASS));
|
||||
return zend_declare_class_constant(ce, name, name_length, &constant TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -548,7 +548,7 @@ END_EXTERN_C()
|
||||
#define CHECK_NULL_PATH(p, l) (strlen(p) != l)
|
||||
|
||||
#define ZVAL_STRINGL(z, s, l) do { \
|
||||
ZVAL_STR(z, STR_INIT(s, l, 0)); \
|
||||
ZVAL_NEW_STR(z, STR_INIT(s, l, 0)); \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_STRING(z, s) do { \
|
||||
@ -557,11 +557,11 @@ END_EXTERN_C()
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_EMPTY_STRING(z) do { \
|
||||
ZVAL_STR(z, STR_EMPTY_ALLOC()); \
|
||||
ZVAL_INT_STR(z, STR_EMPTY_ALLOC()); \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_PSTRINGL(z, s, l) do { \
|
||||
ZVAL_STR(z, STR_INIT(s, l, 1)); \
|
||||
ZVAL_NEW_STR(z, STR_INIT(s, l, 1)); \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_PSTRING(z, s) do { \
|
||||
@ -601,6 +601,8 @@ END_EXTERN_C()
|
||||
#define RETVAL_LONG(l) ZVAL_LONG(return_value, l)
|
||||
#define RETVAL_DOUBLE(d) ZVAL_DOUBLE(return_value, d)
|
||||
#define RETVAL_STR(s) ZVAL_STR(return_value, s)
|
||||
#define RETVAL_INT_STR(s) ZVAL_INT_STR(return_value, s)
|
||||
#define RETVAL_NEW_STR(s) ZVAL_NEW_STR(return_value, s)
|
||||
#define RETVAL_STRING(s) ZVAL_STRING(return_value, s)
|
||||
#define RETVAL_STRINGL(s, l) ZVAL_STRINGL(return_value, s, l)
|
||||
#define RETVAL_EMPTY_STRING() ZVAL_EMPTY_STRING(return_value)
|
||||
@ -614,6 +616,8 @@ END_EXTERN_C()
|
||||
#define RETURN_LONG(l) { RETVAL_LONG(l); return; }
|
||||
#define RETURN_DOUBLE(d) { RETVAL_DOUBLE(d); return; }
|
||||
#define RETURN_STR(s) { RETVAL_STR(s); return; }
|
||||
#define RETURN_INT_STR(s) { RETVAL_INT_STR(s); return; }
|
||||
#define RETURN_NEW_STR(s) { RETVAL_NEW_STR(s); return; }
|
||||
#define RETURN_STRING(s) { RETVAL_STRING(s); return; }
|
||||
#define RETURN_STRINGL(s, l) { RETVAL_STRINGL(s, l); return; }
|
||||
#define RETURN_EMPTY_STRING() { RETVAL_EMPTY_STRING(); return; }
|
||||
|
@ -136,8 +136,8 @@ inline static void * __zend_realloc(void *p, size_t len)
|
||||
#define perealloc_recoverable_rel(ptr, size, persistent) ((persistent)?__zend_realloc((ptr), (size)):erealloc_recoverable_rel((ptr), (size)))
|
||||
#define pestrdup_rel(s, persistent) ((persistent)?strdup(s):estrdup_rel(s))
|
||||
|
||||
#define safe_estrdup(ptr) ((ptr)?(estrdup(ptr)):STR_EMPTY_ALLOC())
|
||||
#define safe_estrndup(ptr, len) ((ptr)?(estrndup((ptr), (len))):STR_EMPTY_ALLOC())
|
||||
//???#define safe_estrdup(ptr) ((ptr)?(estrdup(ptr)):STR_EMPTY_ALLOC())
|
||||
//???#define safe_estrndup(ptr, len) ((ptr)?(estrndup((ptr), (len))):STR_EMPTY_ALLOC())
|
||||
|
||||
ZEND_API int zend_set_memory_limit(size_t memory_limit TSRMLS_DC);
|
||||
|
||||
|
@ -67,7 +67,7 @@ ZEND_API int zend_ast_is_ct_constant(zend_ast *ast)
|
||||
int i;
|
||||
|
||||
if (ast->kind == ZEND_CONST) {
|
||||
return !IS_CONSTANT_TYPE(Z_TYPE(ast->u.val));
|
||||
return !(Z_TYPE_FLAGS(ast->u.val) & IS_TYPE_CONSTANT);
|
||||
} else {
|
||||
for (i = 0; i < ast->children; i++) {
|
||||
if ((&ast->u.child)[i]) {
|
||||
@ -223,7 +223,7 @@ ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *s
|
||||
break;
|
||||
case ZEND_CONST:
|
||||
ZVAL_DUP(result, &ast->u.val);
|
||||
if (IS_CONSTANT_TYPE(Z_TYPE_P(result))) {
|
||||
if (Z_TYPE_FLAGS_P(result) & IS_TYPE_CONSTANT) {
|
||||
zval_update_constant_ex(result, (void *) 1, scope TSRMLS_CC);
|
||||
}
|
||||
break;
|
||||
|
@ -937,7 +937,7 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value
|
||||
|
||||
/* this is necessary to make it able to work with default array
|
||||
* properties, returned to user */
|
||||
if (IS_CONSTANT_TYPE(Z_TYPE(prop_copy))) {
|
||||
if (Z_TYPE_FLAGS(prop_copy) & IS_TYPE_CONSTANT) {
|
||||
zval_update_constant(&prop_copy, 0 TSRMLS_CC);
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ static void build_runtime_defined_function_key(zval *result, const char *name, i
|
||||
}
|
||||
|
||||
/* NULL, name length, filename length, last accepting char position length */
|
||||
ZVAL_STR(result, STR_ALLOC(1+name_length+strlen(filename)+char_pos_len, 0));
|
||||
ZVAL_NEW_STR(result, STR_ALLOC(1+name_length+strlen(filename)+char_pos_len, 0));
|
||||
|
||||
/* must be binary safe */
|
||||
Z_STRVAL_P(result)[0] = '\0';
|
||||
@ -347,6 +347,9 @@ static inline void zend_insert_literal(zend_op_array *op_array, zval *zv, int li
|
||||
if (Z_TYPE_P(zv) == IS_STRING || Z_TYPE_P(zv) == IS_CONSTANT) {
|
||||
STR_HASH_VAL(Z_STR_P(zv));
|
||||
Z_STR_P(zv) = zend_new_interned_string(Z_STR_P(zv) TSRMLS_CC);
|
||||
if (IS_INTERNED(Z_STR_P(zv))) {
|
||||
Z_TYPE_FLAGS_P(zv) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
|
||||
}
|
||||
}
|
||||
ZVAL_COPY_VALUE(&CONSTANT_EX(op_array, literal_position), zv);
|
||||
//??? Z_SET_REFCOUNT(CONSTANT_EX(op_array, literal_position), 2);
|
||||
@ -402,7 +405,7 @@ int zend_add_func_name_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC
|
||||
|
||||
lc_name = STR_ALLOC(Z_STRLEN_P(zv), 0);
|
||||
zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(zv), Z_STRLEN_P(zv));
|
||||
ZVAL_STR(&c, lc_name);
|
||||
ZVAL_NEW_STR(&c, lc_name);
|
||||
zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
|
||||
|
||||
return ret;
|
||||
@ -428,7 +431,7 @@ int zend_add_ns_func_name_literal(zend_op_array *op_array, const zval *zv TSRMLS
|
||||
|
||||
lc_name = STR_ALLOC(Z_STRLEN_P(zv), 0);
|
||||
zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(zv), Z_STRLEN_P(zv));
|
||||
ZVAL_STR(&c, lc_name);
|
||||
ZVAL_NEW_STR(&c, lc_name);
|
||||
zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
|
||||
|
||||
ns_separator = (const char*)zend_memrchr(Z_STRVAL_P(zv), '\\', Z_STRLEN_P(zv));
|
||||
@ -438,7 +441,7 @@ int zend_add_ns_func_name_literal(zend_op_array *op_array, const zval *zv TSRMLS
|
||||
lc_len = Z_STRLEN_P(zv) - (ns_separator - Z_STRVAL_P(zv));
|
||||
lc_name = STR_ALLOC(lc_len, 0);
|
||||
zend_str_tolower_copy(lc_name->val, ns_separator, lc_len);
|
||||
ZVAL_STR(&c, lc_name);
|
||||
ZVAL_NEW_STR(&c, lc_name);
|
||||
zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
|
||||
}
|
||||
|
||||
@ -468,7 +471,7 @@ int zend_add_class_name_literal(zend_op_array *op_array, const zval *zv TSRMLS_D
|
||||
lc_name = STR_ALLOC(Z_STRLEN_P(zv), 0);
|
||||
zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(zv), Z_STRLEN_P(zv));
|
||||
}
|
||||
ZVAL_STR(&c, lc_name);
|
||||
ZVAL_NEW_STR(&c, lc_name);
|
||||
zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
|
||||
|
||||
GET_CACHE_SLOT(ret);
|
||||
@ -514,13 +517,13 @@ int zend_add_const_name_literal(zend_op_array *op_array, const zval *zv, int unq
|
||||
/* lowercased namespace name & original constant name */
|
||||
tmp_name = STR_INIT(name, name_len, 0);
|
||||
zend_str_tolower(tmp_name->val, ns_len);
|
||||
ZVAL_STR(&c, tmp_name);
|
||||
ZVAL_NEW_STR(&c, tmp_name);
|
||||
zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
|
||||
|
||||
/* lowercased namespace name & lowercased constant name */
|
||||
tmp_name = STR_ALLOC(name_len, 0);
|
||||
zend_str_tolower_copy(tmp_name->val, name, name_len);
|
||||
ZVAL_STR(&c, tmp_name);
|
||||
ZVAL_NEW_STR(&c, tmp_name);
|
||||
zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
|
||||
}
|
||||
|
||||
@ -535,13 +538,13 @@ int zend_add_const_name_literal(zend_op_array *op_array, const zval *zv, int unq
|
||||
|
||||
/* original constant name */
|
||||
tmp_name = STR_INIT(name, name_len, 0);
|
||||
ZVAL_STR(&c, tmp_name);
|
||||
ZVAL_NEW_STR(&c, tmp_name);
|
||||
zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
|
||||
|
||||
/* lowercased constant name */
|
||||
tmp_name = STR_ALLOC(name_len, 0);
|
||||
zend_str_tolower_copy(tmp_name->val, name, name_len);
|
||||
ZVAL_STR(&c, tmp_name);
|
||||
ZVAL_NEW_STR(&c, tmp_name);
|
||||
zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
|
||||
|
||||
return ret;
|
||||
@ -1936,6 +1939,9 @@ void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initializ
|
||||
zend_resolve_class_name(class_type TSRMLS_CC);
|
||||
}
|
||||
Z_STR(class_type->u.constant) = zend_new_interned_string(Z_STR(class_type->u.constant) TSRMLS_CC);
|
||||
if (IS_INTERNED(Z_STR(class_type->u.constant))) {
|
||||
Z_TYPE_FLAGS(class_type->u.constant) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
|
||||
}
|
||||
//???: for now we have to copy it :(
|
||||
#if 1
|
||||
cur_arg_info->class_name = estrndup(Z_STRVAL(class_type->u.constant), Z_STRLEN(class_type->u.constant));
|
||||
@ -2165,6 +2171,7 @@ void zend_resolve_non_class_name(znode *element_name, zend_bool *check_namespace
|
||||
if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
|
||||
tmp = *element_name;
|
||||
Z_STR(tmp.u.constant) = STR_ALLOC(sizeof("\\")-1 + Z_STRLEN(element_name->u.constant) + Z_STRLEN(CG(current_namespace)), 0);
|
||||
Z_TYPE_FLAGS(tmp.u.constant) = IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE;
|
||||
memcpy(Z_STRVAL(tmp.u.constant), Z_STRVAL(CG(current_namespace)), Z_STRLEN(CG(current_namespace)));
|
||||
memcpy(&(Z_STRVAL(tmp.u.constant)[Z_STRLEN(CG(current_namespace))]), "\\", sizeof("\\")-1);
|
||||
memcpy(&(Z_STRVAL(tmp.u.constant)[Z_STRLEN(CG(current_namespace)) + sizeof("\\")-1]), Z_STRVAL(element_name->u.constant), Z_STRLEN(element_name->u.constant)+1);
|
||||
@ -2250,6 +2257,7 @@ void zend_resolve_class_name(znode *class_name TSRMLS_DC) /* {{{ */
|
||||
Z_STR(class_name->u.constant) = STR_REALLOC(
|
||||
Z_STR(class_name->u.constant),
|
||||
Z_STRLEN(class_name->u.constant) - 1, 0);
|
||||
Z_TYPE_FLAGS(class_name->u.constant) = IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE;
|
||||
|
||||
if (ZEND_FETCH_CLASS_DEFAULT != zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant))) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "'\\%s' is an invalid class name", Z_STRVAL(class_name->u.constant));
|
||||
@ -2400,7 +2408,7 @@ void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline, int pass2
|
||||
|
||||
opline->op1.opline_num = dest->opline_num;
|
||||
zval_dtor(label);
|
||||
Z_TYPE_P(label) = IS_NULL;
|
||||
ZVAL_NULL(label);
|
||||
|
||||
/* Check that we are not moving into loop or switch */
|
||||
current = opline->extended_value;
|
||||
@ -2475,6 +2483,7 @@ void zend_do_build_full_name(znode *result, znode *prefix, znode *name, int is_c
|
||||
int old_len = Z_STRLEN(result->u.constant);
|
||||
length = sizeof("::")-1 + old_len + Z_STRLEN(name->u.constant);
|
||||
Z_STR(result->u.constant) = STR_REALLOC(Z_STR(result->u.constant), length, 0);
|
||||
Z_TYPE_FLAGS(result->u.constant) = IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE;
|
||||
memcpy(&Z_STRVAL(result->u.constant)[old_len], "::", sizeof("::")-1);
|
||||
memcpy(&Z_STRVAL(result->u.constant)[old_len + sizeof("::")-1], Z_STRVAL(name->u.constant), Z_STRLEN(name->u.constant)+1);
|
||||
STR_RELEASE(Z_STR(name->u.constant));
|
||||
@ -2482,6 +2491,7 @@ void zend_do_build_full_name(znode *result, znode *prefix, znode *name, int is_c
|
||||
int old_len = Z_STRLEN(result->u.constant);
|
||||
length = sizeof("\\")-1 + old_len + Z_STRLEN(name->u.constant);
|
||||
Z_STR(result->u.constant) = STR_REALLOC(Z_STR(result->u.constant), length, 0);
|
||||
Z_TYPE_FLAGS(result->u.constant) = IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE;
|
||||
memcpy(&Z_STRVAL(result->u.constant)[old_len], "\\", sizeof("\\")-1);
|
||||
memcpy(&Z_STRVAL(result->u.constant)[old_len + sizeof("\\")-1], Z_STRVAL(name->u.constant), Z_STRLEN(name->u.constant)+1);
|
||||
STR_RELEASE(Z_STR(name->u.constant));
|
||||
@ -5441,6 +5451,9 @@ void zend_do_declare_property(znode *var_name, const znode *value, zend_uint acc
|
||||
}
|
||||
|
||||
Z_STR(var_name->u.constant) = zend_new_interned_string(Z_STR(var_name->u.constant) TSRMLS_CC);
|
||||
if (IS_INTERNED(Z_STR(var_name->u.constant))) {
|
||||
Z_TYPE_FLAGS(var_name->u.constant) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
|
||||
}
|
||||
zend_declare_property_ex(CG(active_class_entry), Z_STR(var_name->u.constant), &property, access_type, comment TSRMLS_CC);
|
||||
//??? efree(Z_STRVAL(var_name->u.constant));
|
||||
STR_RELEASE(Z_STR(var_name->u.constant));
|
||||
@ -5463,6 +5476,9 @@ void zend_do_declare_class_constant(znode *var_name, const znode *value TSRMLS_D
|
||||
ZVAL_COPY_VALUE(&property, &value->u.constant);
|
||||
|
||||
Z_STR(var_name->u.constant) = zend_new_interned_string(Z_STR(var_name->u.constant) TSRMLS_CC);
|
||||
if (IS_INTERNED(Z_STR(var_name->u.constant))) {
|
||||
Z_TYPE_FLAGS(var_name->u.constant) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
|
||||
}
|
||||
if (zend_hash_add(&CG(active_class_entry)->constants_table, Z_STR(var_name->u.constant), &property) == NULL) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Cannot redefine class constant %s::%s", CG(active_class_entry)->name->val, Z_STRVAL(var_name->u.constant));
|
||||
}
|
||||
@ -5656,7 +5672,7 @@ static zend_constant* zend_get_ct_const(const zval *const_name, int all_internal
|
||||
if (all_internal_constants_substitution &&
|
||||
(c->flags & CONST_PERSISTENT) &&
|
||||
!(CG(compiler_options) & ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION) &&
|
||||
!IS_CONSTANT_TYPE(Z_TYPE(c->value))) {
|
||||
!(Z_TYPE_FLAGS(c->value) & IS_TYPE_CONSTANT)) {
|
||||
return c;
|
||||
}
|
||||
return NULL;
|
||||
@ -5700,7 +5716,12 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con
|
||||
}
|
||||
zend_do_build_full_name(NULL, constant_container, constant_name, 1 TSRMLS_CC);
|
||||
*result = *constant_container;
|
||||
Z_TYPE(result->u.constant) = IS_CONSTANT | fetch_type;
|
||||
//???
|
||||
Z_TYPE_INFO(result->u.constant) = IS_CONSTANT_EX;
|
||||
if (IS_INTERNED(Z_STR(result->u.constant))) {
|
||||
Z_TYPE_FLAGS(result->u.constant) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
|
||||
}
|
||||
Z_CONST_FLAGS(result->u.constant) = fetch_type;
|
||||
break;
|
||||
case ZEND_RT:
|
||||
if (constant_container->op_type == IS_CONST &&
|
||||
@ -5750,7 +5771,12 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con
|
||||
}
|
||||
|
||||
*result = *constant_name;
|
||||
Z_TYPE(result->u.constant) = IS_CONSTANT | fetch_type;
|
||||
//???
|
||||
Z_TYPE_INFO(result->u.constant) = IS_CONSTANT_EX;
|
||||
if (IS_INTERNED(Z_STR(result->u.constant))) {
|
||||
Z_TYPE_FLAGS(result->u.constant) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
|
||||
}
|
||||
Z_CONST_FLAGS(result->u.constant) = fetch_type;
|
||||
break;
|
||||
case ZEND_RT:
|
||||
compound = memchr(Z_STRVAL(constant_name->u.constant), '\\', Z_STRLEN(constant_name->u.constant));
|
||||
@ -5897,11 +5923,11 @@ void zend_do_add_static_array_element(znode *result, znode *offset, const znode
|
||||
|
||||
ZVAL_COPY_VALUE(&element, &expr->u.constant);
|
||||
if (offset) {
|
||||
switch (Z_TYPE(offset->u.constant) & IS_CONSTANT_TYPE_MASK) {
|
||||
switch (Z_TYPE(offset->u.constant)) {
|
||||
case IS_CONSTANT:
|
||||
//??? /* Ugly hack to denote that this value has a constant index */
|
||||
Z_GC_FLAGS(offset->u.constant) |= IS_STR_CONSTANT;
|
||||
if (Z_TYPE(offset->u.constant) & IS_CONSTANT_UNQUALIFIED) {
|
||||
if (Z_CONST_FLAGS(offset->u.constant) & IS_CONSTANT_UNQUALIFIED) {
|
||||
Z_GC_FLAGS(offset->u.constant) |= IS_STR_CONSTANT_UNQUALIFIED;
|
||||
}
|
||||
//??? Z_TYPE(element) |= IS_CONSTANT_INDEX;
|
||||
@ -6092,6 +6118,7 @@ void zend_do_fetch_static_variable(znode *varname, const znode *static_assignmen
|
||||
ZVAL_COPY_VALUE(&tmp, &static_assignment->u.constant);
|
||||
} else {
|
||||
ZVAL_NULL(&tmp);
|
||||
Z_CONST_FLAGS(tmp) = 0;
|
||||
}
|
||||
if (!CG(active_op_array)->static_variables) {
|
||||
if (CG(active_op_array)->scope) {
|
||||
@ -6150,7 +6177,7 @@ void zend_do_fetch_lexical_variable(znode *varname, zend_bool is_ref TSRMLS_DC)
|
||||
|
||||
value.op_type = IS_CONST;
|
||||
ZVAL_NULL(&value.u.constant);
|
||||
Z_TYPE(value.u.constant) |= is_ref ? IS_LEXICAL_REF : IS_LEXICAL_VAR;
|
||||
Z_CONST_FLAGS(value.u.constant) = is_ref ? IS_LEXICAL_REF : IS_LEXICAL_VAR;
|
||||
//??? Z_SET_REFCOUNT_P(&value.u.constant, 1);
|
||||
//??? Z_UNSET_ISREF_P(&value.u.constant);
|
||||
|
||||
@ -6540,7 +6567,7 @@ void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC) /* {{{ */
|
||||
convert_to_long(&val->u.constant);
|
||||
CG(declarables).ticks = val->u.constant;
|
||||
} else if (!zend_binary_strcasecmp(Z_STRVAL(var->u.constant), Z_STRLEN(var->u.constant), "encoding", sizeof("encoding")-1)) {
|
||||
if ((Z_TYPE(val->u.constant) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) {
|
||||
if (Z_TYPE(val->u.constant) == IS_CONSTANT) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Cannot use constants as encoding");
|
||||
}
|
||||
|
||||
@ -6618,8 +6645,7 @@ void zend_do_exit(znode *result, const znode *message TSRMLS_DC) /* {{{ */
|
||||
SET_UNUSED(opline->op2);
|
||||
|
||||
result->op_type = IS_CONST;
|
||||
Z_TYPE(result->u.constant) = IS_BOOL;
|
||||
Z_LVAL(result->u.constant) = 1;
|
||||
ZVAL_BOOL(&result->u.constant, 1);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -6887,7 +6913,8 @@ int zendlex(znode *zendlval TSRMLS_DC) /* {{{ */
|
||||
}
|
||||
|
||||
again:
|
||||
Z_TYPE(zendlval->u.constant) = IS_LONG;
|
||||
//???
|
||||
Z_TYPE_INFO(zendlval->u.constant) = IS_LONG;
|
||||
retval = lex_scan(&zendlval->u.constant TSRMLS_CC);
|
||||
switch (retval) {
|
||||
case T_COMMENT:
|
||||
@ -7333,7 +7360,7 @@ void zend_do_declare_constant(znode *name, znode *value TSRMLS_DC) /* {{{ */
|
||||
znode tmp;
|
||||
|
||||
tmp.op_type = IS_CONST;
|
||||
ZVAL_STR(&tmp.u.constant, STR_ALLOC(Z_STRLEN(CG(current_namespace)), 0));
|
||||
ZVAL_NEW_STR(&tmp.u.constant, STR_ALLOC(Z_STRLEN(CG(current_namespace)), 0));
|
||||
zend_str_tolower_copy(Z_STRVAL(tmp.u.constant), Z_STRVAL(CG(current_namespace)), Z_STRLEN(CG(current_namespace)));
|
||||
zend_do_build_namespace_name(&tmp, &tmp, name TSRMLS_CC);
|
||||
*name = tmp;
|
||||
|
@ -206,7 +206,7 @@ ZEND_API void zend_register_stringl_constant(const char *name, uint name_len, ch
|
||||
zend_constant c;
|
||||
|
||||
//??? ZVAL_STRINGL(&c.value, strval, strlen, 0);
|
||||
ZVAL_STR(&c.value, STR_INIT(strval, strlen, flags & CONST_PERSISTENT));
|
||||
ZVAL_NEW_STR(&c.value, STR_INIT(strval, strlen, flags & CONST_PERSISTENT));
|
||||
c.flags = flags;
|
||||
c.name = STR_INIT(name, name_len, flags & CONST_PERSISTENT);
|
||||
c.module_number = module_number;
|
||||
|
@ -553,7 +553,7 @@ ZEND_METHOD(exception, getTraceAsString)
|
||||
|
||||
str->val[str->len] = '\0';
|
||||
|
||||
RETURN_STR(str);
|
||||
RETURN_NEW_STR(str);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -738,10 +738,12 @@ static inline int zend_assign_to_string_offset(zval *str_offset, zval *value, in
|
||||
if (offset >= Z_STRLEN_P(str)) {
|
||||
int old_len = Z_STRLEN_P(str);
|
||||
Z_STR_P(str) = STR_REALLOC(Z_STR_P(str), offset + 1, 0);
|
||||
Z_TYPE_INFO_P(str) = IS_STRING_EX;
|
||||
memset(Z_STRVAL_P(str) + old_len, ' ', offset - old_len);
|
||||
Z_STRVAL_P(str)[offset+1] = 0;
|
||||
} else if (IS_INTERNED(Z_STR_P(str))) {
|
||||
Z_STR_P(str) = STR_INIT(Z_STRVAL_P(str), Z_STRLEN_P(str), 0);
|
||||
Z_TYPE_INFO_P(str) = IS_STRING_EX;
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(value) != IS_STRING) {
|
||||
@ -1223,7 +1225,6 @@ static void zend_fetch_dimension_address_read(zval *result, zval *container, zva
|
||||
|
||||
case IS_STRING: {
|
||||
zval tmp;
|
||||
zend_string *str;
|
||||
|
||||
if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) {
|
||||
switch(Z_TYPE_P(dim)) {
|
||||
@ -1257,17 +1258,16 @@ static void zend_fetch_dimension_address_read(zval *result, zval *container, zva
|
||||
if (type != BP_VAR_IS) {
|
||||
zend_error(E_NOTICE, "Uninitialized string offset: %ld", Z_LVAL_P(dim));
|
||||
}
|
||||
str = STR_EMPTY_ALLOC();
|
||||
ZVAL_EMPTY_STRING(result);
|
||||
} else {
|
||||
zend_uchar c = (zend_uchar)Z_STRVAL_P(container)[Z_LVAL_P(dim)];
|
||||
|
||||
if (CG(one_char_string)[c]) {
|
||||
str = CG(one_char_string)[c];
|
||||
ZVAL_INT_STR(result, CG(one_char_string)[c]);
|
||||
} else {
|
||||
str = STR_INIT(Z_STRVAL_P(container) + Z_LVAL_P(dim), 1, 0);
|
||||
ZVAL_NEW_STR(result, STR_INIT(Z_STRVAL_P(container) + Z_LVAL_P(dim), 1, 0));
|
||||
}
|
||||
}
|
||||
ZVAL_STR(result, str);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
@ -72,11 +72,7 @@ ZEND_API int zend_verify_arg_error(int error_type, const zend_function *zf, zend
|
||||
|
||||
static zend_always_inline void i_zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC TSRMLS_DC)
|
||||
{
|
||||
//??? IS_CONSTANT_TYPE_MASK used only for some rare cases
|
||||
zend_uchar type = Z_TYPE_P(zval_ptr) & IS_CONSTANT_TYPE_MASK;
|
||||
|
||||
if (IS_REFCOUNTED(type) &&
|
||||
(type != IS_STRING || !IS_INTERNED(Z_STR_P(zval_ptr)))) {
|
||||
if (Z_REFCOUNTED_P(zval_ptr)) {
|
||||
if (!Z_DELREF_P(zval_ptr)) {
|
||||
ZEND_ASSERT(zval_ptr != &EG(uninitialized_zval));
|
||||
_zval_dtor_func_for_ptr(Z_COUNTED_P(zval_ptr) ZEND_FILE_LINE_CC);
|
||||
|
@ -479,7 +479,7 @@ ZEND_API int zend_is_true(zval *op TSRMLS_DC) /* {{{ */
|
||||
#define IS_VISITED_CONSTANT 0x080 //??? IS_CONSTANT_INDEX
|
||||
#define IS_CONSTANT_VISITED(p) (Z_TYPE_P(p) & IS_VISITED_CONSTANT)
|
||||
#define Z_REAL_TYPE_P(p) (Z_TYPE_P(p) & ~IS_VISITED_CONSTANT)
|
||||
#define MARK_CONSTANT_VISITED(p) Z_TYPE_P(p) |= IS_VISITED_CONSTANT
|
||||
#define MARK_CONSTANT_VISITED(p) Z_TYPE_INFO_P(p) |= IS_VISITED_CONSTANT
|
||||
|
||||
static void zval_deep_copy(zval *p)
|
||||
{
|
||||
@ -500,7 +500,7 @@ ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry *scope
|
||||
|
||||
if (IS_CONSTANT_VISITED(p)) {
|
||||
zend_error(E_ERROR, "Cannot declare self-referencing constant '%s'", Z_STRVAL_P(p));
|
||||
} else if ((Z_TYPE_P(p) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) {
|
||||
} else if (Z_TYPE_P(p) == IS_CONSTANT) {
|
||||
int refcount;
|
||||
//??? zend_uchar is_ref;
|
||||
|
||||
@ -508,10 +508,10 @@ ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry *scope
|
||||
|
||||
MARK_CONSTANT_VISITED(p);
|
||||
|
||||
refcount = Z_REFCOUNT_P(p);
|
||||
refcount = Z_REFCOUNTED_P(p) ? Z_REFCOUNT_P(p) : 1;
|
||||
//??? is_ref = Z_ISREF_P(p);
|
||||
|
||||
if (!zend_get_constant_ex(Z_STRVAL_P(p), Z_STRLEN_P(p), &const_value, scope, Z_REAL_TYPE_P(p) TSRMLS_CC)) {
|
||||
if (!zend_get_constant_ex(Z_STRVAL_P(p), Z_STRLEN_P(p), &const_value, scope, Z_CONST_FLAGS_P(p) TSRMLS_CC)) {
|
||||
char *actual = Z_STRVAL_P(p);
|
||||
|
||||
if ((colon = (char*)zend_memrchr(Z_STRVAL_P(p), ':', Z_STRLEN_P(p)))) {
|
||||
@ -527,17 +527,19 @@ ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry *scope
|
||||
//??? Z_STRVAL_P(p) = colon + 1;
|
||||
Z_STR_P(p) = STR_INIT(colon + 1, len, 0);
|
||||
}
|
||||
Z_TYPE_FLAGS_P(p) = IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE;
|
||||
} else {
|
||||
zend_string *save = Z_STR_P(p);
|
||||
char *slash;
|
||||
int actual_len = Z_STRLEN_P(p);
|
||||
if ((Z_TYPE_P(p) & IS_CONSTANT_UNQUALIFIED) && (slash = (char *)zend_memrchr(actual, '\\', actual_len))) {
|
||||
if ((Z_CONST_FLAGS_P(p) & IS_CONSTANT_UNQUALIFIED) && (slash = (char *)zend_memrchr(actual, '\\', actual_len))) {
|
||||
actual = slash + 1;
|
||||
actual_len -= (actual - Z_STRVAL_P(p));
|
||||
if (inline_change) {
|
||||
zend_string *s = STR_INIT(actual, actual_len, 0);
|
||||
//??? STR_RELEASE(Z_STR_P(p));
|
||||
Z_STR_P(p) = s;
|
||||
Z_TYPE_FLAGS_P(p) = IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE;
|
||||
}
|
||||
}
|
||||
if (actual[0] == '\\') {
|
||||
@ -549,7 +551,7 @@ ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry *scope
|
||||
}
|
||||
--actual_len;
|
||||
}
|
||||
if ((Z_TYPE_P(p) & IS_CONSTANT_UNQUALIFIED) == 0) {
|
||||
if ((Z_CONST_FLAGS_P(p) & IS_CONSTANT_UNQUALIFIED) == 0) {
|
||||
if (save->val[0] == '\\') {
|
||||
zend_error(E_ERROR, "Undefined constant '%s'", save->val + 1);
|
||||
} else {
|
||||
@ -561,11 +563,14 @@ ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry *scope
|
||||
save = NULL;
|
||||
}
|
||||
zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual);
|
||||
Z_TYPE_P(p) = IS_STRING;
|
||||
if (!inline_change) {
|
||||
ZVAL_STRINGL(p, actual, actual_len);
|
||||
} else if (save && save->val != actual) {
|
||||
STR_RELEASE(save);
|
||||
} else {
|
||||
Z_TYPE_INFO_P(p) = IS_INTERNED(Z_STR_P(p)) ?
|
||||
IS_INTERNED_STRING_EX : IS_STRING_EX;
|
||||
if (save && save->val != actual) {
|
||||
STR_RELEASE(save);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -585,7 +590,7 @@ ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry *scope
|
||||
|
||||
SEPARATE_ZVAL_IF_NOT_REF(p);
|
||||
|
||||
Z_TYPE_P(p) = IS_ARRAY;
|
||||
Z_TYPE_INFO_P(p) = IS_ARRAY_EX;
|
||||
if (!inline_change) {
|
||||
HashTable *ht = Z_ARRVAL_P(p);
|
||||
ZVAL_NEW_ARR(p);
|
||||
@ -1147,7 +1152,7 @@ ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *s
|
||||
int retval;
|
||||
|
||||
if (retval_ptr) {
|
||||
ZVAL_STR(&pv, STR_ALLOC(str_len + sizeof("return ;")-1, 1));
|
||||
ZVAL_NEW_STR(&pv, STR_ALLOC(str_len + sizeof("return ;")-1, 1));
|
||||
memcpy(Z_STRVAL(pv), "return ", sizeof("return ") - 1);
|
||||
memcpy(Z_STRVAL(pv) + sizeof("return ") - 1, str, str_len);
|
||||
Z_STRVAL(pv)[Z_STRLEN(pv) - 1] = ';';
|
||||
|
@ -136,17 +136,9 @@ ZEND_API void gc_init(TSRMLS_D)
|
||||
|
||||
ZEND_API void gc_possible_root(zend_refcounted *ref TSRMLS_DC)
|
||||
{
|
||||
if (UNEXPECTED(GC_ADDRESS(GC_INFO(ref)) &&
|
||||
GC_GET_COLOR(GC_INFO(ref)) == GC_BLACK &&
|
||||
GC_ADDRESS(GC_INFO(ref)) >= GC_G(last_unused) - GC_G(buf))) {
|
||||
/* The given zval is a garbage that is going to be deleted by
|
||||
* currently running GC */
|
||||
return;
|
||||
}
|
||||
|
||||
GC_BENCH_INC(zval_possible_root);
|
||||
|
||||
if (GC_GET_COLOR(GC_INFO(ref)) == GC_BLACK) {
|
||||
if (EXPECTED(GC_GET_COLOR(GC_INFO(ref)) == GC_BLACK)) {
|
||||
GC_SET_PURPLE(GC_INFO(ref));
|
||||
|
||||
if (!GC_ADDRESS(GC_INFO(ref))) {
|
||||
@ -193,7 +185,7 @@ ZEND_API void gc_remove_from_buffer(zend_refcounted *ref TSRMLS_DC)
|
||||
{
|
||||
gc_root_buffer *root;
|
||||
|
||||
if (UNEXPECTED(GC_ADDRESS(GC_INFO(ref)) &&
|
||||
if (UNEXPECTED(/*GC_ADDRESS(GC_INFO(ref)) &&*/
|
||||
GC_GET_COLOR(GC_INFO(ref)) == GC_BLACK &&
|
||||
GC_ADDRESS(GC_INFO(ref)) >= GC_G(last_unused) - GC_G(buf))) {
|
||||
/* The given zval is a garbage that is going to be deleted by
|
||||
@ -675,16 +667,6 @@ ZEND_API int gc_collect_cycles(TSRMLS_D)
|
||||
zend_hash_destroy(&arr->ht);
|
||||
GC_REMOVE_FROM_BUFFER(arr);
|
||||
efree(arr);
|
||||
} else if (GC_TYPE(p) == IS_REFERENCE) {
|
||||
zend_reference *ref = (zend_reference*)p;
|
||||
|
||||
GC_TYPE(ref) = IS_NULL;
|
||||
if (EXPECTED(EG(objects_store).object_buckets != NULL) ||
|
||||
Z_TYPE(ref->val) != IS_OBJECT) {
|
||||
zval_dtor(&ref->val);
|
||||
}
|
||||
GC_REMOVE_FROM_BUFFER(ref);
|
||||
efree(ref);
|
||||
}
|
||||
current = GC_G(next_to_free);
|
||||
}
|
||||
|
@ -138,9 +138,9 @@ END_EXTERN_C()
|
||||
|
||||
static zend_always_inline void gc_check_possible_root(zval *z TSRMLS_DC)
|
||||
{
|
||||
if (Z_TYPE_P(z) == IS_OBJECT || Z_TYPE_P(z) == IS_ARRAY ||
|
||||
(Z_ISREF_P(z) &&
|
||||
(Z_TYPE_P(Z_REFVAL_P(z)) == IS_ARRAY || Z_TYPE_P(Z_REFVAL_P(z)) == IS_OBJECT))) {
|
||||
ZVAL_DEREF(z);
|
||||
if ((Z_TYPE_FLAGS_P(z) & IS_TYPE_COLLECTABLE) &&
|
||||
UNEXPECTED(!Z_GC_INFO_P(z))) {
|
||||
gc_possible_root(Z_COUNTED_P(z) TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
|
@ -1437,7 +1437,7 @@ ZEND_API void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key,
|
||||
idx = pos ? (*pos) : ht->nInternalPointer;
|
||||
|
||||
if (idx == INVALID_IDX) {
|
||||
Z_TYPE_P(key) = IS_NULL;
|
||||
ZVAL_NULL(key);
|
||||
} else {
|
||||
p = ht->arData + idx;
|
||||
if (p->key) {
|
||||
|
@ -102,7 +102,7 @@ static void zend_ini_add_string(zval *result, zval *op1, zval *op2)
|
||||
int op1_len = Z_STRLEN_P(op1);
|
||||
int length = op1_len + Z_STRLEN_P(op2);
|
||||
|
||||
ZVAL_STR(result, STR_REALLOC(Z_STR_P(op1), length, 1));
|
||||
ZVAL_NEW_STR(result, STR_REALLOC(Z_STR_P(op1), length, 1));
|
||||
memcpy(Z_STRVAL_P(result)+op1_len, Z_STRVAL_P(op2), Z_STRLEN_P(op2));
|
||||
Z_STRVAL_P(result)[length] = 0;
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ ZEND_API zend_ini_scanner_globals ini_scanner_globals;
|
||||
#define EAT_TRAILING_WHITESPACE() EAT_TRAILING_WHITESPACE_EX('X')
|
||||
|
||||
#define zend_ini_copy_value(retval, str, len) \
|
||||
ZVAL_STR(retval, STR_INIT(str, len, 1))
|
||||
ZVAL_NEW_STR(retval, STR_INIT(str, len, 1))
|
||||
|
||||
|
||||
#define RETURN_TOKEN(type, str, len) { \
|
||||
|
@ -132,7 +132,7 @@ ZEND_API zend_ini_scanner_globals ini_scanner_globals;
|
||||
#define EAT_TRAILING_WHITESPACE() EAT_TRAILING_WHITESPACE_EX('X')
|
||||
|
||||
#define zend_ini_copy_value(retval, str, len) \
|
||||
ZVAL_STR(retval, STR_INIT(str, len, 1))
|
||||
ZVAL_NEW_STR(retval, STR_INIT(str, len, 1))
|
||||
|
||||
|
||||
#define RETURN_TOKEN(type, str, len) { \
|
||||
|
@ -568,8 +568,8 @@ parameter:
|
||||
|
||||
optional_class_type:
|
||||
/* empty */ { $$.op_type = IS_UNUSED; }
|
||||
| T_ARRAY { $$.op_type = IS_CONST; Z_TYPE($$.u.constant)=IS_ARRAY; }
|
||||
| T_CALLABLE { $$.op_type = IS_CONST; Z_TYPE($$.u.constant)=IS_CALLABLE; }
|
||||
| T_ARRAY { $$.op_type = IS_CONST; Z_TYPE_INFO($$.u.constant)=IS_ARRAY; }
|
||||
| T_CALLABLE { $$.op_type = IS_CONST; Z_TYPE_INFO($$.u.constant)=IS_CALLABLE; }
|
||||
| fully_qualified_class_name { $$ = $1; }
|
||||
;
|
||||
|
||||
@ -607,9 +607,9 @@ global_var:
|
||||
|
||||
static_var_list:
|
||||
static_var_list ',' T_VARIABLE { zend_do_fetch_static_variable(&$3, NULL, ZEND_FETCH_STATIC TSRMLS_CC); }
|
||||
| static_var_list ',' T_VARIABLE '=' static_scalar { zend_do_fetch_static_variable(&$3, &$5, ZEND_FETCH_STATIC TSRMLS_CC); }
|
||||
| static_var_list ',' T_VARIABLE '=' static_scalar { Z_CONST_FLAGS($5.u.constant) = 0; zend_do_fetch_static_variable(&$3, &$5, ZEND_FETCH_STATIC TSRMLS_CC); }
|
||||
| T_VARIABLE { zend_do_fetch_static_variable(&$1, NULL, ZEND_FETCH_STATIC TSRMLS_CC); }
|
||||
| T_VARIABLE '=' static_scalar { zend_do_fetch_static_variable(&$1, &$3, ZEND_FETCH_STATIC TSRMLS_CC); }
|
||||
| T_VARIABLE '=' static_scalar { Z_CONST_FLAGS($3.u.constant) = 0; zend_do_fetch_static_variable(&$1, &$3, ZEND_FETCH_STATIC TSRMLS_CC); }
|
||||
|
||||
;
|
||||
|
||||
@ -734,7 +734,7 @@ echo_expr_list:
|
||||
|
||||
|
||||
for_expr:
|
||||
/* empty */ { $$.op_type = IS_CONST; Z_TYPE($$.u.constant) = IS_BOOL; Z_LVAL($$.u.constant) = 1; }
|
||||
/* empty */ { $$.op_type = IS_CONST; ZVAL_BOOL(&$$.u.constant, 1); }
|
||||
| non_empty_for_expr { $$ = $1; }
|
||||
;
|
||||
|
||||
@ -906,13 +906,13 @@ class_name:
|
||||
T_STATIC { $$.op_type = IS_CONST; ZVAL_STRINGL(&$$.u.constant, "static", sizeof("static")-1);}
|
||||
| namespace_name { $$ = $1; }
|
||||
| T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); }
|
||||
| T_NS_SEPARATOR namespace_name { zval tmp; ZVAL_STR(&tmp, STR_ALLOC(Z_STRLEN($2.u.constant)+1, 0)); Z_STRVAL(tmp)[0] = '\\'; memcpy(Z_STRVAL(tmp) + 1, Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); if (Z_DELREF($2.u.constant) == 0) {efree(Z_STR($2.u.constant));} Z_STR($2.u.constant) = Z_STR(tmp); $$ = $2; }
|
||||
| T_NS_SEPARATOR namespace_name { zval tmp; ZVAL_NEW_STR(&tmp, STR_ALLOC(Z_STRLEN($2.u.constant)+1, 0)); Z_STRVAL(tmp)[0] = '\\'; memcpy(Z_STRVAL(tmp) + 1, Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); if (Z_DELREF($2.u.constant) == 0) {efree(Z_STR($2.u.constant));} Z_STR($2.u.constant) = Z_STR(tmp); $$ = $2; }
|
||||
;
|
||||
|
||||
fully_qualified_class_name:
|
||||
namespace_name { $$ = $1; }
|
||||
| T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); }
|
||||
| T_NS_SEPARATOR namespace_name { zval tmp; ZVAL_STR(&tmp, STR_ALLOC(Z_STRLEN($2.u.constant)+1, 0)); Z_STRVAL(tmp)[0] = '\\'; memcpy(Z_STRVAL(tmp) + 1, Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); if (Z_DELREF($2.u.constant) == 0) {efree(Z_STR($2.u.constant));} Z_STR($2.u.constant) = Z_STR(tmp); $$ = $2; }
|
||||
| T_NS_SEPARATOR namespace_name { zval tmp; ZVAL_NEW_STR(&tmp, STR_ALLOC(Z_STRLEN($2.u.constant)+1, 0)); Z_STRVAL(tmp)[0] = '\\'; memcpy(Z_STRVAL(tmp) + 1, Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); if (Z_DELREF($2.u.constant) == 0) {efree(Z_STR($2.u.constant));} Z_STR($2.u.constant) = Z_STR(tmp); $$ = $2; }
|
||||
;
|
||||
|
||||
|
||||
@ -981,8 +981,8 @@ static_class_constant:
|
||||
|
||||
static_scalar: /* compile-time evaluated scalars */
|
||||
static_scalar_value { zend_do_constant_expression(&$$, $1.u.ast TSRMLS_CC); }
|
||||
| T_ARRAY '(' static_array_pair_list ')' { $$ = $3; Z_TYPE($$.u.constant) = IS_CONSTANT_ARRAY; }
|
||||
| '[' static_array_pair_list ']' { $$ = $2; Z_TYPE($$.u.constant) = IS_CONSTANT_ARRAY; }
|
||||
| T_ARRAY '(' static_array_pair_list ')' { $$ = $3; Z_TYPE_INFO($$.u.constant) = IS_CONSTANT_ARRAY_EX; }
|
||||
| '[' static_array_pair_list ']' { $$ = $2; Z_TYPE_INFO($$.u.constant) = IS_CONSTANT_ARRAY_EX; }
|
||||
;
|
||||
|
||||
static_scalar_value:
|
||||
@ -990,7 +990,7 @@ static_scalar_value:
|
||||
| static_class_name_scalar { $$.u.ast = zend_ast_create_constant(&$1.u.constant); }
|
||||
| namespace_name { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_CT, 1 TSRMLS_CC); $$.u.ast = zend_ast_create_constant(&$$.u.constant); }
|
||||
| T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); $3 = $$; zend_do_fetch_constant(&$$, NULL, &$3, ZEND_CT, 0 TSRMLS_CC); $$.u.ast = zend_ast_create_constant(&$$.u.constant); }
|
||||
| T_NS_SEPARATOR namespace_name { zval tmp; ZVAL_STR(&tmp, STR_ALLOC(Z_STRLEN($2.u.constant)+1, 0)); Z_STRVAL(tmp)[0] = '\\'; memcpy(Z_STRVAL(tmp) + 1, Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); if (Z_DELREF($2.u.constant) == 0) {efree(Z_STR($2.u.constant));} Z_STR($2.u.constant) = Z_STR(tmp); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_CT, 0 TSRMLS_CC); $$.u.ast = zend_ast_create_constant(&$$.u.constant); }
|
||||
| T_NS_SEPARATOR namespace_name { zval tmp; ZVAL_NEW_STR(&tmp, STR_ALLOC(Z_STRLEN($2.u.constant)+1, 0)); Z_STRVAL(tmp)[0] = '\\'; memcpy(Z_STRVAL(tmp) + 1, Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); if (Z_DELREF($2.u.constant) == 0) {efree(Z_STR($2.u.constant));} Z_STR($2.u.constant) = Z_STR(tmp); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_CT, 0 TSRMLS_CC); $$.u.ast = zend_ast_create_constant(&$$.u.constant); }
|
||||
| static_class_constant { $$.u.ast = zend_ast_create_constant(&$1.u.constant); }
|
||||
| T_CLASS_C { $$.u.ast = zend_ast_create_constant(&$1.u.constant); }
|
||||
| static_operation { $$ = $1; }
|
||||
@ -1037,7 +1037,7 @@ scalar:
|
||||
| class_constant { $$ = $1; }
|
||||
| namespace_name { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_RT, 1 TSRMLS_CC); }
|
||||
| T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); $3 = $$; zend_do_fetch_constant(&$$, NULL, &$3, ZEND_RT, 0 TSRMLS_CC); }
|
||||
| T_NS_SEPARATOR namespace_name { zval tmp; ZVAL_STR(&tmp, STR_ALLOC(Z_STRLEN($2.u.constant)+1, 0)); Z_STRVAL(tmp)[0] = '\\'; memcpy(Z_STRVAL(tmp) + 1, Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); if (Z_DELREF($2.u.constant) == 0) {efree(Z_STR($2.u.constant));} Z_STR($2.u.constant) = Z_STR(tmp); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_RT, 0 TSRMLS_CC); }
|
||||
| T_NS_SEPARATOR namespace_name { zval tmp; ZVAL_NEW_STR(&tmp, STR_ALLOC(Z_STRLEN($2.u.constant)+1, 0)); Z_STRVAL(tmp)[0] = '\\'; memcpy(Z_STRVAL(tmp) + 1, Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); if (Z_DELREF($2.u.constant) == 0) {efree(Z_STR($2.u.constant));} Z_STR($2.u.constant) = Z_STR(tmp); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_RT, 0 TSRMLS_CC); }
|
||||
| common_scalar { $$ = $1; }
|
||||
| '"' encaps_list '"' { $$ = $2; }
|
||||
| T_START_HEREDOC encaps_list T_END_HEREDOC { $$ = $2; }
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -656,6 +656,7 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D
|
||||
/* enforce ZEND_MMAP_AHEAD trailing NULLs for flex... */
|
||||
old_len = Z_STRLEN_P(str);
|
||||
Z_STR_P(str) = STR_REALLOC(Z_STR_P(str), old_len + ZEND_MMAP_AHEAD, 0);
|
||||
Z_TYPE_INFO_P(str) = IS_STRING_EX;
|
||||
memset(Z_STRVAL_P(str) + old_len, 0, ZEND_MMAP_AHEAD + 1);
|
||||
|
||||
SCNG(yy_in) = NULL;
|
||||
@ -1178,7 +1179,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
|
||||
<ST_IN_SCRIPTING,ST_LOOKING_FOR_PROPERTY>{WHITESPACE}+ {
|
||||
//??? ZVAL_STRINGL(zendlval, yytext, yyleng);
|
||||
ZVAL_STR(zendlval, STR_EMPTY_ALLOC()); /* tricky way to no copying - intentional */
|
||||
ZVAL_EMPTY_STRING(zendlval); /* tricky way to no copying - intentional */
|
||||
HANDLE_NEWLINES(yytext, yyleng);
|
||||
return T_WHITESPACE;
|
||||
}
|
||||
@ -1501,11 +1502,10 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
|
||||
if (len < SIZEOF_LONG * 8) {
|
||||
if (len == 0) {
|
||||
Z_LVAL_P(zendlval) = 0;
|
||||
ZVAL_LONG(zendlval, 0);
|
||||
} else {
|
||||
Z_LVAL_P(zendlval) = strtol(bin, NULL, 2);
|
||||
ZVAL_LONG(zendlval, strtol(bin, NULL, 2));
|
||||
}
|
||||
Z_TYPE_P(zendlval) = IS_LONG;
|
||||
return T_LNUMBER;
|
||||
} else {
|
||||
ZVAL_DOUBLE(zendlval, zend_bin_strtod(bin, NULL));
|
||||
@ -1515,22 +1515,19 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
|
||||
<ST_IN_SCRIPTING>{LNUM} {
|
||||
if (yyleng < MAX_LENGTH_OF_LONG - 1) { /* Won't overflow */
|
||||
Z_LVAL_P(zendlval) = strtol(yytext, NULL, 0);
|
||||
ZVAL_LONG(zendlval, strtol(yytext, NULL, 0));
|
||||
} else {
|
||||
errno = 0;
|
||||
Z_LVAL_P(zendlval) = strtol(yytext, NULL, 0);
|
||||
ZVAL_LONG(zendlval, strtol(yytext, NULL, 0));
|
||||
if (errno == ERANGE) { /* Overflow */
|
||||
if (yytext[0] == '0') { /* octal overflow */
|
||||
Z_DVAL_P(zendlval) = zend_oct_strtod(yytext, NULL);
|
||||
ZVAL_DOUBLE(zendlval, zend_oct_strtod(yytext, NULL));
|
||||
} else {
|
||||
Z_DVAL_P(zendlval) = zend_strtod(yytext, NULL);
|
||||
ZVAL_DOUBLE(zendlval, zend_strtod(yytext, NULL));
|
||||
}
|
||||
Z_TYPE_P(zendlval) = IS_DOUBLE;
|
||||
return T_DNUMBER;
|
||||
}
|
||||
}
|
||||
|
||||
Z_TYPE_P(zendlval) = IS_LONG;
|
||||
return T_LNUMBER;
|
||||
}
|
||||
|
||||
@ -1546,11 +1543,10 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
|
||||
if (len < SIZEOF_LONG * 2 || (len == SIZEOF_LONG * 2 && *hex <= '7')) {
|
||||
if (len == 0) {
|
||||
Z_LVAL_P(zendlval) = 0;
|
||||
ZVAL_LONG(zendlval, 0);
|
||||
} else {
|
||||
Z_LVAL_P(zendlval) = strtol(hex, NULL, 16);
|
||||
ZVAL_LONG(zendlval, strtol(hex, NULL, 16));
|
||||
}
|
||||
Z_TYPE_P(zendlval) = IS_LONG;
|
||||
return T_LNUMBER;
|
||||
} else {
|
||||
ZVAL_DOUBLE(zendlval, zend_hex_strtod(hex, NULL));
|
||||
@ -1583,7 +1579,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
/* We create a special __CLASS__ constant that is going to be resolved
|
||||
at run-time */
|
||||
ZVAL_STRINGL(zendlval, "__CLASS__", sizeof("__CLASS__") - 1);
|
||||
Z_TYPE_P(zendlval) = IS_CONSTANT;
|
||||
Z_TYPE_INFO_P(zendlval) = IS_CONSTANT_EX;
|
||||
} else {
|
||||
if (ce && ce->name) {
|
||||
ZVAL_STR(zendlval, STR_COPY(ce->name));
|
||||
@ -1625,7 +1621,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
len += sizeof("::")-1;
|
||||
len += CG(active_op_array)->function_name->len;
|
||||
}
|
||||
ZVAL_STR(zendlval, STR_ALLOC(len, 0));
|
||||
ZVAL_NEW_STR(zendlval, STR_ALLOC(len, 0));
|
||||
len = 0;
|
||||
if (CG(active_class_entry)->name) {
|
||||
memcpy(Z_STRVAL_P(zendlval), CG(active_class_entry)->name->val, CG(active_class_entry)->name->len);
|
||||
@ -1655,9 +1651,10 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
zend_string *filename = zend_get_compiled_filename(TSRMLS_C);
|
||||
|
||||
if (!filename) {
|
||||
filename = STR_EMPTY_ALLOC();
|
||||
ZVAL_EMPTY_STRING(zendlval);
|
||||
} else {
|
||||
ZVAL_STR(zendlval, STR_COPY(filename));
|
||||
}
|
||||
ZVAL_STR(zendlval, STR_COPY(filename));
|
||||
return T_FILE;
|
||||
}
|
||||
|
||||
@ -1706,7 +1703,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
|
||||
HANDLE_NEWLINES(yytext, yyleng);
|
||||
//??? ZVAL_STRINGL(zendlval, yytext, yyleng);
|
||||
ZVAL_STR(zendlval, STR_EMPTY_ALLOC()); /* tricky way to no copying - intentional */
|
||||
ZVAL_EMPTY_STRING(zendlval); /* tricky way to no copying - intentional */
|
||||
BEGIN(ST_IN_SCRIPTING);
|
||||
return T_OPEN_TAG;
|
||||
}
|
||||
@ -1715,7 +1712,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
<INITIAL>"<%=" {
|
||||
if (CG(asp_tags)) {
|
||||
//??? ZVAL_STRINGL(zendlval, yytext, yyleng);
|
||||
ZVAL_STR(zendlval, STR_EMPTY_ALLOC()); /* tricky way to no copying - intentional */
|
||||
ZVAL_EMPTY_STRING(zendlval); /* tricky way to no copying - intentional */
|
||||
BEGIN(ST_IN_SCRIPTING);
|
||||
return T_OPEN_TAG_WITH_ECHO;
|
||||
} else {
|
||||
@ -1726,7 +1723,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
|
||||
<INITIAL>"<?=" {
|
||||
//??? ZVAL_STRINGL(zendlval, yytext, yyleng);
|
||||
ZVAL_STR(zendlval, STR_EMPTY_ALLOC()); /* tricky way to no copying - intentional */
|
||||
ZVAL_EMPTY_STRING(zendlval); /* tricky way to no copying - intentional */
|
||||
BEGIN(ST_IN_SCRIPTING);
|
||||
return T_OPEN_TAG_WITH_ECHO;
|
||||
}
|
||||
@ -1735,7 +1732,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
<INITIAL>"<%" {
|
||||
if (CG(asp_tags)) {
|
||||
//??? ZVAL_STRINGL(zendlval, yytext, yyleng);
|
||||
ZVAL_STR(zendlval, STR_EMPTY_ALLOC()); /* tricky way to no copying - intentional */
|
||||
ZVAL_EMPTY_STRING(zendlval); /* tricky way to no copying - intentional */
|
||||
BEGIN(ST_IN_SCRIPTING);
|
||||
return T_OPEN_TAG;
|
||||
} else {
|
||||
@ -1746,7 +1743,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
|
||||
<INITIAL>"<?php"([ \t]|{NEWLINE}) {
|
||||
//??? ZVAL_STRINGL(zendlval, yytext, yyleng);
|
||||
ZVAL_STR(zendlval, STR_EMPTY_ALLOC()); /* tricky way, no copying intentional */
|
||||
ZVAL_EMPTY_STRING(zendlval); /* tricky way, no copying intentional */
|
||||
HANDLE_NEWLINE(yytext[yyleng-1]);
|
||||
BEGIN(ST_IN_SCRIPTING);
|
||||
return T_OPEN_TAG;
|
||||
@ -1756,7 +1753,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
<INITIAL>"<?" {
|
||||
if (CG(short_tags)) {
|
||||
//??? ZVAL_STRINGL(zendlval, yytext, yyleng);
|
||||
ZVAL_STR(zendlval, STR_EMPTY_ALLOC()); /* tricky way, no copying intentional */
|
||||
ZVAL_EMPTY_STRING(zendlval); /* tricky way, no copying intentional */
|
||||
BEGIN(ST_IN_SCRIPTING);
|
||||
return T_OPEN_TAG;
|
||||
} else {
|
||||
@ -1815,7 +1812,7 @@ inline_html:
|
||||
if (readsize < yyleng) {
|
||||
yyless(readsize);
|
||||
}
|
||||
Z_TYPE_P(zendlval) = IS_STRING;
|
||||
Z_TYPE_INFO_P(zendlval) = IS_STRING_EX;
|
||||
} else {
|
||||
ZVAL_STRINGL(zendlval, yytext, yyleng);
|
||||
}
|
||||
@ -1940,7 +1937,7 @@ inline_html:
|
||||
|
||||
<ST_IN_SCRIPTING>("?>"|"</script"{WHITESPACE}*">"){NEWLINE}? {
|
||||
//??? ZVAL_STRINGL(zendlval, yytext, yyleng);
|
||||
ZVAL_STR(zendlval, STR_EMPTY_ALLOC()); /* tricky way to no copying - intentional */
|
||||
ZVAL_EMPTY_STRING(zendlval); /* tricky way to no copying - intentional */
|
||||
BEGIN(INITIAL);
|
||||
return T_CLOSE_TAG; /* implicit ';' at php-end tag */
|
||||
}
|
||||
@ -1950,7 +1947,7 @@ inline_html:
|
||||
if (CG(asp_tags)) {
|
||||
BEGIN(INITIAL);
|
||||
//??? ZVAL_STRINGL(zendlval, yytext, yyleng);
|
||||
ZVAL_STR(zendlval, STR_EMPTY_ALLOC()); /* tricky way to no copying - intentional */
|
||||
ZVAL_EMPTY_STRING(zendlval); /* tricky way to no copying - intentional */
|
||||
return T_CLOSE_TAG; /* implicit ';' at php-end tag */
|
||||
} else {
|
||||
yyless(1);
|
||||
|
@ -198,14 +198,14 @@ try_again:
|
||||
zend_string *str;
|
||||
|
||||
str = Z_STR_P(op);
|
||||
if ((Z_TYPE_P(op)=is_numeric_string(str->val, str->len, &Z_LVAL_P(op), &Z_DVAL_P(op), 1)) == 0) {
|
||||
if ((Z_TYPE_INFO_P(op)=is_numeric_string(str->val, str->len, &Z_LVAL_P(op), &Z_DVAL_P(op), 1)) == 0) {
|
||||
ZVAL_LONG(op, 0);
|
||||
}
|
||||
STR_RELEASE(str);
|
||||
break;
|
||||
}
|
||||
case IS_BOOL:
|
||||
Z_TYPE_P(op) = IS_LONG;
|
||||
Z_TYPE_INFO_P(op) = IS_LONG;
|
||||
break;
|
||||
case IS_RESOURCE:
|
||||
{
|
||||
@ -234,7 +234,7 @@ try_again:
|
||||
switch (Z_TYPE_P(op)) { \
|
||||
case IS_STRING: \
|
||||
{ \
|
||||
if ((Z_TYPE(holder)=is_numeric_string(Z_STRVAL_P(op), Z_STRLEN_P(op), &Z_LVAL(holder), &Z_DVAL(holder), 1)) == 0) { \
|
||||
if ((Z_TYPE_INFO(holder)=is_numeric_string(Z_STRVAL_P(op), Z_STRLEN_P(op), &Z_LVAL(holder), &Z_DVAL(holder), 1)) == 0) { \
|
||||
ZVAL_LONG(&(holder), 0); \
|
||||
} \
|
||||
(op) = &(holder); \
|
||||
@ -272,23 +272,23 @@ try_again:
|
||||
} else if (Z_TYPE_P(op) != IS_LONG) { \
|
||||
switch (Z_TYPE_P(op)) { \
|
||||
case IS_NULL: \
|
||||
Z_LVAL(holder) = 0; \
|
||||
ZVAL_LONG(&holder, 0); \
|
||||
break; \
|
||||
case IS_DOUBLE: \
|
||||
Z_LVAL(holder) = zend_dval_to_lval(Z_DVAL_P(op)); \
|
||||
ZVAL_LONG(&holder, zend_dval_to_lval(Z_DVAL_P(op)));\
|
||||
break; \
|
||||
case IS_STRING: \
|
||||
Z_LVAL(holder) = strtol(Z_STRVAL_P(op), NULL, 10); \
|
||||
ZVAL_LONG(&holder, strtol(Z_STRVAL_P(op), NULL, 10));\
|
||||
break; \
|
||||
case IS_ARRAY: \
|
||||
Z_LVAL(holder) = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); \
|
||||
ZVAL_LONG(&holder, zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); \
|
||||
break; \
|
||||
case IS_OBJECT: \
|
||||
ZVAL_DUP(&(holder), (op)); \
|
||||
convert_to_long_base(&(holder), 10); \
|
||||
break; \
|
||||
case IS_BOOL: \
|
||||
Z_LVAL(holder) = Z_LVAL_P(op); \
|
||||
ZVAL_LONG(&(holder), Z_LVAL_P(op)); \
|
||||
break; \
|
||||
case IS_RESOURCE: \
|
||||
/* ??? delete old resource ??? */ \
|
||||
@ -296,10 +296,9 @@ try_again:
|
||||
break; \
|
||||
default: \
|
||||
zend_error(E_WARNING, "Cannot convert to ordinal value"); \
|
||||
Z_LVAL(holder) = 0; \
|
||||
ZVAL_LONG(&holder, 0); \
|
||||
break; \
|
||||
} \
|
||||
Z_TYPE(holder) = IS_LONG; \
|
||||
(op) = &(holder); \
|
||||
}
|
||||
|
||||
@ -312,37 +311,36 @@ try_again:
|
||||
} else if (Z_TYPE_P(op) != IS_BOOL) { \
|
||||
switch (Z_TYPE_P(op)) { \
|
||||
case IS_NULL: \
|
||||
Z_LVAL(holder) = 0; \
|
||||
ZVAL_BOOL(&holder, 0); \
|
||||
break; \
|
||||
case IS_RESOURCE: \
|
||||
Z_LVAL(holder) = (Z_RES_HANDLE_P(op) ? 1 : 0); \
|
||||
ZVAL_BOOL(&holder, Z_RES_HANDLE_P(op) ? 1 : 0); \
|
||||
break; \
|
||||
case IS_LONG: \
|
||||
Z_LVAL(holder) = (Z_LVAL_P(op) ? 1 : 0); \
|
||||
ZVAL_BOOL(&holder, Z_LVAL_P(op) ? 1 : 0); \
|
||||
break; \
|
||||
case IS_DOUBLE: \
|
||||
Z_LVAL(holder) = (Z_DVAL_P(op) ? 1 : 0); \
|
||||
ZVAL_BOOL(&holder, Z_DVAL_P(op) ? 1 : 0); \
|
||||
break; \
|
||||
case IS_STRING: \
|
||||
if (Z_STRLEN_P(op) == 0 \
|
||||
|| (Z_STRLEN_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) { \
|
||||
Z_LVAL(holder) = 0; \
|
||||
ZVAL_BOOL(&holder, 0); \
|
||||
} else { \
|
||||
Z_LVAL(holder) = 1; \
|
||||
ZVAL_BOOL(&holder, 1); \
|
||||
} \
|
||||
break; \
|
||||
case IS_ARRAY: \
|
||||
Z_LVAL(holder) = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); \
|
||||
ZVAL_BOOL(&holder, zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); \
|
||||
break; \
|
||||
case IS_OBJECT: \
|
||||
ZVAL_DUP(&(holder), (op)); \
|
||||
convert_to_boolean(&(holder)); \
|
||||
break; \
|
||||
default: \
|
||||
Z_LVAL(holder) = 0; \
|
||||
ZVAL_BOOL(&holder, 0); \
|
||||
break; \
|
||||
} \
|
||||
Z_TYPE(holder) = IS_BOOL; \
|
||||
(op) = &(holder); \
|
||||
}
|
||||
|
||||
@ -359,8 +357,7 @@ try_again:
|
||||
zend_get_type_by_const(ctype)); \
|
||||
} else { \
|
||||
zval_dtor(op); \
|
||||
Z_TYPE_P(op) = ctype; \
|
||||
op->value = dst.value; \
|
||||
ZVAL_COPY_VALUE(op, &dst); \
|
||||
} \
|
||||
} else { \
|
||||
if (Z_OBJ_HT_P(op)->get) { \
|
||||
@ -390,33 +387,35 @@ ZEND_API void convert_to_long_base(zval *op, int base) /* {{{ */
|
||||
|
||||
switch (Z_TYPE_P(op)) {
|
||||
case IS_NULL:
|
||||
Z_LVAL_P(op) = 0;
|
||||
ZVAL_LONG(op, 0);
|
||||
break;
|
||||
case IS_RESOURCE: {
|
||||
TSRMLS_FETCH();
|
||||
long l = Z_RES_HANDLE_P(op);
|
||||
zval_ptr_dtor(op);
|
||||
Z_LVAL_P(op) = l;
|
||||
ZVAL_LONG(op, l);
|
||||
}
|
||||
/* break missing intentionally */
|
||||
case IS_BOOL:
|
||||
Z_TYPE_INFO_P(op) = IS_LONG;
|
||||
break;
|
||||
case IS_LONG:
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
Z_LVAL_P(op) = zend_dval_to_lval(Z_DVAL_P(op));
|
||||
ZVAL_LONG(op, zend_dval_to_lval(Z_DVAL_P(op)));
|
||||
break;
|
||||
case IS_STRING:
|
||||
{
|
||||
zend_string *str = Z_STR_P(op);
|
||||
|
||||
Z_LVAL_P(op) = strtol(str->val, NULL, base);
|
||||
ZVAL_LONG(op, strtol(str->val, NULL, base));
|
||||
STR_RELEASE(str);
|
||||
}
|
||||
break;
|
||||
case IS_ARRAY:
|
||||
tmp = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0);
|
||||
zval_dtor(op);
|
||||
Z_LVAL_P(op) = tmp;
|
||||
ZVAL_LONG(op, tmp);
|
||||
break;
|
||||
case IS_OBJECT:
|
||||
{
|
||||
@ -437,11 +436,9 @@ ZEND_API void convert_to_long_base(zval *op, int base) /* {{{ */
|
||||
default:
|
||||
zend_error(E_WARNING, "Cannot convert to ordinal value");
|
||||
zval_dtor(op);
|
||||
Z_LVAL_P(op) = 0;
|
||||
ZVAL_LONG(op, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
Z_TYPE_P(op) = IS_LONG;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -451,18 +448,18 @@ ZEND_API void convert_to_double(zval *op) /* {{{ */
|
||||
|
||||
switch (Z_TYPE_P(op)) {
|
||||
case IS_NULL:
|
||||
Z_DVAL_P(op) = 0.0;
|
||||
ZVAL_DOUBLE(op, 0.0);
|
||||
break;
|
||||
case IS_RESOURCE: {
|
||||
TSRMLS_FETCH();
|
||||
double d = (double) Z_RES_HANDLE_P(op);
|
||||
zval_ptr_dtor(op);
|
||||
Z_DVAL_P(op) = d;
|
||||
ZVAL_DOUBLE(op, d);
|
||||
}
|
||||
break;
|
||||
case IS_BOOL:
|
||||
case IS_LONG:
|
||||
Z_DVAL_P(op) = (double) Z_LVAL_P(op);
|
||||
ZVAL_DOUBLE(op, (double) Z_LVAL_P(op));
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
break;
|
||||
@ -470,14 +467,14 @@ ZEND_API void convert_to_double(zval *op) /* {{{ */
|
||||
{
|
||||
zend_string *str = Z_STR_P(op);
|
||||
|
||||
Z_DVAL_P(op) = zend_strtod(str->val, NULL);
|
||||
ZVAL_DOUBLE(op, zend_strtod(str->val, NULL));
|
||||
STR_RELEASE(str);
|
||||
}
|
||||
break;
|
||||
case IS_ARRAY:
|
||||
tmp = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0);
|
||||
zval_dtor(op);
|
||||
Z_DVAL_P(op) = tmp;
|
||||
ZVAL_DOUBLE(op, tmp);
|
||||
break;
|
||||
case IS_OBJECT:
|
||||
{
|
||||
@ -498,10 +495,9 @@ ZEND_API void convert_to_double(zval *op) /* {{{ */
|
||||
default:
|
||||
zend_error(E_WARNING, "Cannot convert to real value (type=%d)", Z_TYPE_P(op));
|
||||
zval_dtor(op);
|
||||
Z_DVAL_P(op) = 0;
|
||||
ZVAL_DOUBLE(op, 0);
|
||||
break;
|
||||
}
|
||||
Z_TYPE_P(op) = IS_DOUBLE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -522,7 +518,7 @@ ZEND_API void convert_to_null(zval *op) /* {{{ */
|
||||
}
|
||||
|
||||
zval_dtor(op);
|
||||
Z_TYPE_P(op) = IS_NULL;
|
||||
ZVAL_NULL(op);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -534,21 +530,21 @@ ZEND_API void convert_to_boolean(zval *op) /* {{{ */
|
||||
case IS_BOOL:
|
||||
break;
|
||||
case IS_NULL:
|
||||
Z_LVAL_P(op) = 0;
|
||||
ZVAL_BOOL(op, 0);
|
||||
break;
|
||||
case IS_RESOURCE: {
|
||||
TSRMLS_FETCH();
|
||||
long l = (Z_RES_HANDLE_P(op) ? 1 : 0);
|
||||
|
||||
zval_ptr_dtor(op);
|
||||
Z_LVAL_P(op) = l;
|
||||
ZVAL_BOOL(op, l);
|
||||
}
|
||||
break;
|
||||
case IS_LONG:
|
||||
Z_LVAL_P(op) = (Z_LVAL_P(op) ? 1 : 0);
|
||||
ZVAL_BOOL(op, Z_LVAL_P(op) ? 1 : 0);
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
Z_LVAL_P(op) = (Z_DVAL_P(op) ? 1 : 0);
|
||||
ZVAL_BOOL(op, Z_DVAL_P(op) ? 1 : 0);
|
||||
break;
|
||||
case IS_STRING:
|
||||
{
|
||||
@ -556,9 +552,9 @@ ZEND_API void convert_to_boolean(zval *op) /* {{{ */
|
||||
|
||||
if (str->len == 0
|
||||
|| (str->len == 1 && str->val[0] == '0')) {
|
||||
Z_LVAL_P(op) = 0;
|
||||
ZVAL_BOOL(op, 0);
|
||||
} else {
|
||||
Z_LVAL_P(op) = 1;
|
||||
ZVAL_BOOL(op, 1);
|
||||
}
|
||||
STR_RELEASE(str);
|
||||
}
|
||||
@ -566,7 +562,7 @@ ZEND_API void convert_to_boolean(zval *op) /* {{{ */
|
||||
case IS_ARRAY:
|
||||
tmp = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0);
|
||||
zval_dtor(op);
|
||||
Z_LVAL_P(op) = tmp;
|
||||
ZVAL_BOOL(op, tmp);
|
||||
break;
|
||||
case IS_OBJECT:
|
||||
{
|
||||
@ -585,28 +581,27 @@ ZEND_API void convert_to_boolean(zval *op) /* {{{ */
|
||||
}
|
||||
default:
|
||||
zval_dtor(op);
|
||||
Z_LVAL_P(op) = 0;
|
||||
ZVAL_BOOL(op, 0);
|
||||
break;
|
||||
}
|
||||
Z_TYPE_P(op) = IS_BOOL;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API void _convert_to_cstring(zval *op ZEND_FILE_LINE_DC) /* {{{ */
|
||||
{
|
||||
double dval;
|
||||
switch (Z_TYPE_P(op)) {
|
||||
case IS_DOUBLE: {
|
||||
TSRMLS_FETCH();
|
||||
dval = Z_DVAL_P(op);
|
||||
Z_STRLEN_P(op) = zend_spprintf((char**)&Z_STRVAL_P(op), 0, "%.*H", (int) EG(precision), dval);
|
||||
/* %H already handles removing trailing zeros from the fractional part, yay */
|
||||
break;
|
||||
}
|
||||
default:
|
||||
//??? double dval;
|
||||
//??? switch (Z_TYPE_P(op)) {
|
||||
//??? case IS_DOUBLE: {
|
||||
//??? TSRMLS_FETCH();
|
||||
//??? dval = Z_DVAL_P(op);
|
||||
//??? Z_STRLEN_P(op) = zend_spprintf((char**)&Z_STRVAL_P(op), 0, "%.*H", (int) EG(precision), dval);
|
||||
//??? /* %H already handles removing trailing zeros from the fractional part, yay */
|
||||
//??? break;
|
||||
//??? }
|
||||
//??? default:
|
||||
_convert_to_string(op ZEND_FILE_LINE_CC);
|
||||
}
|
||||
Z_TYPE_P(op) = IS_STRING;
|
||||
//??? }
|
||||
//??? Z_TYPE_P(op) = IS_STRING;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -617,15 +612,15 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */
|
||||
|
||||
switch (Z_TYPE_P(op)) {
|
||||
case IS_NULL:
|
||||
Z_STR_P(op) = STR_EMPTY_ALLOC();
|
||||
ZVAL_EMPTY_STRING(op);
|
||||
break;
|
||||
case IS_STRING:
|
||||
break;
|
||||
case IS_BOOL:
|
||||
if (Z_LVAL_P(op)) {
|
||||
Z_STR_P(op) = STR_INIT("1", 1, 0);
|
||||
ZVAL_NEW_STR(op, STR_INIT("1", 1, 0));
|
||||
} else {
|
||||
Z_STR_P(op) = STR_EMPTY_ALLOC();
|
||||
ZVAL_EMPTY_STRING(op);
|
||||
}
|
||||
break;
|
||||
case IS_RESOURCE: {
|
||||
@ -636,7 +631,7 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */
|
||||
|
||||
zval_ptr_dtor(op);
|
||||
len = zend_spprintf(&str, 0, "Resource id #%ld", tmp);
|
||||
Z_STR_P(op) = STR_INIT(str, len, 0);
|
||||
ZVAL_NEW_STR(op, STR_INIT(str, len, 0));
|
||||
efree(str);
|
||||
break;
|
||||
}
|
||||
@ -646,7 +641,7 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */
|
||||
lval = Z_LVAL_P(op);
|
||||
|
||||
len = zend_spprintf(&str, 0, "%ld", lval);
|
||||
Z_STR_P(op) = STR_INIT(str, len, 0);
|
||||
ZVAL_NEW_STR(op, STR_INIT(str, len, 0));
|
||||
efree(str);
|
||||
break;
|
||||
}
|
||||
@ -658,14 +653,14 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */
|
||||
dval = Z_DVAL_P(op);
|
||||
len = zend_spprintf(&str, 0, "%.*G", (int) EG(precision), dval);
|
||||
/* %G already handles removing trailing zeros from the fractional part, yay */
|
||||
Z_STR_P(op) = STR_INIT(str, len, 0);
|
||||
ZVAL_NEW_STR(op, STR_INIT(str, len, 0));
|
||||
efree(str);
|
||||
break;
|
||||
}
|
||||
case IS_ARRAY:
|
||||
zend_error(E_NOTICE, "Array to string conversion");
|
||||
zval_dtor(op);
|
||||
Z_STR_P(op) = STR_INIT("Array", sizeof("Array")-1, 0);
|
||||
ZVAL_NEW_STR(op, STR_INIT("Array", sizeof("Array")-1, 0));
|
||||
break;
|
||||
case IS_OBJECT: {
|
||||
TSRMLS_FETCH();
|
||||
@ -678,7 +673,7 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */
|
||||
|
||||
zend_error(E_NOTICE, "Object of class %s to string conversion", Z_OBJCE_P(op)->name->val);
|
||||
zval_dtor(op);
|
||||
Z_STR_P(op) = STR_INIT("Object", sizeof("Object")-1, 0);
|
||||
ZVAL_NEW_STR(op, STR_INIT("Object", sizeof("Object")-1, 0));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -687,7 +682,6 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */
|
||||
ZVAL_BOOL(op, 0);
|
||||
break;
|
||||
}
|
||||
Z_TYPE_P(op) = IS_STRING;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -702,7 +696,6 @@ static void convert_scalar_to_array(zval *op, int type TSRMLS_DC) /* {{{ */
|
||||
ZVAL_NEW_ARR(op);
|
||||
zend_hash_init(Z_ARRVAL_P(op), 0, NULL, ZVAL_PTR_DTOR, 0);
|
||||
zend_hash_index_update(Z_ARRVAL_P(op), 0, &entry);
|
||||
Z_TYPE_P(op) = IS_ARRAY;
|
||||
break;
|
||||
case IS_OBJECT:
|
||||
object_init(op);
|
||||
@ -965,7 +958,7 @@ ZEND_API int mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ *
|
||||
long overflow;
|
||||
|
||||
ZEND_SIGNED_MULTIPLY_LONG(Z_LVAL_P(op1),Z_LVAL_P(op2), Z_LVAL_P(result),Z_DVAL_P(result),overflow);
|
||||
Z_TYPE_P(result) = overflow ? IS_DOUBLE : IS_LONG;
|
||||
Z_TYPE_INFO_P(result) = overflow ? IS_DOUBLE : IS_LONG;
|
||||
return SUCCESS;
|
||||
|
||||
}
|
||||
@ -1153,8 +1146,7 @@ ZEND_API int bitwise_not_function(zval *result, zval *op1 TSRMLS_DC) /* {{{ */
|
||||
int i;
|
||||
zval op1_copy = *op1;
|
||||
|
||||
Z_TYPE_P(result) = IS_STRING;
|
||||
Z_STR_P(result) = STR_ALLOC(Z_STRLEN(op1_copy), 0);
|
||||
ZVAL_NEW_STR(result, STR_ALLOC(Z_STRLEN(op1_copy), 0));
|
||||
for (i = 0; i < Z_STRLEN(op1_copy); i++) {
|
||||
Z_STRVAL_P(result)[i] = ~Z_STRVAL(op1_copy)[i];
|
||||
}
|
||||
@ -1196,7 +1188,7 @@ ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /
|
||||
if (result==op1) {
|
||||
STR_RELEASE(Z_STR_P(result));
|
||||
}
|
||||
ZVAL_STR(result, str);
|
||||
ZVAL_NEW_STR(result, str);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@ -1241,7 +1233,7 @@ ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
if (result==op1) {
|
||||
STR_RELEASE(Z_STR_P(result));
|
||||
}
|
||||
ZVAL_STR(result, str);
|
||||
ZVAL_NEW_STR(result, str);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@ -1286,7 +1278,7 @@ ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
if (result==op1) {
|
||||
STR_RELEASE(Z_STR_P(result));
|
||||
}
|
||||
ZVAL_STR(result, str);
|
||||
ZVAL_NEW_STR(result, str);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@ -1353,7 +1345,7 @@ ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2)
|
||||
|
||||
buf->val[length - 1] = (char) Z_LVAL_P(op2);
|
||||
buf->val[length] = 0;
|
||||
ZVAL_STR(result, buf);
|
||||
ZVAL_NEW_STR(result, buf);
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
@ -1367,7 +1359,7 @@ ZEND_API int add_string_to_string(zval *result, const zval *op1, const zval *op2
|
||||
|
||||
memcpy(buf->val + op1_len, Z_STRVAL_P(op2), Z_STRLEN_P(op2));
|
||||
buf->val[length] = 0;
|
||||
ZVAL_STR(result, buf);
|
||||
ZVAL_NEW_STR(result, buf);
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
@ -1411,7 +1403,7 @@ ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{
|
||||
}
|
||||
|
||||
Z_STR_P(result) = STR_REALLOC(Z_STR_P(result), res_len, 0 );
|
||||
|
||||
Z_TYPE_INFO_P(result) = IS_STRING_EX;
|
||||
memcpy(Z_STRVAL_P(result) + op1_len, Z_STRVAL_P(op2), op2_len);
|
||||
Z_STRVAL_P(result)[res_len]=0;
|
||||
} else {
|
||||
@ -1421,7 +1413,7 @@ ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{
|
||||
memcpy(buf->val, Z_STRVAL_P(op1), Z_STRLEN_P(op1));
|
||||
memcpy(buf->val + Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2));
|
||||
buf->val[length] = 0;
|
||||
ZVAL_STR(result, buf);
|
||||
ZVAL_NEW_STR(result, buf);
|
||||
}
|
||||
if (use_copy1) {
|
||||
zval_dtor(op1);
|
||||
@ -1736,42 +1728,42 @@ static int hash_zval_identical_function(const zval *z1, const zval *z2) /* {{{ *
|
||||
|
||||
ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
Z_TYPE_P(result) = IS_BOOL;
|
||||
if (Z_TYPE_P(op1) != Z_TYPE_P(op2)) {
|
||||
Z_LVAL_P(result) = 0;
|
||||
ZVAL_BOOL(result, 0);
|
||||
return SUCCESS;
|
||||
}
|
||||
switch (Z_TYPE_P(op1)) {
|
||||
case IS_NULL:
|
||||
Z_LVAL_P(result) = 1;
|
||||
ZVAL_BOOL(result, 1);
|
||||
break;
|
||||
case IS_BOOL:
|
||||
case IS_LONG:
|
||||
Z_LVAL_P(result) = (Z_LVAL_P(op1) == Z_LVAL_P(op2));
|
||||
ZVAL_BOOL(result, Z_LVAL_P(op1) == Z_LVAL_P(op2));
|
||||
break;
|
||||
case IS_RESOURCE:
|
||||
Z_LVAL_P(result) = (Z_RES_P(op1) == Z_RES_P(op2));
|
||||
ZVAL_BOOL(result, Z_RES_P(op1) == Z_RES_P(op2));
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
Z_LVAL_P(result) = (Z_DVAL_P(op1) == Z_DVAL_P(op2));
|
||||
ZVAL_BOOL(result, Z_DVAL_P(op1) == Z_DVAL_P(op2));
|
||||
break;
|
||||
case IS_STRING:
|
||||
Z_LVAL_P(result) = ((Z_STRLEN_P(op1) == Z_STRLEN_P(op2))
|
||||
// TODO: interned strings ???
|
||||
ZVAL_BOOL(result, (Z_STRLEN_P(op1) == Z_STRLEN_P(op2))
|
||||
&& (!memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1))));
|
||||
break;
|
||||
case IS_ARRAY:
|
||||
Z_LVAL_P(result) = (Z_ARRVAL_P(op1) == Z_ARRVAL_P(op2) ||
|
||||
ZVAL_BOOL(result, Z_ARRVAL_P(op1) == Z_ARRVAL_P(op2) ||
|
||||
zend_hash_compare(Z_ARRVAL_P(op1), Z_ARRVAL_P(op2), (compare_func_t) hash_zval_identical_function, 1 TSRMLS_CC)==0);
|
||||
break;
|
||||
case IS_OBJECT:
|
||||
if (Z_OBJ_HT_P(op1) == Z_OBJ_HT_P(op2)) {
|
||||
Z_LVAL_P(result) = (Z_OBJ_P(op1) == Z_OBJ_P(op2));
|
||||
ZVAL_BOOL(result, Z_OBJ_P(op1) == Z_OBJ_P(op2));
|
||||
} else {
|
||||
Z_LVAL_P(result) = 0;
|
||||
ZVAL_BOOL(result, 0);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Z_LVAL_P(result) = 0;
|
||||
ZVAL_BOOL(result, 0);
|
||||
return FAILURE;
|
||||
}
|
||||
return SUCCESS;
|
||||
@ -1872,11 +1864,13 @@ static void increment_string(zval *str) /* {{{ */
|
||||
if (Z_STRLEN_P(str) == 0) {
|
||||
STR_RELEASE(Z_STR_P(str));
|
||||
Z_STR_P(str) = STR_INIT("1", sizeof("1")-1, 0);
|
||||
Z_TYPE_INFO_P(str) = IS_STRING_EX;
|
||||
return;
|
||||
}
|
||||
|
||||
if (IS_INTERNED(Z_STR_P(str))) {
|
||||
Z_STR_P(str) = STR_INIT(Z_STRVAL_P(str), Z_STRLEN_P(str), 0);
|
||||
Z_TYPE_INFO_P(str) = IS_STRING_EX;
|
||||
} else if (Z_REFCOUNT_P(str) > 1) {
|
||||
Z_DELREF_P(str);
|
||||
Z_STR_P(str) = STR_INIT(Z_STRVAL_P(str), Z_STRLEN_P(str), 0);
|
||||
@ -1940,7 +1934,7 @@ static void increment_string(zval *str) /* {{{ */
|
||||
break;
|
||||
}
|
||||
STR_FREE(Z_STR_P(str));
|
||||
ZVAL_STR(str, t);
|
||||
ZVAL_NEW_STR(str, t);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@ -2342,17 +2336,15 @@ ZEND_API void zend_compare_arrays(zval *result, zval *a1, zval *a2 TSRMLS_DC) /*
|
||||
|
||||
ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
Z_TYPE_P(result) = IS_LONG;
|
||||
|
||||
if (Z_OBJ_P(o1) == Z_OBJ_P(o2)) {
|
||||
Z_LVAL_P(result) = 0;
|
||||
ZVAL_LONG(result, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Z_OBJ_HT_P(o1)->compare_objects == NULL) {
|
||||
Z_LVAL_P(result) = 1;
|
||||
ZVAL_LONG(result, 1);
|
||||
} else {
|
||||
Z_LVAL_P(result) = Z_OBJ_HT_P(o1)->compare_objects(o1, o2 TSRMLS_CC);
|
||||
ZVAL_LONG(result, Z_OBJ_HT_P(o1)->compare_objects(o1, o2 TSRMLS_CC));
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@ -2364,7 +2356,7 @@ ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC) /* {{{ */
|
||||
int len;
|
||||
|
||||
len = zend_spprintf(&str, 0, "%.*G", (int) EG(precision), (double)Z_DVAL_P(op));
|
||||
Z_STR_P(op) = STR_INIT(str, len, 0);
|
||||
ZVAL_NEW_STR(op, STR_INIT(str, len, 0));
|
||||
efree(str);
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -449,7 +449,7 @@ ZEND_API void zend_update_current_locale(void);
|
||||
|
||||
/* The offset in bytes between the value and type fields of a zval */
|
||||
#define ZVAL_OFFSETOF_TYPE \
|
||||
(offsetof(zval, u.v.type) - offsetof(zval, value))
|
||||
(offsetof(zval, u1.type_info) - offsetof(zval, value))
|
||||
|
||||
static zend_always_inline int fast_increment_function(zval *op1)
|
||||
{
|
||||
@ -460,7 +460,7 @@ static zend_always_inline int fast_increment_function(zval *op1)
|
||||
"jno 0f\n\t"
|
||||
"movl $0x0, (%0)\n\t"
|
||||
"movl $0x41e00000, 0x4(%0)\n\t"
|
||||
"movb %1, %c2(%0)\n"
|
||||
"movl %1, %c2(%0)\n"
|
||||
"0:"
|
||||
:
|
||||
: "r"(&op1->value),
|
||||
@ -473,7 +473,7 @@ static zend_always_inline int fast_increment_function(zval *op1)
|
||||
"jno 0f\n\t"
|
||||
"movl $0x0, (%0)\n\t"
|
||||
"movl $0x43e00000, 0x4(%0)\n\t"
|
||||
"movb %1, %c2(%0)\n"
|
||||
"movl %1, %c2(%0)\n"
|
||||
"0:"
|
||||
:
|
||||
: "r"(&op1->value),
|
||||
@ -483,8 +483,7 @@ static zend_always_inline int fast_increment_function(zval *op1)
|
||||
#else
|
||||
if (UNEXPECTED(Z_LVAL_P(op1) == LONG_MAX)) {
|
||||
/* switch to double */
|
||||
Z_DVAL_P(op1) = (double)LONG_MAX + 1.0;
|
||||
Z_TYPE_P(op1) = IS_DOUBLE;
|
||||
ZVAL_DOUBLE(op1, (double)LONG_MAX + 1.0);
|
||||
} else {
|
||||
Z_LVAL_P(op1)++;
|
||||
}
|
||||
@ -503,7 +502,7 @@ static zend_always_inline int fast_decrement_function(zval *op1)
|
||||
"jno 0f\n\t"
|
||||
"movl $0x00200000, (%0)\n\t"
|
||||
"movl $0xc1e00000, 0x4(%0)\n\t"
|
||||
"movb %1,%c2(%0)\n"
|
||||
"movl %1,%c2(%0)\n"
|
||||
"0:"
|
||||
:
|
||||
: "r"(&op1->value),
|
||||
@ -516,7 +515,7 @@ static zend_always_inline int fast_decrement_function(zval *op1)
|
||||
"jno 0f\n\t"
|
||||
"movl $0x00000000, (%0)\n\t"
|
||||
"movl $0xc3e00000, 0x4(%0)\n\t"
|
||||
"movb %1,%c2(%0)\n"
|
||||
"movl %1,%c2(%0)\n"
|
||||
"0:"
|
||||
:
|
||||
: "r"(&op1->value),
|
||||
@ -526,8 +525,7 @@ static zend_always_inline int fast_decrement_function(zval *op1)
|
||||
#else
|
||||
if (UNEXPECTED(Z_LVAL_P(op1) == LONG_MIN)) {
|
||||
/* switch to double */
|
||||
Z_DVAL_P(op1) = (double)LONG_MIN - 1.0;
|
||||
Z_TYPE_P(op1) = IS_DOUBLE;
|
||||
ZVAL_DOUBLE(op1, (double)LONG_MIN - 1.0);
|
||||
} else {
|
||||
Z_LVAL_P(op1)--;
|
||||
}
|
||||
@ -547,13 +545,13 @@ static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *o
|
||||
"addl (%2), %%eax\n\t"
|
||||
"jo 0f\n\t"
|
||||
"movl %%eax, (%0)\n\t"
|
||||
"movb %3, %c5(%0)\n\t"
|
||||
"movl %3, %c5(%0)\n\t"
|
||||
"jmp 1f\n"
|
||||
"0:\n\t"
|
||||
"fildl (%1)\n\t"
|
||||
"fildl (%2)\n\t"
|
||||
"faddp %%st, %%st(1)\n\t"
|
||||
"movb %4, %c5(%0)\n\t"
|
||||
"movl %4, %c5(%0)\n\t"
|
||||
"fstpl (%0)\n"
|
||||
"1:"
|
||||
:
|
||||
@ -570,13 +568,13 @@ static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *o
|
||||
"addq (%2), %%rax\n\t"
|
||||
"jo 0f\n\t"
|
||||
"movq %%rax, (%0)\n\t"
|
||||
"movb %3, %c5(%0)\n\t"
|
||||
"movl %3, %c5(%0)\n\t"
|
||||
"jmp 1f\n"
|
||||
"0:\n\t"
|
||||
"fildq (%1)\n\t"
|
||||
"fildq (%2)\n\t"
|
||||
"faddp %%st, %%st(1)\n\t"
|
||||
"movb %4, %c5(%0)\n\t"
|
||||
"movl %4, %c5(%0)\n\t"
|
||||
"fstpl (%0)\n"
|
||||
"1:"
|
||||
:
|
||||
@ -596,27 +594,22 @@ static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *o
|
||||
|
||||
if (UNEXPECTED((Z_LVAL_P(op1) & LONG_SIGN_MASK) == (Z_LVAL_P(op2) & LONG_SIGN_MASK)
|
||||
&& (Z_LVAL_P(op1) & LONG_SIGN_MASK) != ((Z_LVAL_P(op1) + Z_LVAL_P(op2)) & LONG_SIGN_MASK))) {
|
||||
Z_DVAL_P(result) = (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2));
|
||||
} else {
|
||||
Z_LVAL_P(result) = Z_LVAL_P(op1) + Z_LVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_LONG;
|
||||
ZVAL_LONG(result, Z_LVAL_P(op1) + Z_LVAL_P(op2));
|
||||
}
|
||||
#endif
|
||||
return SUCCESS;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
Z_DVAL_P(result) = ((double)Z_LVAL_P(op1)) + Z_DVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) + Z_DVAL_P(op2));
|
||||
return SUCCESS;
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
Z_DVAL_P(result) = Z_DVAL_P(op1) + Z_DVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
ZVAL_DOUBLE(result, Z_DVAL_P(op1) + Z_DVAL_P(op2));
|
||||
return SUCCESS;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
Z_DVAL_P(result) = Z_DVAL_P(op1) + ((double)Z_LVAL_P(op2));
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
ZVAL_DOUBLE(result, Z_DVAL_P(op1) + ((double)Z_LVAL_P(op2)));
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
@ -633,7 +626,7 @@ static zend_always_inline int fast_sub_function(zval *result, zval *op1, zval *o
|
||||
"subl (%2), %%eax\n\t"
|
||||
"jo 0f\n\t"
|
||||
"movl %%eax, (%0)\n\t"
|
||||
"movb %3, %c5(%0)\n\t"
|
||||
"movl %3, %c5(%0)\n\t"
|
||||
"jmp 1f\n"
|
||||
"0:\n\t"
|
||||
"fildl (%2)\n\t"
|
||||
@ -643,7 +636,7 @@ static zend_always_inline int fast_sub_function(zval *result, zval *op1, zval *o
|
||||
#else
|
||||
"fsubp %%st, %%st(1)\n\t"
|
||||
#endif
|
||||
"movb %4, %c5(%0)\n\t"
|
||||
"movl %4, %c5(%0)\n\t"
|
||||
"fstpl (%0)\n"
|
||||
"1:"
|
||||
:
|
||||
@ -660,7 +653,7 @@ static zend_always_inline int fast_sub_function(zval *result, zval *op1, zval *o
|
||||
"subq (%2), %%rax\n\t"
|
||||
"jo 0f\n\t"
|
||||
"movq %%rax, (%0)\n\t"
|
||||
"movb %3, %c5(%0)\n\t"
|
||||
"movl %3, %c5(%0)\n\t"
|
||||
"jmp 1f\n"
|
||||
"0:\n\t"
|
||||
"fildq (%2)\n\t"
|
||||
@ -670,7 +663,7 @@ static zend_always_inline int fast_sub_function(zval *result, zval *op1, zval *o
|
||||
#else
|
||||
"fsubp %%st, %%st(1)\n\t"
|
||||
#endif
|
||||
"movb %4, %c5(%0)\n\t"
|
||||
"movl %4, %c5(%0)\n\t"
|
||||
"fstpl (%0)\n"
|
||||
"1:"
|
||||
:
|
||||
@ -682,30 +675,24 @@ static zend_always_inline int fast_sub_function(zval *result, zval *op1, zval *o
|
||||
"n"(ZVAL_OFFSETOF_TYPE)
|
||||
: "rax","cc");
|
||||
#else
|
||||
Z_LVAL_P(result) = Z_LVAL_P(op1) - Z_LVAL_P(op2);
|
||||
ZVAL_LONG(result, Z_LVAL_P(op1) - Z_LVAL_P(op2));
|
||||
|
||||
if (UNEXPECTED((Z_LVAL_P(op1) & LONG_SIGN_MASK) != (Z_LVAL_P(op2) & LONG_SIGN_MASK)
|
||||
&& (Z_LVAL_P(op1) & LONG_SIGN_MASK) != (Z_LVAL_P(result) & LONG_SIGN_MASK))) {
|
||||
Z_DVAL_P(result) = (double) Z_LVAL_P(op1) - (double) Z_LVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
} else {
|
||||
Z_TYPE_P(result) = IS_LONG;
|
||||
ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) - (double) Z_LVAL_P(op2));
|
||||
}
|
||||
#endif
|
||||
return SUCCESS;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
Z_DVAL_P(result) = ((double)Z_LVAL_P(op1)) - Z_DVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) - Z_DVAL_P(op2));
|
||||
return SUCCESS;
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
Z_DVAL_P(result) = Z_DVAL_P(op1) - Z_DVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
ZVAL_DOUBLE(result, Z_DVAL_P(op1) - Z_DVAL_P(op2));
|
||||
return SUCCESS;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
Z_DVAL_P(result) = Z_DVAL_P(op1) - ((double)Z_LVAL_P(op2));
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
ZVAL_DOUBLE(result, Z_DVAL_P(op1) - ((double)Z_LVAL_P(op2)));
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
@ -719,21 +706,18 @@ static zend_always_inline int fast_mul_function(zval *result, zval *op1, zval *o
|
||||
long overflow;
|
||||
|
||||
ZEND_SIGNED_MULTIPLY_LONG(Z_LVAL_P(op1), Z_LVAL_P(op2), Z_LVAL_P(result), Z_DVAL_P(result), overflow);
|
||||
Z_TYPE_P(result) = overflow ? IS_DOUBLE : IS_LONG;
|
||||
Z_TYPE_INFO_P(result) = overflow ? IS_DOUBLE : IS_LONG;
|
||||
return SUCCESS;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
Z_DVAL_P(result) = ((double)Z_LVAL_P(op1)) * Z_DVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) * Z_DVAL_P(op2));
|
||||
return SUCCESS;
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
Z_DVAL_P(result) = Z_DVAL_P(op1) * Z_DVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
ZVAL_DOUBLE(result, Z_DVAL_P(op1) * Z_DVAL_P(op2));
|
||||
return SUCCESS;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
Z_DVAL_P(result) = Z_DVAL_P(op1) * ((double)Z_LVAL_P(op2));
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
ZVAL_DOUBLE(result, Z_DVAL_P(op1) * ((double)Z_LVAL_P(op2)));
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
@ -747,53 +731,43 @@ static zend_always_inline int fast_div_function(zval *result, zval *op1, zval *o
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
if (UNEXPECTED(Z_LVAL_P(op2) == 0)) {
|
||||
zend_error(E_WARNING, "Division by zero");
|
||||
Z_LVAL_P(result) = 0;
|
||||
Z_TYPE_P(result) = IS_BOOL;
|
||||
ZVAL_BOOL(result, 0);
|
||||
return FAILURE;
|
||||
} else if (UNEXPECTED(Z_LVAL_P(op2) == -1 && Z_LVAL_P(op1) == LONG_MIN)) {
|
||||
/* Prevent overflow error/crash */
|
||||
Z_DVAL_P(result) = (double) LONG_MIN / -1;
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
ZVAL_DOUBLE(result, (double) LONG_MIN / -1);
|
||||
} else if (EXPECTED(Z_LVAL_P(op1) % Z_LVAL_P(op2) == 0)) {
|
||||
/* integer */
|
||||
Z_LVAL_P(result) = Z_LVAL_P(op1) / Z_LVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_LONG;
|
||||
ZVAL_LONG(result, Z_LVAL_P(op1) / Z_LVAL_P(op2));
|
||||
} else {
|
||||
Z_DVAL_P(result) = ((double) Z_LVAL_P(op1)) / ((double)Z_LVAL_P(op2));
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
ZVAL_DOUBLE(result, ((double) Z_LVAL_P(op1)) / ((double)Z_LVAL_P(op2)));
|
||||
}
|
||||
return SUCCESS;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
if (UNEXPECTED(Z_DVAL_P(op2) == 0)) {
|
||||
zend_error(E_WARNING, "Division by zero");
|
||||
Z_LVAL_P(result) = 0;
|
||||
Z_TYPE_P(result) = IS_BOOL;
|
||||
ZVAL_BOOL(result, 0);
|
||||
return FAILURE;
|
||||
}
|
||||
Z_DVAL_P(result) = ((double)Z_LVAL_P(op1)) / Z_DVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) / Z_DVAL_P(op2));
|
||||
return SUCCESS;
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE) && 0) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
if (UNEXPECTED(Z_DVAL_P(op2) == 0)) {
|
||||
zend_error(E_WARNING, "Division by zero");
|
||||
Z_LVAL_P(result) = 0;
|
||||
Z_TYPE_P(result) = IS_BOOL;
|
||||
ZVAL_BOOL(result, 0);
|
||||
return FAILURE;
|
||||
}
|
||||
Z_DVAL_P(result) = Z_DVAL_P(op1) / Z_DVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
ZVAL_DOUBLE(result, Z_DVAL_P(op1) / Z_DVAL_P(op2));
|
||||
return SUCCESS;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
if (UNEXPECTED(Z_LVAL_P(op2) == 0)) {
|
||||
zend_error(E_WARNING, "Division by zero");
|
||||
Z_LVAL_P(result) = 0;
|
||||
Z_TYPE_P(result) = IS_BOOL;
|
||||
ZVAL_BOOL(result, 0);
|
||||
return FAILURE;
|
||||
}
|
||||
Z_DVAL_P(result) = Z_DVAL_P(op1) / ((double)Z_LVAL_P(op2));
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
ZVAL_DOUBLE(result, Z_DVAL_P(op1) / ((double)Z_LVAL_P(op2)));
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
@ -807,17 +781,14 @@ static zend_always_inline int fast_mod_function(zval *result, zval *op1, zval *o
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
if (UNEXPECTED(Z_LVAL_P(op2) == 0)) {
|
||||
zend_error(E_WARNING, "Division by zero");
|
||||
Z_LVAL_P(result) = 0;
|
||||
Z_TYPE_P(result) = IS_BOOL;
|
||||
ZVAL_BOOL(result, 0);
|
||||
return FAILURE;
|
||||
} else if (UNEXPECTED(Z_LVAL_P(op2) == -1)) {
|
||||
/* Prevent overflow error/crash if op1==LONG_MIN */
|
||||
Z_LVAL_P(result) = 0;
|
||||
Z_TYPE_P(result) = IS_LONG;
|
||||
ZVAL_LONG(result, 0);
|
||||
return SUCCESS;
|
||||
}
|
||||
Z_LVAL_P(result) = Z_LVAL_P(op1) % Z_LVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_LONG;
|
||||
ZVAL_LONG(result, Z_LVAL_P(op1) % Z_LVAL_P(op2));
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ static zend_string *zend_new_interned_string_int(zend_string *str TSRMLS_DC)
|
||||
p->h = h;
|
||||
p->key = str;
|
||||
Z_STR(p->val) = str;
|
||||
Z_TYPE(p->val) = IS_STRING;
|
||||
Z_TYPE_INFO(p->val) = IS_INTERNED_STRING_EX;
|
||||
nIndex = h & CG(interned_strings).nTableMask;
|
||||
Z_NEXT(p->val) = CG(interned_strings).arHash[nIndex];
|
||||
CG(interned_strings).arHash[nIndex] = idx;
|
||||
|
@ -98,10 +98,14 @@ static zend_always_inline zend_string *zend_str_alloc(int len, int persistent)
|
||||
zend_string *ret = pemalloc(sizeof(zend_string) + len, persistent);
|
||||
|
||||
GC_REFCOUNT(ret) = 1;
|
||||
// TODO use one assignment ???
|
||||
#if 1
|
||||
/* optimized single assignment */
|
||||
GC_TYPE_INFO(ret) = IS_STRING | ((persistent ? IS_STR_PERSISTENT : 0) << 8);
|
||||
#else
|
||||
GC_TYPE(ret) = IS_STRING;
|
||||
GC_FLAGS(ret) = (persistent ? IS_STR_PERSISTENT : 0);
|
||||
GC_INFO(ret) = 0;
|
||||
#endif
|
||||
ret->h = 0;
|
||||
ret->len = len;
|
||||
return ret;
|
||||
|
@ -109,14 +109,17 @@ struct _zval_struct {
|
||||
union {
|
||||
struct {
|
||||
ZEND_ENDIAN_LOHI_4(
|
||||
zend_uchar type, /* active type */
|
||||
zend_uchar flags, /* various IS_VAR flags */
|
||||
zend_uchar res1,
|
||||
zend_uchar res2)
|
||||
zend_uchar type, /* active type */
|
||||
zend_uchar type_flags,
|
||||
zend_uchar const_flags,
|
||||
zend_uchar reserved) /* various IS_VAR flags */
|
||||
} v;
|
||||
zend_uint type_info;
|
||||
} u;
|
||||
zend_uint next; /* hash collision chain */
|
||||
} u1;
|
||||
union {
|
||||
zend_uint var_flags;
|
||||
zend_uint next; /* hash collision chain */
|
||||
} u2;
|
||||
};
|
||||
|
||||
struct _zend_refcounted {
|
||||
@ -204,45 +207,45 @@ struct _zend_ast_ref {
|
||||
#define IS_BOOL 3
|
||||
#define IS_LONG 4
|
||||
#define IS_DOUBLE 5
|
||||
//#define IS_INTERNED_STRING 6
|
||||
#define IS_STRING 7
|
||||
#define IS_ARRAY 8
|
||||
#define IS_OBJECT 9
|
||||
#define IS_RESOURCE 10
|
||||
#define IS_REFERENCE 11
|
||||
#define IS_STRING 6
|
||||
#define IS_ARRAY 7
|
||||
#define IS_OBJECT 8
|
||||
#define IS_RESOURCE 9
|
||||
#define IS_REFERENCE 10
|
||||
|
||||
#define IS_CONSTANT 12
|
||||
#define IS_CONSTANT_ARRAY 13
|
||||
#define IS_CONSTANT_AST 14
|
||||
#define IS_CALLABLE 15
|
||||
#define IS_CONSTANT 11
|
||||
#define IS_CONSTANT_ARRAY 12
|
||||
#define IS_CONSTANT_AST 13
|
||||
#define IS_CALLABLE 14
|
||||
|
||||
#define IS_STR_OFFSET 16
|
||||
#define IS_PTR 17
|
||||
#define IS_STR_OFFSET 15
|
||||
#define IS_PTR 16
|
||||
|
||||
/* Ugly hack to support constants as static array indices */
|
||||
#define IS_CONSTANT_TYPE_MASK 0x00f
|
||||
#define IS_CONSTANT_UNQUALIFIED 0x010
|
||||
//???#define IS_CONSTANT_INDEX 0x080
|
||||
#define IS_LEXICAL_VAR 0x020
|
||||
#define IS_LEXICAL_REF 0x040
|
||||
#define IS_CONSTANT_IN_NAMESPACE 0x100
|
||||
static inline zend_uchar zval_get_type(const zval* pz) {
|
||||
return pz->u1.v.type;
|
||||
}
|
||||
|
||||
#define IS_CONSTANT_TYPE(type) \
|
||||
(((type) & IS_CONSTANT_TYPE_MASK) >= IS_CONSTANT && ((type) & IS_CONSTANT_TYPE_MASK) <= IS_CONSTANT_AST)
|
||||
|
||||
/* All data types < IS_STRING have their constructor/destructors skipped */
|
||||
#define IS_REFCOUNTED(type) ((type) >= IS_STRING)
|
||||
|
||||
#define Z_TYPE(zval) (zval).u.v.type
|
||||
//???
|
||||
#if 0
|
||||
# define Z_TYPE(zval) (zval).u1.v.type
|
||||
#else
|
||||
# define Z_TYPE(zval) zval_get_type(&(zval))
|
||||
#endif
|
||||
#define Z_TYPE_P(zval_p) Z_TYPE(*(zval_p))
|
||||
|
||||
#define Z_FLAGS(zval) (zval).u.v.flags
|
||||
#define Z_FLAGS_P(zval_p) Z_FLAGS(*(zval_p))
|
||||
#define Z_TYPE_FLAGS(zval) (zval).u1.v.type_flags
|
||||
#define Z_TYPE_FLAGS_P(zval_p) Z_TYPE_FLAGS(*(zval_p))
|
||||
|
||||
#define Z_TYPE_INFO(zval) (zval).u.type_info
|
||||
#define Z_CONST_FLAGS(zval) (zval).u1.v.const_flags
|
||||
#define Z_CONST_FLAGS_P(zval_p) Z_CONST_FLAGS(*(zval_p))
|
||||
|
||||
#define Z_VAR_FLAGS(zval) (zval).u2.var_flags
|
||||
#define Z_VAR_FLAGS_P(zval_p) Z_VAR_FLAGS(*(zval_p))
|
||||
|
||||
#define Z_TYPE_INFO(zval) (zval).u1.type_info
|
||||
#define Z_TYPE_INFO_P(zval_p) Z_TYPE_INFO(*(zval_p))
|
||||
|
||||
#define Z_NEXT(zval) (zval).next
|
||||
#define Z_NEXT(zval) (zval).u2.next
|
||||
#define Z_NEXT_P(zval_p) Z_NEXT(*(zval_p))
|
||||
|
||||
#define Z_COUNTED(zval) (zval).value.counted
|
||||
@ -266,7 +269,32 @@ struct _zend_ast_ref {
|
||||
#define Z_GC_TYPE_INFO(zval) GC_TYPE_INFO(Z_COUNTED(zval))
|
||||
#define Z_GC_TYPE_INFO_P(zval_p) Z_GC_TYPE_INFO(*(zval_p))
|
||||
|
||||
/* zval.var_flags */
|
||||
/* zval.u1.v.type_flags */
|
||||
#define IS_TYPE_CONSTANT (1<<0)
|
||||
#define IS_TYPE_REFCOUNTED (1<<1)
|
||||
#define IS_TYPE_COLLECTABLE (1<<2)
|
||||
#define IS_TYPE_COPYABLE (1<<3)
|
||||
|
||||
/* extended types */
|
||||
#define IS_INTERNED_STRING_EX IS_STRING
|
||||
|
||||
#define IS_STRING_EX (IS_STRING | (( IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE) << 8))
|
||||
#define IS_ARRAY_EX (IS_ARRAY | (( IS_TYPE_REFCOUNTED | IS_TYPE_COLLECTABLE | IS_TYPE_COPYABLE) << 8))
|
||||
#define IS_OBJECT_EX (IS_OBJECT | (( IS_TYPE_REFCOUNTED | IS_TYPE_COLLECTABLE ) << 8))
|
||||
#define IS_RESOURCE_EX (IS_RESOURCE | (( IS_TYPE_REFCOUNTED ) << 8))
|
||||
#define IS_REFERENCE_EX (IS_REFERENCE | (( IS_TYPE_REFCOUNTED ) << 8))
|
||||
|
||||
#define IS_CONSTANT_EX (IS_CONSTANT | ((IS_TYPE_CONSTANT | IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE) << 8))
|
||||
#define IS_CONSTANT_ARRAY_EX (IS_CONSTANT_ARRAY | ((IS_TYPE_CONSTANT | IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE) << 8))
|
||||
#define IS_CONSTANT_AST_EX (IS_CONSTANT_AST | ((IS_TYPE_CONSTANT | IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE) << 8))
|
||||
|
||||
/* zval.u1.v.const_flags */
|
||||
#define IS_CONSTANT_UNQUALIFIED 0x010
|
||||
#define IS_LEXICAL_VAR 0x020
|
||||
#define IS_LEXICAL_REF 0x040
|
||||
#define IS_CONSTANT_IN_NAMESPACE 0x100 /* used only in opline->extended_value */
|
||||
|
||||
/* zval.u2.var_flags */
|
||||
#define IS_VAR_RET_REF (1<<0) /* return by by reference */
|
||||
|
||||
/* string flags (zval.value->gc.u.flags) */
|
||||
@ -278,7 +306,7 @@ struct _zend_ast_ref {
|
||||
#define IS_STR_CONSTANT_UNQUALIFIED (1<<4) /* the same as IS_CONSTANT_UNQUALIFIED */
|
||||
#define IS_STR_AST (1<<5) /* constant expression index */
|
||||
|
||||
/* object flags (zval.value->gc.u.vflags) */
|
||||
/* object flags (zval.value->gc.u.flags) */
|
||||
#define IS_OBJ_APPLY_COUNT 0x07
|
||||
#define IS_OBJ_DESTRUCTOR_CALLED (1<<3)
|
||||
|
||||
@ -301,9 +329,8 @@ struct _zend_ast_ref {
|
||||
#define Z_OBJ_INC_APPLY_COUNT_P(zv) Z_OBJ_INC_APPLY_COUNT(*(zv))
|
||||
#define Z_OBJ_DEC_APPLY_COUNT_P(zv) Z_OBJ_DEC_APPLY_COUNT(*(zv))
|
||||
|
||||
#define Z_REFCOUNTED(zval) (IS_REFCOUNTED(Z_TYPE(zval)) && \
|
||||
(Z_TYPE(zval) != IS_STRING || \
|
||||
!IS_INTERNED(Z_STR(zval))))
|
||||
/* All data types < IS_STRING have their constructor/destructors skipped */
|
||||
#define Z_REFCOUNTED(zval) (Z_TYPE_FLAGS(zval) & IS_TYPE_REFCOUNTED)
|
||||
#define Z_REFCOUNTED_P(zval_p) Z_REFCOUNTED(*(zval_p))
|
||||
|
||||
#define Z_ISREF(zval) (Z_TYPE(zval) == IS_REFERENCE)
|
||||
@ -396,42 +423,61 @@ struct _zend_ast_ref {
|
||||
#define Z_STR_OFFSET(zval) (zval).value.str_offset
|
||||
#define Z_STR_OFFSET_P(zval_p) Z_STR_OFFSET(*(zval_p))
|
||||
|
||||
#define ZVAL_UNDEF(z) do { \
|
||||
Z_TYPE_P(z) = IS_UNDEF; \
|
||||
#define ZVAL_UNDEF(z) do { \
|
||||
Z_TYPE_INFO_P(z) = IS_UNDEF; \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_NULL(z) do { \
|
||||
Z_TYPE_P(z) = IS_NULL; \
|
||||
#define ZVAL_NULL(z) do { \
|
||||
Z_TYPE_INFO_P(z) = IS_NULL; \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_BOOL(z, b) do { \
|
||||
zval *__z = (z); \
|
||||
Z_LVAL_P(__z) = ((b) != 0); \
|
||||
Z_TYPE_P(__z) = IS_BOOL; \
|
||||
#define ZVAL_BOOL(z, b) do { \
|
||||
zval *__z = (z); \
|
||||
Z_LVAL_P(__z) = ((b) != 0); \
|
||||
Z_TYPE_INFO_P(__z) = IS_BOOL; \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_LONG(z, l) { \
|
||||
zval *__z = (z); \
|
||||
Z_LVAL_P(__z) = l; \
|
||||
Z_TYPE_P(__z) = IS_LONG; \
|
||||
#define ZVAL_LONG(z, l) { \
|
||||
zval *__z = (z); \
|
||||
Z_LVAL_P(__z) = l; \
|
||||
Z_TYPE_INFO_P(__z) = IS_LONG; \
|
||||
}
|
||||
|
||||
#define ZVAL_DOUBLE(z, d) { \
|
||||
zval *__z = (z); \
|
||||
Z_DVAL_P(__z) = d; \
|
||||
Z_TYPE_P(__z) = IS_DOUBLE; \
|
||||
#define ZVAL_DOUBLE(z, d) { \
|
||||
zval *__z = (z); \
|
||||
Z_DVAL_P(__z) = d; \
|
||||
Z_TYPE_INFO_P(__z) = IS_DOUBLE; \
|
||||
}
|
||||
|
||||
#define ZVAL_STR(z, s) do { \
|
||||
zval *__z = (z); \
|
||||
Z_STR_P(__z) = (s); \
|
||||
Z_TYPE_P(__z) = IS_STRING; \
|
||||
zend_string *__s = (s); \
|
||||
Z_STR_P(__z) = __s; \
|
||||
/* interned strings support */ \
|
||||
Z_TYPE_INFO_P(__z) = IS_INTERNED(__s) ? \
|
||||
IS_INTERNED_STRING_EX : \
|
||||
IS_STRING_EX; \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_INT_STR(z, s) do { \
|
||||
zval *__z = (z); \
|
||||
zend_string *__s = (s); \
|
||||
Z_STR_P(__z) = __s; \
|
||||
Z_TYPE_INFO_P(__z) = IS_INTERNED_STRING_EX; \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_NEW_STR(z, s) do { \
|
||||
zval *__z = (z); \
|
||||
zend_string *__s = (s); \
|
||||
Z_STR_P(__z) = __s; \
|
||||
/* interned strings support */ \
|
||||
Z_TYPE_INFO_P(__z) = IS_STRING_EX; \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_ARR(z, a) do { \
|
||||
zval *__z = (z); \
|
||||
Z_ARR_P(__z) = (a); \
|
||||
Z_TYPE_P(__z) = IS_ARRAY; \
|
||||
Z_TYPE_INFO_P(__z) = IS_ARRAY_EX; \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_NEW_ARR(z) do { \
|
||||
@ -440,7 +486,7 @@ struct _zend_ast_ref {
|
||||
GC_REFCOUNT(_arr) = 1; \
|
||||
GC_TYPE_INFO(_arr) = IS_ARRAY; \
|
||||
Z_ARR_P(__z) = _arr; \
|
||||
Z_TYPE_P(__z) = IS_ARRAY; \
|
||||
Z_TYPE_INFO_P(__z) = IS_ARRAY_EX; \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_NEW_PERSISTENT_ARR(z) do { \
|
||||
@ -449,19 +495,19 @@ struct _zend_ast_ref {
|
||||
GC_REFCOUNT(_arr) = 1; \
|
||||
GC_TYPE_INFO(_arr) = IS_ARRAY; \
|
||||
Z_ARR_P(__z) = _arr; \
|
||||
Z_TYPE_P(__z) = IS_ARRAY; \
|
||||
Z_TYPE_INFO_P(__z) = IS_ARRAY_EX; \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_OBJ(z, o) do { \
|
||||
zval *__z = (z); \
|
||||
Z_OBJ_P(__z) = (o); \
|
||||
Z_TYPE_P(__z) = IS_OBJECT; \
|
||||
Z_TYPE_INFO_P(__z) = IS_OBJECT_EX; \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_RES(z, r) do { \
|
||||
zval *__z = (z); \
|
||||
Z_RES_P(__z) = (r); \
|
||||
Z_TYPE_P(__z) = IS_RESOURCE; \
|
||||
Z_TYPE_INFO_P(__z) = IS_RESOURCE_EX; \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_NEW_RES(z, h, p, t) do { \
|
||||
@ -473,7 +519,7 @@ struct _zend_ast_ref {
|
||||
_res->ptr = (p); \
|
||||
zval *__z = (z); \
|
||||
Z_RES_P(__z) = _res; \
|
||||
Z_TYPE_P(__z) = IS_RESOURCE; \
|
||||
Z_TYPE_INFO_P(__z) = IS_RESOURCE_EX; \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_NEW_PERSISTENT_RES(z, h, p, t) do { \
|
||||
@ -485,13 +531,13 @@ struct _zend_ast_ref {
|
||||
_res->ptr = (p); \
|
||||
zval *__z = (z); \
|
||||
Z_RES_P(__z) = _res; \
|
||||
Z_TYPE_P(__z) = IS_RESOURCE; \
|
||||
Z_TYPE_INFO_P(__z) = IS_RESOURCE_EX; \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_REF(z, r) do { \
|
||||
zval *__z = (z); \
|
||||
Z_REF_P(__z) = (r); \
|
||||
Z_TYPE_P(__z) = IS_REFERENCE; \
|
||||
Z_TYPE_INFO_P(__z) = IS_REFERENCE_EX; \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_NEW_REF(z, r) do { \
|
||||
@ -500,7 +546,7 @@ struct _zend_ast_ref {
|
||||
GC_TYPE_INFO(_ref) = IS_REFERENCE; \
|
||||
ZVAL_COPY_VALUE(&_ref->val, r); \
|
||||
Z_REF_P(z) = _ref; \
|
||||
Z_TYPE_P(z) = IS_REFERENCE; \
|
||||
Z_TYPE_INFO_P(z) = IS_REFERENCE_EX; \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_NEW_AST(z, a) do { \
|
||||
@ -510,27 +556,27 @@ struct _zend_ast_ref {
|
||||
GC_TYPE_INFO(_ast) = IS_CONSTANT_AST; \
|
||||
_ast->ast = (a); \
|
||||
Z_AST_P(__z) = _ast; \
|
||||
Z_TYPE_P(__z) = IS_CONSTANT_AST; \
|
||||
Z_TYPE_INFO_P(__z) = IS_CONSTANT_AST_EX; \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_INDIRECT(z, v) do { \
|
||||
Z_INDIRECT_P(z) = (v); \
|
||||
Z_TYPE_P(z) = IS_INDIRECT; \
|
||||
Z_TYPE_INFO_P(z) = IS_INDIRECT; \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_PTR(z, p) do { \
|
||||
Z_PTR_P(z) = (p); \
|
||||
Z_TYPE_P(z) = IS_PTR; \
|
||||
Z_TYPE_INFO_P(z) = IS_PTR; \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_FUNC(z, f) do { \
|
||||
Z_FUNC_P(z) = (f); \
|
||||
Z_TYPE_P(z) = IS_PTR; \
|
||||
Z_TYPE_INFO_P(z) = IS_PTR; \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_CE(z, c) do { \
|
||||
Z_CE_P(z) = (c); \
|
||||
Z_TYPE_P(z) = IS_PTR; \
|
||||
Z_TYPE_INFO_P(z) = IS_PTR; \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_STR_OFFSET(z, s, o) do { \
|
||||
@ -540,7 +586,7 @@ struct _zend_ast_ref {
|
||||
x->str = (s); \
|
||||
x->offset = (o); \
|
||||
Z_STR_OFFSET_P(z) = x; \
|
||||
Z_TYPE_P(z) = IS_STR_OFFSET; \
|
||||
Z_TYPE_INFO_P(z) = IS_STR_OFFSET; \
|
||||
} while (0)
|
||||
|
||||
#endif /* ZEND_TYPES_H */
|
||||
|
@ -29,14 +29,13 @@
|
||||
|
||||
ZEND_API void _zval_dtor_func(zend_refcounted *p ZEND_FILE_LINE_DC)
|
||||
{
|
||||
//??? switch (Z_TYPE_P(zvalue) & IS_CONSTANT_TYPE_MASK) {
|
||||
switch (GC_TYPE(p)) {
|
||||
case IS_STRING:
|
||||
case IS_CONSTANT: {
|
||||
zend_string *str = (zend_string*)p;
|
||||
//??? CHECK_ZVAL_STRING_REL(zvalue);
|
||||
STR_RELEASE(str);
|
||||
goto exit;
|
||||
break;
|
||||
}
|
||||
case IS_ARRAY:
|
||||
case IS_CONSTANT_ARRAY: {
|
||||
@ -47,23 +46,24 @@ ZEND_API void _zval_dtor_func(zend_refcounted *p ZEND_FILE_LINE_DC)
|
||||
/* break possible cycles */
|
||||
GC_TYPE(arr) = IS_NULL;
|
||||
zend_hash_destroy(&arr->ht);
|
||||
goto gc_exit;
|
||||
GC_REMOVE_FROM_BUFFER(arr);
|
||||
efree(arr);
|
||||
}
|
||||
goto exit;
|
||||
break;
|
||||
}
|
||||
case IS_CONSTANT_AST: {
|
||||
zend_ast_ref *ast =(zend_ast_ref*)p;
|
||||
|
||||
zend_ast_destroy(ast->ast);
|
||||
efree(ast);
|
||||
goto exit;
|
||||
break;
|
||||
}
|
||||
case IS_OBJECT: {
|
||||
zend_object *obj = (zend_object*)p;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
OBJ_RELEASE(obj);
|
||||
goto exit;
|
||||
break;
|
||||
}
|
||||
case IS_RESOURCE: {
|
||||
zend_resource *res = (zend_resource*)p;
|
||||
@ -73,36 +73,30 @@ ZEND_API void _zval_dtor_func(zend_refcounted *p ZEND_FILE_LINE_DC)
|
||||
/* destroy resource */
|
||||
zend_list_delete(res);
|
||||
}
|
||||
goto exit;
|
||||
break;
|
||||
}
|
||||
case IS_REFERENCE: {
|
||||
zend_reference *ref = (zend_reference*)p;
|
||||
if (--GC_REFCOUNT(ref) == 0) {
|
||||
zval_ptr_dtor(&ref->val);
|
||||
goto gc_exit;
|
||||
efree(ref);
|
||||
}
|
||||
goto exit;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
goto exit;
|
||||
break;
|
||||
}
|
||||
gc_exit:
|
||||
GC_REMOVE_FROM_BUFFER(p);
|
||||
efree(p);
|
||||
exit:
|
||||
return;
|
||||
}
|
||||
|
||||
ZEND_API void _zval_dtor_func_for_ptr(zend_refcounted *p ZEND_FILE_LINE_DC)
|
||||
{
|
||||
//??? switch (Z_TYPE_P(zvalue) & IS_CONSTANT_TYPE_MASK) {
|
||||
switch (GC_TYPE(p)) {
|
||||
case IS_STRING:
|
||||
case IS_CONSTANT: {
|
||||
zend_string *str = (zend_string*)p;
|
||||
//??? CHECK_ZVAL_STRING_REL(zvalue);
|
||||
STR_FREE(str);
|
||||
goto exit;
|
||||
break;
|
||||
}
|
||||
case IS_ARRAY:
|
||||
case IS_CONSTANT_ARRAY: {
|
||||
@ -113,23 +107,24 @@ ZEND_API void _zval_dtor_func_for_ptr(zend_refcounted *p ZEND_FILE_LINE_DC)
|
||||
/* break possible cycles */
|
||||
GC_TYPE(arr) = IS_NULL;
|
||||
zend_hash_destroy(&arr->ht);
|
||||
goto gc_exit;
|
||||
GC_REMOVE_FROM_BUFFER(arr);
|
||||
efree(arr);
|
||||
}
|
||||
goto exit;
|
||||
break;
|
||||
}
|
||||
case IS_CONSTANT_AST: {
|
||||
zend_ast_ref *ast =(zend_ast_ref*)p;
|
||||
|
||||
zend_ast_destroy(ast->ast);
|
||||
efree(ast);
|
||||
goto exit;
|
||||
break;
|
||||
}
|
||||
case IS_OBJECT: {
|
||||
zend_object *obj = (zend_object*)p;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
zend_objects_store_del(obj TSRMLS_CC);
|
||||
goto exit;
|
||||
break;
|
||||
}
|
||||
case IS_RESOURCE: {
|
||||
zend_resource *res = (zend_resource*)p;
|
||||
@ -137,27 +132,23 @@ ZEND_API void _zval_dtor_func_for_ptr(zend_refcounted *p ZEND_FILE_LINE_DC)
|
||||
|
||||
/* destroy resource */
|
||||
zend_list_delete(res);
|
||||
goto exit;
|
||||
break;
|
||||
}
|
||||
case IS_REFERENCE: {
|
||||
zend_reference *ref = (zend_reference*)p;
|
||||
|
||||
zval_ptr_dtor(&ref->val);
|
||||
goto gc_exit;
|
||||
efree(ref);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
goto exit;
|
||||
break;
|
||||
}
|
||||
gc_exit:
|
||||
GC_REMOVE_FROM_BUFFER(p);
|
||||
efree(p);
|
||||
exit:
|
||||
return;
|
||||
}
|
||||
|
||||
ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC)
|
||||
{
|
||||
switch (Z_TYPE_P(zvalue) & IS_CONSTANT_TYPE_MASK) {
|
||||
switch (Z_TYPE_P(zvalue)) {
|
||||
case IS_STRING:
|
||||
case IS_CONSTANT:
|
||||
CHECK_ZVAL_STRING_REL(zvalue);
|
||||
@ -181,7 +172,7 @@ ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC)
|
||||
|
||||
ZEND_API void _zval_internal_dtor_for_ptr(zval *zvalue ZEND_FILE_LINE_DC)
|
||||
{
|
||||
switch (Z_TYPE_P(zvalue) & IS_CONSTANT_TYPE_MASK) {
|
||||
switch (Z_TYPE_P(zvalue)) {
|
||||
case IS_STRING:
|
||||
case IS_CONSTANT:
|
||||
CHECK_ZVAL_STRING_REL(zvalue);
|
||||
@ -233,7 +224,7 @@ ZEND_API void zval_add_ref_unref(zval *p)
|
||||
|
||||
ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC)
|
||||
{
|
||||
switch (Z_TYPE_P(zvalue) & IS_CONSTANT_TYPE_MASK) {
|
||||
switch (Z_TYPE_P(zvalue)) {
|
||||
case IS_CONSTANT:
|
||||
case IS_STRING:
|
||||
CHECK_ZVAL_STRING_REL(zvalue);
|
||||
@ -316,8 +307,8 @@ ZEND_API int zval_copy_static_var(zval *p TSRMLS_DC, int num_args, va_list args,
|
||||
zend_bool is_ref;
|
||||
zval tmp;
|
||||
|
||||
if (Z_TYPE_P(p) & (IS_LEXICAL_VAR|IS_LEXICAL_REF)) {
|
||||
is_ref = Z_TYPE_P(p) & IS_LEXICAL_REF;
|
||||
if (Z_CONST_FLAGS_P(p) & (IS_LEXICAL_VAR|IS_LEXICAL_REF)) {
|
||||
is_ref = Z_CONST_FLAGS_P(p) & IS_LEXICAL_REF;
|
||||
|
||||
if (!EG(active_symbol_table)) {
|
||||
zend_rebuild_symbol_table(TSRMLS_C);
|
||||
|
@ -38,12 +38,17 @@ static zend_always_inline void _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC)
|
||||
|
||||
ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC);
|
||||
|
||||
#define zval_copy_ctor_func(zv) _zval_copy_ctor_func(zv ZEND_FILE_LINE_CC)
|
||||
|
||||
static zend_always_inline void _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC)
|
||||
{
|
||||
if (!Z_REFCOUNTED_P(zvalue)) {
|
||||
return;
|
||||
if (Z_REFCOUNTED_P(zvalue)) {
|
||||
if (Z_TYPE_FLAGS_P(zvalue) & IS_TYPE_COPYABLE) {
|
||||
_zval_copy_ctor_func(zvalue ZEND_FILE_LINE_RELAY_CC);
|
||||
} else {
|
||||
Z_ADDREF_P(zvalue);
|
||||
}
|
||||
}
|
||||
_zval_copy_ctor_func(zvalue ZEND_FILE_LINE_RELAY_CC);
|
||||
}
|
||||
|
||||
ZEND_API int zval_copy_static_var(zval *p TSRMLS_DC, int num_args, va_list args, zend_hash_key *key);
|
||||
|
@ -1807,7 +1807,7 @@ ZEND_VM_HANDLER(39, ZEND_ASSIGN_REF, VAR|CV, VAR|CV)
|
||||
value_ptr &&
|
||||
!Z_ISREF_P(value_ptr) &&
|
||||
opline->extended_value == ZEND_RETURNS_FUNCTION &&
|
||||
!(Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) {
|
||||
!(Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) {
|
||||
if (!OP2_FREE) {
|
||||
PZVAL_LOCK(value_ptr); /* undo the effect of get_zval_ptr_ptr() */
|
||||
}
|
||||
@ -2025,7 +2025,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
|
||||
|
||||
ZVAL_NULL(ret);
|
||||
//??? ret->var.ptr_ptr = &ret->var.ptr;
|
||||
Z_FLAGS_P(ret) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0;
|
||||
Z_VAR_FLAGS_P(ret) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0;
|
||||
|
||||
if (!zend_execute_internal) {
|
||||
/* saves one function call if zend_execute_internal is not used */
|
||||
@ -2050,7 +2050,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
|
||||
|
||||
ZVAL_NULL(return_value);
|
||||
//??? ret->var.ptr_ptr = &ret->var.ptr;
|
||||
Z_FLAGS_P(return_value) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0;
|
||||
Z_VAR_FLAGS_P(return_value) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0;
|
||||
}
|
||||
|
||||
if (UNEXPECTED((EG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) != 0)) {
|
||||
@ -2092,7 +2092,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
|
||||
} else {
|
||||
//??? Z_UNSET_ISREF_P(EX_T(opline->result.var).var.ptr);
|
||||
//??? Z_SET_REFCOUNT_P(EX_T(opline->result.var).var.ptr, 1);
|
||||
Z_FLAGS_P(EX_VAR(opline->result.var)) = 0;
|
||||
Z_VAR_FLAGS_P(EX_VAR(opline->result.var)) = 0;
|
||||
//??? EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
|
||||
}
|
||||
}
|
||||
@ -2331,7 +2331,7 @@ ZEND_VM_HANDLER(54, ZEND_ADD_CHAR, TMP|UNUSED, CONST)
|
||||
|
||||
if (OP1_TYPE == IS_UNUSED) {
|
||||
/* Initialize for erealloc in add_char_to_string */
|
||||
ZVAL_STR(str, STR_EMPTY_ALLOC());
|
||||
ZVAL_EMPTY_STRING(str);
|
||||
}
|
||||
|
||||
add_char_to_string(str, str, opline->op2.zv);
|
||||
@ -2350,7 +2350,7 @@ ZEND_VM_HANDLER(55, ZEND_ADD_STRING, TMP|UNUSED, CONST)
|
||||
|
||||
if (OP1_TYPE == IS_UNUSED) {
|
||||
/* Initialize for erealloc in add_string_to_string */
|
||||
ZVAL_STR(str, STR_EMPTY_ALLOC());
|
||||
ZVAL_EMPTY_STRING(str);
|
||||
}
|
||||
|
||||
add_string_to_string(str, str, opline->op2.zv);
|
||||
@ -2374,7 +2374,7 @@ ZEND_VM_HANDLER(56, ZEND_ADD_VAR, TMP|UNUSED, TMP|VAR|CV)
|
||||
|
||||
if (OP1_TYPE == IS_UNUSED) {
|
||||
/* Initialize for erealloc in add_string_to_string */
|
||||
ZVAL_STR(str, STR_EMPTY_ALLOC());
|
||||
ZVAL_EMPTY_STRING(str);
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(var) != IS_STRING) {
|
||||
@ -2913,7 +2913,7 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY)
|
||||
|
||||
if (OP1_TYPE == IS_VAR && !Z_ISREF_P(retval_ptr)) {
|
||||
if (opline->extended_value == ZEND_RETURNS_FUNCTION &&
|
||||
(Z_FLAGS_P(retval_ptr) & IS_VAR_RET_REF)) {
|
||||
(Z_VAR_FLAGS_P(retval_ptr) & IS_VAR_RET_REF)) {
|
||||
//??? } else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Only variable references should be returned by reference");
|
||||
@ -3109,7 +3109,7 @@ ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY)
|
||||
|
||||
varptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
|
||||
if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) ||
|
||||
(Z_FLAGS_P(varptr) & IS_VAR_RET_REF)) &&
|
||||
(Z_VAR_FLAGS_P(varptr) & IS_VAR_RET_REF)) &&
|
||||
((!Z_REFCOUNTED_P(varptr) && Z_TYPE_P(varptr) != IS_STRING) ||
|
||||
Z_ISREF_P(varptr) ||
|
||||
Z_TYPE_P(varptr) == IS_OBJECT ||
|
||||
@ -3402,7 +3402,7 @@ ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST)
|
||||
var_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
|
||||
zval_ptr_dtor(var_ptr);
|
||||
if (param == NULL) {
|
||||
if (IS_CONSTANT_TYPE(Z_TYPE_P(opline->op2.zv))) {
|
||||
if (Z_TYPE_FLAGS_P(opline->op2.zv) & IS_TYPE_CONSTANT) {
|
||||
zval tmp;
|
||||
|
||||
ZVAL_COPY_VALUE(&tmp, opline->op2.zv);
|
||||
@ -3715,7 +3715,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
|
||||
}
|
||||
|
||||
if (EXPECTED((value = zend_hash_find(&ce->constants_table, Z_STR_P(opline->op2.zv))) != NULL)) {
|
||||
if (IS_CONSTANT_TYPE(Z_TYPE_P(value))) {
|
||||
if (Z_TYPE_FLAGS_P(value) & IS_TYPE_CONSTANT) {
|
||||
zend_class_entry *old_scope = EG(scope);
|
||||
|
||||
EG(scope) = ce;
|
||||
@ -5339,7 +5339,7 @@ ZEND_VM_HANDLER(143, ZEND_DECLARE_CONST, CONST, CONST)
|
||||
name = GET_OP1_ZVAL_PTR(BP_VAR_R);
|
||||
val = GET_OP2_ZVAL_PTR(BP_VAR_R);
|
||||
|
||||
if (IS_CONSTANT_TYPE(Z_TYPE_P(val))) {
|
||||
if (Z_TYPE_FLAGS_P(val) & IS_TYPE_CONSTANT) {
|
||||
ZVAL_COPY_VALUE(&c.value, val);
|
||||
if (Z_TYPE_P(val) == IS_CONSTANT_ARRAY) {
|
||||
zval_copy_ctor(&c.value);
|
||||
@ -5445,7 +5445,7 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE
|
||||
* not return by reference we throw a notice. */
|
||||
if (OP1_TYPE == IS_VAR && !Z_ISREF_P(value_ptr)
|
||||
&& !(opline->extended_value == ZEND_RETURNS_FUNCTION
|
||||
&& (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
&& (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
//??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
) {
|
||||
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
|
||||
|
@ -554,7 +554,7 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
|
||||
|
||||
ZVAL_NULL(ret);
|
||||
//??? ret->var.ptr_ptr = &ret->var.ptr;
|
||||
Z_FLAGS_P(ret) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0;
|
||||
Z_VAR_FLAGS_P(ret) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0;
|
||||
|
||||
if (!zend_execute_internal) {
|
||||
/* saves one function call if zend_execute_internal is not used */
|
||||
@ -579,7 +579,7 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
|
||||
|
||||
ZVAL_NULL(return_value);
|
||||
//??? ret->var.ptr_ptr = &ret->var.ptr;
|
||||
Z_FLAGS_P(return_value) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0;
|
||||
Z_VAR_FLAGS_P(return_value) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0;
|
||||
}
|
||||
|
||||
if (UNEXPECTED((EG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) != 0)) {
|
||||
@ -621,7 +621,7 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
|
||||
} else {
|
||||
//??? Z_UNSET_ISREF_P(EX_T(opline->result.var).var.ptr);
|
||||
//??? Z_SET_REFCOUNT_P(EX_T(opline->result.var).var.ptr, 1);
|
||||
Z_FLAGS_P(EX_VAR(opline->result.var)) = 0;
|
||||
Z_VAR_FLAGS_P(EX_VAR(opline->result.var)) = 0;
|
||||
//??? EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
|
||||
}
|
||||
}
|
||||
@ -1607,7 +1607,7 @@ static int ZEND_FASTCALL ZEND_RECV_INIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_
|
||||
var_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
|
||||
zval_ptr_dtor(var_ptr);
|
||||
if (param == NULL) {
|
||||
if (IS_CONSTANT_TYPE(Z_TYPE_P(opline->op2.zv))) {
|
||||
if (Z_TYPE_FLAGS_P(opline->op2.zv) & IS_TYPE_CONSTANT) {
|
||||
zval tmp;
|
||||
|
||||
ZVAL_COPY_VALUE(&tmp, opline->op2.zv);
|
||||
@ -2602,7 +2602,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND
|
||||
|
||||
if (IS_CONST == IS_VAR && !Z_ISREF_P(retval_ptr)) {
|
||||
if (opline->extended_value == ZEND_RETURNS_FUNCTION &&
|
||||
(Z_FLAGS_P(retval_ptr) & IS_VAR_RET_REF)) {
|
||||
(Z_VAR_FLAGS_P(retval_ptr) & IS_VAR_RET_REF)) {
|
||||
//??? } else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Only variable references should be returned by reference");
|
||||
@ -3929,7 +3929,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO
|
||||
}
|
||||
|
||||
if (EXPECTED((value = zend_hash_find(&ce->constants_table, Z_STR_P(opline->op2.zv))) != NULL)) {
|
||||
if (IS_CONSTANT_TYPE(Z_TYPE_P(value))) {
|
||||
if (Z_TYPE_FLAGS_P(value) & IS_TYPE_CONSTANT) {
|
||||
zend_class_entry *old_scope = EG(scope);
|
||||
|
||||
EG(scope) = ce;
|
||||
@ -4205,7 +4205,7 @@ static int ZEND_FASTCALL ZEND_DECLARE_CONST_SPEC_CONST_CONST_HANDLER(ZEND_OPCOD
|
||||
name = opline->op1.zv;
|
||||
val = opline->op2.zv;
|
||||
|
||||
if (IS_CONSTANT_TYPE(Z_TYPE_P(val))) {
|
||||
if (Z_TYPE_FLAGS_P(val) & IS_TYPE_CONSTANT) {
|
||||
ZVAL_COPY_VALUE(&c.value, val);
|
||||
if (Z_TYPE_P(val) == IS_CONSTANT_ARRAY) {
|
||||
zval_copy_ctor(&c.value);
|
||||
@ -4274,7 +4274,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLE
|
||||
* not return by reference we throw a notice. */
|
||||
if (IS_CONST == IS_VAR && !Z_ISREF_P(value_ptr)
|
||||
&& !(opline->extended_value == ZEND_RETURNS_FUNCTION
|
||||
&& (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
&& (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
//??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
) {
|
||||
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
|
||||
@ -4927,7 +4927,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_
|
||||
* not return by reference we throw a notice. */
|
||||
if (IS_CONST == IS_VAR && !Z_ISREF_P(value_ptr)
|
||||
&& !(opline->extended_value == ZEND_RETURNS_FUNCTION
|
||||
&& (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
&& (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
//??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
) {
|
||||
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
|
||||
@ -5906,7 +5906,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_
|
||||
* not return by reference we throw a notice. */
|
||||
if (IS_CONST == IS_VAR && !Z_ISREF_P(value_ptr)
|
||||
&& !(opline->extended_value == ZEND_RETURNS_FUNCTION
|
||||
&& (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
&& (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
//??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
) {
|
||||
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
|
||||
@ -6595,7 +6595,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDL
|
||||
* not return by reference we throw a notice. */
|
||||
if (IS_CONST == IS_VAR && !Z_ISREF_P(value_ptr)
|
||||
&& !(opline->extended_value == ZEND_RETURNS_FUNCTION
|
||||
&& (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
&& (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
//??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
) {
|
||||
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
|
||||
@ -7301,7 +7301,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A
|
||||
* not return by reference we throw a notice. */
|
||||
if (IS_CONST == IS_VAR && !Z_ISREF_P(value_ptr)
|
||||
&& !(opline->extended_value == ZEND_RETURNS_FUNCTION
|
||||
&& (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
&& (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
//??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
) {
|
||||
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
|
||||
@ -7676,7 +7676,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE
|
||||
|
||||
if (IS_TMP_VAR == IS_VAR && !Z_ISREF_P(retval_ptr)) {
|
||||
if (opline->extended_value == ZEND_RETURNS_FUNCTION &&
|
||||
(Z_FLAGS_P(retval_ptr) & IS_VAR_RET_REF)) {
|
||||
(Z_VAR_FLAGS_P(retval_ptr) & IS_VAR_RET_REF)) {
|
||||
//??? } else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Only variable references should be returned by reference");
|
||||
@ -8867,7 +8867,7 @@ static int ZEND_FASTCALL ZEND_ADD_CHAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDL
|
||||
|
||||
if (IS_TMP_VAR == IS_UNUSED) {
|
||||
/* Initialize for erealloc in add_char_to_string */
|
||||
ZVAL_STR(str, STR_EMPTY_ALLOC());
|
||||
ZVAL_EMPTY_STRING(str);
|
||||
}
|
||||
|
||||
add_char_to_string(str, str, opline->op2.zv);
|
||||
@ -8886,7 +8886,7 @@ static int ZEND_FASTCALL ZEND_ADD_STRING_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HAN
|
||||
|
||||
if (IS_TMP_VAR == IS_UNUSED) {
|
||||
/* Initialize for erealloc in add_string_to_string */
|
||||
ZVAL_STR(str, STR_EMPTY_ALLOC());
|
||||
ZVAL_EMPTY_STRING(str);
|
||||
}
|
||||
|
||||
add_string_to_string(str, str, opline->op2.zv);
|
||||
@ -9266,7 +9266,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_
|
||||
* not return by reference we throw a notice. */
|
||||
if (IS_TMP_VAR == IS_VAR && !Z_ISREF_P(value_ptr)
|
||||
&& !(opline->extended_value == ZEND_RETURNS_FUNCTION
|
||||
&& (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
&& (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
//??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
) {
|
||||
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
|
||||
@ -9664,7 +9664,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_
|
||||
|
||||
if (IS_TMP_VAR == IS_UNUSED) {
|
||||
/* Initialize for erealloc in add_string_to_string */
|
||||
ZVAL_STR(str, STR_EMPTY_ALLOC());
|
||||
ZVAL_EMPTY_STRING(str);
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(var) != IS_STRING) {
|
||||
@ -9919,7 +9919,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
|
||||
* not return by reference we throw a notice. */
|
||||
if (IS_TMP_VAR == IS_VAR && !Z_ISREF_P(value_ptr)
|
||||
&& !(opline->extended_value == ZEND_RETURNS_FUNCTION
|
||||
&& (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
&& (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
//??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
) {
|
||||
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
|
||||
@ -10496,7 +10496,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_
|
||||
|
||||
if (IS_TMP_VAR == IS_UNUSED) {
|
||||
/* Initialize for erealloc in add_string_to_string */
|
||||
ZVAL_STR(str, STR_EMPTY_ALLOC());
|
||||
ZVAL_EMPTY_STRING(str);
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(var) != IS_STRING) {
|
||||
@ -10898,7 +10898,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
|
||||
* not return by reference we throw a notice. */
|
||||
if (IS_TMP_VAR == IS_VAR && !Z_ISREF_P(value_ptr)
|
||||
&& !(opline->extended_value == ZEND_RETURNS_FUNCTION
|
||||
&& (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
&& (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
//??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
) {
|
||||
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
|
||||
@ -11455,7 +11455,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER
|
||||
* not return by reference we throw a notice. */
|
||||
if (IS_TMP_VAR == IS_VAR && !Z_ISREF_P(value_ptr)
|
||||
&& !(opline->extended_value == ZEND_RETURNS_FUNCTION
|
||||
&& (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
&& (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
//??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
) {
|
||||
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
|
||||
@ -11853,7 +11853,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_A
|
||||
|
||||
if (IS_TMP_VAR == IS_UNUSED) {
|
||||
/* Initialize for erealloc in add_string_to_string */
|
||||
ZVAL_STR(str, STR_EMPTY_ALLOC());
|
||||
ZVAL_EMPTY_STRING(str);
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(var) != IS_STRING) {
|
||||
@ -12105,7 +12105,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
|
||||
* not return by reference we throw a notice. */
|
||||
if (IS_TMP_VAR == IS_VAR && !Z_ISREF_P(value_ptr)
|
||||
&& !(opline->extended_value == ZEND_RETURNS_FUNCTION
|
||||
&& (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
&& (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
//??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
) {
|
||||
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
|
||||
@ -12672,7 +12672,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE
|
||||
|
||||
if (IS_VAR == IS_VAR && !Z_ISREF_P(retval_ptr)) {
|
||||
if (opline->extended_value == ZEND_RETURNS_FUNCTION &&
|
||||
(Z_FLAGS_P(retval_ptr) & IS_VAR_RET_REF)) {
|
||||
(Z_VAR_FLAGS_P(retval_ptr) & IS_VAR_RET_REF)) {
|
||||
//??? } else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Only variable references should be returned by reference");
|
||||
@ -12772,7 +12772,7 @@ static int ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND
|
||||
|
||||
varptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
|
||||
if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) ||
|
||||
(Z_FLAGS_P(varptr) & IS_VAR_RET_REF)) &&
|
||||
(Z_VAR_FLAGS_P(varptr) & IS_VAR_RET_REF)) &&
|
||||
((!Z_REFCOUNTED_P(varptr) && Z_TYPE_P(varptr) != IS_STRING) ||
|
||||
Z_ISREF_P(varptr) ||
|
||||
Z_TYPE_P(varptr) == IS_OBJECT ||
|
||||
@ -15360,7 +15360,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE
|
||||
}
|
||||
|
||||
if (EXPECTED((value = zend_hash_find(&ce->constants_table, Z_STR_P(opline->op2.zv))) != NULL)) {
|
||||
if (IS_CONSTANT_TYPE(Z_TYPE_P(value))) {
|
||||
if (Z_TYPE_FLAGS_P(value) & IS_TYPE_CONSTANT) {
|
||||
zend_class_entry *old_scope = EG(scope);
|
||||
|
||||
EG(scope) = ce;
|
||||
@ -15966,7 +15966,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_
|
||||
* not return by reference we throw a notice. */
|
||||
if (IS_VAR == IS_VAR && !Z_ISREF_P(value_ptr)
|
||||
&& !(opline->extended_value == ZEND_RETURNS_FUNCTION
|
||||
&& (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
&& (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
//??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
) {
|
||||
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
|
||||
@ -18016,7 +18016,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
|
||||
* not return by reference we throw a notice. */
|
||||
if (IS_VAR == IS_VAR && !Z_ISREF_P(value_ptr)
|
||||
&& !(opline->extended_value == ZEND_RETURNS_FUNCTION
|
||||
&& (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
&& (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
//??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
) {
|
||||
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
|
||||
@ -19626,7 +19626,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDL
|
||||
value_ptr &&
|
||||
!Z_ISREF_P(value_ptr) &&
|
||||
opline->extended_value == ZEND_RETURNS_FUNCTION &&
|
||||
!(Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) {
|
||||
!(Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) {
|
||||
if (!(free_op2.var != NULL)) {
|
||||
PZVAL_LOCK(value_ptr); /* undo the effect of get_zval_ptr_ptr() */
|
||||
}
|
||||
@ -20452,7 +20452,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
|
||||
* not return by reference we throw a notice. */
|
||||
if (IS_VAR == IS_VAR && !Z_ISREF_P(value_ptr)
|
||||
&& !(opline->extended_value == ZEND_RETURNS_FUNCTION
|
||||
&& (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
&& (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
//??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
) {
|
||||
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
|
||||
@ -21579,7 +21579,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER
|
||||
* not return by reference we throw a notice. */
|
||||
if (IS_VAR == IS_VAR && !Z_ISREF_P(value_ptr)
|
||||
&& !(opline->extended_value == ZEND_RETURNS_FUNCTION
|
||||
&& (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
&& (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
//??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
) {
|
||||
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
|
||||
@ -23007,7 +23007,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLE
|
||||
value_ptr &&
|
||||
!Z_ISREF_P(value_ptr) &&
|
||||
opline->extended_value == ZEND_RETURNS_FUNCTION &&
|
||||
!(Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) {
|
||||
!(Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) {
|
||||
if (!0) {
|
||||
PZVAL_LOCK(value_ptr); /* undo the effect of get_zval_ptr_ptr() */
|
||||
}
|
||||
@ -23683,7 +23683,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
|
||||
* not return by reference we throw a notice. */
|
||||
if (IS_VAR == IS_VAR && !Z_ISREF_P(value_ptr)
|
||||
&& !(opline->extended_value == ZEND_RETURNS_FUNCTION
|
||||
&& (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
&& (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
//??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
) {
|
||||
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
|
||||
@ -24597,7 +24597,7 @@ static int ZEND_FASTCALL ZEND_ADD_CHAR_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HA
|
||||
|
||||
if (IS_UNUSED == IS_UNUSED) {
|
||||
/* Initialize for erealloc in add_char_to_string */
|
||||
ZVAL_STR(str, STR_EMPTY_ALLOC());
|
||||
ZVAL_EMPTY_STRING(str);
|
||||
}
|
||||
|
||||
add_char_to_string(str, str, opline->op2.zv);
|
||||
@ -24616,7 +24616,7 @@ static int ZEND_FASTCALL ZEND_ADD_STRING_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_
|
||||
|
||||
if (IS_UNUSED == IS_UNUSED) {
|
||||
/* Initialize for erealloc in add_string_to_string */
|
||||
ZVAL_STR(str, STR_EMPTY_ALLOC());
|
||||
ZVAL_EMPTY_STRING(str);
|
||||
}
|
||||
|
||||
add_string_to_string(str, str, opline->op2.zv);
|
||||
@ -24762,7 +24762,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC
|
||||
}
|
||||
|
||||
if (EXPECTED((value = zend_hash_find(&ce->constants_table, Z_STR_P(opline->op2.zv))) != NULL)) {
|
||||
if (IS_CONSTANT_TYPE(Z_TYPE_P(value))) {
|
||||
if (Z_TYPE_FLAGS_P(value) & IS_TYPE_CONSTANT) {
|
||||
zend_class_entry *old_scope = EG(scope);
|
||||
|
||||
EG(scope) = ce;
|
||||
@ -25140,7 +25140,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDL
|
||||
* not return by reference we throw a notice. */
|
||||
if (IS_UNUSED == IS_VAR && !Z_ISREF_P(value_ptr)
|
||||
&& !(opline->extended_value == ZEND_RETURNS_FUNCTION
|
||||
&& (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
&& (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
//??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
) {
|
||||
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
|
||||
@ -25977,7 +25977,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDL
|
||||
|
||||
if (IS_UNUSED == IS_UNUSED) {
|
||||
/* Initialize for erealloc in add_string_to_string */
|
||||
ZVAL_STR(str, STR_EMPTY_ALLOC());
|
||||
ZVAL_EMPTY_STRING(str);
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(var) != IS_STRING) {
|
||||
@ -26429,7 +26429,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER
|
||||
* not return by reference we throw a notice. */
|
||||
if (IS_UNUSED == IS_VAR && !Z_ISREF_P(value_ptr)
|
||||
&& !(opline->extended_value == ZEND_RETURNS_FUNCTION
|
||||
&& (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
&& (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
//??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
) {
|
||||
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
|
||||
@ -27266,7 +27266,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDL
|
||||
|
||||
if (IS_UNUSED == IS_UNUSED) {
|
||||
/* Initialize for erealloc in add_string_to_string */
|
||||
ZVAL_STR(str, STR_EMPTY_ALLOC());
|
||||
ZVAL_EMPTY_STRING(str);
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(var) != IS_STRING) {
|
||||
@ -27718,7 +27718,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER
|
||||
* not return by reference we throw a notice. */
|
||||
if (IS_UNUSED == IS_VAR && !Z_ISREF_P(value_ptr)
|
||||
&& !(opline->extended_value == ZEND_RETURNS_FUNCTION
|
||||
&& (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
&& (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
//??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
) {
|
||||
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
|
||||
@ -28120,7 +28120,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HAND
|
||||
* not return by reference we throw a notice. */
|
||||
if (IS_UNUSED == IS_VAR && !Z_ISREF_P(value_ptr)
|
||||
&& !(opline->extended_value == ZEND_RETURNS_FUNCTION
|
||||
&& (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
&& (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
//??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
) {
|
||||
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
|
||||
@ -28956,7 +28956,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLE
|
||||
|
||||
if (IS_UNUSED == IS_UNUSED) {
|
||||
/* Initialize for erealloc in add_string_to_string */
|
||||
ZVAL_STR(str, STR_EMPTY_ALLOC());
|
||||
ZVAL_EMPTY_STRING(str);
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(var) != IS_STRING) {
|
||||
@ -29406,7 +29406,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_
|
||||
* not return by reference we throw a notice. */
|
||||
if (IS_UNUSED == IS_VAR && !Z_ISREF_P(value_ptr)
|
||||
&& !(opline->extended_value == ZEND_RETURNS_FUNCTION
|
||||
&& (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
&& (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
//??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
) {
|
||||
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
|
||||
@ -29954,7 +29954,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER
|
||||
|
||||
if (IS_CV == IS_VAR && !Z_ISREF_P(retval_ptr)) {
|
||||
if (opline->extended_value == ZEND_RETURNS_FUNCTION &&
|
||||
(Z_FLAGS_P(retval_ptr) & IS_VAR_RET_REF)) {
|
||||
(Z_VAR_FLAGS_P(retval_ptr) & IS_VAR_RET_REF)) {
|
||||
//??? } else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Only variable references should be returned by reference");
|
||||
@ -30053,7 +30053,7 @@ static int ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL
|
||||
|
||||
varptr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
|
||||
if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) ||
|
||||
(Z_FLAGS_P(varptr) & IS_VAR_RET_REF)) &&
|
||||
(Z_VAR_FLAGS_P(varptr) & IS_VAR_RET_REF)) &&
|
||||
((!Z_REFCOUNTED_P(varptr) && Z_TYPE_P(varptr) != IS_STRING) ||
|
||||
Z_ISREF_P(varptr) ||
|
||||
Z_TYPE_P(varptr) == IS_OBJECT ||
|
||||
@ -32874,7 +32874,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
|
||||
* not return by reference we throw a notice. */
|
||||
if (IS_CV == IS_VAR && !Z_ISREF_P(value_ptr)
|
||||
&& !(opline->extended_value == ZEND_RETURNS_FUNCTION
|
||||
&& (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
&& (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
//??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
) {
|
||||
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
|
||||
@ -34796,7 +34796,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
|
||||
* not return by reference we throw a notice. */
|
||||
if (IS_CV == IS_VAR && !Z_ISREF_P(value_ptr)
|
||||
&& !(opline->extended_value == ZEND_RETURNS_FUNCTION
|
||||
&& (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
&& (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
//??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
) {
|
||||
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
|
||||
@ -36397,7 +36397,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLE
|
||||
value_ptr &&
|
||||
!Z_ISREF_P(value_ptr) &&
|
||||
opline->extended_value == ZEND_RETURNS_FUNCTION &&
|
||||
!(Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) {
|
||||
!(Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) {
|
||||
if (!(free_op2.var != NULL)) {
|
||||
PZVAL_LOCK(value_ptr); /* undo the effect of get_zval_ptr_ptr() */
|
||||
}
|
||||
@ -37103,7 +37103,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
|
||||
* not return by reference we throw a notice. */
|
||||
if (IS_CV == IS_VAR && !Z_ISREF_P(value_ptr)
|
||||
&& !(opline->extended_value == ZEND_RETURNS_FUNCTION
|
||||
&& (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
&& (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
//??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
) {
|
||||
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
|
||||
@ -38093,7 +38093,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_
|
||||
* not return by reference we throw a notice. */
|
||||
if (IS_CV == IS_VAR && !Z_ISREF_P(value_ptr)
|
||||
&& !(opline->extended_value == ZEND_RETURNS_FUNCTION
|
||||
&& (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
&& (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
//??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
) {
|
||||
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
|
||||
@ -39512,7 +39512,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER
|
||||
value_ptr &&
|
||||
!Z_ISREF_P(value_ptr) &&
|
||||
opline->extended_value == ZEND_RETURNS_FUNCTION &&
|
||||
!(Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) {
|
||||
!(Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) {
|
||||
if (!0) {
|
||||
PZVAL_LOCK(value_ptr); /* undo the effect of get_zval_ptr_ptr() */
|
||||
}
|
||||
@ -40068,7 +40068,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
|
||||
* not return by reference we throw a notice. */
|
||||
if (IS_CV == IS_VAR && !Z_ISREF_P(value_ptr)
|
||||
&& !(opline->extended_value == ZEND_RETURNS_FUNCTION
|
||||
&& (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
&& (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF))
|
||||
//??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
) {
|
||||
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
|
||||
|
@ -2491,7 +2491,6 @@ static void date_object_free_storage_period(zend_object *object TSRMLS_DC) /* {{
|
||||
/* Advanced Interface */
|
||||
PHPAPI zval *php_date_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
Z_TYPE_P(object) = IS_OBJECT;
|
||||
object_init_ex(object, pce);
|
||||
return object;
|
||||
} /* }}} */
|
||||
|
@ -1893,7 +1893,7 @@ PHP_FUNCTION(mysql_real_escape_string)
|
||||
new_str = STR_ALLOC(str_len * 2, 0);
|
||||
new_str->len = mysql_real_escape_string(mysql->conn, new_str->val, str, str_len);
|
||||
|
||||
RETURN_STR(new_str);
|
||||
RETURN_NEW_STR(new_str);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -924,12 +924,16 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
|
||||
} else {
|
||||
Z_STR(ZEND_OP1_LITERAL(last_op)) = STR_REALLOC(Z_STR(ZEND_OP1_LITERAL(last_op)), l, 0);
|
||||
}
|
||||
Z_TYPE_INFO(ZEND_OP1_LITERAL(last_op)) = IS_STRING_EX;
|
||||
memcpy(Z_STRVAL(ZEND_OP1_LITERAL(last_op)) + old_len, Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)));
|
||||
Z_STRVAL(ZEND_OP1_LITERAL(last_op))[l] = '\0';
|
||||
zval_dtor(&ZEND_OP1_LITERAL(opline));
|
||||
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
|
||||
Z_STR(ZEND_OP1_LITERAL(opline)) = zend_new_interned_string(Z_STR(ZEND_OP1_LITERAL(last_op)) TSRMLS_CC);
|
||||
Z_TYPE(ZEND_OP1_LITERAL(last_op)) = IS_NULL;
|
||||
if (IS_INTERNED(Z_STR(ZEND_OP1_LITERAL(opline)))) {
|
||||
Z_TYPE_FLAGS(ZEND_OP1_LITERAL(opline)) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
|
||||
}
|
||||
ZVAL_NULL(&ZEND_OP1_LITERAL(last_op));
|
||||
#else
|
||||
Z_STR(ZEND_OP1_LITERAL(opline)) = Z_STR(ZEND_OP1_LITERAL(last_op));
|
||||
#endif
|
||||
@ -968,12 +972,16 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
|
||||
} else {
|
||||
Z_STR(ZEND_OP2_LITERAL(src)) = STR_REALLOC(Z_STR(ZEND_OP2_LITERAL(src)), l, 0);
|
||||
}
|
||||
Z_TYPE_INFO(ZEND_OP2_LITERAL(last_op)) = IS_STRING_EX;
|
||||
memcpy(Z_STRVAL(ZEND_OP2_LITERAL(src)) + old_len, Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)));
|
||||
Z_STRVAL(ZEND_OP2_LITERAL(src))[l] = '\0';
|
||||
STR_RELEASE(Z_STR(ZEND_OP2_LITERAL(opline)));
|
||||
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
|
||||
Z_STR(ZEND_OP2_LITERAL(opline)) = zend_new_interned_string(Z_STR(ZEND_OP2_LITERAL(src)) TSRMLS_CC);
|
||||
Z_TYPE(ZEND_OP2_LITERAL(src)) = IS_NULL;
|
||||
if (IS_INTERNED(Z_STR(ZEND_OP2_LITERAL(opline)))) {
|
||||
Z_TYPE_FLAGS(ZEND_OP2_LITERAL(opline)) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
|
||||
}
|
||||
ZVAL_NULL(&ZEND_OP2_LITERAL(src));
|
||||
#else
|
||||
Z_STR(ZEND_OP2_LITERAL(opline)) = Z_STR(ZEND_OP2_LITERAL(src));
|
||||
#endif
|
||||
@ -1055,7 +1063,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
|
||||
/* BOOL */
|
||||
result = ZEND_OP1_LITERAL(opline);
|
||||
convert_to_boolean(&result);
|
||||
Z_TYPE(ZEND_OP1_LITERAL(opline)) = IS_NULL;
|
||||
ZVAL_NULL(&ZEND_OP1_LITERAL(opline));
|
||||
}
|
||||
//??? PZ_SET_REFCOUNT_P(&result, 1);
|
||||
//??? PZ_UNSET_ISREF_P(&result);
|
||||
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
#if ZEND_EXTENSION_API_NO > PHP_5_2_X_API_NO
|
||||
# define ZEND_IS_CONSTANT_TYPE(t) (((t) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT)
|
||||
# define ZEND_IS_CONSTANT_TYPE(t) ((t) == IS_CONSTANT)
|
||||
#else
|
||||
# define ZEND_IS_CONSTANT_TYPE(t) ((t) == IS_CONSTANT)
|
||||
#endif
|
||||
@ -177,7 +177,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
|
||||
if (requires_conversion) { /* ZEND_ADD_CHAR */
|
||||
char chval = (char)Z_LVAL(ZEND_OP2_LITERAL(opline));
|
||||
|
||||
ZVAL_STR(&ZEND_OP2_LITERAL(opline), str);
|
||||
ZVAL_NEW_STR(&ZEND_OP2_LITERAL(opline), str);
|
||||
ptr[0] = chval;
|
||||
opline->opcode = ZEND_ADD_STRING;
|
||||
ptr++;
|
||||
|
@ -131,7 +131,7 @@ int zend_optimizer_add_literal(zend_op_array *op_array, zval *zv TSRMLS_DC)
|
||||
|
||||
# define literal_dtor(zv) do { \
|
||||
zval_dtor(zv); \
|
||||
Z_TYPE_P(zv) = IS_NULL; \
|
||||
ZVAL_NULL(zv); \
|
||||
} while (0)
|
||||
|
||||
#define COPY_NODE(target, src) do { \
|
||||
|
@ -353,9 +353,13 @@ zend_string *accel_new_interned_string(zend_string *str TSRMLS_DC)
|
||||
ZCSG(interned_strings_top) += ZEND_MM_ALIGNED_SIZE(sizeof(zend_string) + str->len);
|
||||
p->h = h;
|
||||
GC_REFCOUNT(p->key) = 1;
|
||||
// TODO: use one assignment ???
|
||||
#if 1
|
||||
/* optimized single assignment */
|
||||
GC_TYPE_INFO(p->key) = IS_STRING | ((IS_STR_INTERNED | IS_STR_PERMANENT) << 8);
|
||||
#else
|
||||
GC_TYPE(p->key) = IS_STRING;
|
||||
GC_FLAGS(p->key) = IS_STR_INTERNED | IS_STR_PERMANENT;
|
||||
#endif
|
||||
p->key->h = str->h;
|
||||
p->key->len = str->len;
|
||||
memcpy(p->key->val, str->val, str->len);
|
||||
@ -2204,9 +2208,9 @@ static void accel_fast_zval_dtor(zval *zvalue)
|
||||
{
|
||||
if (Z_REFCOUNTED_P(zvalue) && Z_DELREF_P(zvalue) == 0) {
|
||||
#if ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO
|
||||
switch (Z_TYPE_P(zvalue) & IS_CONSTANT_TYPE_MASK) {
|
||||
switch (Z_TYPE_P(zvalue)) {
|
||||
#else
|
||||
switch (Z_TYPE_P(zvalue) & ~IS_CONSTANT_INDEX) {
|
||||
switch (Z_TYPE_P(zvalue)) {
|
||||
#endif
|
||||
case IS_ARRAY:
|
||||
case IS_CONSTANT_ARRAY: {
|
||||
@ -2217,7 +2221,7 @@ static void accel_fast_zval_dtor(zval *zvalue)
|
||||
#endif
|
||||
if (Z_ARR_P(zvalue) != &EG(symbol_table)) {
|
||||
/* break possible cycles */
|
||||
Z_TYPE_P(zvalue) = IS_NULL;
|
||||
ZVAL_NULL(zvalue);
|
||||
Z_ARRVAL_P(zvalue)->pDestructor = accel_fast_zval_dtor;
|
||||
accel_fast_hash_destroy(Z_ARRVAL_P(zvalue));
|
||||
}
|
||||
|
@ -249,9 +249,9 @@ static inline void zend_clone_zval(zval *src, int bind TSRMLS_DC)
|
||||
void *ptr;
|
||||
|
||||
#if ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO
|
||||
switch ((Z_TYPE_P(src) & IS_CONSTANT_TYPE_MASK)) {
|
||||
switch (Z_TYPE_P(src)) {
|
||||
#else
|
||||
switch ((Z_TYPE_P(src) & ~IS_CONSTANT_INDEX)) {
|
||||
switch (Z_TYPE_P(src)) {
|
||||
#endif
|
||||
case IS_STRING:
|
||||
case IS_CONSTANT:
|
||||
|
@ -115,9 +115,9 @@ static void zend_persist_zval(zval *z TSRMLS_DC)
|
||||
void *new_ptr;
|
||||
|
||||
#if ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO
|
||||
switch (Z_TYPE_P(z) & IS_CONSTANT_TYPE_MASK) {
|
||||
switch (Z_TYPE_P(z)) {
|
||||
#else
|
||||
switch (Z_TYPE_P(z) & ~IS_CONSTANT_INDEX) {
|
||||
switch (Z_TYPE_P(z)) {
|
||||
#endif
|
||||
case IS_STRING:
|
||||
case IS_CONSTANT:
|
||||
|
@ -112,14 +112,17 @@ static uint zend_persist_zval_calc(zval *z TSRMLS_DC)
|
||||
START_SIZE();
|
||||
|
||||
#if ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO
|
||||
switch (Z_TYPE_P(z) & IS_CONSTANT_TYPE_MASK) {
|
||||
switch (Z_TYPE_P(z)) {
|
||||
#else
|
||||
switch (Z_TYPE_P(z) & ~IS_CONSTANT_INDEX) {
|
||||
switch (Z_TYPE_P(z)) {
|
||||
#endif
|
||||
case IS_STRING:
|
||||
case IS_CONSTANT:
|
||||
flags = Z_GC_FLAGS_P(z) & ~ (IS_STR_PERSISTENT | IS_STR_INTERNED | IS_STR_PERMANENT);
|
||||
ADD_INTERNED_STRING(Z_STR_P(z), 0);
|
||||
if (IS_INTERNED(Z_STR_P(z))) {
|
||||
Z_TYPE_FLAGS_P(z) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
|
||||
}
|
||||
Z_GC_FLAGS_P(z) |= flags;
|
||||
break;
|
||||
case IS_ARRAY:
|
||||
|
@ -2588,7 +2588,7 @@ ZEND_METHOD(reflection_parameter, getDefaultValue)
|
||||
|
||||
ZVAL_COPY_VALUE(return_value, precv->op2.zv);
|
||||
//??? INIT_PZVAL(return_value);
|
||||
if (!IS_CONSTANT_TYPE(Z_TYPE_P(return_value))) {
|
||||
if (!(Z_TYPE_FLAGS_P(return_value) & IS_TYPE_CONSTANT)) {
|
||||
zval_copy_ctor(return_value);
|
||||
}
|
||||
zval_update_constant_ex(return_value, (void*)0, param->fptr->common.scope TSRMLS_CC);
|
||||
@ -2612,7 +2612,7 @@ ZEND_METHOD(reflection_parameter, isDefaultValueConstant)
|
||||
}
|
||||
|
||||
precv = _reflection_param_get_default_precv(INTERNAL_FUNCTION_PARAM_PASSTHRU, param);
|
||||
if (precv && (Z_TYPE_P(precv->op2.zv) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) {
|
||||
if (precv && Z_TYPE_P(precv->op2.zv) == IS_CONSTANT) {
|
||||
RETURN_TRUE;
|
||||
}
|
||||
|
||||
@ -2637,7 +2637,7 @@ ZEND_METHOD(reflection_parameter, getDefaultValueConstantName)
|
||||
}
|
||||
|
||||
precv = _reflection_param_get_default_precv(INTERNAL_FUNCTION_PARAM_PASSTHRU, param);
|
||||
if (precv && (Z_TYPE_P(precv->op2.zv) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) {
|
||||
if (precv && Z_TYPE_P(precv->op2.zv) == IS_CONSTANT) {
|
||||
RETURN_STR(STR_COPY(Z_STR_P(precv->op2.zv)));
|
||||
}
|
||||
}
|
||||
@ -3383,7 +3383,7 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value
|
||||
|
||||
/* this is necessary to make it able to work with default array
|
||||
* properties, returned to user */
|
||||
if (IS_CONSTANT_TYPE(Z_TYPE(prop_copy))) {
|
||||
if (Z_TYPE_FLAGS(prop_copy) & IS_TYPE_CONSTANT) {
|
||||
zval_update_constant(&prop_copy, (void *) 1 TSRMLS_CC);
|
||||
}
|
||||
|
||||
|
@ -441,8 +441,7 @@ static spl_filesystem_object *spl_filesystem_object_create_info(spl_filesystem_o
|
||||
zend_update_class_constants(ce TSRMLS_CC);
|
||||
|
||||
intern = spl_filesystem_from_obj(spl_filesystem_object_new_ex(ce TSRMLS_CC));
|
||||
return_value->value.obj = &intern->std;
|
||||
Z_TYPE_P(return_value) = IS_OBJECT;
|
||||
ZVAL_OBJ(return_value, &intern->std);
|
||||
|
||||
if (ce->constructor->common.scope != spl_ce_SplFileInfo) {
|
||||
ZVAL_STRINGL(&arg1, file_path, file_path_len);
|
||||
@ -484,8 +483,7 @@ static spl_filesystem_object *spl_filesystem_object_create_type(int ht, spl_file
|
||||
zend_update_class_constants(ce TSRMLS_CC);
|
||||
|
||||
intern = spl_filesystem_from_obj(spl_filesystem_object_new_ex(ce TSRMLS_CC));
|
||||
return_value->value.obj = &intern->std;
|
||||
Z_TYPE_P(return_value) = IS_OBJECT;
|
||||
ZVAL_OBJ(return_value, &intern->std);
|
||||
|
||||
spl_filesystem_object_get_file_name(source TSRMLS_CC);
|
||||
if (ce->constructor->common.scope != spl_ce_SplFileInfo) {
|
||||
@ -506,8 +504,7 @@ static spl_filesystem_object *spl_filesystem_object_create_type(int ht, spl_file
|
||||
|
||||
intern = spl_filesystem_from_obj(spl_filesystem_object_new_ex(ce TSRMLS_CC));
|
||||
|
||||
return_value->value.obj = &intern->std;
|
||||
Z_TYPE_P(return_value) = IS_OBJECT;
|
||||
ZVAL_OBJ(return_value, &intern->std);
|
||||
|
||||
spl_filesystem_object_get_file_name(source TSRMLS_CC);
|
||||
|
||||
@ -632,7 +629,7 @@ static HashTable *spl_filesystem_object_get_debug_info(zval *object, int *is_tem
|
||||
if (intern->u.dir.sub_path) {
|
||||
ZVAL_STRINGL(&tmp, intern->u.dir.sub_path, intern->u.dir.sub_path_len);
|
||||
} else {
|
||||
ZVAL_STR(&tmp, STR_EMPTY_ALLOC());
|
||||
ZVAL_EMPTY_STRING(&tmp);
|
||||
}
|
||||
zend_symtable_update(rv, pnstr, &tmp);
|
||||
STR_RELEASE(pnstr);
|
||||
@ -1548,7 +1545,7 @@ SPL_METHOD(RecursiveDirectoryIterator, getSubPath)
|
||||
if (intern->u.dir.sub_path) {
|
||||
RETURN_STRINGL(intern->u.dir.sub_path, intern->u.dir.sub_path_len);
|
||||
} else {
|
||||
RETURN_STR(STR_EMPTY_ALLOC());
|
||||
RETURN_EMPTY_STRING();
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -744,7 +744,6 @@ SPL_METHOD(SplFixedArray, fromArray)
|
||||
}
|
||||
|
||||
object_init_ex(return_value, spl_ce_SplFixedArray);
|
||||
Z_TYPE_P(return_value) = IS_OBJECT;
|
||||
|
||||
intern = Z_SPLFIXEDARRAY_P(return_value);
|
||||
intern->array = array;
|
||||
|
@ -1167,7 +1167,7 @@ SPL_METHOD(RecursiveTreeIterator, current)
|
||||
zval_ptr_dtor(&entry);
|
||||
zval_ptr_dtor(&postfix);
|
||||
|
||||
RETURN_STR(str);
|
||||
RETURN_NEW_STR(str);
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ proto mixed RecursiveTreeIterator::key()
|
||||
@ -1223,7 +1223,7 @@ SPL_METHOD(RecursiveTreeIterator, key)
|
||||
zval_ptr_dtor(&key);
|
||||
zval_ptr_dtor(&postfix);
|
||||
|
||||
RETURN_STR(str);
|
||||
RETURN_NEW_STR(str);
|
||||
} /* }}} */
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_recursive_tree_it___construct, 0, 0, 1)
|
||||
|
@ -1271,7 +1271,7 @@ static int php_valid_var_name(char *var_name, int var_name_len) /* {{{ */
|
||||
|
||||
PHPAPI int php_prefix_varname(zval *result, zval *prefix, char *var_name, int var_name_len, zend_bool add_underscore TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
ZVAL_STR(result, STR_ALLOC(Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0) + var_name_len, 0));
|
||||
ZVAL_NEW_STR(result, STR_ALLOC(Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0) + var_name_len, 0));
|
||||
memcpy(Z_STRVAL_P(result), Z_STRVAL_P(prefix), Z_STRLEN_P(prefix));
|
||||
|
||||
if (add_underscore) {
|
||||
|
@ -169,7 +169,7 @@ static void php_browscap_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callb
|
||||
(Z_STRLEN_P(arg2) == 3 && !strncasecmp(Z_STRVAL_P(arg2), "yes", sizeof("yes") - 1)) ||
|
||||
(Z_STRLEN_P(arg2) == 4 && !strncasecmp(Z_STRVAL_P(arg2), "true", sizeof("true") - 1))
|
||||
) {
|
||||
ZVAL_STR(&new_property, STR_INIT("1", sizeof("1")-1, persistent));
|
||||
ZVAL_NEW_STR(&new_property, STR_INIT("1", sizeof("1")-1, persistent));
|
||||
} else if (
|
||||
(Z_STRLEN_P(arg2) == 2 && !strncasecmp(Z_STRVAL_P(arg2), "no", sizeof("no") - 1)) ||
|
||||
(Z_STRLEN_P(arg2) == 3 && !strncasecmp(Z_STRVAL_P(arg2), "off", sizeof("off") - 1)) ||
|
||||
@ -177,7 +177,7 @@ static void php_browscap_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callb
|
||||
(Z_STRLEN_P(arg2) == 5 && !strncasecmp(Z_STRVAL_P(arg2), "false", sizeof("false") - 1))
|
||||
) {
|
||||
// TODO: USE STR_EMPTY_ALLOC()?
|
||||
ZVAL_STR(&new_property, STR_INIT("", sizeof("")-1, persistent));
|
||||
ZVAL_NEW_STR(&new_property, STR_INIT("", sizeof("")-1, persistent));
|
||||
} else { /* Other than true/false setting */
|
||||
ZVAL_STR(&new_property, STR_DUP(Z_STR_P(arg2), persistent));
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ PHP_FUNCTION(convert_cyr_string)
|
||||
str = STR_INIT(input, input_len, 0);
|
||||
|
||||
php_convert_cyr_string(str->val, str->len, fr_cs[0], to_cs[0] TSRMLS_CC);
|
||||
RETVAL_STR(str);
|
||||
RETVAL_NEW_STR(str);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -556,7 +556,7 @@ PHP_FUNCTION(file_get_contents)
|
||||
if ((contents = php_stream_copy_to_mem(stream, maxlen, 0)) != NULL) {
|
||||
RETVAL_STR(contents);
|
||||
} else {
|
||||
RETVAL_STR(STR_EMPTY_ALLOC());
|
||||
RETVAL_EMPTY_STRING();
|
||||
}
|
||||
|
||||
php_stream_close(stream);
|
||||
@ -1751,7 +1751,7 @@ PHPAPI PHP_FUNCTION(fread)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZVAL_STR(return_value, STR_ALLOC(len, 0));
|
||||
ZVAL_NEW_STR(return_value, STR_ALLOC(len, 0));
|
||||
Z_STRLEN_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len);
|
||||
|
||||
/* needed because recv/read/gzread doesnt put a null at the end*/
|
||||
|
@ -257,7 +257,7 @@ PHP_FUNCTION(quoted_printable_decode)
|
||||
str_out->val[j] = '\0';
|
||||
str_out->len = j;
|
||||
|
||||
RETVAL_STR(str_out);
|
||||
RETVAL_NEW_STR(str_out);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -1207,8 +1207,7 @@ done:
|
||||
static inline void scan_set_error_return(int numVars, zval *return_value) /* {{{ */
|
||||
{
|
||||
if (numVars) {
|
||||
Z_TYPE_P(return_value) = IS_LONG;
|
||||
Z_LVAL_P(return_value) = SCAN_ERROR_EOF; /* EOF marker */
|
||||
ZVAL_LONG(return_value, SCAN_ERROR_EOF); /* EOF marker */
|
||||
} else {
|
||||
/* convert_to_null calls destructor */
|
||||
convert_to_null(return_value);
|
||||
|
@ -399,7 +399,7 @@ PHP_FUNCTION(stream_socket_recvfrom)
|
||||
}
|
||||
read_buf->val[recvd] = '\0';
|
||||
read_buf->len = recvd;
|
||||
RETURN_STR(read_buf);
|
||||
RETURN_NEW_STR(read_buf);
|
||||
}
|
||||
|
||||
STR_FREE(read_buf);
|
||||
|
@ -917,7 +917,7 @@ PHP_FUNCTION(wordwrap)
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_STR(newtext);
|
||||
RETURN_NEW_STR(newtext);
|
||||
} else {
|
||||
/* Multiple character line break or forced cut */
|
||||
if (linelength > 0) {
|
||||
@ -1000,7 +1000,7 @@ PHP_FUNCTION(wordwrap)
|
||||
/* free unused memory */
|
||||
newtext = STR_REALLOC(newtext, newtextlen, 0);
|
||||
|
||||
RETURN_STR(newtext);
|
||||
RETURN_NEW_STR(newtext);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@ -1222,7 +1222,7 @@ PHP_FUNCTION(implode)
|
||||
return;
|
||||
}
|
||||
|
||||
ZVAL_STR(&tmp, STR_EMPTY_ALLOC());
|
||||
ZVAL_EMPTY_STRING(&tmp);
|
||||
delim = &tmp;
|
||||
|
||||
SEPARATE_ZVAL(arg1);
|
||||
@ -1356,7 +1356,7 @@ PHP_FUNCTION(strtoupper)
|
||||
|
||||
result = STR_INIT(arg, arglen, 0);
|
||||
php_strtoupper(result->val, result->len);
|
||||
RETURN_STR(result);
|
||||
RETURN_NEW_STR(result);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -1391,7 +1391,7 @@ PHP_FUNCTION(strtolower)
|
||||
|
||||
result = STR_INIT(str, arglen, 0);
|
||||
php_strtolower(result->val, result->len);
|
||||
RETURN_STR(result);
|
||||
RETURN_NEW_STR(result);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -1513,7 +1513,7 @@ PHP_FUNCTION(dirname)
|
||||
ret = STR_INIT(str, str_len, 0);
|
||||
ret->len = zend_dirname(ret->val, str_len);
|
||||
|
||||
RETURN_STR(ret);
|
||||
RETURN_NEW_STR(ret);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -2183,7 +2183,7 @@ PHP_FUNCTION(chunk_split)
|
||||
memcpy(result->val, str, str_len);
|
||||
memcpy(result->val + str_len, end, endlen);
|
||||
result->val[result->len] = '\0';
|
||||
RETURN_STR(result);
|
||||
RETURN_NEW_STR(result);
|
||||
}
|
||||
|
||||
if (!str_len) {
|
||||
@ -2380,7 +2380,7 @@ PHP_FUNCTION(substr_replace)
|
||||
}
|
||||
memcpy((result->val + f + repl_len), Z_STRVAL_P(str) + f + l, Z_STRLEN_P(str) - f - l);
|
||||
result->val[result->len] = '\0';
|
||||
RETURN_STR(result);
|
||||
RETURN_NEW_STR(result);
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Functionality of 'from' and 'len' as arrays is not implemented");
|
||||
RETURN_STR(STR_COPY(Z_STR_P(str)));
|
||||
@ -2611,7 +2611,7 @@ PHP_FUNCTION(quotemeta)
|
||||
|
||||
*q = '\0';
|
||||
|
||||
RETURN_STR(STR_REALLOC(str, q - str->val, 0));
|
||||
RETURN_NEW_STR(STR_REALLOC(str, q - str->val, 0));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -3153,7 +3153,7 @@ PHP_FUNCTION(strrev)
|
||||
|
||||
*p = '\0';
|
||||
|
||||
RETVAL_STR(n);
|
||||
RETVAL_NEW_STR(n);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -3569,7 +3569,7 @@ PHPAPI int php_char_to_str_ex(char *str, uint len, char from, char *to, int to_l
|
||||
return 0;
|
||||
}
|
||||
|
||||
ZVAL_STR(result, STR_ALLOC(len + (char_count * (to_len - 1)), 0));
|
||||
ZVAL_NEW_STR(result, STR_ALLOC(len + (char_count * (to_len - 1)), 0));
|
||||
target = Z_STRVAL_P(result); //??? = target = safe_emalloc(char_count, to_len, len + 1);
|
||||
|
||||
if (case_sensitivity) {
|
||||
@ -3818,7 +3818,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval *subjec
|
||||
ZVAL_EMPTY_STRING(result);
|
||||
return;
|
||||
}
|
||||
Z_TYPE_P(result) = IS_STRING;
|
||||
//??? Z_TYPE_P(result) = IS_STRING;
|
||||
|
||||
/* If search is an array */
|
||||
if (Z_TYPE_P(search) == IS_ARRAY) {
|
||||
@ -3884,6 +3884,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval *subjec
|
||||
|
||||
STR_FREE(Z_STR_P(result));
|
||||
Z_STR_P(result) = Z_STR(temp_result);
|
||||
Z_TYPE_INFO_P(result) = Z_TYPE_INFO(temp_result);
|
||||
|
||||
if (Z_STRLEN_P(result) == 0) {
|
||||
zval_ptr_dtor(&tmp_subject);
|
||||
@ -4163,7 +4164,7 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines)
|
||||
php_char_to_str(broken_str->val, broken_str->len,'\n', "<br />\n", 7, return_value);
|
||||
STR_FREE(broken_str);
|
||||
} else {
|
||||
RETURN_STR(broken_str);
|
||||
RETURN_NEW_STR(broken_str);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@ -4260,7 +4261,7 @@ PHP_FUNCTION(nl2br)
|
||||
|
||||
*target = '\0';
|
||||
|
||||
RETURN_STR(result);
|
||||
RETURN_NEW_STR(result);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -4879,7 +4880,7 @@ PHP_FUNCTION(str_repeat)
|
||||
|
||||
result->val[result_len] = '\0';
|
||||
|
||||
RETURN_STR(result);
|
||||
RETURN_NEW_STR(result);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -5254,7 +5255,7 @@ PHP_FUNCTION(str_pad)
|
||||
|
||||
result->val[result->len] = '\0';
|
||||
|
||||
RETURN_STR(result);
|
||||
RETURN_NEW_STR(result);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -5464,7 +5465,7 @@ PHP_FUNCTION(money_format)
|
||||
}
|
||||
str->val[str->len] = '\0';
|
||||
|
||||
RETURN_STR(STR_REALLOC(str, str->len, 0));
|
||||
RETURN_NEW_STR(STR_REALLOC(str, str->len, 0));
|
||||
}
|
||||
/* }}} */
|
||||
#endif
|
||||
|
@ -558,7 +558,7 @@ PHP_FUNCTION(urldecode)
|
||||
out_str = STR_INIT(in_str->val, in_str->len, 0);
|
||||
out_str->len = php_url_decode(out_str->val, out_str->len);
|
||||
|
||||
RETURN_STR(out_str);
|
||||
RETURN_NEW_STR(out_str);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -653,7 +653,7 @@ PHP_FUNCTION(rawurldecode)
|
||||
out_str = STR_INIT(in_str->val, in_str->len, 0);
|
||||
out_str->len = php_raw_url_decode(out_str->val, out_str->len);
|
||||
|
||||
RETURN_STR(out_str);
|
||||
RETURN_NEW_STR(out_str);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -594,7 +594,7 @@ int php_init_config(TSRMLS_D)
|
||||
{
|
||||
zval tmp;
|
||||
|
||||
ZVAL_STR(&tmp, STR_INIT(fh.filename, strlen(fh.filename), 1));
|
||||
ZVAL_NEW_STR(&tmp, STR_INIT(fh.filename, strlen(fh.filename), 1));
|
||||
zend_hash_str_update(&configuration_hash, "cfg_file_path", sizeof("cfg_file_path")-1, &tmp);
|
||||
if (php_ini_opened_path) {
|
||||
efree(php_ini_opened_path);
|
||||
|
@ -49,7 +49,7 @@ PHPAPI void php_register_variable_safe(char *var, char *strval, int str_len, zva
|
||||
assert(strval != NULL);
|
||||
|
||||
/* Prepare value */
|
||||
ZVAL_STR(&new_entry, STR_INIT(strval, str_len, 0));
|
||||
ZVAL_NEW_STR(&new_entry, STR_INIT(strval, str_len, 0));
|
||||
php_register_variable_ex(var, &new_entry, track_vars_array TSRMLS_CC);
|
||||
}
|
||||
|
||||
@ -609,11 +609,9 @@ static inline void php_register_server_variables(TSRMLS_D)
|
||||
/* store request init time */
|
||||
{
|
||||
zval request_time_float, request_time_long;
|
||||
Z_TYPE(request_time_float) = IS_DOUBLE;
|
||||
Z_DVAL(request_time_float) = sapi_get_request_time(TSRMLS_C);
|
||||
ZVAL_DOUBLE(&request_time_float, sapi_get_request_time(TSRMLS_C));
|
||||
php_register_variable_ex("REQUEST_TIME_FLOAT", &request_time_float, &PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC);
|
||||
Z_TYPE(request_time_long) = IS_LONG;
|
||||
Z_LVAL(request_time_long) = zend_dval_to_lval(Z_DVAL(request_time_float));
|
||||
ZVAL_LONG(&request_time_long, zend_dval_to_lval(Z_DVAL(request_time_float)));
|
||||
php_register_variable_ex("REQUEST_TIME", &request_time_long, &PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC);
|
||||
}
|
||||
|
||||
|
@ -1511,7 +1511,7 @@ void fcgi_impersonate(void)
|
||||
void fcgi_set_mgmt_var(const char * name, size_t name_len, const char * value, size_t value_len)
|
||||
{
|
||||
zval zvalue;
|
||||
ZVAL_STR(&zvalue, STR_INIT(value, value_len, 1));
|
||||
ZVAL_NEW_STR(&zvalue, STR_INIT(value, value_len, 1));
|
||||
zend_hash_str_add(&fcgi_mgmt_vars, name, name_len, &zvalue);
|
||||
}
|
||||
|
||||
|
@ -425,7 +425,7 @@ static int php_cli_startup(sapi_module_struct *sapi_module) /* {{{ */
|
||||
|
||||
/* overwriteable ini defaults must be set in sapi_cli_ini_defaults() */
|
||||
#define INI_DEFAULT(name,value)\
|
||||
ZVAL_STR(&tmp, STR_INIT(value, sizeof(value)-1, 1));\
|
||||
ZVAL_NEW_STR(&tmp, STR_INIT(value, sizeof(value)-1, 1));\
|
||||
zend_hash_str_update(configuration_hash, name, sizeof(name)-1, &tmp);\
|
||||
|
||||
static void sapi_cli_ini_defaults(HashTable *configuration_hash)
|
||||
|
@ -711,7 +711,7 @@ static inline void phpdbg_create_conditional_break(phpdbg_breakcond_t *brake, co
|
||||
new_break.code_len = expr_len;
|
||||
|
||||
str = STR_ALLOC(expr_len + sizeof("return ;") - 1, 0);
|
||||
ZVAL_STR(&pv, str);
|
||||
ZVAL_NEW_STR(&pv, str);
|
||||
memcpy(Z_STRVAL(pv), "return ", sizeof("return ") - 1);
|
||||
memcpy(Z_STRVAL(pv) + sizeof("return ") - 1, expr, expr_len);
|
||||
Z_STRVAL(pv)[Z_STRLEN(pv) - 1] = ';';
|
||||
|
Loading…
Reference in New Issue
Block a user