Bug 244076

Summary: Static calling of a method of a class represented by a string is considered a syntax error
Product: [Applications] kdevelop Reporter: Jan Buchar <Teyras>
Component: Language Support: PHPAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: normal CC: andrew.crouthamel, pprkut
Priority: NOR    
Version First Reported In: git master   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Jan Buchar 2010-07-09 21:50:38 UTC
Version:           SVN (using KDE 4.4.4) 
OS:                Linux

A class should be accessible through a variable which contains its name as a string. However, calling its method through such a variable results in the parser reporting a syntax error.

An example:
<?php
class A {
	public static function foo () {
		return "bar";
	}
}
$cls = 'A';
$bar = $cls::foo(); // assigns "bar" to $bar - syntax error on "::"
?>

Reproducible: Always
Comment 1 Andrew Crouthamel 2018-11-11 04:31:33 UTC
Dear Bug Submitter,

This bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version? I am setting the status to NEEDSINFO pending your response, please change the Status back to REPORTED when you respond.

Thank you for helping us make KDE software even better for everyone!
Comment 2 Jan Buchar 2018-11-11 11:19:04 UTC
I do not use KDevelop or PHP anymore, but the steps for reproduction seem simple enough for anyone to follow. Thanks for returning to this old issue!
Comment 3 Andrew Crouthamel 2018-11-12 03:08:52 UTC
Thanks for the update!
Comment 4 Heinz Wiesinger 2019-03-20 20:00:12 UTC
This no longer causes a syntax error for me on kdev-php 5.3