php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67773 Scope-Resolution Operator
Submitted: 2014-08-05 16:56 UTC Modified: 2015-06-28 21:37 UTC
From: joelm@php.net Assigned: stas (profile)
Status: Closed Package: PHP Language Specification
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2014-08-05 16:56 UTC] joelm@php.net
Description:
------------
https://github.com/php/php-langspec/blob/master/spec/10-expressions.md#scope-resolution-operator

This section makes it sound like class constants and methods and static properties all live in the same namespace (which is wrong, they have distinct namespaces and you can have a method and a class constant with the same name). Also, nothing in this section, other sections, or the syntax rules give enough information allow the reader to distinguish between a ::-style method call expression, a constant access, and a static property access. This is key to describing how a parsed expression involving the :: operator is interpreted by the engine. For example does "C::$x" access a static property of class C named 'x', or does it access a class constant whose name is held in local variable $x? Does "C::$x()" call a method on class C whose name is held in local variable $x, or does it call a callback stored in static property of class C named 'x'? Finally, this section doesn't describe how ::-style method lookup or static property lookup or class constant lookup. For example if there is are multiple static properties named 'x' (possibly with different public/protected/private modifiers), how do we decide which one gets accessed. Same goes for methods. 


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-28 21:24 UTC] stas@php.net
I'm sorry but I don't see where the language implies properties and methods live in the same namespace (the language may have changed since the report, so maybe it's fixed already). I'll add the language making it more clear when :: is used for constants, properties and methods.
 [2015-06-28 21:37 UTC] stas@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: stas
 [2015-06-28 21:37 UTC] stas@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Oct 13 02:01:27 2024 UTC