|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-07-21 14:54 UTC] nikic@php.net
-Status: Open
+Status: Not a bug
[2013-07-21 14:54 UTC] nikic@php.net
[2013-07-21 15:03 UTC] ryan at skidmore dot pro
[2013-07-21 15:05 UTC] nikic@php.net
[2013-07-21 15:07 UTC] ryan at skidmore dot pro
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 21:00:01 2025 UTC |
Description: ------------ When capitalising the first letter of the $this keyword to $This and then assigning it to a variable (with appropiate class structures) like this: "$Variable = $This->Class1->Function1();" causes PHP to throw an error and not display the page, when $This is changed to $this, it works fine. Test script: --------------- This test script is fit into two parts, for two separate files. ** UNCOMMENT THE LINES TO REPRODUCE PROBLEM ** FILE 1 ** (The file to be run) Class Class1 { Public $Class2Inst; Public function __construct() { include("phpbug2.php"); // ******* Change this to the path of the other file. $this->Class2Inst = new Class2; //$Variable1 = $This->Class2Inst->Func1(); // This produces error //$Variable2 = $this->Class2Inst->Func1(); // This does not produce error echo $Variable2; } } $Class1Inst = new Class1; ** FILE 2 ** The file that gets included Class Class2 { Public function Func1() { return "Function 1 is being run"; } } Expected result: ---------------- The expected result is that Func1 within the Class2 class is run. Actual result: -------------- The $This keyword is treated like a variable, instead of like a keyword.