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
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: 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: Fri Dec 27 14:01:29 2024 UTC