php-src/Zend/tests/026.phpt
Scott MacVicar 6144da7e35 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);
2010-12-31 16:57:45 +00:00

26 lines
376 B
PHP

--TEST--
Trying assign value to property when an object is not returned in a function
--FILE--
<?php
class foo {
public function a() {
}
}
$test = new foo;
$test->a()->a;
print "ok\n";
$test->a()->a = 1;
print "ok\n";
?>
--EXPECTF--
Notice: Trying to get property of non-object in %s on line %d
ok
Warning: Creating default object from empty value in %s on line %d
ok