php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: siggi at junesystems dot com
New email:
PHP Version: OS:

 

 [2004-01-26 05:38 UTC] 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>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-26 20:03 UTC] sniper@php.net
# 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] magnus@php.net
Still not a bug. Leave as bogus.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC