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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Wed Apr 24 04:01:30 2024 UTC