1
0
mirror of https://github.com/php/php-src.git synced 2026-04-27 18:23:26 +02:00

Add "Strict error" when assigning value to property of inexistent object

This commit is contained in:
Felipe Pena
2008-02-28 19:33:40 +00:00
parent c82d6062ac
commit ff8e13dd86
2 changed files with 29 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
--TEST--
Strict error when assigning value to property of inexistent object
--FILE--
<?php
error_reporting(E_ALL);
echo "\nAbout to create a default object from empty value:\n";
$obj1->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
+1
View File
@@ -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);