From: ryan at skidmore dot pro Operating system: Linux/Ubuntu PHP version: 5.4.17 Package: Class/Object related Bug Type: Bug Bug description:$this keyword is treated like a variable under certain circumstances
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. -- Edit bug report at https://bugs.php.net/bug.php?id=65305&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=65305&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=65305&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=65305&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=65305&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=65305&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=65305&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=65305&r=needscript Try newer version: https://bugs.php.net/fix.php?id=65305&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=65305&r=support Expected behavior: https://bugs.php.net/fix.php?id=65305&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=65305&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=65305&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=65305&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65305&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=65305&r=dst IIS Stability: https://bugs.php.net/fix.php?id=65305&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=65305&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=65305&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=65305&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=65305&r=mysqlcfg