diff options
author | Scott MacVicar <scottmac@php.net> | 2010-12-31 16:57:45 +0000 |
---|---|---|
committer | Scott MacVicar <scottmac@php.net> | 2010-12-31 16:57:45 +0000 |
commit | 6144da7e351545158db3fad647b818b1027354f7 (patch) | |
tree | fc988d0b79b3385551482b0f0ca071763a4b8114 /Zend | |
parent | c9c0de49a8f56b940a4d2142408f19f1f1821f7d (diff) | |
download | php-git-6144da7e351545158db3fad647b818b1027354f7.tar.gz |
Silently casting an empty string, null or false into an object by adding a property
is pretty non-intuitive. If the same value was 1 or true you get a warning and it halts.
Since we can't break BC completely (yet) lets bump this from E_STRICT.
Also added a new section to UPGRADING for engine changes.
<?php
$x = '';
// $x = null;
// $x = false;
$x->baz = 1;
var_dump($x);
$y = 1;
$y->baz = 1;
var_dump($y);
Diffstat (limited to 'Zend')
-rw-r--r-- | Zend/tests/026.phpt | 2 | ||||
-rw-r--r-- | Zend/tests/033.phpt | 4 | ||||
-rw-r--r-- | Zend/tests/bug52041.phpt | 12 | ||||
-rw-r--r-- | Zend/tests/bug52614.phpt | 2 | ||||
-rw-r--r-- | Zend/zend_execute.c | 4 |
5 files changed, 12 insertions, 12 deletions
diff --git a/Zend/tests/026.phpt b/Zend/tests/026.phpt index 784b12c69b..5fa0e1677c 100644 --- a/Zend/tests/026.phpt +++ b/Zend/tests/026.phpt @@ -21,5 +21,5 @@ print "ok\n"; Notice: Trying to get property of non-object in %s on line %d ok -Strict Standards: Creating default object from empty value in %s on line %d +Warning: Creating default object from empty value in %s on line %d ok diff --git a/Zend/tests/033.phpt b/Zend/tests/033.phpt index c8651159a6..17319e0d61 100644 --- a/Zend/tests/033.phpt +++ b/Zend/tests/033.phpt @@ -26,6 +26,6 @@ Notice: Undefined variable: arr in %s on line %d Notice: Trying to get property of non-object in %s on line %d -Strict Standards: Creating default object from empty value in %s on line %d +Warning: Creating default object from empty value in %s on line %d -Strict Standards: Creating default object from empty value in %s on line %d +Warning: Creating default object from empty value in %s on line %d diff --git a/Zend/tests/bug52041.phpt b/Zend/tests/bug52041.phpt index f2eb8d3ed8..944baf4edd 100644 --- a/Zend/tests/bug52041.phpt +++ b/Zend/tests/bug52041.phpt @@ -25,27 +25,27 @@ var_dump(foo()); --EXPECTF-- Notice: Undefined variable: x in %sbug52041.php on line 3 -Strict Standards: Creating default object from empty value in %sbug52041.php on line 6 +Warning: Creating default object from empty value in %sbug52041.php on line 6 Notice: Undefined variable: x in %sbug52041.php on line 3 -Strict Standards: Creating default object from empty value in %sbug52041.php on line 7 +Warning: Creating default object from empty value in %sbug52041.php on line 7 Notice: Undefined variable: x in %sbug52041.php on line 3 -Strict Standards: Creating default object from empty value in %sbug52041.php on line 8 +Warning: Creating default object from empty value in %sbug52041.php on line 8 Notice: Undefined variable: x in %sbug52041.php on line 3 -Strict Standards: Creating default object from empty value in %sbug52041.php on line 9 +Warning: Creating default object from empty value in %sbug52041.php on line 9 Notice: Undefined variable: x in %sbug52041.php on line 3 -Strict Standards: Creating default object from empty value in %sbug52041.php on line 10 +Warning: Creating default object from empty value in %sbug52041.php on line 10 Notice: Undefined variable: x in %sbug52041.php on line 3 -Strict Standards: Creating default object from empty value in %sbug52041.php on line 11 +Warning: Creating default object from empty value in %sbug52041.php on line 11 Notice: Undefined variable: x in %sbug52041.php on line 3 diff --git a/Zend/tests/bug52614.phpt b/Zend/tests/bug52614.phpt index 38a210b9a9..d220881679 100644 --- a/Zend/tests/bug52614.phpt +++ b/Zend/tests/bug52614.phpt @@ -72,7 +72,7 @@ array(0) { array(0) { } -Strict Standards: Creating default object from empty value in %sbug52614.php on line 52 +Warning: Creating default object from empty value in %sbug52614.php on line 52 NULL object(stdClass)#%d (1) { ["a"]=> diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 258a4ccd00..340ab29712 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -554,7 +554,7 @@ static inline void make_real_object(zval **object_ptr TSRMLS_DC) || (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) ) { - zend_error(E_STRICT, "Creating default object from empty value"); + zend_error(E_WARNING, "Creating default object from empty value"); SEPARATE_ZVAL_IF_NOT_REF(object_ptr); zval_dtor(*object_ptr); @@ -660,7 +660,7 @@ static inline void zend_assign_to_object(zval **retval, zval **object_ptr, zval zval_dtor(*object_ptr); object_init(*object_ptr); object = *object_ptr; - zend_error(E_STRICT, "Creating default object from empty value"); + zend_error(E_WARNING, "Creating default object from empty value"); } else { zend_error(E_WARNING, "Attempt to assign property of non-object"); if (retval) { |