ID: 27044 Updated by: [EMAIL PROTECTED] Reported By: siggi at junesystems dot com -Status: Open +Status: Bogus Bug Type: Class/Object related Operating System: RedHat 9, Linux 2.4.20-27.9smp PHP Version: 4.3.4 New Comment:
# php t.php PHP Fatal error: Cannot use [] for reading in /home/jani/t.php on line 6 Previous Comments: ------------------------------------------------------------------------ [2004-01-26 05:38:39] siggi at junesystems dot com Description: ------------ When creating a class that contains a class variable array being filled (in this case in the wrong way) like: $this->$Variable[] = "whatever"; (!! notice second $ ) PHP produces no output and no error message ($Variable is empty BTW, does not exist). In a script with a couple of hundred of lines of code it is a nightmare trying to locate a typo like this with no help from PHP. Reproduce code: --------------- class Test { var $Variable = Array(); function Test(){ $this->$Variable[] = "Test string"; } } $object = new Test(); Expected result: ---------------- Error message. Actual result: -------------- No output (this comes from PHP): <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD> <BODY></BODY></HTML> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27044&edit=1