- Support Cast operator in convert_to_* so that we support internal

- extensions such as SimpleXML. This is for Sterling.
This commit is contained in:
Andi Gutmans 2004-03-14 13:52:36 +00:00
parent 4f897b2f3c
commit 88de69b97c
4 changed files with 9 additions and 9 deletions

View file

@ -216,7 +216,8 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop
case IS_OBJECT:
if (expr->value.obj.handlers->cast_object) {
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) {
break;
}

View file

@ -945,10 +945,6 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty
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_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_name, /* get_class_name */
zend_std_compare_objects, /* compare_objects */
zend_std_cast_object, /* cast_object */
NULL, /* cast_object */
};
/*

View file

@ -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 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);

View file

@ -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); \
break; \
case IS_OBJECT: \
(holder).value.lval = 1; /* TBI!! */ \
(holder) = (*(op)); \
zval_copy_ctor(&(holder)); \
convert_to_long(&(holder)); \
break; \
case IS_BOOL: \
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); \
break; \
case IS_OBJECT: \
(holder).value.lval = 1; /* TBI!! */ \
(holder) = (*(op)); \
zval_copy_ctor(&(holder)); \
convert_to_boolean(&(holder)); \
break; \
default: \
(holder).value.lval = 0; \