php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9164 wrong variable is initialized
Submitted: 2001-02-07 16:21 UTC Modified: 2001-02-07 16:27 UTC
From: di99otmi at hd dot chalmers dot se Assigned: waldschrott (profile)
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.0.3pl1 OS: slackware 7.1
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: di99otmi at hd dot chalmers dot se
New email:
PHP Version: OS:

 

 [2001-02-07 16:21 UTC] di99otmi at hd dot chalmers dot se
function Bjbase($antal){  
    $this->$lekar=$antal;
    $this->$dragna=array();
    $this->$ess=58;
    echo $this->$dragna;
  }

this is a constructor

the echo statement prints 58 even though that it is $ess that is initialized to 58.
The variable $dragna is not treated as an array anywhere but when the $ess line is gone it works fine.
tried at another server too.
is this a problem you know of?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-07 16:26 UTC] jmoore@php.net
Your code is incorrect, try this:

function Bjbase($antal){  
    $this->lekar=$antal;
    $this->dragna=array();
    $this->ess=58;
    echo $this->dragna;
  }

 [2001-02-07 16:27 UTC] waldschrott@php.net
please read the manual on how to use class members
hint: the second $ sign is _not_ needed
$this->variable='foo';

 [2011-08-07 05:20 UTC] gwynne@php.net
Automatic comment from SVN on behalf of gwynne
Revision: http://svn.php.net/viewvc/?view=revision&revision=314400
Log: Fix build under Clang 2.9 - see LLVM bug #9164 (http://llvm.org/bugs/show_bug.cgi?id=9164). Tested with GCC and Clang on Darwin and Ubuntu.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC