Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 363605

Summary: Variable call of static class function using colons
Product: z_Archived Reporter: Jos <yvhjhs>
Component: PDTAssignee: PHP UI <php.ui-inbox>
Status: CLOSED WORKSFORME QA Contact:
Severity: enhancement    
Priority: P3 CC: silviya, zhaozhongwei
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Jos CLA 2011-11-11 12:52:06 EST
Build Identifier: 20090920-1017

I was developing a function to execute static functions for any class and function that I give it; so I instantiate the parameters (obviously) in variables; I didn't like to use call_user_func, then I decided to try with:

/*
* As example
*/

class my_class{
      public static function my_function(){
         echo "Hello world!!!";
         return true;
      }
}
$class='my_class';
$function='my_function';

$result=$class::$function();

/*
 * Displays "Hello world!!!" and returns true.
 */
The PDT Editor marks it as syntax's error, but executing the code, the run was Ok. And for reasons of my workplace I can't to upload any code that the editor marks with any error. I expect you can give me a solution to include it to my local syntax checker, and at future to include it in the next versions.

Sincerly, Jos.
Thank you.

Reproducible: Always

Steps to Reproduce:
1. Create a class with a static function
2. Assign the classname and the static function name to variables 
3. Use the syntax $my_class::$my_function
Comment 1 Zhongwei Zhao CLA 2013-01-30 02:27:10 EST
Set php version to 5.3 or later,you will not see the error.
Comment 2 Sylvia Tancheva CLA 2015-02-17 09:10:16 EST
I confirm that the error shows for PHP5.1/5.2. Setting up for higher removes the error. Closing the issue.