GitHub

@@ -197,7 +197,7 @@ static int zend_std_call_setter(zval *object, zval *member, zval *value TSRMLS_D

197197

}

198198

/* }}} */

199199200-

static void zend_std_call_unsetter(zval *object, zval *member TSRMLS_DC) /* {{{ */

200+

static int zend_std_call_unsetter(zval *object, zval *member TSRMLS_DC) /* {{{ */

201201

{

202202

zend_class_entry *ce = Z_OBJCE_P(object);

203203

@@ -207,9 +207,12 @@ static void zend_std_call_unsetter(zval *object, zval *member TSRMLS_DC) /* {{{

207207208208

SEPARATE_ARG_IF_REF(member);

209209210-

zend_call_method_with_1_params(&object, ce, &ce->__unset, ZEND_UNSET_FUNC_NAME, NULL, member);

210+

zval *ret_zval = zend_call_method_with_1_params(&object, ce, &ce->__unset, ZEND_UNSET_FUNC_NAME, NULL, member);

211211212212

zval_ptr_dtor(&member);

213+214+

convert_to_boolean(ret_zval);

215+

return Z_LVAL_P(ret_zval)?SUCCESS:FAILURE;

213216

}

214217

/* }}} */

215218

@@ -786,11 +789,12 @@ static zval **zend_std_get_property_ptr_ptr(zval *object, zval *member, const ze

786789

}

787790

/* }}} */

788791789-

static void zend_std_unset_property(zval *object, zval *member, const zend_literal *key TSRMLS_DC) /* {{{ */

792+

static int zend_std_unset_property(zval *object, zval *member, const zend_literal *key TSRMLS_DC) /* {{{ */

790793

{

791794

zend_object *zobj;

792795

zval *tmp_member = NULL;

793796

zend_property_info *property_info;

797+

int result = FAILURE;

794798795799

zobj = Z_OBJ_P(object);

796800

@@ -813,9 +817,10 @@ static void zend_std_unset_property(zval *object, zval *member, const zend_liter

813817

EXPECTED(zobj->properties_table[property_info->offset] != NULL)) {

814818

zval_ptr_dtor(&zobj->properties_table[property_info->offset]);

815819

zobj->properties_table[property_info->offset] = NULL;

820+

result = SUCCESS;

816821

} else if (UNEXPECTED(!property_info) ||

817822

!zobj->properties ||

818-

UNEXPECTED(zend_hash_quick_del(zobj->properties, property_info->name, property_info->name_length+1, property_info->h) == FAILURE)) {

823+

UNEXPECTED((result = zend_hash_quick_del(zobj->properties, property_info->name, property_info->name_length+1, property_info->h)) == FAILURE)) {

819824

zend_guard *guard = NULL;

820825821826

if (zobj->ce->__unset &&

@@ -827,7 +832,7 @@ static void zend_std_unset_property(zval *object, zval *member, const zend_liter

827832

SEPARATE_ZVAL(&object);

828833

}

829834

guard->in_unset = 1; /* prevent circular unsetting */

830-

zend_std_call_unsetter(object, member TSRMLS_CC);

835+

result = zend_std_call_unsetter(object, member TSRMLS_CC);

831836

guard->in_unset = 0;

832837

zval_ptr_dtor(&object);

833838

} else if (zobj->ce->__unset && guard && guard->in_unset == 1) {

@@ -838,30 +843,37 @@ static void zend_std_unset_property(zval *object, zval *member, const zend_liter

838843

zend_error(E_ERROR, "Cannot access property started with '\\0'");

839844

}

840845

}

846+

result = FAILURE;

841847

}

842848

} else if (EXPECTED(property_info != NULL) &&

843849

EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&

844850

property_info->offset >= 0) {

845851

zobj->properties_table[property_info->offset] = NULL;

852+

result = SUCCESS;

846853

}

847854848855

if (UNEXPECTED(tmp_member != NULL)) {

849856

zval_ptr_dtor(&tmp_member);

850857

}

858+859+

return result;

851860

}

852861

/* }}} */

853862854-

static void zend_std_unset_dimension(zval *object, zval *offset TSRMLS_DC) /* {{{ */

863+

static int zend_std_unset_dimension(zval *object, zval *offset TSRMLS_DC) /* {{{ */

855864

{

856865

zend_class_entry *ce = Z_OBJCE_P(object);

857866858867

if (instanceof_function_ex(ce, zend_ce_arrayaccess, 1 TSRMLS_CC)) {

859868

SEPARATE_ARG_IF_REF(offset);

860-

zend_call_method_with_1_params(&object, ce, NULL, "offsetunset", NULL, offset);

869+

zval *ret_zval = zend_call_method_with_1_params(&object, ce, NULL, "offsetunset", NULL, offset);

861870

zval_ptr_dtor(&offset);

862-

} else {

863-

zend_error_noreturn(E_ERROR, "Cannot use object of type %s as array", ce->name);

871+

convert_to_boolean(ret_zval);

872+

return Z_LVAL_P(ret_zval)?SUCCESS:FAILURE;

864873

}

874+875+

zend_error_noreturn(E_ERROR, "Cannot use object of type %s as array", ce->name);

876+

return FAILURE;

865877

}

866878

/* }}} */

867879

Read the original on github.com ↗