php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68467 T_DOUBLE_COLON and T_PAAMAYIM_NEKUDOTAYIM used inconsistently
Submitted: 2014-11-20 20:50 UTC Modified: 2014-12-30 16:37 UTC
Votes:4
Avg. Score:4.0 ± 1.7
Reproduced:3 of 4 (75.0%)
Same Version:2 (66.7%)
Same OS:3 (100.0%)
From: fredemmott@php.net Assigned: nikic (profile)
Status: Wont fix Package: Scripting Engine problem
PHP Version: 5.6.3 OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2014-11-20 20:50 UTC] fredemmott@php.net
Description:
------------
token_name() reports T_DOUBLE_COLON

Error messages report T_PAAMAYIM_NEKUDOTAYIM

Test script:
---------------
token_name() (http://3v4l.org/RjmUW):

<?php

foreach(token_get_all("<?php echo SplFileObject::SKIP_EMPTY;")[4] as $key=>$val) {
    echo token_name($val), PHP_EOL;
}

error message (http://3v4l.org/2T8qQ):

<?php

::

Expected result:
----------------
The name should be consistent for the same token, regardless of content.

Actual result:
--------------
T_DOUBLE_COLON

Warning: token_name() expects parameter 1 to be long, string given in /in/RjmUW on line 4

UNKNOWN

-----

Parse error: syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM), expecting end of file in /in/2T8qQ on line 3


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-11-20 20:52 UTC] fredemmott@php.net
s/regardless of content/regardless of context/
 [2014-11-21 14:46 UTC] laruence@php.net
-Assigned To: +Assigned To: nikic
 [2014-12-30 16:37 UTC] nikic@php.net
-Status: Assigned +Status: Wont fix
 [2014-12-30 16:37 UTC] nikic@php.net
Past discussions on the topic have shown that the error message is unlikely to be changed. And there's no point changing the token_name() output to a BC-incompatible, less obvious name just for the sake of changing it.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 13:01:28 2024 UTC