php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1143 Name mismatch functions<->variables in classes
Submitted: 1999-02-11 10:55 UTC Modified: 1999-02-21 15:38 UTC
From: aulbach at unter dot franken dot de Assigned:
Status: Closed Package: Parser error
PHP Version: 3.0.5 OS: linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: aulbach at unter dot franken dot de
New email:
PHP Version: OS:

 

 [1999-02-11 10:55 UTC] aulbach at unter dot franken dot de
I don?t know, if this bug was reported before, I didn?t see it in the 3.0.6 ChangeLog.

This is the example script.

<?

class test {
    var $htmlhead = ARRAY(
        'title' => '<TITLE>%s</TITLE>\n',
        'stylesheet' => ''
    );

    function htmlhead() {
        echo $this->htmlhead['title'];
    }
}

$newtest = new test;

echo $newtest->htmlhead();
echo "<BR>";


?>

The result is:

Warning: Variable $htmlhead is not an array or string in /www/wer-ist-wer.com/pages/aPage/test.html on line 10


If I change e.g. $htmlhead to $htmlhd it works.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-02-21 15:38 UTC] jim
You can't have two class members of the same name,
even if one is a function and the other a variable.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 22:01:28 2024 UTC