/* {{{ sxe_object_cast()
*/
static int
-sxe_object_cast(zval *readobj, zval *writeobj, int type, int should_free TSRMLS_DC)
+sxe_object_cast(zval *readobj, zval *writeobj, int type TSRMLS_DC)
{
php_sxe_object *sxe;
char *contents = NULL;
xmlNodePtr node;
- zval free_obj;
int rv;
sxe = php_sxe_fetch_object(readobj TSRMLS_CC);
- if (should_free) {
- free_obj = *writeobj;
- }
-
if (sxe->iter.type != SXE_ITER_NONE) {
node = php_sxe_get_first_node(sxe, NULL TSRMLS_CC);
if (node) {
if (contents) {
xmlFree(contents);
}
- if (should_free) {
- zval_dtor(&free_obj);
- }
return rv;
}
/* }}} */
/* }}} */
/* {{{ spl_ce_dir_cast */
-static int spl_ce_dir_cast(zval *readobj, zval *writeobj, int type, int should_free TSRMLS_DC)
+static int spl_ce_dir_cast(zval *readobj, zval *writeobj, int type TSRMLS_DC)
{
- zval free_obj;
spl_ce_dir_object *dir_object = (spl_ce_dir_object*)zend_object_store_get_object(readobj TSRMLS_CC);
if (type ==IS_STRING && *dir_object->entry.d_name) {
- if (should_free) {
- free_obj = *writeobj;
- }
ZVAL_STRING(writeobj, dir_object->entry.d_name, 1);
- if (should_free) {
- zval_dtor(&free_obj);
- }
return SUCCESS;
}
return FAILURE;
zval_ptr_dtor(&retval);
}
if (intern->u.caching.flags & CIT_CALL_TOSTRING) {
- if (Z_TYPE_P(intern->current.data) == IS_OBJECT) {
- zval expr_copy;
- if (intern->current.data->value.obj.handlers->cast_object &&
- intern->current.data->value.obj.handlers->cast_object(intern->current.data, &expr_copy, IS_STRING, 0 TSRMLS_CC) == SUCCESS)
- {
- ALLOC_ZVAL(intern->u.caching.zstr);
- *intern->u.caching.zstr = expr_copy;
- INIT_PZVAL(intern->u.caching.zstr);
- zval_copy_ctor(intern->u.caching.zstr);
- zval_dtor(&expr_copy);
- } else {
- zend_class_entry *ce_data = spl_get_class_entry(intern->current.data TSRMLS_CC);
- if (ce_data && zend_hash_exists(&ce_data->function_table, "__tostring", sizeof("__tostring"))) {
- zend_call_method_with_0_params(&intern->current.data, ce_data, NULL, "__tostring", &intern->u.caching.zstr);
- } else {
- ALLOC_ZVAL(intern->u.caching.zstr);
- *intern->u.caching.zstr = *intern->current.data;
- zval_copy_ctor(intern->u.caching.zstr);
- INIT_PZVAL(intern->u.caching.zstr);
- convert_to_string(intern->u.caching.zstr);
- }
- }
+ int use_copy;
+ zval expr_copy;
+ ALLOC_ZVAL(intern->u.caching.zstr);
+ *intern->u.caching.zstr = *intern->current.data;
+ zend_make_printable_zval(intern->u.caching.zstr, &expr_copy, &use_copy);
+ if (use_copy) {
+ *intern->u.caching.zstr = expr_copy;
+ INIT_PZVAL(intern->u.caching.zstr);
+ zval_copy_ctor(intern->u.caching.zstr);
+ zval_dtor(&expr_copy);
} else {
- /* This version requires zend_make_printable_zval() being able to
- * call __toString().
- */
- int use_copy;
- zval expr_copy;
- ALLOC_ZVAL(intern->u.caching.zstr);
- *intern->u.caching.zstr = *intern->current.data;
- zend_make_printable_zval(intern->u.caching.zstr, &expr_copy, &use_copy);
- if (use_copy) {
- *intern->u.caching.zstr = expr_copy;
- INIT_PZVAL(intern->u.caching.zstr);
- zval_copy_ctor(intern->u.caching.zstr);
- zval_dtor(&expr_copy);
- } else {
- INIT_PZVAL(intern->u.caching.zstr);
- zval_copy_ctor(intern->u.caching.zstr);
- }
+ INIT_PZVAL(intern->u.caching.zstr);
+ zval_copy_ctor(intern->u.caching.zstr);
}
}
spl_dual_it_next(intern, 0 TSRMLS_CC);
static zend_class_entry *tidy_get_ce_node(zval * TSRMLS_DC);
static zend_class_entry *tidy_get_ce_doc(zval * TSRMLS_DC);
static zval * tidy_instanciate(zend_class_entry *, zval * TSRMLS_DC);
-static int tidy_doc_cast_handler(zval *, zval *, int, int TSRMLS_DC);
-static int tidy_node_cast_handler(zval *, zval *, int, int TSRMLS_DC);
+static int tidy_doc_cast_handler(zval *, zval *, int TSRMLS_DC);
+static int tidy_node_cast_handler(zval *, zval *, int TSRMLS_DC);
static void tidy_doc_update_properties(PHPTidyObj * TSRMLS_DC);
static void tidy_add_default_properties(PHPTidyObj *, tidy_obj_type TSRMLS_DC);
static void *php_tidy_get_opt_val(PHPTidyDoc *, TidyOption, TidyOptionType * TSRMLS_DC);
return object;
}
-static int tidy_doc_cast_handler(zval *in, zval *out, int type, int free TSRMLS_DC)
+static int tidy_doc_cast_handler(zval *in, zval *out, int type TSRMLS_DC)
{
TidyBuffer output = {0};
PHPTidyObj *obj;
return SUCCESS;
}
-static int tidy_node_cast_handler(zval *in, zval *out, int type, int free TSRMLS_DC)
+static int tidy_node_cast_handler(zval *in, zval *out, int type TSRMLS_DC)
{
TidyBuffer buf = {0};
PHPTidyObj *obj;