mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
- Support Cast operator in convert_to_* so that we support internal
- extensions such as SimpleXML. This is for Sterling.
This commit is contained in:
parent
4f897b2f3c
commit
88de69b97c
4 changed files with 9 additions and 9 deletions
|
@ -216,7 +216,8 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop
|
||||||
case IS_OBJECT:
|
case IS_OBJECT:
|
||||||
if (expr->value.obj.handlers->cast_object) {
|
if (expr->value.obj.handlers->cast_object) {
|
||||||
TSRMLS_FETCH();
|
TSRMLS_FETCH();
|
||||||
if (expr->value.obj.handlers->cast_object == zend_std_cast_object) {
|
/* Standard PHP objects */
|
||||||
|
if (expr->value.obj.handlers == &std_object_handlers) {
|
||||||
if (zend_std_cast_object_tostring(expr, expr_copy, IS_STRING, 0 TSRMLS_CC) == SUCCESS) {
|
if (zend_std_cast_object_tostring(expr, expr_copy, IS_STRING, 0 TSRMLS_CC) == SUCCESS) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -945,10 +945,6 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int zend_std_cast_object(zval *readobj, zval *writeobj, int type, int should_free TSRMLS_DC)
|
|
||||||
{
|
|
||||||
return FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
ZEND_API zend_object_handlers std_object_handlers = {
|
ZEND_API zend_object_handlers std_object_handlers = {
|
||||||
zend_objects_store_add_ref, /* add_ref */
|
zend_objects_store_add_ref, /* add_ref */
|
||||||
|
@ -973,7 +969,7 @@ ZEND_API zend_object_handlers std_object_handlers = {
|
||||||
zend_std_object_get_class, /* get_class_entry */
|
zend_std_object_get_class, /* get_class_entry */
|
||||||
zend_std_object_get_class_name, /* get_class_name */
|
zend_std_object_get_class_name, /* get_class_name */
|
||||||
zend_std_compare_objects, /* compare_objects */
|
zend_std_compare_objects, /* compare_objects */
|
||||||
zend_std_cast_object, /* cast_object */
|
NULL, /* cast_object */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -129,7 +129,6 @@ ZEND_API union _zend_function *zend_std_get_static_method(zend_class_entry *ce,
|
||||||
ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, char *property_name, int property_name_len, zend_bool silent TSRMLS_DC);
|
ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, char *property_name, int property_name_len, zend_bool silent TSRMLS_DC);
|
||||||
ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, char *property_name, int property_name_len TSRMLS_DC);
|
ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, char *property_name, int property_name_len TSRMLS_DC);
|
||||||
|
|
||||||
int zend_std_cast_object(zval *readobj, zval *writeobj, int type, int should_free TSRMLS_DC);
|
|
||||||
ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int type, int should_free TSRMLS_DC);
|
ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int type, int should_free TSRMLS_DC);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -203,7 +203,9 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC)
|
||||||
(holder).value.lval = (zend_hash_num_elements((op)->value.ht)?1:0); \
|
(holder).value.lval = (zend_hash_num_elements((op)->value.ht)?1:0); \
|
||||||
break; \
|
break; \
|
||||||
case IS_OBJECT: \
|
case IS_OBJECT: \
|
||||||
(holder).value.lval = 1; /* TBI!! */ \
|
(holder) = (*(op)); \
|
||||||
|
zval_copy_ctor(&(holder)); \
|
||||||
|
convert_to_long(&(holder)); \
|
||||||
break; \
|
break; \
|
||||||
case IS_BOOL: \
|
case IS_BOOL: \
|
||||||
case IS_RESOURCE: \
|
case IS_RESOURCE: \
|
||||||
|
@ -246,7 +248,9 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC)
|
||||||
(holder).value.lval = (zend_hash_num_elements((op)->value.ht)?1:0); \
|
(holder).value.lval = (zend_hash_num_elements((op)->value.ht)?1:0); \
|
||||||
break; \
|
break; \
|
||||||
case IS_OBJECT: \
|
case IS_OBJECT: \
|
||||||
(holder).value.lval = 1; /* TBI!! */ \
|
(holder) = (*(op)); \
|
||||||
|
zval_copy_ctor(&(holder)); \
|
||||||
|
convert_to_boolean(&(holder)); \
|
||||||
break; \
|
break; \
|
||||||
default: \
|
default: \
|
||||||
(holder).value.lval = 0; \
|
(holder).value.lval = 0; \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue