ID: 44313 Updated by: [EMAIL PROTECTED] Reported By: johann dot queuniet at gmail dot com -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: * PHP Version: 5.2.5 New Comment:
AS Felipe said, it's for BC and you do get warning with E_STRICT. Previous Comments: ------------------------------------------------------------------------ [2008-03-02 21:33:08] [EMAIL PROTECTED] Using E_STRICT, "Strict Standards: Creating default object from empty value" are showed for other cases. ------------------------------------------------------------------------ [2008-03-02 18:19:19] johann dot queuniet at gmail dot com Description: ------------ The way PHP handles property assignation on scalar variables evaluating as false is inconsistent. Reproduce code: --------------- <?php $var1->test = true; $var2 = null; $var2->test = true; $var3 = false; $var3->test = true; $var3 = ''; $var3->test = true; $var4 = 0; $var4->test = true; $var5 = '0'; $var5->test = true; $var6 = array(); $var6->test = true; ?> Expected result: ---------------- PHP should handle every case the same way, with a "Warning: Attempt to assign property of non-object". The first line should also trigger a notice since the $var1 variable is undeclared. Actual result: -------------- PHP behaves as with arrays and only triggers a warning for the last three. The other lines create an stdClass object with the test property set. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=44313&edit=1