Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_execute.c /tests bug48004.phpt
[email protected] (Jani Taskinen) Tue, 21 Apr 2009 11:24:14 +0300
| Newsgroups | php.zend-engine.cvs |
|---|---|
| Message-ID | <[email protected]> |
Dmitry Stogov wrote:
> dmitry Tue Apr 21 08:12:23 2009 UTC
>
> Modified files:
> /ZendEngine2 zend_execute.c
> /ZendEngine2/tests bug48004.phpt
> Log:
> Fixed bug #48004 (Error handler prevents creation of default object)
>
>
> http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute.c?r1=1.811&r2=1.812&diff_format=u
> Index: ZendEngine2/zend_execute.c
> diff -u ZendEngine2/zend_execute.c:1.811 ZendEngine2/zend_execute.c:1.812
> --- ZendEngine2/zend_execute.c:1.811 Thu Mar 26 20:01:38 2009
> +++ ZendEngine2/zend_execute.c Tue Apr 21 08:12:23 2009
> @@ -17,7 +17,7 @@
> +----------------------------------------------------------------------+
> */
>
> -/* $Id: zend_execute.c,v 1.811 2009/03/26 20:01:38 felipe Exp $ */
> +/* $Id: zend_execute.c,v 1.812 2009/04/21 08:12:23 dmitry Exp $ */
>
> #define ZEND_INTENSIVE_DEBUGGING 0
>
> @@ -559,13 +559,13 @@
>
> static inline void zend_assign_to_object(znode *result, zval **object_ptr, zval *property_name, znode *value_op, const temp_variable *Ts, int opcode TSRMLS_DC) /* {{{ */
> {
> - zval *object;
> + zval *object = *object_ptr;
> zend_free_op free_value;
> zval *value = get_zval_ptr(value_op, Ts, &free_value, BP_VAR_R);
> zval **retval = &T(result->u.var).var.ptr;
>
> - if (Z_TYPE_P(*object_ptr) != IS_OBJECT) {
> - if (*object_ptr == EG(error_zval_ptr)) {
> + if (Z_TYPE_P(object) != IS_OBJECT) {
> + if (object == EG(error_zval_ptr)) {
> if (!RETURN_VALUE_UNUSED(result)) {
> *retval = EG(uninitialized_zval_ptr);
> PZVAL_LOCK(*retval);
> @@ -573,14 +573,15 @@
> FREE_OP(free_value);
> return;
> }
> - if (Z_TYPE_PP(object_ptr) == IS_NULL ||
> - (Z_TYPE_PP(object_ptr) == IS_BOOL && Z_LVAL_PP(object_ptr) == 0) ||
> - (Z_TYPE_PP(object_ptr) == IS_STRING && Z_STRLEN_PP(object_ptr) == 0) ||
> - (Z_TYPE_PP(object_ptr) == IS_UNICODE && Z_USTRLEN_PP(object_ptr) == 0)) {
> - zend_error(E_STRICT, "Creating default object from empty value");
> + if (Z_TYPE_P(object) == IS_NULL ||
> + (Z_TYPE_P(object) == IS_BOOL && Z_LVAL_P(object) == 0) ||
> + (Z_TYPE_P(object) == IS_STRING && Z_STRLEN_P(object) == 0) ||
> + (Z_TYPE_P(object) == IS_UNICODE && Z_USTRLEN_P(object) == 0)) {
> SEPARATE_ZVAL_IF_NOT_REF(object_ptr);
> - zval_dtor(*object_ptr);
> - object_init(*object_ptr);
> + zval_dtor(object);
> + object = *object_ptr;
> + object_init(object);
> + zend_error(E_STRICT, "Creating default object from empty value");
> } else {
> zend_error(E_WARNING, "Attempt to assign property of non-object");
> if (!RETURN_VALUE_UNUSED(result)) {
> @@ -593,7 +594,6 @@
> }
>
> /* here we are sure we are dealing with an object */
> - object = *object_ptr;
Would make more sense if you removed that comment too? Now it's kinda
confusing there.. :)
--Jani