Lines Matching refs:op

232 #define convert_object_to_type(op, dst, ctype)									\  argument
234 if (Z_OBJ_HT_P(op)->cast_object(Z_OBJ_P(op), dst, ctype) == FAILURE) { \
236 "Object of class %s could not be converted to %s", ZSTR_VAL(Z_OBJCE_P(op)->name),\
242 ZEND_API void ZEND_FASTCALL convert_scalar_to_number(zval *op) /* {{{ */ in convert_scalar_to_number() argument
245 switch (Z_TYPE_P(op)) { in convert_scalar_to_number()
247 zend_unwrap_reference(op); in convert_scalar_to_number()
253 str = Z_STR_P(op); in convert_scalar_to_number()
254 …if ((Z_TYPE_INFO_P(op)=is_numeric_string(ZSTR_VAL(str), ZSTR_LEN(str), &Z_LVAL_P(op), &Z_DVAL_P(op in convert_scalar_to_number()
255 ZVAL_LONG(op, 0); in convert_scalar_to_number()
262 ZVAL_LONG(op, 0); in convert_scalar_to_number()
265 ZVAL_LONG(op, 1); in convert_scalar_to_number()
269 zend_long l = Z_RES_HANDLE_P(op); in convert_scalar_to_number()
270 zval_ptr_dtor(op); in convert_scalar_to_number()
271 ZVAL_LONG(op, l); in convert_scalar_to_number()
278 convert_object_to_type(op, &dst, _IS_NUMBER); in convert_scalar_to_number()
279 zval_ptr_dtor(op); in convert_scalar_to_number()
282 ZVAL_COPY_VALUE(op, &dst); in convert_scalar_to_number()
284 ZVAL_LONG(op, 1); in convert_scalar_to_number()
292 static zend_never_inline zval* ZEND_FASTCALL _zendi_convert_scalar_to_number_silent(zval *op, zval … in _zendi_convert_scalar_to_number_silent() argument
294 switch (Z_TYPE_P(op)) { in _zendi_convert_scalar_to_number_silent()
303 …if ((Z_TYPE_INFO_P(holder) = is_numeric_string(Z_STRVAL_P(op), Z_STRLEN_P(op), &Z_LVAL_P(holder), … in _zendi_convert_scalar_to_number_silent()
308 ZVAL_LONG(holder, Z_RES_HANDLE_P(op)); in _zendi_convert_scalar_to_number_silent()
311 convert_object_to_type(op, holder, _IS_NUMBER); in _zendi_convert_scalar_to_number_silent()
320 return op; in _zendi_convert_scalar_to_number_silent()
325 static zend_never_inline zend_result ZEND_FASTCALL _zendi_try_convert_scalar_to_number(zval *op, zv… in _zendi_try_convert_scalar_to_number() argument
327 switch (Z_TYPE_P(op)) { in _zendi_try_convert_scalar_to_number()
339 if (0 == (Z_TYPE_INFO_P(holder) = is_numeric_string_ex(Z_STRVAL_P(op), Z_STRLEN_P(op), in _zendi_try_convert_scalar_to_number()
353 if (Z_OBJ_HT_P(op)->cast_object(Z_OBJ_P(op), holder, _IS_NUMBER) == FAILURE in _zendi_try_convert_scalar_to_number()
367 static zend_always_inline zend_result zendi_try_convert_scalar_to_number(zval *op, zval *holder) /*… in zendi_try_convert_scalar_to_number() argument
369 if (Z_TYPE_P(op) == IS_LONG || Z_TYPE_P(op) == IS_DOUBLE) { in zendi_try_convert_scalar_to_number()
370 ZVAL_COPY_VALUE(holder, op); in zendi_try_convert_scalar_to_number()
373 return _zendi_try_convert_scalar_to_number(op, holder); in zendi_try_convert_scalar_to_number()
378 static zend_never_inline zend_long ZEND_FASTCALL zendi_try_get_long(const zval *op, bool *failed) /… in zendi_try_get_long() argument
381 switch (Z_TYPE_P(op)) { in zendi_try_get_long()
388 double dval = Z_DVAL_P(op); in zendi_try_get_long()
406 type = is_numeric_string_ex(Z_STRVAL_P(op), Z_STRLEN_P(op), &lval, &dval, in zendi_try_get_long()
428 zend_incompatible_string_to_long_error(Z_STR_P(op)); in zendi_try_get_long()
439 if (Z_OBJ_HT_P(op)->cast_object(Z_OBJ_P(op), &dst, IS_LONG) == FAILURE in zendi_try_get_long()
456 ZEND_API zend_long ZEND_FASTCALL zval_try_get_long(const zval *op, bool *failed) in zval_try_get_long() argument
458 if (EXPECTED(Z_TYPE_P(op) == IS_LONG)) { in zval_try_get_long()
460 return Z_LVAL_P(op); in zval_try_get_long()
462 return zendi_try_get_long(op, failed); in zval_try_get_long()
540 ZEND_API void ZEND_FASTCALL convert_to_long(zval *op) /* {{{ */ in convert_to_long() argument
545 switch (Z_TYPE_P(op)) { in convert_to_long()
548 ZVAL_LONG(op, 0); in convert_to_long()
551 ZVAL_LONG(op, 1); in convert_to_long()
554 tmp = Z_RES_HANDLE_P(op); in convert_to_long()
555 zval_ptr_dtor(op); in convert_to_long()
556 ZVAL_LONG(op, tmp); in convert_to_long()
561 ZVAL_LONG(op, zend_dval_to_lval(Z_DVAL_P(op))); in convert_to_long()
565 zend_string *str = Z_STR_P(op); in convert_to_long()
566 ZVAL_LONG(op, zval_get_long(op)); in convert_to_long()
571 tmp = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); in convert_to_long()
572 zval_ptr_dtor(op); in convert_to_long()
573 ZVAL_LONG(op, tmp); in convert_to_long()
579 convert_object_to_type(op, &dst, IS_LONG); in convert_to_long()
580 zval_ptr_dtor(op); in convert_to_long()
583 ZVAL_LONG(op, Z_LVAL(dst)); in convert_to_long()
585 ZVAL_LONG(op, 1); in convert_to_long()
590 zend_unwrap_reference(op); in convert_to_long()
597 ZEND_API void ZEND_FASTCALL convert_to_double(zval *op) /* {{{ */ in convert_to_double() argument
602 switch (Z_TYPE_P(op)) { in convert_to_double()
605 ZVAL_DOUBLE(op, 0.0); in convert_to_double()
608 ZVAL_DOUBLE(op, 1.0); in convert_to_double()
611 double d = (double) Z_RES_HANDLE_P(op); in convert_to_double()
612 zval_ptr_dtor(op); in convert_to_double()
613 ZVAL_DOUBLE(op, d); in convert_to_double()
617 ZVAL_DOUBLE(op, (double) Z_LVAL_P(op)); in convert_to_double()
623 zend_string *str = Z_STR_P(op); in convert_to_double()
625 ZVAL_DOUBLE(op, zend_strtod(ZSTR_VAL(str), NULL)); in convert_to_double()
630 tmp = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); in convert_to_double()
631 zval_ptr_dtor(op); in convert_to_double()
632 ZVAL_DOUBLE(op, tmp); in convert_to_double()
638 convert_object_to_type(op, &dst, IS_DOUBLE); in convert_to_double()
639 zval_ptr_dtor(op); in convert_to_double()
642 ZVAL_DOUBLE(op, Z_DVAL(dst)); in convert_to_double()
644 ZVAL_DOUBLE(op, 1.0); in convert_to_double()
649 zend_unwrap_reference(op); in convert_to_double()
656 ZEND_API void ZEND_FASTCALL convert_to_null(zval *op) /* {{{ */ in convert_to_null() argument
658 zval_ptr_dtor(op); in convert_to_null()
659 ZVAL_NULL(op); in convert_to_null()
663 ZEND_API void ZEND_FASTCALL convert_to_boolean(zval *op) /* {{{ */ in convert_to_boolean() argument
668 switch (Z_TYPE_P(op)) { in convert_to_boolean()
673 ZVAL_FALSE(op); in convert_to_boolean()
676 zend_long l = (Z_RES_HANDLE_P(op) ? 1 : 0); in convert_to_boolean()
678 zval_ptr_dtor(op); in convert_to_boolean()
679 ZVAL_BOOL(op, l); in convert_to_boolean()
683 ZVAL_BOOL(op, Z_LVAL_P(op) ? 1 : 0); in convert_to_boolean()
686 ZVAL_BOOL(op, Z_DVAL_P(op) ? 1 : 0); in convert_to_boolean()
690 zend_string *str = Z_STR_P(op); in convert_to_boolean()
694 ZVAL_FALSE(op); in convert_to_boolean()
696 ZVAL_TRUE(op); in convert_to_boolean()
702 tmp = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); in convert_to_boolean()
703 zval_ptr_dtor(op); in convert_to_boolean()
704 ZVAL_BOOL(op, tmp); in convert_to_boolean()
710 convert_object_to_type(op, &dst, _IS_BOOL); in convert_to_boolean()
711 zval_ptr_dtor(op); in convert_to_boolean()
714 Z_TYPE_INFO_P(op) = Z_TYPE_INFO(dst); in convert_to_boolean()
716 ZVAL_TRUE(op); in convert_to_boolean()
721 zend_unwrap_reference(op); in convert_to_boolean()
728 ZEND_API void ZEND_FASTCALL _convert_to_string(zval *op) /* {{{ */ in _convert_to_string() argument
731 switch (Z_TYPE_P(op)) { in _convert_to_string()
735 ZVAL_EMPTY_STRING(op); in _convert_to_string()
739 ZVAL_CHAR(op, '1'); in _convert_to_string()
744 …end_string *str = zend_strpprintf(0, "Resource id #" ZEND_LONG_FMT, (zend_long)Z_RES_HANDLE_P(op)); in _convert_to_string()
745 zval_ptr_dtor(op); in _convert_to_string()
746 ZVAL_NEW_STR(op, str); in _convert_to_string()
750 ZVAL_STR(op, zend_long_to_str(Z_LVAL_P(op))); in _convert_to_string()
753 ZVAL_NEW_STR(op, zend_double_to_str(Z_DVAL_P(op))); in _convert_to_string()
757 zval_ptr_dtor(op); in _convert_to_string()
758 ZVAL_INTERNED_STR(op, ZSTR_KNOWN(ZEND_STR_ARRAY_CAPITALIZED)); in _convert_to_string()
762 if (Z_OBJ_HT_P(op)->cast_object(Z_OBJ_P(op), &tmp, IS_STRING) == SUCCESS) { in _convert_to_string()
763 zval_ptr_dtor(op); in _convert_to_string()
764 ZVAL_COPY_VALUE(op, &tmp); in _convert_to_string()
768 …_error(NULL, "Object of class %s could not be converted to string", ZSTR_VAL(Z_OBJCE_P(op)->name)); in _convert_to_string()
770 zval_ptr_dtor(op); in _convert_to_string()
771 ZVAL_EMPTY_STRING(op); in _convert_to_string()
775 zend_unwrap_reference(op); in _convert_to_string()
782 ZEND_API bool ZEND_FASTCALL _try_convert_to_string(zval *op) /* {{{ */ in _try_convert_to_string() argument
786 ZEND_ASSERT(Z_TYPE_P(op) != IS_STRING); in _try_convert_to_string()
787 str = zval_try_get_string_func(op); in _try_convert_to_string()
791 zval_ptr_dtor(op); in _try_convert_to_string()
792 ZVAL_STR(op, str); in _try_convert_to_string()
797 static void convert_scalar_to_array(zval *op) /* {{{ */ in convert_scalar_to_array() argument
800 zend_hash_index_add_new(ht, 0, op); in convert_scalar_to_array()
801 ZVAL_ARR(op, ht); in convert_scalar_to_array()
805 ZEND_API void ZEND_FASTCALL convert_to_array(zval *op) /* {{{ */ in convert_to_array() argument
808 switch (Z_TYPE_P(op)) { in convert_to_array()
813 if (Z_OBJCE_P(op) == zend_ce_closure) { in convert_to_array()
814 convert_scalar_to_array(op); in convert_to_array()
815 } else if (ZEND_STD_BUILD_OBJECT_PROPERTIES_ARRAY_COMPATIBLE(op)) { in convert_to_array()
817 HashTable *ht = zend_std_build_object_properties_array(Z_OBJ_P(op)); in convert_to_array()
818 OBJ_RELEASE(Z_OBJ_P(op)); in convert_to_array()
819 ZVAL_ARR(op, ht); in convert_to_array()
821 HashTable *obj_ht = zend_get_properties_for(op, ZEND_PROP_PURPOSE_ARRAY_CAST); in convert_to_array()
824 (Z_OBJCE_P(op)->default_properties_count || in convert_to_array()
825 Z_OBJ_P(op)->handlers != &std_object_handlers || in convert_to_array()
827 zval_ptr_dtor(op); in convert_to_array()
828 ZVAL_ARR(op, new_obj_ht); in convert_to_array()
831 zval_ptr_dtor(op); in convert_to_array()
833 array_init(op); in convert_to_array()
839 array_init(op); in convert_to_array()
842 zend_unwrap_reference(op); in convert_to_array()
845 convert_scalar_to_array(op); in convert_to_array()
851 ZEND_API void ZEND_FASTCALL convert_to_object(zval *op) /* {{{ */ in convert_to_object() argument
854 switch (Z_TYPE_P(op)) { in convert_to_object()
857 HashTable *ht = zend_symtable_to_proptable(Z_ARR_P(op)); in convert_to_object()
863 } else if (ht != Z_ARR_P(op)) { in convert_to_object()
864 zval_ptr_dtor(op); in convert_to_object()
870 ZVAL_OBJ(op, obj); in convert_to_object()
876 object_init(op); in convert_to_object()
879 zend_unwrap_reference(op); in convert_to_object()
883 ZVAL_COPY_VALUE(&tmp, op); in convert_to_object()
884 object_init(op); in convert_to_object()
885 zend_hash_add_new(Z_OBJPROP_P(op), ZSTR_KNOWN(ZEND_STR_SCALAR), &tmp); in convert_to_object()
901 ZEND_API zend_long ZEND_FASTCALL zval_get_long_func(const zval *op, bool is_strict) /* {{{ */ in zval_get_long_func() argument
904 switch (Z_TYPE_P(op)) { in zval_get_long_func()
912 return Z_RES_HANDLE_P(op); in zval_get_long_func()
914 return Z_LVAL_P(op); in zval_get_long_func()
916 double dval = Z_DVAL_P(op); in zval_get_long_func()
930 if (0 == (type = is_numeric_string(Z_STRVAL_P(op), Z_STRLEN_P(op), &lval, &dval, true))) { in zval_get_long_func()
944 zend_incompatible_string_to_long_error(Z_STR_P(op)); in zval_get_long_func()
951 return zend_hash_num_elements(Z_ARRVAL_P(op)) ? 1 : 0; in zval_get_long_func()
955 convert_object_to_type(op, &dst, IS_LONG); in zval_get_long_func()
963 op = Z_REFVAL_P(op); in zval_get_long_func()
971 ZEND_API double ZEND_FASTCALL zval_get_double_func(const zval *op) /* {{{ */ in zval_get_double_func() argument
974 switch (Z_TYPE_P(op)) { in zval_get_double_func()
981 return (double) Z_RES_HANDLE_P(op); in zval_get_double_func()
983 return (double) Z_LVAL_P(op); in zval_get_double_func()
985 return Z_DVAL_P(op); in zval_get_double_func()
987 return zend_strtod(Z_STRVAL_P(op), NULL); in zval_get_double_func()
989 return zend_hash_num_elements(Z_ARRVAL_P(op)) ? 1.0 : 0.0; in zval_get_double_func()
993 convert_object_to_type(op, &dst, IS_DOUBLE); in zval_get_double_func()
1002 op = Z_REFVAL_P(op); in zval_get_double_func()
1010 static zend_always_inline zend_string* __zval_get_string_func(zval *op, bool try) /* {{{ */ in __zval_get_string_func() argument
1013 switch (Z_TYPE_P(op)) { in __zval_get_string_func()
1021 return zend_strpprintf(0, "Resource id #" ZEND_LONG_FMT, (zend_long)Z_RES_HANDLE_P(op)); in __zval_get_string_func()
1023 return zend_long_to_str(Z_LVAL_P(op)); in __zval_get_string_func()
1025 return zend_double_to_str(Z_DVAL_P(op)); in __zval_get_string_func()
1032 if (Z_OBJ_HT_P(op)->cast_object(Z_OBJ_P(op), &tmp, IS_STRING) == SUCCESS) { in __zval_get_string_func()
1036 …_error(NULL, "Object of class %s could not be converted to string", ZSTR_VAL(Z_OBJCE_P(op)->name)); in __zval_get_string_func()
1041 op = Z_REFVAL_P(op); in __zval_get_string_func()
1044 return zend_string_copy(Z_STR_P(op)); in __zval_get_string_func()
1051 ZEND_API zend_string* ZEND_FASTCALL zval_get_string_func(zval *op) /* {{{ */ in zval_get_string_func() argument
1053 return __zval_get_string_func(op, 0); in zval_get_string_func()
1057 ZEND_API zend_string* ZEND_FASTCALL zval_try_get_string_func(zval *op) /* {{{ */ in zval_try_get_string_func() argument
1059 return __zval_get_string_func(op, 1); in zval_try_get_string_func()
2838 ZEND_API bool ZEND_FASTCALL zend_is_true(const zval *op) /* {{{ */ in zend_is_true() argument
2840 return i_zend_is_true(op); in zend_is_true()
2844 ZEND_API bool ZEND_FASTCALL zend_object_is_true(const zval *op) /* {{{ */ in zend_object_is_true() argument
2846 zend_object *zobj = Z_OBJ_P(op); in zend_object_is_true()