mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
Split IS_BOOL into IS_FALSE and IS_TRUE
This commit is contained in:
parent
6a911e833f
commit
17d027ed47
16
Zend/zend.c
16
Zend/zend.c
@ -220,19 +220,15 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop
|
||||
|
||||
again:
|
||||
switch (Z_TYPE_P(expr)) {
|
||||
case IS_NULL: {
|
||||
case IS_NULL:
|
||||
case IS_FALSE: {
|
||||
TSRMLS_FETCH();
|
||||
ZVAL_EMPTY_STRING(expr_copy);
|
||||
break;
|
||||
}
|
||||
case IS_BOOL:
|
||||
if (Z_LVAL_P(expr)) {
|
||||
// TODO: use interned string ???
|
||||
ZVAL_NEW_STR(expr_copy, STR_INIT("1", 1, 0));
|
||||
} else {
|
||||
TSRMLS_FETCH();
|
||||
ZVAL_EMPTY_STRING(expr_copy);
|
||||
}
|
||||
case IS_TRUE:
|
||||
// TODO: use interned string ???
|
||||
ZVAL_NEW_STR(expr_copy, STR_INIT("1", 1, 0));
|
||||
break;
|
||||
case IS_RESOURCE: {
|
||||
char buf[sizeof("Resource id #") + MAX_LENGTH_OF_LONG];
|
||||
@ -1201,7 +1197,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
|
||||
ZVAL_UNDEF(&retval);
|
||||
if (call_user_function_ex(CG(function_table), NULL, &orig_user_error_handler, &retval, 5, params, 1, NULL TSRMLS_CC) == SUCCESS) {
|
||||
if (Z_TYPE(retval) != IS_UNDEF) {
|
||||
if (Z_TYPE(retval) == IS_BOOL && Z_LVAL(retval) == 0) {
|
||||
if (Z_TYPE(retval) == IS_FALSE) {
|
||||
zend_error_cb(type, error_filename, error_lineno, format, args);
|
||||
}
|
||||
zval_ptr_dtor(&retval);
|
||||
|
@ -201,7 +201,8 @@ ZEND_API void zend_wrong_param_count(TSRMLS_D) /* {{{ */
|
||||
ZEND_API char *zend_get_type_by_const(int type) /* {{{ */
|
||||
{
|
||||
switch(type) {
|
||||
case IS_BOOL:
|
||||
case IS_FALSE:
|
||||
case IS_TRUE:
|
||||
return "boolean";
|
||||
case IS_LONG:
|
||||
return "integer";
|
||||
@ -408,8 +409,9 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
|
||||
}
|
||||
}
|
||||
case IS_NULL:
|
||||
case IS_FALSE:
|
||||
case IS_TRUE:
|
||||
case IS_LONG:
|
||||
case IS_BOOL:
|
||||
convert_to_long_ex(arg);
|
||||
*p = Z_LVAL_P(arg);
|
||||
break;
|
||||
@ -447,9 +449,10 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
|
||||
break;
|
||||
|
||||
case IS_NULL:
|
||||
case IS_FALSE:
|
||||
case IS_TRUE:
|
||||
case IS_LONG:
|
||||
case IS_DOUBLE:
|
||||
case IS_BOOL:
|
||||
convert_to_double_ex(arg);
|
||||
*p = Z_DVAL_P(arg);
|
||||
break;
|
||||
@ -480,7 +483,8 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
|
||||
case IS_STRING:
|
||||
case IS_LONG:
|
||||
case IS_DOUBLE:
|
||||
case IS_BOOL:
|
||||
case IS_FALSE:
|
||||
case IS_TRUE:
|
||||
convert_to_string_ex(arg);
|
||||
if (UNEXPECTED(Z_ISREF_P(arg))) {
|
||||
/* it's dangerous to return pointers to string
|
||||
@ -525,7 +529,8 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
|
||||
case IS_STRING:
|
||||
case IS_LONG:
|
||||
case IS_DOUBLE:
|
||||
case IS_BOOL:
|
||||
case IS_FALSE:
|
||||
case IS_TRUE:
|
||||
convert_to_string_ex(arg);
|
||||
if (UNEXPECTED(Z_ISREF_P(arg))) {
|
||||
/* it's dangerous to return pointers to string
|
||||
@ -563,9 +568,10 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
|
||||
case IS_STRING:
|
||||
case IS_LONG:
|
||||
case IS_DOUBLE:
|
||||
case IS_BOOL:
|
||||
case IS_FALSE:
|
||||
case IS_TRUE:
|
||||
convert_to_boolean_ex(arg);
|
||||
*p = Z_BVAL_P(arg);
|
||||
*p = Z_TYPE_P(arg) == IS_TRUE;
|
||||
break;
|
||||
|
||||
case IS_ARRAY:
|
||||
@ -1641,7 +1647,12 @@ ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value TSRMLS_DC)
|
||||
zend_error(E_STRICT, "Resource ID#%ld used as offset, casting to integer (%ld)", Z_RES_HANDLE_P(key), Z_RES_HANDLE_P(key));
|
||||
result = zend_hash_index_update(ht, Z_RES_HANDLE_P(key), value);
|
||||
break;
|
||||
case IS_BOOL:
|
||||
case IS_FALSE:
|
||||
result = zend_hash_index_update(ht, 0, value);
|
||||
break;
|
||||
case IS_TRUE:
|
||||
result = zend_hash_index_update(ht, 1, value);
|
||||
break;
|
||||
case IS_LONG:
|
||||
result = zend_hash_index_update(ht, Z_LVAL_P(key), value);
|
||||
break;
|
||||
@ -3954,8 +3965,9 @@ static int same_zval(zval *zv1, zval *zv2) /* {{{ */
|
||||
switch (Z_TYPE_P(zv1)) {
|
||||
case IS_UNDEF:
|
||||
case IS_NULL:
|
||||
case IS_FALSE:
|
||||
case IS_TRUE:
|
||||
return 1;
|
||||
case IS_BOOL:
|
||||
case IS_LONG:
|
||||
return Z_LVAL_P(zv1) == Z_LVAL_P(zv2);
|
||||
case IS_DOUBLE:
|
||||
|
@ -594,9 +594,6 @@ END_EXTERN_C()
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_FALSE(z) ZVAL_BOOL(z, 0)
|
||||
#define ZVAL_TRUE(z) ZVAL_BOOL(z, 1)
|
||||
|
||||
#define RETVAL_BOOL(b) ZVAL_BOOL(return_value, b)
|
||||
#define RETVAL_NULL() ZVAL_NULL(return_value)
|
||||
#define RETVAL_LONG(l) ZVAL_LONG(return_value, l)
|
||||
|
@ -686,7 +686,8 @@ repeat:
|
||||
case IS_LONG:
|
||||
case IS_DOUBLE:
|
||||
case IS_STRING:
|
||||
case IS_BOOL:
|
||||
case IS_FALSE:
|
||||
case IS_TRUE:
|
||||
case IS_RESOURCE:
|
||||
case IS_NULL:
|
||||
break;
|
||||
|
@ -3494,14 +3494,12 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{
|
||||
|
||||
ZVAL_DUP(&zv, precv->op2.zv);
|
||||
zval_update_constant_ex(&zv, 1, fptr->common.scope TSRMLS_CC);
|
||||
if (Z_TYPE(zv) == IS_BOOL) {
|
||||
if (Z_LVAL(zv)) {
|
||||
memcpy(offset, "true", 4);
|
||||
offset += 4;
|
||||
} else {
|
||||
memcpy(offset, "false", 5);
|
||||
offset += 5;
|
||||
}
|
||||
if (Z_TYPE(zv) == IS_FALSE) {
|
||||
memcpy(offset, "false", 5);
|
||||
offset += 5;
|
||||
} else if (Z_TYPE(zv) == IS_TRUE) {
|
||||
memcpy(offset, "true", 4);
|
||||
offset += 4;
|
||||
} else if (Z_TYPE(zv) == IS_NULL) {
|
||||
memcpy(offset, "NULL", 4);
|
||||
offset += 4;
|
||||
@ -5973,9 +5971,14 @@ void zend_do_add_static_array_element(znode *result, znode *offset, znode *expr
|
||||
zend_symtable_update(Z_ARRVAL(result->u.constant), STR_EMPTY_ALLOC(), &element);
|
||||
break;
|
||||
case IS_LONG:
|
||||
case IS_BOOL:
|
||||
zend_hash_index_update(Z_ARRVAL(result->u.constant), Z_LVAL(offset->u.constant), &element);
|
||||
break;
|
||||
case IS_FALSE:
|
||||
zend_hash_index_update(Z_ARRVAL(result->u.constant), 0, &element);
|
||||
break;
|
||||
case IS_TRUE:
|
||||
zend_hash_index_update(Z_ARRVAL(result->u.constant), 1, &element);
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
zend_hash_index_update(Z_ARRVAL(result->u.constant), zend_dval_to_lval(Z_DVAL(offset->u.constant)), &element);
|
||||
break;
|
||||
|
@ -456,12 +456,11 @@ static int _build_trace_args(zval *arg TSRMLS_DC, int num_args, va_list args, ze
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IS_BOOL:
|
||||
if (Z_LVAL_P(arg)) {
|
||||
TRACE_APPEND_STR("true, ");
|
||||
} else {
|
||||
TRACE_APPEND_STR("false, ");
|
||||
}
|
||||
case IS_FALSE:
|
||||
TRACE_APPEND_STR("false, ");
|
||||
break;
|
||||
case IS_TRUE:
|
||||
TRACE_APPEND_STR("true, ");
|
||||
break;
|
||||
case IS_RESOURCE: {
|
||||
long lval = Z_RES_HANDLE_P(arg);
|
||||
|
@ -503,7 +503,7 @@ static inline zval* make_real_object(zval *object_ptr TSRMLS_DC)
|
||||
ZVAL_DEREF(object);
|
||||
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
|
||||
if (Z_TYPE_P(object) == IS_NULL
|
||||
|| (Z_TYPE_P(object) == IS_BOOL && Z_LVAL_P(object) == 0)
|
||||
|| Z_TYPE_P(object) == IS_FALSE
|
||||
|| (Z_TYPE_P(object) == IS_STRING && Z_STRLEN_P(object) == 0)) {
|
||||
if (EXPECTED(object == object_ptr)) {
|
||||
/* object_ptr is not a reference */
|
||||
@ -678,7 +678,7 @@ static inline void zend_assign_to_object(zval *retval, zval *object_ptr, zval *p
|
||||
return;
|
||||
}
|
||||
if (Z_TYPE_P(object) == IS_NULL ||
|
||||
(Z_TYPE_P(object) == IS_BOOL && Z_LVAL_P(object) == 0) ||
|
||||
Z_TYPE_P(object) == IS_FALSE ||
|
||||
(Z_TYPE_P(object) == IS_STRING && Z_STRLEN_P(object) == 0)) {
|
||||
//??? The following block may handle only non-interned empty string,
|
||||
//??? but it doesn't work anyway
|
||||
@ -1093,8 +1093,11 @@ str_index:
|
||||
zend_error(E_STRICT, "Resource ID#%ld used as offset, casting to integer (%ld)", Z_RES_HANDLE_P(dim), Z_RES_HANDLE_P(dim));
|
||||
hval = Z_RES_HANDLE_P(dim);
|
||||
goto num_index;
|
||||
case IS_BOOL:
|
||||
hval = Z_LVAL_P(dim);
|
||||
case IS_FALSE:
|
||||
hval = 0;
|
||||
goto num_index;
|
||||
case IS_TRUE:
|
||||
hval = 1;
|
||||
goto num_index;
|
||||
default:
|
||||
zend_error(E_WARNING, "Illegal offset type");
|
||||
@ -1162,7 +1165,8 @@ convert_to_array:
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
case IS_NULL:
|
||||
case IS_BOOL:
|
||||
case IS_FALSE:
|
||||
case IS_TRUE:
|
||||
zend_error(E_NOTICE, "String offset cast occurred");
|
||||
break;
|
||||
default:
|
||||
@ -1226,8 +1230,7 @@ convert_to_array:
|
||||
}
|
||||
} else {
|
||||
if (type != BP_VAR_UNSET &&
|
||||
Z_TYPE_P(container) == IS_BOOL &&
|
||||
Z_LVAL_P(container)==0) {
|
||||
Z_TYPE_P(container) == IS_FALSE) {
|
||||
goto convert_to_array;
|
||||
}
|
||||
if (type == BP_VAR_UNSET) {
|
||||
@ -1284,7 +1287,8 @@ static zend_always_inline void zend_fetch_dimension_address_read(zval *result, z
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
case IS_NULL:
|
||||
case IS_BOOL:
|
||||
case IS_FALSE:
|
||||
case IS_TRUE:
|
||||
if (type != BP_VAR_IS) {
|
||||
zend_error(E_NOTICE, "String offset cast occurred");
|
||||
}
|
||||
@ -1358,8 +1362,8 @@ static void zend_fetch_property_address(zval *result, zval *container_ptr, zval
|
||||
/* this should modify object only if it's empty */
|
||||
if (type != BP_VAR_UNSET &&
|
||||
((Z_TYPE_P(container) == IS_NULL ||
|
||||
(Z_TYPE_P(container) == IS_BOOL && Z_LVAL_P(container)==0) ||
|
||||
(Z_TYPE_P(container) == IS_STRING && Z_STRLEN_P(container)==0)))) {
|
||||
Z_TYPE_P(container) == IS_FALSE ||
|
||||
(Z_TYPE_P(container) == IS_STRING && Z_STRLEN_P(container)==0)))) {
|
||||
if (container == container_ptr) {
|
||||
SEPARATE_ZVAL(container);
|
||||
}
|
||||
|
@ -80,13 +80,18 @@ again:
|
||||
switch (Z_TYPE_P(op)) {
|
||||
case IS_UNDEF:
|
||||
case IS_NULL:
|
||||
case IS_FALSE:
|
||||
result = 0;
|
||||
break;
|
||||
case IS_TRUE:
|
||||
result = 1;
|
||||
break;
|
||||
case IS_LONG:
|
||||
case IS_BOOL:
|
||||
case IS_RESOURCE:
|
||||
result = (Z_LVAL_P(op)?1:0);
|
||||
break;
|
||||
case IS_RESOURCE:
|
||||
result = (Z_RES_HANDLE_P(op)?1:0);
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
result = (Z_DVAL_P(op) ? 1 : 0);
|
||||
break;
|
||||
@ -105,8 +110,8 @@ again:
|
||||
if (IS_ZEND_STD_OBJECT(*op)) {
|
||||
if (Z_OBJ_HT_P(op)->cast_object) {
|
||||
zval tmp;
|
||||
if (Z_OBJ_HT_P(op)->cast_object(op, &tmp, IS_BOOL TSRMLS_CC) == SUCCESS) {
|
||||
result = Z_LVAL(tmp);
|
||||
if (Z_OBJ_HT_P(op)->cast_object(op, &tmp, _IS_BOOL TSRMLS_CC) == SUCCESS) {
|
||||
result = Z_TYPE(tmp) == IS_TRUE;
|
||||
break;
|
||||
}
|
||||
} else if (Z_OBJ_HT_P(op)->get) {
|
||||
@ -115,7 +120,7 @@ again:
|
||||
if (Z_TYPE_P(tmp) != IS_OBJECT) {
|
||||
/* for safety - avoid loop */
|
||||
convert_to_boolean(tmp);
|
||||
result = Z_LVAL_P(tmp);
|
||||
result = Z_TYPE_P(tmp) == IS_TRUE;
|
||||
zval_ptr_dtor(tmp);
|
||||
break;
|
||||
}
|
||||
|
@ -685,7 +685,12 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_bool inline_change, zend_clas
|
||||
case IS_STRING:
|
||||
ret = zend_symtable_update_current_key_ex(Z_ARRVAL_P(p), Z_STR_P(const_value), HASH_UPDATE_KEY_IF_BEFORE);
|
||||
break;
|
||||
case IS_BOOL:
|
||||
case IS_FALSE:
|
||||
ret = zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL, 0, HASH_UPDATE_KEY_IF_BEFORE);
|
||||
break;
|
||||
case IS_TRUE:
|
||||
ret = zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL, 1, HASH_UPDATE_KEY_IF_BEFORE);
|
||||
break;
|
||||
case IS_LONG:
|
||||
ret = zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL, Z_LVAL_P(const_value), HASH_UPDATE_KEY_IF_BEFORE);
|
||||
break;
|
||||
|
@ -839,7 +839,7 @@ expr_without_variable:
|
||||
| T_STRING_CAST expr { zend_do_cast(&$$, &$2, IS_STRING TSRMLS_CC); }
|
||||
| T_ARRAY_CAST expr { zend_do_cast(&$$, &$2, IS_ARRAY TSRMLS_CC); }
|
||||
| T_OBJECT_CAST expr { zend_do_cast(&$$, &$2, IS_OBJECT TSRMLS_CC); }
|
||||
| T_BOOL_CAST expr { zend_do_cast(&$$, &$2, IS_BOOL TSRMLS_CC); }
|
||||
| T_BOOL_CAST expr { zend_do_cast(&$$, &$2, _IS_BOOL TSRMLS_CC); }
|
||||
| T_UNSET_CAST expr { zend_do_cast(&$$, &$2, IS_NULL TSRMLS_CC); }
|
||||
| T_EXIT exit_expr { zend_do_exit(&$$, &$2 TSRMLS_CC); }
|
||||
| '@' { zend_do_begin_silence(&$1 TSRMLS_CC); } expr { zend_do_end_silence(&$1 TSRMLS_CC); $$ = $3; }
|
||||
|
@ -37,6 +37,9 @@ ZEND_API zval *zend_list_insert(void *ptr, int type TSRMLS_DC)
|
||||
zval zv;
|
||||
|
||||
index = zend_hash_next_free_element(&EG(regular_list));
|
||||
if (index == 0) {
|
||||
index = 1;
|
||||
}
|
||||
ZVAL_NEW_RES(&zv, index, ptr, type);
|
||||
return zend_hash_index_update(&EG(regular_list), index, &zv);
|
||||
}
|
||||
|
@ -1570,7 +1570,7 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty
|
||||
}
|
||||
}
|
||||
return FAILURE;
|
||||
case IS_BOOL:
|
||||
case _IS_BOOL:
|
||||
ZVAL_BOOL(writeobj, 1);
|
||||
return SUCCESS;
|
||||
case IS_LONG:
|
||||
|
@ -204,8 +204,12 @@ try_again:
|
||||
STR_RELEASE(str);
|
||||
break;
|
||||
}
|
||||
case IS_BOOL:
|
||||
Z_TYPE_INFO_P(op) = IS_LONG;
|
||||
case IS_NULL:
|
||||
case IS_FALSE:
|
||||
ZVAL_LONG(op, 0);
|
||||
break;
|
||||
case IS_TRUE:
|
||||
ZVAL_LONG(op, 1);
|
||||
break;
|
||||
case IS_RESOURCE:
|
||||
{
|
||||
@ -217,9 +221,6 @@ try_again:
|
||||
case IS_OBJECT:
|
||||
convert_to_long_base(op, 10);
|
||||
break;
|
||||
case IS_NULL:
|
||||
ZVAL_LONG(op, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@ -240,18 +241,19 @@ try_again:
|
||||
(op) = &(holder); \
|
||||
break; \
|
||||
} \
|
||||
case IS_BOOL: \
|
||||
ZVAL_LONG(&(holder), Z_LVAL_P(op)); \
|
||||
case IS_NULL: \
|
||||
case IS_FALSE: \
|
||||
ZVAL_LONG(&(holder), 0); \
|
||||
(op) = &(holder); \
|
||||
break; \
|
||||
case IS_TRUE: \
|
||||
ZVAL_LONG(&(holder), 1); \
|
||||
(op) = &(holder); \
|
||||
break; \
|
||||
case IS_RESOURCE: \
|
||||
ZVAL_LONG(&(holder), Z_RES_HANDLE_P(op)); \
|
||||
(op) = &(holder); \
|
||||
break; \
|
||||
case IS_NULL: \
|
||||
ZVAL_LONG(&(holder), 0); \
|
||||
(op) = &(holder); \
|
||||
break; \
|
||||
case IS_OBJECT: \
|
||||
ZVAL_DUP(&(holder), op); \
|
||||
convert_to_long_base(&(holder), 10); \
|
||||
@ -271,7 +273,11 @@ try_again:
|
||||
} else if (Z_TYPE_P(op) != IS_LONG) { \
|
||||
switch (Z_TYPE_P(op)) { \
|
||||
case IS_NULL: \
|
||||
ZVAL_LONG(&holder, 0); \
|
||||
case IS_FALSE: \
|
||||
ZVAL_LONG(&(holder), 0); \
|
||||
break; \
|
||||
case IS_TRUE: \
|
||||
ZVAL_LONG(&(holder), 1); \
|
||||
break; \
|
||||
case IS_DOUBLE: \
|
||||
ZVAL_LONG(&holder, zend_dval_to_lval(Z_DVAL_P(op)));\
|
||||
@ -286,9 +292,6 @@ try_again:
|
||||
ZVAL_DUP(&(holder), (op)); \
|
||||
convert_to_long_base(&(holder), 10); \
|
||||
break; \
|
||||
case IS_BOOL: \
|
||||
ZVAL_LONG(&(holder), Z_LVAL_P(op)); \
|
||||
break; \
|
||||
case IS_RESOURCE: \
|
||||
ZVAL_LONG(&holder, Z_RES_HANDLE_P(op)); \
|
||||
break; \
|
||||
@ -306,7 +309,8 @@ try_again:
|
||||
#define zendi_convert_to_boolean(op, holder, result) \
|
||||
if (op==result) { \
|
||||
convert_to_boolean(op); \
|
||||
} else if (Z_TYPE_P(op) != IS_BOOL) { \
|
||||
} else if (Z_TYPE_P(op) != IS_FALSE && \
|
||||
Z_TYPE_P(op) != IS_TRUE) { \
|
||||
switch (Z_TYPE_P(op)) { \
|
||||
case IS_NULL: \
|
||||
ZVAL_BOOL(&holder, 0); \
|
||||
@ -378,15 +382,18 @@ ZEND_API void convert_to_long_base(zval *op, int base) /* {{{ */
|
||||
|
||||
switch (Z_TYPE_P(op)) {
|
||||
case IS_NULL:
|
||||
case IS_FALSE:
|
||||
ZVAL_LONG(op, 0);
|
||||
break;
|
||||
case IS_TRUE:
|
||||
ZVAL_LONG(op, 1);
|
||||
break;
|
||||
case IS_RESOURCE: {
|
||||
long l = Z_RES_HANDLE_P(op);
|
||||
zval_ptr_dtor(op);
|
||||
ZVAL_LONG(op, l);
|
||||
}
|
||||
/* break missing intentionally */
|
||||
case IS_BOOL:
|
||||
Z_TYPE_INFO_P(op) = IS_LONG;
|
||||
break;
|
||||
case IS_LONG:
|
||||
@ -439,15 +446,18 @@ ZEND_API void convert_to_double(zval *op) /* {{{ */
|
||||
|
||||
switch (Z_TYPE_P(op)) {
|
||||
case IS_NULL:
|
||||
case IS_FALSE:
|
||||
ZVAL_DOUBLE(op, 0.0);
|
||||
break;
|
||||
case IS_TRUE:
|
||||
ZVAL_DOUBLE(op, 1.0);
|
||||
break;
|
||||
case IS_RESOURCE: {
|
||||
double d = (double) Z_RES_HANDLE_P(op);
|
||||
zval_ptr_dtor(op);
|
||||
ZVAL_DOUBLE(op, d);
|
||||
}
|
||||
break;
|
||||
case IS_BOOL:
|
||||
case IS_LONG:
|
||||
ZVAL_DOUBLE(op, (double) Z_LVAL_P(op));
|
||||
break;
|
||||
@ -518,7 +528,8 @@ ZEND_API void convert_to_boolean(zval *op) /* {{{ */
|
||||
int tmp;
|
||||
|
||||
switch (Z_TYPE_P(op)) {
|
||||
case IS_BOOL:
|
||||
case IS_FALSE:
|
||||
case IS_TRUE:
|
||||
break;
|
||||
case IS_NULL:
|
||||
ZVAL_BOOL(op, 0);
|
||||
@ -559,10 +570,10 @@ ZEND_API void convert_to_boolean(zval *op) /* {{{ */
|
||||
zval dst;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
convert_object_to_type(op, &dst, IS_BOOL, convert_to_boolean);
|
||||
convert_object_to_type(op, &dst, _IS_BOOL, convert_to_boolean);
|
||||
zval_dtor(op);
|
||||
|
||||
if (Z_TYPE(dst) == IS_BOOL) {
|
||||
if (Z_TYPE(dst) == IS_FALSE || Z_TYPE(dst) == IS_TRUE) {
|
||||
ZVAL_COPY_VALUE(op, &dst);
|
||||
} else {
|
||||
ZVAL_BOOL(op, 1);
|
||||
@ -589,20 +600,16 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */
|
||||
double dval;
|
||||
|
||||
switch (Z_TYPE_P(op)) {
|
||||
case IS_NULL: {
|
||||
case IS_NULL:
|
||||
case IS_FALSE: {
|
||||
TSRMLS_FETCH();
|
||||
ZVAL_EMPTY_STRING(op);
|
||||
break;
|
||||
}
|
||||
case IS_STRING:
|
||||
case IS_TRUE:
|
||||
ZVAL_NEW_STR(op, STR_INIT("1", 1, 0));
|
||||
break;
|
||||
case IS_BOOL:
|
||||
if (Z_LVAL_P(op)) {
|
||||
ZVAL_NEW_STR(op, STR_INIT("1", 1, 0));
|
||||
} else {
|
||||
TSRMLS_FETCH();
|
||||
ZVAL_EMPTY_STRING(op);
|
||||
}
|
||||
case IS_STRING:
|
||||
break;
|
||||
case IS_RESOURCE: {
|
||||
long tmp = Z_RES_HANDLE_P(op);
|
||||
@ -812,10 +819,12 @@ ZEND_API long _zval_get_long_func(zval *op TSRMLS_DC) /* {{{ */
|
||||
try_again:
|
||||
switch (Z_TYPE_P(op)) {
|
||||
case IS_NULL:
|
||||
case IS_FALSE:
|
||||
return 0;
|
||||
case IS_TRUE:
|
||||
return 1;
|
||||
case IS_RESOURCE:
|
||||
return Z_RES_HANDLE_P(op);
|
||||
case IS_BOOL:
|
||||
case IS_LONG:
|
||||
return Z_LVAL_P(op);
|
||||
case IS_DOUBLE:
|
||||
@ -850,10 +859,12 @@ ZEND_API double _zval_get_double_func(zval *op TSRMLS_DC) /* {{{ */
|
||||
try_again:
|
||||
switch (Z_TYPE_P(op)) {
|
||||
case IS_NULL:
|
||||
case IS_FALSE:
|
||||
return 0.0;
|
||||
case IS_TRUE:
|
||||
return 1.0;
|
||||
case IS_RESOURCE:
|
||||
return (double) Z_RES_HANDLE_P(op);
|
||||
case IS_BOOL:
|
||||
case IS_LONG:
|
||||
return (double) Z_LVAL_P(op);
|
||||
case IS_DOUBLE:
|
||||
@ -890,15 +901,12 @@ ZEND_API zend_string *_zval_get_string_func(zval *op TSRMLS_DC) /* {{{ */
|
||||
try_again:
|
||||
switch (Z_TYPE_P(op)) {
|
||||
case IS_NULL:
|
||||
case IS_FALSE:
|
||||
return STR_EMPTY_ALLOC();
|
||||
case IS_STRING:
|
||||
return STR_COPY(Z_STR_P(op));
|
||||
case IS_BOOL:
|
||||
if (Z_BVAL_P(op)) {
|
||||
return STR_INIT("1", 1, 0);
|
||||
} else {
|
||||
return STR_EMPTY_ALLOC();
|
||||
}
|
||||
case IS_TRUE:
|
||||
return STR_INIT("1", 1, 0);
|
||||
case IS_RESOURCE: {
|
||||
char buf[sizeof("Resource id #") + MAX_LENGTH_OF_LONG];
|
||||
int len;
|
||||
@ -1309,17 +1317,18 @@ ZEND_API int boolean_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
zval op1_copy, op2_copy;
|
||||
long op1_lval;
|
||||
|
||||
if (Z_TYPE_P(op1) != IS_BOOL || Z_TYPE_P(op2) != IS_BOOL) {
|
||||
if ((Z_TYPE_P(op1) != IS_FALSE && Z_TYPE_P(op1) != IS_TRUE) ||
|
||||
(Z_TYPE_P(op2) != IS_FALSE && Z_TYPE_P(op2) != IS_TRUE)) {
|
||||
ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_BOOL_XOR);
|
||||
|
||||
zendi_convert_to_boolean(op1, op1_copy, result);
|
||||
op1_lval = Z_LVAL_P(op1);
|
||||
op1_lval = Z_TYPE_P(op1) == IS_TRUE;
|
||||
zendi_convert_to_boolean(op2, op2_copy, result);
|
||||
} else {
|
||||
op1_lval = Z_LVAL_P(op1);
|
||||
op1_lval = Z_TYPE_P(op1) == IS_TRUE;
|
||||
}
|
||||
|
||||
ZVAL_BOOL(result, op1_lval ^ Z_LVAL_P(op2));
|
||||
ZVAL_BOOL(result, op1_lval ^ (Z_TYPE_P(op2) == IS_TRUE));
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
@ -1328,13 +1337,17 @@ ZEND_API int boolean_not_function(zval *result, zval *op1 TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zval op1_copy;
|
||||
|
||||
if (Z_TYPE_P(op1) != IS_BOOL) {
|
||||
if (Z_TYPE_P(op1) == IS_FALSE) {
|
||||
ZVAL_TRUE(result);
|
||||
} else if (Z_TYPE_P(op1) == IS_TRUE) {
|
||||
ZVAL_FALSE(result);
|
||||
} else {
|
||||
ZEND_TRY_UNARY_OBJECT_OPERATION(ZEND_BOOL_NOT);
|
||||
|
||||
zendi_convert_to_boolean(op1, op1_copy, result);
|
||||
}
|
||||
|
||||
ZVAL_BOOL(result, !Z_LVAL_P(op1));
|
||||
ZVAL_BOOL(result, Z_TYPE_P(op1) == IS_FALSE);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
@ -1741,19 +1754,19 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {
|
||||
return SUCCESS;
|
||||
|
||||
case TYPE_PAIR(IS_NULL, IS_NULL):
|
||||
case TYPE_PAIR(IS_NULL, IS_FALSE):
|
||||
case TYPE_PAIR(IS_FALSE, IS_NULL):
|
||||
case TYPE_PAIR(IS_FALSE, IS_FALSE):
|
||||
case TYPE_PAIR(IS_TRUE, IS_TRUE):
|
||||
ZVAL_LONG(result, 0);
|
||||
return SUCCESS;
|
||||
|
||||
case TYPE_PAIR(IS_NULL, IS_BOOL):
|
||||
ZVAL_LONG(result, Z_LVAL_P(op2) ? -1 : 0);
|
||||
case TYPE_PAIR(IS_NULL, IS_TRUE):
|
||||
ZVAL_LONG(result, -1);
|
||||
return SUCCESS;
|
||||
|
||||
case TYPE_PAIR(IS_BOOL, IS_NULL):
|
||||
ZVAL_LONG(result, Z_LVAL_P(op1) ? 1 : 0);
|
||||
return SUCCESS;
|
||||
|
||||
case TYPE_PAIR(IS_BOOL, IS_BOOL):
|
||||
ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_LVAL_P(op1) - Z_LVAL_P(op2)));
|
||||
case TYPE_PAIR(IS_TRUE, IS_NULL):
|
||||
ZVAL_LONG(result, 1);
|
||||
return SUCCESS;
|
||||
|
||||
case TYPE_PAIR(IS_STRING, IS_STRING):
|
||||
@ -1803,7 +1816,7 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {
|
||||
return ret;
|
||||
} else if (Z_TYPE_P(op2) != IS_OBJECT && Z_OBJ_HT_P(op1)->cast_object) {
|
||||
ZVAL_UNDEF(&tmp_free);
|
||||
if (Z_OBJ_HT_P(op1)->cast_object(op1, &tmp_free, Z_TYPE_P(op2) TSRMLS_CC) == FAILURE) {
|
||||
if (Z_OBJ_HT_P(op1)->cast_object(op1, &tmp_free, ((Z_TYPE_P(op2) == IS_FALSE || Z_TYPE_P(op2) == IS_TRUE) ? _IS_BOOL : Z_TYPE_P(op2)) TSRMLS_CC) == FAILURE) {
|
||||
ZVAL_LONG(result, 1);
|
||||
zend_free_obj_get_result(&tmp_free TSRMLS_CC);
|
||||
return SUCCESS;
|
||||
@ -1822,7 +1835,7 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {
|
||||
return ret;
|
||||
} else if (Z_TYPE_P(op1) != IS_OBJECT && Z_OBJ_HT_P(op2)->cast_object) {
|
||||
ZVAL_UNDEF(&tmp_free);
|
||||
if (Z_OBJ_HT_P(op2)->cast_object(op2, &tmp_free, Z_TYPE_P(op1) TSRMLS_CC) == FAILURE) {
|
||||
if (Z_OBJ_HT_P(op2)->cast_object(op2, &tmp_free, ((Z_TYPE_P(op1) == IS_FALSE || Z_TYPE_P(op1) == IS_TRUE) ? _IS_BOOL : Z_TYPE_P(op1)) TSRMLS_CC) == FAILURE) {
|
||||
ZVAL_LONG(result, -1);
|
||||
zend_free_obj_get_result(&tmp_free TSRMLS_CC);
|
||||
return SUCCESS;
|
||||
@ -1840,21 +1853,21 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {
|
||||
} else if (Z_ISREF_P(op2)) {
|
||||
op2 = Z_REFVAL_P(op2);
|
||||
} else if (!converted) {
|
||||
if (Z_TYPE_P(op1) == IS_NULL) {
|
||||
if (Z_TYPE_P(op1) == IS_NULL || Z_TYPE_P(op1) == IS_FALSE) {
|
||||
zendi_convert_to_boolean(op2, op2_copy, result);
|
||||
ZVAL_LONG(result, Z_LVAL_P(op2) ? -1 : 0);
|
||||
ZVAL_LONG(result, (Z_TYPE_P(op2) == IS_TRUE) ? -1 : 0);
|
||||
return SUCCESS;
|
||||
} else if (Z_TYPE_P(op2) == IS_NULL) {
|
||||
} else if (Z_TYPE_P(op2) == IS_NULL || Z_TYPE_P(op2) == IS_FALSE) {
|
||||
zendi_convert_to_boolean(op1, op1_copy, result);
|
||||
ZVAL_LONG(result, Z_LVAL_P(op1) ? 1 : 0);
|
||||
ZVAL_LONG(result, (Z_TYPE_P(op1) == IS_TRUE) ? 1 : 0);
|
||||
return SUCCESS;
|
||||
} else if (Z_TYPE_P(op1) == IS_BOOL) {
|
||||
} else if (Z_TYPE_P(op1) == IS_TRUE) {
|
||||
zendi_convert_to_boolean(op2, op2_copy, result);
|
||||
ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_LVAL_P(op1) - Z_LVAL_P(op2)));
|
||||
ZVAL_LONG(result, (Z_TYPE_P(op2) == IS_TRUE) ? 0 : 1);
|
||||
return SUCCESS;
|
||||
} else if (Z_TYPE_P(op2) == IS_BOOL) {
|
||||
} else if (Z_TYPE_P(op2) == IS_TRUE) {
|
||||
zendi_convert_to_boolean(op1, op1_copy, result);
|
||||
ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_LVAL_P(op1) - Z_LVAL_P(op2)));
|
||||
ZVAL_LONG(result, (Z_TYPE_P(op1) == IS_TRUE) ? 0 : -1);
|
||||
return SUCCESS;
|
||||
} else {
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
@ -1895,7 +1908,7 @@ static int hash_zval_identical_function(zval *z1, zval *z2) /* {{{ */
|
||||
if (is_identical_function(&result, z1, z2 TSRMLS_CC)==FAILURE) {
|
||||
return 1;
|
||||
}
|
||||
return !Z_LVAL(result);
|
||||
return Z_TYPE(result) != IS_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -1907,9 +1920,10 @@ ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
}
|
||||
switch (Z_TYPE_P(op1)) {
|
||||
case IS_NULL:
|
||||
case IS_FALSE:
|
||||
case IS_TRUE:
|
||||
ZVAL_BOOL(result, 1);
|
||||
break;
|
||||
case IS_BOOL:
|
||||
case IS_LONG:
|
||||
ZVAL_BOOL(result, Z_LVAL_P(op1) == Z_LVAL_P(op2));
|
||||
break;
|
||||
@ -1951,7 +1965,7 @@ ZEND_API int is_not_identical_function(zval *result, zval *op1, zval *op2 TSRMLS
|
||||
if (is_identical_function(result, op1, op2 TSRMLS_CC) == FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
Z_LVAL_P(result) = !Z_LVAL_P(result);
|
||||
ZVAL_BOOL(result, Z_TYPE_P(result) != IS_TRUE);
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
@ -2242,7 +2256,7 @@ ZEND_API int decrement_function(zval *op1) /* {{{ */
|
||||
ZEND_API int zval_is_true(zval *op) /* {{{ */
|
||||
{
|
||||
convert_to_boolean(op);
|
||||
return (Z_LVAL_P(op) ? 1 : 0);
|
||||
return (Z_TYPE_P(op) == IS_TRUE ? 1 : 0);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -400,7 +400,7 @@ ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC);
|
||||
END_EXTERN_C()
|
||||
|
||||
#define convert_to_ex_master(pzv, lower_type, upper_type) \
|
||||
if (Z_TYPE_P(pzv)!=IS_##upper_type) { \
|
||||
if (Z_TYPE_P(pzv)!=upper_type) { \
|
||||
SEPARATE_ZVAL_IF_NOT_REF(pzv); \
|
||||
convert_to_##lower_type(pzv); \
|
||||
}
|
||||
@ -417,7 +417,7 @@ END_EXTERN_C()
|
||||
case IS_DOUBLE: \
|
||||
convert_to_double(pzv); \
|
||||
break; \
|
||||
case IS_BOOL: \
|
||||
case _IS_BOOL: \
|
||||
convert_to_boolean(pzv); \
|
||||
break; \
|
||||
case IS_ARRAY: \
|
||||
@ -441,13 +441,13 @@ END_EXTERN_C()
|
||||
convert_to_explicit_type(pzv, str_type); \
|
||||
}
|
||||
|
||||
#define convert_to_boolean_ex(pzv) convert_to_ex_master(pzv, boolean, BOOL)
|
||||
#define convert_to_long_ex(pzv) convert_to_ex_master(pzv, long, LONG)
|
||||
#define convert_to_double_ex(pzv) convert_to_ex_master(pzv, double, DOUBLE)
|
||||
#define convert_to_string_ex(pzv) convert_to_ex_master(pzv, string, STRING)
|
||||
#define convert_to_array_ex(pzv) convert_to_ex_master(pzv, array, ARRAY)
|
||||
#define convert_to_object_ex(pzv) convert_to_ex_master(pzv, object, OBJECT)
|
||||
#define convert_to_null_ex(pzv) convert_to_ex_master(pzv, null, NULL)
|
||||
#define convert_to_boolean_ex(pzv) convert_to_ex_master(pzv, boolean, _IS_BOOL)
|
||||
#define convert_to_long_ex(pzv) convert_to_ex_master(pzv, long, IS_LONG)
|
||||
#define convert_to_double_ex(pzv) convert_to_ex_master(pzv, double, IS_DOUBLE)
|
||||
#define convert_to_string_ex(pzv) convert_to_ex_master(pzv, string, IS_STRING)
|
||||
#define convert_to_array_ex(pzv) convert_to_ex_master(pzv, array, IS_ARRAY)
|
||||
#define convert_to_object_ex(pzv) convert_to_ex_master(pzv, object, IS_OBJECT)
|
||||
#define convert_to_null_ex(pzv) convert_to_ex_master(pzv, null, IS_NULL)
|
||||
|
||||
#define convert_scalar_to_number_ex(pzv) \
|
||||
if (Z_TYPE_P(pzv)!=IS_LONG && Z_TYPE_P(pzv)!=IS_DOUBLE) { \
|
||||
@ -816,7 +816,7 @@ static zend_always_inline int fast_mod_function(zval *result, zval *op1, zval *o
|
||||
return mod_function(result, op1, op2 TSRMLS_CC);
|
||||
}
|
||||
|
||||
static zend_always_inline int fast_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
static zend_always_inline int fast_equal_check_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
@ -835,61 +835,115 @@ static zend_always_inline int fast_equal_function(zval *result, zval *op1, zval
|
||||
return Z_LVAL_P(result) == 0;
|
||||
}
|
||||
|
||||
static zend_always_inline int fast_not_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
static zend_always_inline void fast_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
return Z_LVAL_P(op1) != Z_LVAL_P(op2);
|
||||
ZVAL_BOOL(result, Z_LVAL_P(op1) == Z_LVAL_P(op2));
|
||||
return;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
return ((double)Z_LVAL_P(op1)) != Z_DVAL_P(op2);
|
||||
ZVAL_BOOL(result, (double)Z_LVAL_P(op1) == Z_DVAL_P(op2));
|
||||
return;
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
return Z_DVAL_P(op1) != Z_DVAL_P(op2);
|
||||
ZVAL_BOOL(result, Z_DVAL_P(op1) == Z_DVAL_P(op2));
|
||||
return;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
return Z_DVAL_P(op1) != ((double)Z_LVAL_P(op2));
|
||||
ZVAL_BOOL(result, Z_DVAL_P(op1) == ((double)Z_LVAL_P(op2)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
compare_function(result, op1, op2 TSRMLS_CC);
|
||||
return Z_LVAL_P(result) != 0;
|
||||
ZVAL_BOOL(result, Z_LVAL_P(result) == 0);
|
||||
}
|
||||
|
||||
static zend_always_inline int fast_is_smaller_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
static zend_always_inline void fast_not_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
return Z_LVAL_P(op1) < Z_LVAL_P(op2);
|
||||
ZVAL_BOOL(result, Z_LVAL_P(op1) != Z_LVAL_P(op2));
|
||||
return;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
return ((double)Z_LVAL_P(op1)) < Z_DVAL_P(op2);
|
||||
ZVAL_BOOL(result, (double)Z_LVAL_P(op1) != Z_DVAL_P(op2));
|
||||
return;
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
return Z_DVAL_P(op1) < Z_DVAL_P(op2);
|
||||
ZVAL_BOOL(result, Z_DVAL_P(op1) != Z_DVAL_P(op2));
|
||||
return;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
return Z_DVAL_P(op1) < ((double)Z_LVAL_P(op2));
|
||||
ZVAL_BOOL(result, Z_DVAL_P(op1) != ((double)Z_LVAL_P(op2)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
compare_function(result, op1, op2 TSRMLS_CC);
|
||||
return Z_LVAL_P(result) < 0;
|
||||
ZVAL_BOOL(result, Z_LVAL_P(result) != 0);
|
||||
}
|
||||
|
||||
static zend_always_inline int fast_is_smaller_or_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
static zend_always_inline void fast_is_smaller_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
return Z_LVAL_P(op1) <= Z_LVAL_P(op2);
|
||||
ZVAL_BOOL(result, Z_LVAL_P(op1) < Z_LVAL_P(op2));
|
||||
return;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
return ((double)Z_LVAL_P(op1)) <= Z_DVAL_P(op2);
|
||||
ZVAL_BOOL(result, (double)Z_LVAL_P(op1) < Z_DVAL_P(op2));
|
||||
return;
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
return Z_DVAL_P(op1) <= Z_DVAL_P(op2);
|
||||
ZVAL_BOOL(result, Z_DVAL_P(op1) < Z_DVAL_P(op2));
|
||||
return;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
return Z_DVAL_P(op1) <= ((double)Z_LVAL_P(op2));
|
||||
ZVAL_BOOL(result, Z_DVAL_P(op1) < ((double)Z_LVAL_P(op2)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
compare_function(result, op1, op2 TSRMLS_CC);
|
||||
return Z_LVAL_P(result) <= 0;
|
||||
ZVAL_BOOL(result, Z_LVAL_P(result) < 0);
|
||||
}
|
||||
|
||||
static zend_always_inline void fast_is_smaller_or_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
ZVAL_BOOL(result, Z_LVAL_P(op1) <= Z_LVAL_P(op2));
|
||||
return;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
ZVAL_BOOL(result, (double)Z_LVAL_P(op1) <= Z_DVAL_P(op2));
|
||||
return;
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
ZVAL_BOOL(result, Z_DVAL_P(op1) <= Z_DVAL_P(op2));
|
||||
return;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
ZVAL_BOOL(result, Z_DVAL_P(op1) <= ((double)Z_LVAL_P(op2)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
compare_function(result, op1, op2 TSRMLS_CC);
|
||||
ZVAL_BOOL(result, Z_LVAL_P(result) <= 0);
|
||||
}
|
||||
|
||||
static zend_always_inline void fast_is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
if (Z_TYPE_P(op1) != Z_TYPE_P(op2)) {
|
||||
ZVAL_BOOL(result, 0);
|
||||
return;
|
||||
}
|
||||
is_identical_function(result, op1, op2 TSRMLS_CC);
|
||||
}
|
||||
|
||||
static zend_always_inline void fast_is_not_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
if (Z_TYPE_P(op1) != Z_TYPE_P(op2)) {
|
||||
ZVAL_BOOL(result, 1);
|
||||
return;
|
||||
}
|
||||
is_identical_function(result, op1, op2 TSRMLS_CC);
|
||||
ZVAL_BOOL(result, Z_TYPE_P(result) != IS_TRUE);
|
||||
}
|
||||
|
||||
#define ZEND_TRY_BINARY_OBJECT_OPERATION(opcode) \
|
||||
|
@ -204,27 +204,29 @@ struct _zend_ast_ref {
|
||||
/* regular data types */
|
||||
#define IS_UNDEF 0
|
||||
#define IS_NULL 1
|
||||
#define IS_BOOL 2
|
||||
#define IS_LONG 3
|
||||
#define IS_DOUBLE 4
|
||||
#define IS_STRING 5
|
||||
#define IS_ARRAY 6
|
||||
#define IS_OBJECT 7
|
||||
#define IS_RESOURCE 8
|
||||
#define IS_REFERENCE 9
|
||||
#define IS_FALSE 2
|
||||
#define IS_TRUE 3
|
||||
#define IS_LONG 4
|
||||
#define IS_DOUBLE 5
|
||||
#define IS_STRING 6
|
||||
#define IS_ARRAY 7
|
||||
#define IS_OBJECT 8
|
||||
#define IS_RESOURCE 9
|
||||
#define IS_REFERENCE 10
|
||||
|
||||
/* constant expressions */
|
||||
#define IS_CONSTANT 10
|
||||
#define IS_CONSTANT_ARRAY 11
|
||||
#define IS_CONSTANT_AST 12
|
||||
#define IS_CONSTANT 11
|
||||
#define IS_CONSTANT_ARRAY 12
|
||||
#define IS_CONSTANT_AST 13
|
||||
|
||||
/* type hinting */
|
||||
#define IS_CALLABLE 13
|
||||
/* fake types */
|
||||
#define _IS_BOOL 14
|
||||
#define IS_CALLABLE 15
|
||||
|
||||
/* internal types */
|
||||
#define IS_INDIRECT 14
|
||||
#define IS_STR_OFFSET 15
|
||||
#define IS_PTR 16
|
||||
#define IS_INDIRECT 16
|
||||
#define IS_STR_OFFSET 17
|
||||
#define IS_PTR 18
|
||||
|
||||
static inline zend_uchar zval_get_type(const zval* pz) {
|
||||
return pz->u1.v.type;
|
||||
@ -369,9 +371,6 @@ static inline zend_uchar zval_get_type(const zval* pz) {
|
||||
#define Z_ISREF(zval) (Z_TYPE(zval) == IS_REFERENCE)
|
||||
#define Z_ISREF_P(zval_p) Z_ISREF(*(zval_p))
|
||||
|
||||
#define Z_BVAL(zval) (zend_bool)(zval).value.lval
|
||||
#define Z_BVAL_P(zval_p) Z_LVAL(*(zval_p))
|
||||
|
||||
#define Z_LVAL(zval) (zval).value.lval
|
||||
#define Z_LVAL_P(zval_p) Z_LVAL(*(zval_p))
|
||||
|
||||
@ -461,10 +460,17 @@ static inline zend_uchar zval_get_type(const zval* pz) {
|
||||
Z_TYPE_INFO_P(z) = IS_NULL; \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_FALSE(z) do { \
|
||||
Z_TYPE_INFO_P(z) = IS_FALSE; \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_TRUE(z) do { \
|
||||
Z_TYPE_INFO_P(z) = IS_TRUE; \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_BOOL(z, b) do { \
|
||||
zval *__z = (z); \
|
||||
Z_LVAL_P(__z) = ((b) != 0); \
|
||||
Z_TYPE_INFO_P(__z) = IS_BOOL; \
|
||||
Z_TYPE_INFO_P(z) = \
|
||||
(b) ? IS_TRUE : IS_FALSE; \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_LONG(z, l) { \
|
||||
|
@ -170,7 +170,8 @@ ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC)
|
||||
}
|
||||
case IS_LONG:
|
||||
case IS_DOUBLE:
|
||||
case IS_BOOL:
|
||||
case IS_FALSE:
|
||||
case IS_TRUE:
|
||||
case IS_NULL:
|
||||
default:
|
||||
break;
|
||||
@ -201,7 +202,8 @@ ZEND_API void _zval_internal_dtor_for_ptr(zval *zvalue ZEND_FILE_LINE_DC)
|
||||
}
|
||||
case IS_LONG:
|
||||
case IS_DOUBLE:
|
||||
case IS_BOOL:
|
||||
case IS_FALSE:
|
||||
case IS_TRUE:
|
||||
case IS_NULL:
|
||||
default:
|
||||
break;
|
||||
|
@ -151,7 +151,7 @@ ZEND_VM_HANDLER(15, ZEND_IS_IDENTICAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
|
||||
zend_free_op free_op1, free_op2;
|
||||
|
||||
SAVE_OPLINE();
|
||||
is_identical_function(EX_VAR(opline->result.var),
|
||||
fast_is_identical_function(EX_VAR(opline->result.var),
|
||||
GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R),
|
||||
GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R) TSRMLS_CC);
|
||||
FREE_OP1();
|
||||
@ -167,10 +167,9 @@ ZEND_VM_HANDLER(16, ZEND_IS_NOT_IDENTICAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
|
||||
zval *result = EX_VAR(opline->result.var);
|
||||
|
||||
SAVE_OPLINE();
|
||||
is_identical_function(result,
|
||||
fast_is_not_identical_function(result,
|
||||
GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R),
|
||||
GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R) TSRMLS_CC);
|
||||
Z_LVAL_P(result) = !Z_LVAL_P(result);
|
||||
FREE_OP1();
|
||||
FREE_OP2();
|
||||
CHECK_EXCEPTION();
|
||||
@ -184,9 +183,9 @@ ZEND_VM_HANDLER(17, ZEND_IS_EQUAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
|
||||
zval *result = EX_VAR(opline->result.var);
|
||||
|
||||
SAVE_OPLINE();
|
||||
ZVAL_BOOL(result, fast_equal_function(result,
|
||||
fast_equal_function(result,
|
||||
GET_OP1_ZVAL_PTR(BP_VAR_R),
|
||||
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC));
|
||||
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
|
||||
FREE_OP1();
|
||||
FREE_OP2();
|
||||
CHECK_EXCEPTION();
|
||||
@ -200,9 +199,9 @@ ZEND_VM_HANDLER(18, ZEND_IS_NOT_EQUAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
|
||||
zval *result = EX_VAR(opline->result.var);
|
||||
|
||||
SAVE_OPLINE();
|
||||
ZVAL_BOOL(result, fast_not_equal_function(result,
|
||||
fast_not_equal_function(result,
|
||||
GET_OP1_ZVAL_PTR(BP_VAR_R),
|
||||
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC));
|
||||
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
|
||||
FREE_OP1();
|
||||
FREE_OP2();
|
||||
CHECK_EXCEPTION();
|
||||
@ -216,9 +215,9 @@ ZEND_VM_HANDLER(19, ZEND_IS_SMALLER, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
|
||||
zval *result = EX_VAR(opline->result.var);
|
||||
|
||||
SAVE_OPLINE();
|
||||
ZVAL_BOOL(result, fast_is_smaller_function(result,
|
||||
fast_is_smaller_function(result,
|
||||
GET_OP1_ZVAL_PTR(BP_VAR_R),
|
||||
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC));
|
||||
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
|
||||
FREE_OP1();
|
||||
FREE_OP2();
|
||||
CHECK_EXCEPTION();
|
||||
@ -232,9 +231,9 @@ ZEND_VM_HANDLER(20, ZEND_IS_SMALLER_OR_EQUAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV
|
||||
zval *result = EX_VAR(opline->result.var);
|
||||
|
||||
SAVE_OPLINE();
|
||||
ZVAL_BOOL(result, fast_is_smaller_or_equal_function(result,
|
||||
fast_is_smaller_or_equal_function(result,
|
||||
GET_OP1_ZVAL_PTR(BP_VAR_R),
|
||||
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC));
|
||||
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
|
||||
FREE_OP1();
|
||||
FREE_OP2();
|
||||
CHECK_EXCEPTION();
|
||||
@ -2107,8 +2106,8 @@ ZEND_VM_HANDLER(43, ZEND_JMPZ, CONST|TMP|VAR|CV, ANY)
|
||||
SAVE_OPLINE();
|
||||
val = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
|
||||
|
||||
if (OP1_TYPE == IS_TMP_VAR && EXPECTED(Z_TYPE_P(val) == IS_BOOL)) {
|
||||
ret = Z_LVAL_P(val);
|
||||
if (OP1_TYPE == IS_TMP_VAR && EXPECTED(Z_TYPE_P(val) <= IS_TRUE)) {
|
||||
ret = (Z_TYPE_P(val) == IS_TRUE);
|
||||
} else {
|
||||
ret = i_zend_is_true(val TSRMLS_CC);
|
||||
FREE_OP1();
|
||||
@ -2137,8 +2136,8 @@ ZEND_VM_HANDLER(44, ZEND_JMPNZ, CONST|TMP|VAR|CV, ANY)
|
||||
SAVE_OPLINE();
|
||||
val = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
|
||||
|
||||
if (OP1_TYPE == IS_TMP_VAR && EXPECTED(Z_TYPE_P(val) == IS_BOOL)) {
|
||||
ret = Z_LVAL_P(val);
|
||||
if (OP1_TYPE == IS_TMP_VAR && EXPECTED(Z_TYPE_P(val) <= IS_TRUE)) {
|
||||
ret = (Z_TYPE_P(val) == IS_TRUE);
|
||||
} else {
|
||||
ret = i_zend_is_true(val TSRMLS_CC);
|
||||
FREE_OP1();
|
||||
@ -2167,8 +2166,8 @@ ZEND_VM_HANDLER(45, ZEND_JMPZNZ, CONST|TMP|VAR|CV, ANY)
|
||||
SAVE_OPLINE();
|
||||
val = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
|
||||
|
||||
if (OP1_TYPE == IS_TMP_VAR && EXPECTED(Z_TYPE_P(val) == IS_BOOL)) {
|
||||
retval = Z_LVAL_P(val);
|
||||
if (OP1_TYPE == IS_TMP_VAR && EXPECTED(Z_TYPE_P(val) <= IS_TRUE)) {
|
||||
retval = (Z_TYPE_P(val) == IS_TRUE);
|
||||
} else {
|
||||
retval = i_zend_is_true(val TSRMLS_CC);
|
||||
FREE_OP1();
|
||||
@ -2201,8 +2200,8 @@ ZEND_VM_HANDLER(46, ZEND_JMPZ_EX, CONST|TMP|VAR|CV, ANY)
|
||||
SAVE_OPLINE();
|
||||
val = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
|
||||
|
||||
if (OP1_TYPE == IS_TMP_VAR && EXPECTED(Z_TYPE_P(val) == IS_BOOL)) {
|
||||
retval = Z_LVAL_P(val);
|
||||
if (OP1_TYPE == IS_TMP_VAR && EXPECTED(Z_TYPE_P(val) <= IS_TRUE)) {
|
||||
retval = (Z_TYPE_P(val) == IS_TRUE);
|
||||
} else {
|
||||
retval = i_zend_is_true(val TSRMLS_CC);
|
||||
FREE_OP1();
|
||||
@ -2231,8 +2230,8 @@ ZEND_VM_HANDLER(47, ZEND_JMPNZ_EX, CONST|TMP|VAR|CV, ANY)
|
||||
SAVE_OPLINE();
|
||||
val = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
|
||||
|
||||
if (OP1_TYPE == IS_TMP_VAR && EXPECTED(Z_TYPE_P(val) == IS_BOOL)) {
|
||||
retval = Z_LVAL_P(val);
|
||||
if (OP1_TYPE == IS_TMP_VAR && EXPECTED(Z_TYPE_P(val) <= IS_TRUE)) {
|
||||
retval = (Z_TYPE_P(val) == IS_TRUE);
|
||||
} else {
|
||||
retval = i_zend_is_true(val TSRMLS_CC);
|
||||
FREE_OP1();
|
||||
@ -3448,9 +3447,9 @@ ZEND_VM_HANDLER(48, ZEND_CASE, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
|
||||
zval *result = EX_VAR(opline->result.var);
|
||||
|
||||
SAVE_OPLINE();
|
||||
ZVAL_BOOL(result, fast_equal_function(result,
|
||||
GET_OP1_ZVAL_PTR(BP_VAR_R),
|
||||
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC));
|
||||
fast_equal_function(result,
|
||||
GET_OP1_ZVAL_PTR(BP_VAR_R),
|
||||
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
|
||||
|
||||
FREE_OP2();
|
||||
CHECK_EXCEPTION();
|
||||
@ -3709,7 +3708,6 @@ ZEND_VM_C_LABEL(add_again):
|
||||
hval = zend_dval_to_lval(Z_DVAL_P(offset));
|
||||
ZEND_VM_C_GOTO(num_index);
|
||||
case IS_LONG:
|
||||
case IS_BOOL:
|
||||
hval = Z_LVAL_P(offset);
|
||||
ZEND_VM_C_LABEL(num_index):
|
||||
zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
|
||||
@ -3725,6 +3723,12 @@ ZEND_VM_C_LABEL(str_index):
|
||||
case IS_NULL:
|
||||
str = STR_EMPTY_ALLOC();
|
||||
ZEND_VM_C_GOTO(str_index);
|
||||
case IS_FALSE:
|
||||
hval = 0;
|
||||
ZEND_VM_C_GOTO(num_index);
|
||||
case IS_TRUE:
|
||||
hval = 1;
|
||||
ZEND_VM_C_GOTO(num_index);
|
||||
case IS_REFERENCE:
|
||||
offset = Z_REFVAL_P(offset);
|
||||
ZEND_VM_C_GOTO(add_again);
|
||||
@ -3797,7 +3801,7 @@ ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY)
|
||||
|
||||
ZVAL_NULL(result);
|
||||
break;
|
||||
case IS_BOOL:
|
||||
case _IS_BOOL:
|
||||
ZVAL_BOOL(result, zend_is_true(expr TSRMLS_CC));
|
||||
break;
|
||||
case IS_LONG:
|
||||
@ -4067,10 +4071,9 @@ ZEND_VM_C_LABEL(offset_again):
|
||||
hval = zend_dval_to_lval(Z_DVAL_P(offset));
|
||||
zend_hash_index_del(ht, hval);
|
||||
break;
|
||||
case IS_RESOURCE:
|
||||
case IS_BOOL:
|
||||
case IS_LONG:
|
||||
hval = Z_LVAL_P(offset);
|
||||
ZEND_VM_C_LABEL(num_index_dim):
|
||||
zend_hash_index_del(ht, hval);
|
||||
break;
|
||||
case IS_STRING:
|
||||
@ -4078,7 +4081,7 @@ ZEND_VM_C_LABEL(offset_again):
|
||||
if (Z_REFCOUNTED_P(offset)) Z_ADDREF_P(offset);
|
||||
}
|
||||
if (OP2_TYPE != IS_CONST) {
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index_dim));
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, ZEND_VM_C_GOTO(numeric_index_dim));
|
||||
}
|
||||
if (ht == &EG(symbol_table).ht) {
|
||||
zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
|
||||
@ -4089,7 +4092,7 @@ ZEND_VM_C_LABEL(offset_again):
|
||||
zval_ptr_dtor(offset);
|
||||
}
|
||||
break;
|
||||
ZEND_VM_C_LABEL(num_index_dim):
|
||||
ZEND_VM_C_LABEL(numeric_index_dim):
|
||||
zend_hash_index_del(ht, hval);
|
||||
if (OP2_TYPE == IS_CV || OP2_TYPE == IS_VAR) {
|
||||
zval_ptr_dtor(offset);
|
||||
@ -4098,6 +4101,15 @@ ZEND_VM_C_LABEL(num_index_dim):
|
||||
case IS_NULL:
|
||||
zend_hash_del(ht, STR_EMPTY_ALLOC());
|
||||
break;
|
||||
case IS_FALSE:
|
||||
hval = 0;
|
||||
ZEND_VM_C_GOTO(num_index_dim);
|
||||
case IS_TRUE:
|
||||
hval = 1;
|
||||
ZEND_VM_C_GOTO(num_index_dim);
|
||||
case IS_RESOURCE:
|
||||
hval = Z_RES_HANDLE_P(offset);
|
||||
ZEND_VM_C_GOTO(num_index_dim);
|
||||
case IS_REFERENCE:
|
||||
offset = Z_REFVAL_P(offset);
|
||||
ZEND_VM_C_GOTO(offset_again);
|
||||
@ -4575,8 +4587,6 @@ ZEND_VM_C_LABEL(isset_again):
|
||||
case IS_DOUBLE:
|
||||
hval = zend_dval_to_lval(Z_DVAL_P(offset));
|
||||
ZEND_VM_C_GOTO(num_index_prop);
|
||||
case IS_RESOURCE:
|
||||
case IS_BOOL:
|
||||
case IS_LONG:
|
||||
hval = Z_LVAL_P(offset);
|
||||
ZEND_VM_C_LABEL(num_index_prop):
|
||||
@ -4594,6 +4604,15 @@ ZEND_VM_C_LABEL(str_index_prop):
|
||||
str = STR_EMPTY_ALLOC();
|
||||
ZEND_VM_C_GOTO(str_index_prop);
|
||||
break;
|
||||
case IS_FALSE:
|
||||
hval = 0;
|
||||
ZEND_VM_C_GOTO(num_index_prop);
|
||||
case IS_TRUE:
|
||||
hval = 0;
|
||||
ZEND_VM_C_GOTO(num_index_prop);
|
||||
case IS_RESOURCE:
|
||||
hval = Z_RES_HANDLE_P(offset);
|
||||
ZEND_VM_C_GOTO(num_index_prop);
|
||||
case IS_REFERENCE:
|
||||
offset = Z_REFVAL_P(offset);
|
||||
ZEND_VM_C_GOTO(isset_again);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -358,7 +358,7 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
|
||||
zval_copy_ctor(&tmp);
|
||||
tmp2 = &tmp;
|
||||
convert_to_boolean_ex(&tmp2);
|
||||
data->expect_concatenated = Z_LVAL(tmp);
|
||||
data->expect_concatenated = Z_TMP(tmp) == IS_TRUE;
|
||||
tmpzval = NULL;
|
||||
}
|
||||
|
||||
@ -374,7 +374,7 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
|
||||
zval_copy_ctor(&tmp);
|
||||
tmp2 = &tmp;
|
||||
convert_to_boolean_ex(&tmp2);
|
||||
data->small_footprint = Z_LVAL(tmp);
|
||||
data->small_footprint = Z_TYPE(tmp) == IS_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4888,8 +4888,8 @@ static int php_date_period_initialize_from_hash(php_period_obj *period_obj, Hash
|
||||
|
||||
ht_entry = zend_hash_str_find(myht, "include_start_date", sizeof("include_start_date")-1);
|
||||
if (ht_entry &&
|
||||
Z_TYPE_P(ht_entry) == IS_BOOL) {
|
||||
period_obj->include_start_date = Z_BVAL_P(ht_entry);
|
||||
(Z_TYPE_P(ht_entry) == IS_FALSE || Z_TYPE_P(ht_entry) == IS_TRUE)) {
|
||||
period_obj->include_start_date = (Z_TYPE_P(ht_entry) == IS_TRUE);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
@ -215,8 +215,8 @@ static void dom_xpath_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs,
|
||||
obj = Z_XPATHOBJ_P(&retval);
|
||||
nodep = dom_object_get_node(obj);
|
||||
valuePush(ctxt, xmlXPathNewNodeSet(nodep));
|
||||
} else if (Z_TYPE(retval) == IS_BOOL) {
|
||||
valuePush(ctxt, xmlXPathNewBoolean(Z_BVAL(retval)));
|
||||
} else if (Z_TYPE(retval) == IS_FALSE || Z_TYPE(retval) == IS_TRUE) {
|
||||
valuePush(ctxt, xmlXPathNewBoolean(Z_TYPE(retval) == IS_TRUE));
|
||||
} else if (Z_TYPE(retval) == IS_OBJECT) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "A PHP Object cannot be converted to a XPath-string");
|
||||
valuePush(ctxt, xmlXPathNewString((xmlChar *)""));
|
||||
|
@ -2118,7 +2118,7 @@ PHP_FUNCTION(ldap_set_option)
|
||||
{
|
||||
void *val;
|
||||
convert_to_boolean_ex(newval);
|
||||
val = Z_LVAL_PP(newval)
|
||||
val = Z_TYPE_PP(newval) == IS_TRUE
|
||||
? LDAP_OPT_ON : LDAP_OPT_OFF;
|
||||
if (ldap_set_option(ldap, option, val)) {
|
||||
RETURN_FALSE;
|
||||
@ -2165,7 +2165,7 @@ PHP_FUNCTION(ldap_set_option)
|
||||
}
|
||||
if (zend_hash_find(Z_ARRVAL_PP(ctrlval), "iscritical", sizeof("iscritical"), (void **) &val) == SUCCESS) {
|
||||
convert_to_boolean_ex(val);
|
||||
ctrl->ldctl_iscritical = Z_BVAL_PP(val);
|
||||
ctrl->ldctl_iscritical = Z_TYPE_PP(val) == IS_TRUE;
|
||||
} else {
|
||||
ctrl->ldctl_iscritical = 0;
|
||||
}
|
||||
|
@ -2165,7 +2165,7 @@ static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type,
|
||||
|
||||
#ifdef ZEND_ENGINE_2
|
||||
/* mysqlnd might return FALSE if no more rows */
|
||||
if (into_object && Z_TYPE_P(return_value) != IS_BOOL) {
|
||||
if (into_object && Z_TYPE_P(return_value) != IS_FALSE) {
|
||||
zval dataset;
|
||||
zend_fcall_info fci;
|
||||
zend_fcall_info_cache fcc;
|
||||
|
@ -425,7 +425,7 @@ static int mysqli_object_has_property(zval *object, zval *member, int has_set_ex
|
||||
zval *value = mysqli_read_property(object, member, BP_VAR_IS, key TSRMLS_CC);
|
||||
if (value != EG(uninitialized_zval_ptr)) {
|
||||
convert_to_boolean(value);
|
||||
ret = Z_BVAL_P(value)? 1:0;
|
||||
ret = Z_TYPE_P(value) == IS_TRUE ? 1 : 0;
|
||||
/* refcount is 0 */
|
||||
Z_ADDREF_P(value);
|
||||
zval_ptr_dtor(&value);
|
||||
|
@ -792,16 +792,28 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
|
||||
opline->opcode == ZEND_IS_NOT_EQUAL ||
|
||||
opline->opcode == ZEND_CASE) {
|
||||
if (ZEND_OP1_TYPE(opline) == IS_CONST &&
|
||||
Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_BOOL) {
|
||||
// TODO: Optimization of comparison with null may be not safe ???
|
||||
#if 1
|
||||
(Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_FALSE ||
|
||||
Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_TRUE)) {
|
||||
#else
|
||||
Z_TYPE(ZEND_OP1_LITERAL(opline)) <= IS_TRUE) {
|
||||
#endif
|
||||
opline->opcode =
|
||||
((opline->opcode != ZEND_IS_NOT_EQUAL) == Z_LVAL(ZEND_OP1_LITERAL(opline)))?
|
||||
((opline->opcode != ZEND_IS_NOT_EQUAL) == ((Z_TYPE(ZEND_OP1_LITERAL(opline))) == IS_TRUE)) ?
|
||||
ZEND_BOOL : ZEND_BOOL_NOT;
|
||||
COPY_NODE(opline->op1, opline->op2);
|
||||
SET_UNUSED(opline->op2);
|
||||
} else if (ZEND_OP2_TYPE(opline) == IS_CONST &&
|
||||
Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_BOOL) {
|
||||
// TODO: Optimization of comparison with null may be not safe ???
|
||||
#if 1
|
||||
(Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_FALSE ||
|
||||
Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_TRUE)) {
|
||||
#else
|
||||
Z_TYPE(ZEND_OP2_LITERAL(opline)) <= IS_TRUE) {
|
||||
#endif
|
||||
opline->opcode =
|
||||
((opline->opcode != ZEND_IS_NOT_EQUAL) == Z_LVAL(ZEND_OP2_LITERAL(opline)))?
|
||||
((opline->opcode != ZEND_IS_NOT_EQUAL) == ((Z_TYPE(ZEND_OP2_LITERAL(opline))) == IS_TRUE)) ?
|
||||
ZEND_BOOL : ZEND_BOOL_NOT;
|
||||
SET_UNUSED(opline->op2);
|
||||
}
|
||||
|
@ -300,28 +300,27 @@ static void optimizer_compact_literals(zend_op_array *op_array TSRMLS_DC)
|
||||
}
|
||||
map[i] = l_null;
|
||||
break;
|
||||
case IS_BOOL:
|
||||
if (Z_LVAL(op_array->literals[i])) {
|
||||
if (l_true < 0) {
|
||||
l_true = j;
|
||||
if (i != j) {
|
||||
op_array->literals[j] = op_array->literals[i];
|
||||
info[j] = info[i];
|
||||
}
|
||||
j++;
|
||||
case IS_FALSE:
|
||||
if (l_false < 0) {
|
||||
l_false = j;
|
||||
if (i != j) {
|
||||
op_array->literals[j] = op_array->literals[i];
|
||||
info[j] = info[i];
|
||||
}
|
||||
map[i] = l_true;
|
||||
} else {
|
||||
if (l_false < 0) {
|
||||
l_false = j;
|
||||
if (i != j) {
|
||||
op_array->literals[j] = op_array->literals[i];
|
||||
info[j] = info[i];
|
||||
}
|
||||
j++;
|
||||
}
|
||||
map[i] = l_false;
|
||||
j++;
|
||||
}
|
||||
map[i] = l_false;
|
||||
break;
|
||||
case IS_TRUE:
|
||||
if (l_true < 0) {
|
||||
l_true = j;
|
||||
if (i != j) {
|
||||
op_array->literals[j] = op_array->literals[i];
|
||||
info[j] = info[i];
|
||||
}
|
||||
j++;
|
||||
}
|
||||
map[i] = l_true;
|
||||
break;
|
||||
case IS_LONG:
|
||||
if ((pos = (int)zend_hash_index_find_ptr(&hash, Z_LVAL(op_array->literals[i]))) != 0) {
|
||||
|
@ -82,7 +82,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
|
||||
case IS_NULL:
|
||||
convert_to_null(&res);
|
||||
break;
|
||||
case IS_BOOL:
|
||||
case _IS_BOOL:
|
||||
convert_to_boolean(&res);
|
||||
break;
|
||||
case IS_LONG:
|
||||
@ -104,7 +104,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
|
||||
} else /* if (opline->result_type == IS_VAR) */ {
|
||||
replace_var_by_const(op_array, opline + 1, tv, &res TSRMLS_CC);
|
||||
}
|
||||
} else if (opline->extended_value == IS_BOOL) {
|
||||
} else if (opline->extended_value == _IS_BOOL) {
|
||||
/* T = CAST(X, IS_BOOL) => T = BOOL(X) */
|
||||
opline->opcode = ZEND_BOOL;
|
||||
opline->extended_value = 0;
|
||||
@ -327,8 +327,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
|
||||
zend_binary_strcasecmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)), "define", sizeof("define")-1) == 0 &&
|
||||
(opline-1)->opcode == ZEND_SEND_VAL &&
|
||||
ZEND_OP1_TYPE(opline-1) == IS_CONST &&
|
||||
(Z_TYPE(ZEND_OP1_LITERAL(opline-1)) <= IS_BOOL ||
|
||||
Z_TYPE(ZEND_OP1_LITERAL(opline-1)) == IS_STRING) &&
|
||||
Z_TYPE(ZEND_OP1_LITERAL(opline-1)) <= IS_STRING &&
|
||||
(opline-2)->opcode == ZEND_SEND_VAL &&
|
||||
ZEND_OP1_TYPE(opline-2) == IS_CONST &&
|
||||
Z_TYPE(ZEND_OP1_LITERAL(opline-2)) == IS_STRING) {
|
||||
@ -449,8 +448,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
|
||||
case ZEND_DECLARE_CONST:
|
||||
if (collect_constants &&
|
||||
Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING &&
|
||||
(Z_TYPE(ZEND_OP2_LITERAL(opline)) <= IS_BOOL ||
|
||||
Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING)) {
|
||||
Z_TYPE(ZEND_OP2_LITERAL(opline)) <= IS_STRING) {
|
||||
zend_optimizer_collect_constant(constants, &ZEND_OP1_LITERAL(opline), &ZEND_OP2_LITERAL(opline));
|
||||
}
|
||||
break;
|
||||
|
@ -2250,7 +2250,8 @@ static void accel_fast_zval_dtor(zval *zvalue)
|
||||
break;
|
||||
case IS_LONG:
|
||||
case IS_DOUBLE:
|
||||
case IS_BOOL:
|
||||
case IS_FALSE:
|
||||
case IS_TRUE:
|
||||
case IS_NULL:
|
||||
case IS_STRING:
|
||||
case IS_CONSTANT:
|
||||
|
@ -695,7 +695,7 @@ static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, long attr, zval *value TSRMLS_D
|
||||
{
|
||||
|
||||
#define PDO_LONG_PARAM_CHECK \
|
||||
if (Z_TYPE_P(value) != IS_LONG && Z_TYPE_P(value) != IS_STRING && Z_TYPE_P(value) != IS_BOOL) { \
|
||||
if (Z_TYPE_P(value) != IS_LONG && Z_TYPE_P(value) != IS_STRING && Z_TYPE_P(value) != IS_FALSE && Z_TYPE_P(value) != IS_TRUE) { \
|
||||
pdo_raise_impl_error(dbh, NULL, "HY000", "attribute value must be an integer" TSRMLS_CC); \
|
||||
PDO_HANDLE_DBH_ERR(); \
|
||||
return FAILURE; \
|
||||
|
@ -594,7 +594,8 @@ safe:
|
||||
plc->freeq = 0;
|
||||
break;
|
||||
|
||||
case IS_BOOL:
|
||||
case IS_FALSE:
|
||||
case IS_TRUE:
|
||||
convert_to_long(&tmp_param);
|
||||
/* fall through */
|
||||
case IS_LONG:
|
||||
|
@ -236,7 +236,8 @@ safe:
|
||||
plc->freeq = 0;
|
||||
break;
|
||||
|
||||
case IS_BOOL:
|
||||
case IS_FALSE:
|
||||
case IS_TRUE:
|
||||
convert_to_long(&tmp_param);
|
||||
/* fall through */
|
||||
case IS_LONG:
|
||||
|
@ -327,7 +327,7 @@ static int really_register_bound_param(struct pdo_bound_param_data *param, pdo_s
|
||||
} else {
|
||||
convert_to_string(parameter);
|
||||
}
|
||||
} else if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_INT && Z_TYPE_P(parameter) == IS_BOOL) {
|
||||
} else if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_INT && (Z_TYPE_P(parameter) == IS_FALSE || Z_TYPE_P(parameter) == IS_TRUE)) {
|
||||
convert_to_long(parameter);
|
||||
} else if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_BOOL && Z_TYPE_P(parameter) == IS_LONG) {
|
||||
convert_to_boolean(parameter);
|
||||
|
@ -725,12 +725,10 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg
|
||||
string_write(str, " = ", sizeof(" = ")-1);
|
||||
ZVAL_DUP(&zv, precv->op2.zv);
|
||||
zval_update_constant_ex(&zv, 1, fptr->common.scope TSRMLS_CC);
|
||||
if (Z_TYPE(zv) == IS_BOOL) {
|
||||
if (Z_LVAL(zv)) {
|
||||
string_write(str, "true", sizeof("true")-1);
|
||||
} else {
|
||||
string_write(str, "false", sizeof("false")-1);
|
||||
}
|
||||
if (Z_TYPE(zv) == IS_TRUE) {
|
||||
string_write(str, "true", sizeof("true")-1);
|
||||
} else if (Z_TYPE(zv) == IS_FALSE) {
|
||||
string_write(str, "false", sizeof("false")-1);
|
||||
} else if (Z_TYPE(zv) == IS_NULL) {
|
||||
string_write(str, "NULL", sizeof("NULL")-1);
|
||||
} else if (Z_TYPE(zv) == IS_STRING) {
|
||||
|
@ -2598,7 +2598,7 @@ static zend_bool php_check_cancel_upload(php_session_rfc1867_progress *progress
|
||||
if ((cancel_upload = zend_hash_str_find(Z_ARRVAL_P(progress_ary), "cancel_upload", sizeof("cancel_upload") - 1)) == NULL) {
|
||||
return 0;
|
||||
}
|
||||
return Z_TYPE_P(cancel_upload) == IS_BOOL && Z_LVAL_P(cancel_upload);
|
||||
return Z_TYPE_P(cancel_upload) == IS_TRUE;
|
||||
} /* }}} */
|
||||
|
||||
static void php_session_rfc1867_update(php_session_rfc1867_progress *progress, int force_update TSRMLS_DC) /* {{{ */
|
||||
|
@ -411,7 +411,8 @@ static void change_node_zval(xmlNodePtr node, zval *value TSRMLS_DC)
|
||||
}
|
||||
switch (Z_TYPE_P(value)) {
|
||||
case IS_LONG:
|
||||
case IS_BOOL:
|
||||
case IS_FALSE:
|
||||
case IS_TRUE:
|
||||
case IS_DOUBLE:
|
||||
case IS_NULL:
|
||||
if (Z_REFCOUNT_P(value) > 1) {
|
||||
@ -525,7 +526,8 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool
|
||||
if (value) {
|
||||
switch (Z_TYPE_P(value)) {
|
||||
case IS_LONG:
|
||||
case IS_BOOL:
|
||||
case IS_FALSE:
|
||||
case IS_TRUE:
|
||||
case IS_DOUBLE:
|
||||
case IS_NULL:
|
||||
convert_to_string(value);
|
||||
@ -1754,7 +1756,7 @@ static int cast_object(zval *object, int type, char *contents TSRMLS_DC)
|
||||
case IS_STRING:
|
||||
convert_to_string(object);
|
||||
break;
|
||||
case IS_BOOL:
|
||||
case _IS_BOOL:
|
||||
convert_to_boolean(object);
|
||||
break;
|
||||
case IS_LONG:
|
||||
@ -1782,7 +1784,7 @@ static int sxe_object_cast(zval *readobj, zval *writeobj, int type TSRMLS_DC)
|
||||
|
||||
sxe = Z_SXEOBJ_P(readobj);
|
||||
|
||||
if (type == IS_BOOL) {
|
||||
if (type == _IS_BOOL) {
|
||||
node = php_sxe_get_first_node(sxe, NULL TSRMLS_CC);
|
||||
prop_hash = sxe_get_prop_hash(readobj, 1 TSRMLS_CC);
|
||||
ZVAL_BOOL(writeobj, node != NULL || zend_hash_num_elements(prop_hash) > 0);
|
||||
|
@ -282,6 +282,7 @@ int php_do_setsockopt_ip_mcast(php_socket *php_sock,
|
||||
|
||||
case IP_MULTICAST_LOOP:
|
||||
convert_to_boolean_ex(arg4);
|
||||
ipv4_mcast_ttl_lback = (unsigned char) (Z_TYPE_PP(arg4) == IS_TRUE);
|
||||
goto ipv4_loop_ttl;
|
||||
|
||||
case IP_MULTICAST_TTL:
|
||||
@ -291,8 +292,8 @@ int php_do_setsockopt_ip_mcast(php_socket *php_sock,
|
||||
"Expected a value between 0 and 255");
|
||||
return FAILURE;
|
||||
}
|
||||
ipv4_loop_ttl:
|
||||
ipv4_mcast_ttl_lback = (unsigned char) Z_LVAL_PP(arg4);
|
||||
ipv4_loop_ttl:
|
||||
opt_ptr = &ipv4_mcast_ttl_lback;
|
||||
optlen = sizeof(ipv4_mcast_ttl_lback);
|
||||
goto dosockopt;
|
||||
@ -347,6 +348,7 @@ int php_do_setsockopt_ipv6_mcast(php_socket *php_sock,
|
||||
|
||||
case IPV6_MULTICAST_LOOP:
|
||||
convert_to_boolean_ex(arg4);
|
||||
ov = (int) Z_TYPE_PP(arg4) == IS_TRUE;
|
||||
goto ipv6_loop_hops;
|
||||
case IPV6_MULTICAST_HOPS:
|
||||
convert_to_long_ex(arg4);
|
||||
@ -355,8 +357,8 @@ int php_do_setsockopt_ipv6_mcast(php_socket *php_sock,
|
||||
"Expected a value between -1 and 255");
|
||||
return FAILURE;
|
||||
}
|
||||
ipv6_loop_hops:
|
||||
ov = (int) Z_LVAL_PP(arg4);
|
||||
ipv6_loop_hops:
|
||||
opt_ptr = &ov;
|
||||
optlen = sizeof(ov);
|
||||
goto dosockopt;
|
||||
|
@ -366,7 +366,12 @@ fetch_dim_string:
|
||||
case IS_DOUBLE:
|
||||
index = (long)Z_DVAL_P(offset);
|
||||
goto num_index;
|
||||
case IS_BOOL:
|
||||
case IS_FALSE:
|
||||
index = 0;
|
||||
goto num_index;
|
||||
case IS_TRUE:
|
||||
index = 1;
|
||||
goto num_index;
|
||||
case IS_LONG:
|
||||
index = Z_LVAL_P(offset);
|
||||
num_index:
|
||||
@ -488,19 +493,25 @@ static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval
|
||||
zend_symtable_update_ind(ht, Z_STR_P(offset), value);
|
||||
return;
|
||||
case IS_DOUBLE:
|
||||
index = (long)Z_DVAL_P(offset);
|
||||
goto num_index;
|
||||
case IS_RESOURCE:
|
||||
case IS_BOOL:
|
||||
index = Z_RES_HANDLE_P(offset);
|
||||
goto num_index;
|
||||
case IS_FALSE:
|
||||
index = 0;
|
||||
goto num_index;
|
||||
case IS_TRUE:
|
||||
index = 1;
|
||||
goto num_index;
|
||||
case IS_LONG:
|
||||
index = Z_LVAL_P(offset);
|
||||
num_index:
|
||||
ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
|
||||
if (ht->u.v.nApplyCount > 0) {
|
||||
zend_error(E_WARNING, "Modification of ArrayObject during sorting is prohibited");
|
||||
return;
|
||||
}
|
||||
if (Z_TYPE_P(offset) == IS_DOUBLE) {
|
||||
index = (long)Z_DVAL_P(offset);
|
||||
} else {
|
||||
index = Z_LVAL_P(offset);
|
||||
}
|
||||
zend_hash_index_update(ht, index, value);
|
||||
return;
|
||||
case IS_NULL:
|
||||
@ -574,21 +585,27 @@ static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval
|
||||
}
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
index = (long)Z_DVAL_P(offset);
|
||||
goto num_index;
|
||||
case IS_RESOURCE:
|
||||
case IS_BOOL:
|
||||
index = Z_RES_HANDLE_P(offset);
|
||||
goto num_index;
|
||||
case IS_FALSE:
|
||||
index = 0;
|
||||
goto num_index;
|
||||
case IS_TRUE:
|
||||
index = 1;
|
||||
goto num_index;
|
||||
case IS_LONG:
|
||||
if (Z_TYPE_P(offset) == IS_DOUBLE) {
|
||||
index = (long)Z_DVAL_P(offset);
|
||||
} else {
|
||||
index = Z_LVAL_P(offset);
|
||||
}
|
||||
index = Z_LVAL_P(offset);
|
||||
num_index:
|
||||
ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
|
||||
if (ht->u.v.nApplyCount > 0) {
|
||||
zend_error(E_WARNING, "Modification of ArrayObject during sorting is prohibited");
|
||||
return;
|
||||
}
|
||||
if (zend_hash_index_del(ht, index) == FAILURE) {
|
||||
zend_error(E_NOTICE,"Undefined offset: %ld", Z_LVAL_P(offset));
|
||||
zend_error(E_NOTICE,"Undefined offset: %ld", index);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -646,14 +663,20 @@ static int spl_array_has_dimension_ex(int check_inherited, zval *object, zval *o
|
||||
}
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
index = (long)Z_DVAL_P(offset);
|
||||
goto num_index;
|
||||
case IS_RESOURCE:
|
||||
case IS_BOOL:
|
||||
index = Z_RES_HANDLE_P(offset);
|
||||
goto num_index;
|
||||
case IS_FALSE:
|
||||
index = 0;
|
||||
goto num_index;
|
||||
case IS_TRUE:
|
||||
index = 1;
|
||||
goto num_index;
|
||||
case IS_LONG:
|
||||
if (Z_TYPE_P(offset) == IS_DOUBLE) {
|
||||
index = (long)Z_DVAL_P(offset);
|
||||
} else {
|
||||
index = Z_LVAL_P(offset);
|
||||
}
|
||||
index = Z_LVAL_P(offset);
|
||||
num_index:
|
||||
if ((tmp = zend_hash_index_find(ht, index)) != NULL) {
|
||||
if (check_empty == 2) {
|
||||
return 1;
|
||||
|
@ -265,7 +265,7 @@ static int spl_filesystem_file_open(spl_filesystem_object *intern, int use_inclu
|
||||
intern->type = SPL_FS_FILE;
|
||||
|
||||
php_stat(intern->file_name, intern->file_name_len, FS_IS_DIR, &tmp TSRMLS_CC);
|
||||
if (Z_LVAL(tmp)) {
|
||||
if (Z_TYPE(tmp) == IS_TRUE) {
|
||||
intern->u.file.open_mode = NULL;
|
||||
intern->file_name = NULL;
|
||||
zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Cannot use SplFileObject with directories");
|
||||
|
@ -48,10 +48,14 @@ PHPAPI long spl_offset_convert_to_long(zval *offset TSRMLS_DC) /* {{{ */
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
return (long)Z_DVAL_P(offset);
|
||||
case IS_RESOURCE:
|
||||
case IS_BOOL:
|
||||
case IS_LONG:
|
||||
return Z_LVAL_P(offset);
|
||||
case IS_FALSE:
|
||||
return 0;
|
||||
case IS_TRUE:
|
||||
return 1;
|
||||
case IS_RESOURCE:
|
||||
return Z_RES_HANDLE_P(offset);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -977,7 +977,7 @@ static void spl_recursive_tree_iterator_get_prefix(spl_recursive_it_object *obje
|
||||
for (level = 0; level < object->level; ++level) {
|
||||
zend_call_method_with_0_params(&object->iterators[level].zobject, object->iterators[level].ce, NULL, "hasnext", &has_next);
|
||||
if (Z_TYPE(has_next) != IS_UNDEF) {
|
||||
if (Z_LVAL(has_next)) {
|
||||
if (Z_TYPE(has_next) == IS_TRUE) {
|
||||
smart_str_appendl(&str, object->prefix[1].s->val, object->prefix[1].s->len);
|
||||
} else {
|
||||
smart_str_appendl(&str, object->prefix[2].s->val, object->prefix[2].s->len);
|
||||
@ -987,7 +987,7 @@ static void spl_recursive_tree_iterator_get_prefix(spl_recursive_it_object *obje
|
||||
}
|
||||
zend_call_method_with_0_params(&object->iterators[level].zobject, object->iterators[level].ce, NULL, "hasnext", &has_next);
|
||||
if (Z_TYPE(has_next) != IS_UNDEF) {
|
||||
if (Z_LVAL(has_next)) {
|
||||
if (Z_TYPE(has_next) == IS_TRUE) {
|
||||
smart_str_appendl(&str, object->prefix[3].s->val, object->prefix[3].s->len);
|
||||
} else {
|
||||
smart_str_appendl(&str, object->prefix[4].s->val, object->prefix[4].s->len);
|
||||
@ -2041,7 +2041,7 @@ SPL_METHOD(RegexIterator, accept)
|
||||
}
|
||||
|
||||
if (intern->u.regex.flags & REGIT_INVERTED) {
|
||||
RETVAL_BOOL(! Z_LVAL_P(return_value));
|
||||
RETVAL_BOOL(Z_TYPE_P(return_value) != IS_TRUE);
|
||||
}
|
||||
|
||||
if (use_copy) {
|
||||
|
@ -1064,7 +1064,7 @@ SPL_METHOD(MultipleIterator, attachIterator)
|
||||
zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos);
|
||||
while ((element = zend_hash_get_current_data_ptr_ex(&intern->storage, &intern->pos)) != NULL) {
|
||||
is_identical_function(&compare_result, info, &element->inf TSRMLS_CC);
|
||||
if (Z_LVAL(compare_result)) {
|
||||
if (Z_TYPE(compare_result) == IS_TRUE) {
|
||||
zend_throw_exception(spl_ce_InvalidArgumentException, "Key duplication error", 0 TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
@ -1149,7 +1149,7 @@ SPL_METHOD(MultipleIterator, valid)
|
||||
zend_call_method_with_0_params(it, Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs.zf_valid, "valid", &retval);
|
||||
|
||||
if (!ZVAL_IS_UNDEF(&retval)) {
|
||||
valid = Z_LVAL(retval);
|
||||
valid = (Z_TYPE(retval) == IS_TRUE);
|
||||
zval_ptr_dtor(&retval);
|
||||
} else {
|
||||
valid = 0;
|
||||
@ -1185,7 +1185,7 @@ static void spl_multiple_iterator_get_all(spl_SplObjectStorage *intern, int get_
|
||||
zend_call_method_with_0_params(it, Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs.zf_valid, "valid", &retval);
|
||||
|
||||
if (!ZVAL_IS_UNDEF(&retval)) {
|
||||
valid = Z_LVAL(retval);
|
||||
valid = Z_TYPE(retval) == IS_TRUE;
|
||||
zval_ptr_dtor(&retval);
|
||||
} else {
|
||||
valid = 0;
|
||||
|
@ -933,7 +933,7 @@ PHP_FUNCTION(min)
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
is_smaller_function(&result, &args[i], min TSRMLS_CC);
|
||||
if (Z_LVAL(result) == 1) {
|
||||
if (Z_TYPE(result) == IS_TRUE) {
|
||||
min = &args[i];
|
||||
}
|
||||
}
|
||||
@ -980,7 +980,7 @@ PHP_FUNCTION(max)
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
is_smaller_or_equal_function(&result, &args[i], max TSRMLS_CC);
|
||||
if (Z_LVAL(result) == 0) {
|
||||
if (Z_TYPE(result) == IS_FALSE) {
|
||||
max = &args[i];
|
||||
}
|
||||
}
|
||||
@ -1166,7 +1166,7 @@ static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior) /* {{{
|
||||
if (strict) {
|
||||
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_idx, str_idx, entry) {
|
||||
is_identical_function(&res, value, entry TSRMLS_CC);
|
||||
if (Z_LVAL(res)) {
|
||||
if (Z_TYPE(res) == IS_TRUE) {
|
||||
if (behavior == 0) {
|
||||
RETURN_TRUE;
|
||||
} else {
|
||||
@ -1181,7 +1181,7 @@ static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior) /* {{{
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
} else {
|
||||
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_idx, str_idx, entry) {
|
||||
if (fast_equal_function(&res, value, entry TSRMLS_CC)) {
|
||||
if (fast_equal_check_function(&res, value, entry TSRMLS_CC)) {
|
||||
if (behavior == 0) {
|
||||
RETURN_TRUE;
|
||||
} else {
|
||||
|
@ -183,10 +183,10 @@ PHP_FUNCTION(assert)
|
||||
}
|
||||
|
||||
convert_to_boolean(&retval);
|
||||
val = Z_LVAL(retval);
|
||||
val = Z_TYPE(retval) == IS_TRUE;
|
||||
} else {
|
||||
convert_to_boolean_ex(assertion);
|
||||
val = Z_LVAL_P(assertion);
|
||||
val = Z_TYPE_P(assertion) == IS_TRUE;
|
||||
}
|
||||
|
||||
if (val) {
|
||||
|
@ -634,7 +634,8 @@ PHP_FUNCTION(file_put_contents)
|
||||
case IS_NULL:
|
||||
case IS_LONG:
|
||||
case IS_DOUBLE:
|
||||
case IS_BOOL:
|
||||
case IS_FALSE:
|
||||
case IS_TRUE:
|
||||
convert_to_string_ex(data);
|
||||
|
||||
case IS_STRING:
|
||||
|
@ -1289,13 +1289,13 @@ static php_conv_err_t php_conv_get_bool_prop_ex(const HashTable *ht, int *pretva
|
||||
if ((tmpval = zend_hash_str_find((HashTable *)ht, field_name, field_name_len-1)) != NULL) {
|
||||
zval tmp;
|
||||
|
||||
if (Z_TYPE_P(tmpval) != IS_BOOL) {
|
||||
if (Z_TYPE_P(tmpval) != IS_FALSE || Z_TYPE_P(tmpval) != IS_TRUE) {
|
||||
ZVAL_DUP(&tmp, tmpval);
|
||||
zval_copy_ctor(&tmp);
|
||||
convert_to_boolean(&tmp);
|
||||
tmpval = &tmp;
|
||||
}
|
||||
*pretval = Z_BVAL_P(tmpval);
|
||||
*pretval = (Z_TYPE_P(tmpval) == IS_TRUE);
|
||||
} else {
|
||||
return PHP_CONV_ERR_NOT_FOUND;
|
||||
}
|
||||
|
@ -183,7 +183,6 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
|
||||
}
|
||||
break;
|
||||
case IS_LONG:
|
||||
case IS_BOOL:
|
||||
{
|
||||
char *ekey;
|
||||
int ekey_len;
|
||||
@ -192,6 +191,12 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
|
||||
efree(ekey);
|
||||
}
|
||||
break;
|
||||
case IS_FALSE:
|
||||
smart_str_appendl(formstr, "0", sizeof("0")-1);
|
||||
break;
|
||||
case IS_TRUE:
|
||||
smart_str_appendl(formstr, "1", sizeof("1")-1);
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
{
|
||||
char *ekey;
|
||||
|
@ -376,7 +376,8 @@ PHP_FUNCTION(password_hash)
|
||||
}
|
||||
zval_dtor(&cast_option_buffer);
|
||||
}
|
||||
case IS_BOOL:
|
||||
case IS_FALSE:
|
||||
case IS_TRUE:
|
||||
case IS_NULL:
|
||||
case IS_RESOURCE:
|
||||
case IS_ARRAY:
|
||||
|
@ -1146,13 +1146,12 @@ again:
|
||||
}
|
||||
break;
|
||||
|
||||
case IS_BOOL:
|
||||
if (Z_LVAL_P(tmp) == 1) {
|
||||
smart_str_appendl(&implstr, "1", sizeof("1")-1);
|
||||
}
|
||||
case IS_TRUE:
|
||||
smart_str_appendl(&implstr, "1", sizeof("1")-1);
|
||||
break;
|
||||
|
||||
case IS_NULL:
|
||||
case IS_FALSE:
|
||||
break;
|
||||
|
||||
case IS_DOUBLE: {
|
||||
@ -1648,12 +1647,15 @@ static int php_needle_char(zval *needle, char *target TSRMLS_DC)
|
||||
{
|
||||
switch (Z_TYPE_P(needle)) {
|
||||
case IS_LONG:
|
||||
case IS_BOOL:
|
||||
*target = (char)Z_LVAL_P(needle);
|
||||
return SUCCESS;
|
||||
case IS_NULL:
|
||||
case IS_FALSE:
|
||||
*target = '\0';
|
||||
return SUCCESS;
|
||||
case IS_TRUE:
|
||||
*target = '\1';
|
||||
return SUCCESS;
|
||||
case IS_DOUBLE:
|
||||
*target = (char)(int)Z_DVAL_P(needle);
|
||||
return SUCCESS;
|
||||
|
@ -36,7 +36,8 @@ PHP_FUNCTION(gettype)
|
||||
RETVAL_STRING("NULL");
|
||||
break;
|
||||
|
||||
case IS_BOOL:
|
||||
case IS_FALSE:
|
||||
case IS_TRUE:
|
||||
RETVAL_STRING("boolean");
|
||||
break;
|
||||
|
||||
@ -258,7 +259,14 @@ PHP_FUNCTION(is_resource)
|
||||
Returns true if variable is a boolean */
|
||||
PHP_FUNCTION(is_bool)
|
||||
{
|
||||
php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_BOOL);
|
||||
zval *arg;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &arg) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZVAL_DEREF(arg);
|
||||
RETURN_BOOL(Z_TYPE_P(arg) == IS_FALSE || Z_TYPE_P(arg) == IS_TRUE);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -344,7 +352,8 @@ PHP_FUNCTION(is_scalar)
|
||||
}
|
||||
|
||||
switch (Z_TYPE_P(arg)) {
|
||||
case IS_BOOL:
|
||||
case IS_FALSE:
|
||||
case IS_TRUE:
|
||||
case IS_DOUBLE:
|
||||
case IS_LONG:
|
||||
case IS_STRING:
|
||||
|
@ -363,7 +363,7 @@ static php_stream_filter *user_filter_factory_create(const char *filtername,
|
||||
0, NULL TSRMLS_CC);
|
||||
|
||||
if (Z_TYPE(retval) != IS_UNDEF) {
|
||||
if (Z_TYPE(retval) == IS_BOOL && Z_LVAL(retval) == 0) {
|
||||
if (Z_TYPE(retval) == IS_FALSE) {
|
||||
/* User reported filter creation error "return false;" */
|
||||
zval_ptr_dtor(&retval);
|
||||
|
||||
|
@ -129,8 +129,11 @@ PHPAPI void php_var_dump(zval *struc, int level TSRMLS_DC) /* {{{ */
|
||||
|
||||
again:
|
||||
switch (Z_TYPE_P(struc)) {
|
||||
case IS_BOOL:
|
||||
php_printf("%sbool(%s)\n", COMMON, Z_LVAL_P(struc) ? "true" : "false");
|
||||
case IS_FALSE:
|
||||
php_printf("%sbool(false)\n", COMMON);
|
||||
break;
|
||||
case IS_TRUE:
|
||||
php_printf("%sbool(true)\n", COMMON);
|
||||
break;
|
||||
case IS_NULL:
|
||||
php_printf("%sNULL\n", COMMON);
|
||||
@ -304,8 +307,11 @@ PHPAPI void php_debug_zval_dump(zval *struc, int level TSRMLS_DC) /* {{{ */
|
||||
|
||||
again:
|
||||
switch (Z_TYPE_P(struc)) {
|
||||
case IS_BOOL:
|
||||
php_printf("%sbool(%s)\n", COMMON, Z_LVAL_P(struc)?"true":"false");
|
||||
case IS_FALSE:
|
||||
php_printf("%sbool(false)\n", COMMON);
|
||||
break;
|
||||
case IS_TRUE:
|
||||
php_printf("%sbool(true)\n", COMMON);
|
||||
break;
|
||||
case IS_NULL:
|
||||
php_printf("%sNULL\n", COMMON);
|
||||
@ -491,12 +497,11 @@ PHPAPI void php_var_export_ex(zval *struc, int level, smart_str *buf TSRMLS_DC)
|
||||
|
||||
again:
|
||||
switch (Z_TYPE_P(struc)) {
|
||||
case IS_BOOL:
|
||||
if (Z_LVAL_P(struc)) {
|
||||
smart_str_appendl(buf, "true", 4);
|
||||
} else {
|
||||
smart_str_appendl(buf, "false", 5);
|
||||
}
|
||||
case IS_FALSE:
|
||||
smart_str_appendl(buf, "false", 5);
|
||||
break;
|
||||
case IS_TRUE:
|
||||
smart_str_appendl(buf, "true", 4);
|
||||
break;
|
||||
case IS_NULL:
|
||||
smart_str_appendl(buf, "NULL", 4);
|
||||
@ -828,10 +833,12 @@ static void php_var_serialize_intern(smart_str *buf, zval *struc, HashTable *var
|
||||
|
||||
again:
|
||||
switch (Z_TYPE_P(struc)) {
|
||||
case IS_BOOL:
|
||||
smart_str_appendl(buf, "b:", 2);
|
||||
smart_str_append_long(buf, Z_LVAL_P(struc));
|
||||
smart_str_appendc(buf, ';');
|
||||
case IS_FALSE:
|
||||
smart_str_appendl(buf, "b:0;", 4);
|
||||
return;
|
||||
|
||||
case IS_TRUE:
|
||||
smart_str_appendl(buf, "b:1;", 4);
|
||||
return;
|
||||
|
||||
case IS_NULL:
|
||||
|
@ -541,7 +541,7 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int dep
|
||||
break;
|
||||
case xmlrpc_boolean:
|
||||
convert_to_boolean(val);
|
||||
xReturn = XMLRPC_CreateValueBoolean(key, Z_LVAL_P(val));
|
||||
xReturn = XMLRPC_CreateValueBoolean(key, Z_TYPE_P(val) == IS_TRUE);
|
||||
break;
|
||||
case xmlrpc_int:
|
||||
convert_to_long(val);
|
||||
|
@ -975,11 +975,11 @@ static inline php_output_handler_status_t php_output_handler_op(php_output_handl
|
||||
ZVAL_LONG(&ob_mode, (long) context->op);
|
||||
zend_fcall_info_argn(&handler->func.user->fci TSRMLS_CC, 2, &ob_data, &ob_mode);
|
||||
|
||||
#define PHP_OUTPUT_USER_SUCCESS(retval) ((Z_TYPE(retval) != IS_UNDEF) && !(Z_TYPE(retval) == IS_BOOL && Z_BVAL(retval)==0))
|
||||
#define PHP_OUTPUT_USER_SUCCESS(retval) ((Z_TYPE(retval) != IS_UNDEF) && !(Z_TYPE(retval) == IS_FALSE))
|
||||
if (SUCCESS == zend_fcall_info_call(&handler->func.user->fci, &handler->func.user->fcc, &retval, NULL TSRMLS_CC) && PHP_OUTPUT_USER_SUCCESS(retval)) {
|
||||
/* user handler may have returned TRUE */
|
||||
status = PHP_OUTPUT_HANDLER_NO_DATA;
|
||||
if (Z_TYPE(retval) != IS_BOOL) {
|
||||
if (Z_TYPE(retval) != IS_FALSE && Z_TYPE(retval) != IS_TRUE) {
|
||||
convert_to_string_ex(&retval);
|
||||
if (Z_STRLEN(retval)) {
|
||||
context->out.data = estrndup(Z_STRVAL(retval), Z_STRLEN(retval));
|
||||
|
@ -915,7 +915,7 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value
|
||||
case PHP_STREAM_OPTION_CHECK_LIVENESS:
|
||||
ZVAL_STRINGL(&func_name, USERSTREAM_EOF, sizeof(USERSTREAM_EOF)-1);
|
||||
call_result = call_user_function_ex(NULL, ZVAL_IS_UNDEF(&us->object)? NULL : &us->object, &func_name, &retval, 0, NULL, 0, NULL TSRMLS_CC);
|
||||
if (call_result == SUCCESS && Z_TYPE(retval) == IS_BOOL) {
|
||||
if (call_result == SUCCESS && (Z_TYPE(retval) == IS_FALSE || Z_TYPE(retval) == IS_TRUE)) {
|
||||
ret = zval_is_true(&retval) ? PHP_STREAM_OPTION_RETURN_ERR : PHP_STREAM_OPTION_RETURN_OK;
|
||||
} else {
|
||||
ret = PHP_STREAM_OPTION_RETURN_ERR;
|
||||
@ -954,8 +954,8 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value
|
||||
&retval,
|
||||
1, args, 0, NULL TSRMLS_CC);
|
||||
|
||||
if (call_result == SUCCESS && Z_TYPE(retval) == IS_BOOL) {
|
||||
ret = !Z_LVAL(retval);
|
||||
if (call_result == SUCCESS && (Z_TYPE(retval) == IS_FALSE || Z_TYPE(retval) == IS_TRUE)) {
|
||||
ret = (Z_TYPE(retval) == IS_FALSE);
|
||||
} else if (call_result == FAILURE) {
|
||||
if (value == 0) {
|
||||
/* lock support test (TODO: more check) */
|
||||
@ -995,8 +995,8 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value
|
||||
&retval,
|
||||
1, args, 0, NULL TSRMLS_CC);
|
||||
if (call_result == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
|
||||
if (Z_TYPE(retval) == IS_BOOL) {
|
||||
ret = Z_LVAL(retval) ? PHP_STREAM_OPTION_RETURN_OK :
|
||||
if (Z_TYPE(retval) == IS_FALSE || Z_TYPE(retval) == IS_TRUE) {
|
||||
ret = (Z_TYPE(retval) == IS_TRUE) ? PHP_STREAM_OPTION_RETURN_OK :
|
||||
PHP_STREAM_OPTION_RETURN_ERR;
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING,
|
||||
@ -1110,8 +1110,8 @@ static int user_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int
|
||||
1, args,
|
||||
0, NULL TSRMLS_CC);
|
||||
|
||||
if (call_result == SUCCESS && Z_TYPE(zretval) == IS_BOOL) {
|
||||
ret = Z_LVAL(zretval);
|
||||
if (call_result == SUCCESS && (Z_TYPE(zretval) == IS_FALSE || Z_TYPE(zretval) == IS_TRUE)) {
|
||||
ret = (Z_TYPE(zretval) == IS_TRUE);
|
||||
} else if (call_result == FAILURE) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_UNLINK " is not implemented!", uwrap->classname);
|
||||
}
|
||||
@ -1156,8 +1156,8 @@ static int user_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from
|
||||
2, args,
|
||||
0, NULL TSRMLS_CC);
|
||||
|
||||
if (call_result == SUCCESS && Z_TYPE(zretval) == IS_BOOL) {
|
||||
ret = Z_LVAL(zretval);
|
||||
if (call_result == SUCCESS && (Z_TYPE(zretval) == IS_FALSE || Z_TYPE(zretval) == IS_TRUE)) {
|
||||
ret = (Z_TYPE(zretval) == IS_TRUE);
|
||||
} else if (call_result == FAILURE) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_RENAME " is not implemented!", uwrap->classname);
|
||||
}
|
||||
@ -1203,8 +1203,8 @@ static int user_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url, int
|
||||
3, args,
|
||||
0, NULL TSRMLS_CC);
|
||||
|
||||
if (call_result == SUCCESS && Z_TYPE(zretval) == IS_BOOL) {
|
||||
ret = Z_LVAL(zretval);
|
||||
if (call_result == SUCCESS && (Z_TYPE(zretval) == IS_FALSE || Z_TYPE(zretval) == IS_TRUE)) {
|
||||
ret = (Z_TYPE(zretval) == IS_TRUE);
|
||||
} else if (call_result == FAILURE) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_MKDIR " is not implemented!", uwrap->classname);
|
||||
}
|
||||
@ -1250,8 +1250,8 @@ static int user_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url,
|
||||
2, args,
|
||||
0, NULL TSRMLS_CC);
|
||||
|
||||
if (call_result == SUCCESS && Z_TYPE(zretval) == IS_BOOL) {
|
||||
ret = Z_LVAL(zretval);
|
||||
if (call_result == SUCCESS && (Z_TYPE(zretval) == IS_FALSE || Z_TYPE(zretval) == IS_TRUE)) {
|
||||
ret = (Z_TYPE(zretval) == IS_TRUE);
|
||||
} else if (call_result == FAILURE) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_RMDIR " is not implemented!", uwrap->classname);
|
||||
}
|
||||
@ -1321,8 +1321,8 @@ static int user_wrapper_metadata(php_stream_wrapper *wrapper, const char *url, i
|
||||
3, args,
|
||||
0, NULL TSRMLS_CC);
|
||||
|
||||
if (call_result == SUCCESS && Z_TYPE(zretval) == IS_BOOL) {
|
||||
ret = Z_LVAL(zretval);
|
||||
if (call_result == SUCCESS && (Z_TYPE(zretval) == IS_FALSE || Z_TYPE(zretval) == IS_TRUE)) {
|
||||
ret = Z_TYPE(zretval) == IS_TRUE;
|
||||
} else if (call_result == FAILURE) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_METADATA " is not implemented!", uwrap->classname);
|
||||
}
|
||||
@ -1414,7 +1414,7 @@ static size_t php_userstreamop_readdir(php_stream *stream, char *buf, size_t cou
|
||||
0, NULL,
|
||||
0, NULL TSRMLS_CC);
|
||||
|
||||
if (call_result == SUCCESS && Z_TYPE(retval) != IS_BOOL) {
|
||||
if (call_result == SUCCESS && Z_TYPE(retval) != IS_FALSE && Z_TYPE(retval) != IS_TRUE) {
|
||||
convert_to_string(&retval);
|
||||
PHP_STRLCPY(ent->d_name, Z_STRVAL(retval), sizeof(ent->d_name), Z_STRLEN(retval));
|
||||
|
||||
|
@ -2128,7 +2128,7 @@ static int php_cli_server_dispatch_router(php_cli_server *server, php_cli_server
|
||||
zval retval;
|
||||
if (SUCCESS == zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, &retval, 1, &zfd)) {
|
||||
if (Z_TYPE(retval) != IS_UNDEF) {
|
||||
decline = Z_TYPE(retval) == IS_BOOL && !Z_LVAL(retval);
|
||||
decline = Z_TYPE(retval) == IS_FALSE;
|
||||
zval_ptr_dtor(&retval);
|
||||
}
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user