From:
Operating system:
PHP version: 5.4.0alpha3
Package: Scripting Engine problem
Bug Type: Bug
Bug description:Can't make token_get_all return T_CALLABLE
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
)
{
}
;
--
Edit bug report at https://bugs.php.net/bug.php?id=55616&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=55616&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=55616&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=55616&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=55616&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=55616&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=55616&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=55616&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=55616&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=55616&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=55616&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=55616&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=55616&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=55616&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=55616&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=55616&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=55616&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=55616&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=55616&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=55616&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=55616&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=55616&r=mysqlcfg