Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 363605 - Variable call of static class function using colons
Summary: Variable call of static class function using colons
Status: CLOSED WORKSFORME
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 enhancement with 3 votes (vote)
Target Milestone: ---   Edit
Assignee: PHP UI CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-11 12:52 EST by Jos CLA
Modified: 2020-05-14 11:32 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.