| Summary: | Calling a static variable using a variable variable to reference a class causes an error to appear in the problems tray. | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | shadowadler |
| Component: | PDT | Assignee: | PHP Debug <php.debug-inbox> |
| Status: | CLOSED WORKSFORME | QA Contact: | Ilina Stefanova <ilina.s> |
| Severity: | normal | ||
| Priority: | P3 | CC: | euthanasia_waltz, ganoro, kalin.a, pligor |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
This had been solved on Helios(eclipse 3.6.0, pdt 2.2.0) long ago. closing per Toshihiro Izumi comment. Toshihiro - can I contact you by email somehow? NO it is not resolved as it is mentioned in here I just download Eclipse SDK for PHP developers and I have the same situation. Let's say you have declared a class named Employer then this code: $myclass = "Employer"; $myclass::GoThere(); will produce an error inside the editor. Although if you execute it using php no warning or error occurs because it is correct. Could you please fix it as soon as possible? Or provide a workaround if that is possible... Thank you! George Pligor Hi George, I cannot reproduce your problem. Do you mean "syntax error, unexpected '::'" as "an error inside the editor" ? That error is correct unless you set "PHP 5.3" as PHP Version(Preferences>PHP>PHP Interpreter, or project properties). Could you make sure PHP Version? Ok! Yes this fixed it.. I wouldn't guess that eclipse would implement multiple interpreters since php is easily upgradable and everyone uses the latest version. I guess there could be some rare occasions where an old php version is required (such as facebook engineering puzzles) Thank you! you saved the day (: No longer reproducible. Closing... |
Build Identifier: M20100211-1343 When a variable variable is used to describe a class name in order to call a static method, the validator picks this out as an error (because, I think, it understands that I am trying to call a static method from a variable, which is wrong, but not actually what I am doing). The code works when run, and triggers no errors from php 5.3. Reproducible: Always Steps to Reproduce: Code to reproduce error: class myClass { static $greeting = "hello\n"; public function greet() { $thisClass = __CLASS__; return $thisClass::$greeting;//error will 'occur' here. } } class myChild extends myClass { public function greet() { $thisClass = __CLASS__; return $thisClass::$greeting;//error will 'occur' here. } } //should print_> hello hello when summoned as webpage. $me = new myClass; $child = new myChild; echo $me->greet(); echo $child->greet();