|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27044 $this->$Variable[] crashes PHP, no output
Submitted: 2004-01-26 05:38 UTC Modified: 2004-01-29 21:12 UTC
From: siggi at junesystems dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 4.3.4 OS: RedHat 9, Linux 2.4.20-27.9smp
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: siggi at junesystems dot com
New email:
PHP Version: OS:


 [2004-01-26 05:38 UTC] siggi at junesystems dot com
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">
<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-26 20:03 UTC]
# php t.php 
PHP Fatal error:  Cannot use [] for reading in /home/jani/t.php on line 6
 [2004-01-27 03:07 UTC] siggi at junesystems dot com
Very stupid mistake. E_COMPILE_ERROR was not defined in the php.ini and so the message was not displayed.
 [2004-01-29 21:12 UTC]
Still not a bug. Leave as bogus.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Feb 26 02:01:28 2024 UTC