ID: 43322 Updated by: [EMAIL PROTECTED] Reported By: felipensp at gmail dot com Status: Open Bug Type: Scripting Engine problem PHP Version: 6CVS-2007-11-18 (snap) New Comment:
There is nothing wrong in $this[] syntax, as it's used in ArrayAccess (see Zend/tests/bug33710.phpt for example), hence we cannot detect this in compile time. But we can't check for $this in runtime, since that would be a major performance hit. So this is clear "Won't fix" in my opinion. Previous Comments: ------------------------------------------------------------------------ [2007-11-18 23:40:04] crrodriguez at suse dot de <?php $this[] = new stdClass; // no error ?> happends as well on 5_3 as is wrong :( maybe dmitry can check this out. ------------------------------------------------------------------------ [2007-11-18 13:15:38] felipensp at gmail dot com Description: ------------ $this[] outside of class not produces error. Reproduce code: --------------- <?php class foo { public function __construct() { $this[] = 1; } } // Fatal error: Cannot re-assign $this // $this = new foo; // Fatal error: Using $this when not in object context // $this->a = new foo; // Fatal error: Cannot use object of type foo as array // new foo; $this[] = new stdClass; // no error Expected result: ---------------- Fatal error: Using $this when not in object context Actual result: -------------- No error ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43322&edit=1