php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55616 Can't make token_get_all return T_CALLABLE
Submitted: 2011-09-06 07:49 UTC Modified: 2011-09-16 17:30 UTC
From: nicolas dot grekas+php at gmail dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5.4.0alpha3 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
34 - 10 = ?
Subscribe to this entry?

 
 [2011-09-06 07:49 UTC] nicolas dot grekas+php at gmail dot com
Description:
------------
Reading the code for next PHP5.4, I saw four new tokens, amongs them is T_CALLABLE.
I thought this would tag any "callable" keyword in the source.
But using token_get_all(), I can't get a T_CALLABLE token. See test script.

Btw, UPGRADING doesn't mention these four new tokens (T_TRAIT, T_TRAIT_C, T_CALLABLE, T_INSTEADOF)

Test script:
---------------
<?php

$a = '<?php function(callable $a){};';

foreach (token_get_all($a) as $a)
{
	if (isset($a[1])) echo token_name($a[0]), ': ', $a[1], "\n";
	else echo $a, "\n";
}

Expected result:
----------------
T_OPEN_TAG: <?php
T_FUNCTION: function
(
T_CALLABLE: callable 
T_WHITESPACE:
T_VARIABLE: $a
)
{
}
;


Actual result:
--------------
T_OPEN_TAG: <?php
T_FUNCTION: function
(
T_STRING: callable // Why T_STRING ???
T_WHITESPACE:
T_VARIABLE: $a
)
{
}
;


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-09-06 09:03 UTC] laruence@php.net
-Status: Open +Status: Feedback
 [2011-09-06 09:03 UTC] laruence@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.4-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2011-09-16 17:30 UTC] nicolas dot grekas+php at gmail dot com
-Status: Feedback +Status: Closed
 [2011-09-16 17:30 UTC] nicolas dot grekas+php at gmail dot com
Just tested in beta1, it's fixed, thanks!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 13:01:28 2024 UTC