From: Felipe Pena Date: Thu, 28 Feb 2008 19:33:40 +0000 (+0000) Subject: Add "Strict error" when assigning value to property of inexistent object X-Git-Tag: RELEASE_2_0_0a1~290 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ff8e13dd86f2fde6047c2063432d8a916dcd7dff;p=php Add "Strict error" when assigning value to property of inexistent object --- diff --git a/Zend/tests/objects_016.phpt b/Zend/tests/objects_016.phpt new file mode 100644 index 0000000000..a7085c415a --- /dev/null +++ b/Zend/tests/objects_016.phpt @@ -0,0 +1,28 @@ +--TEST-- +Strict error when assigning value to property of inexistent object +--FILE-- +p = 1; +echo "\nAbout to create a default object from empty value again:\n"; +$obj2->p[] = 1; +echo "\nAbout to create a default object from empty value one more time:\n"; +$a = 1; +$obj3->p = &$a; + +?> +--EXPECTF-- +About to create a default object from empty value: + +Strict Standards: Creating default object from empty value in %s on line %d + +About to create a default object from empty value again: + +Strict Standards: Creating default object from empty value in %s on line %d + +About to create a default object from empty value one more time: + +Strict Standards: Creating default object from empty value in %s on line %d diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 3b09f6cb0e..5115c7b9fe 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1291,6 +1291,7 @@ static void zend_fetch_property_address(temp_variable *result, zval **container_ SEPARATE_ZVAL(container_ptr); container = *container_ptr; } + zend_error(E_STRICT, "Creating default object from empty value"); object_init(container); } else { result->var.ptr_ptr = &EG(error_zval_ptr);