From: robin_fernandes at uk dot ibm dot com Operating system: Windows PHP version: 5.3CVS-2008-04-07 (snap) PHP Bug Type: Scripting Engine problem Bug description: Indexed and reference assignment to propery of non-object don't trigger warning
Description: ------------ Attempting to read or write to a property of a (non-empty) non-object usually results in a notice or a warning. However, no warning or notice is raised when performing an indexed or reference assignment. Consequently, the assignment fails silently. Confirmed on 5_2, 5_3 and HEAD snaps. Reproduce code: --------------- <?php $s = "hello"; $a = true; echo "--> read access: "; echo $a->p; echo "\n--> direct assignment: "; $a->p = $s; echo "\n--> increment: "; $a->p++; echo "\n--> reference assignment:"; $a->p =& $s; echo "\n--> indexed assignment:"; $a->p[0] = $s; echo "\n\n\n--> Confirm assignments have had no impact:"; var_dump($a, $a->p); ?> Expected result: ---------------- --> read access: Notice: Trying to get property of non-object in %s on line 6 --> direct assignment: Warning: Attempt to assign property of non-object in %s on line 9 --> increment: Warning: Attempt to increment/decrement property of non-object in %s on line 12 --> reference assignment: --> indexed assignment: --> Confirm assignments have had no impact: Notice: Trying to get property of non-object in %s on line 21 bool(true) NULL Actual result: -------------- --> read access: Notice: Trying to get property of non-object in %s on line 6 --> direct assignment: Warning: Attempt to assign property of non-object in %s on line 9 --> increment: Warning: Attempt to increment/decrement property of non-object in %s on line 12 --> reference assignment: Warning: Attempt to assign property of non-object in %s on line 15 --> indexed assignment: Warning: Attempt to assign property of non-object in %s on line 18 --> Confirm assignments have had no impact: Notice: Trying to get property of non-object in %s on line 21 bool(true) NULL -- Edit bug report at http://bugs.php.net/?id=44660&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44660&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44660&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44660&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=44660&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=44660&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=44660&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=44660&r=needscript Try newer version: http://bugs.php.net/fix.php?id=44660&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=44660&r=support Expected behavior: http://bugs.php.net/fix.php?id=44660&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=44660&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=44660&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=44660&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44660&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=44660&r=dst IIS Stability: http://bugs.php.net/fix.php?id=44660&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=44660&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=44660&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=44660&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=44660&r=mysqlcfg