Edit report at https://bugs.php.net/bug.php?id=55616&edit=1
ID: 55616 Updated by: larue...@php.net Reported by: nicolas dot grekas+php at gmail dot com Summary: Can't make token_get_all return T_CALLABLE -Status: Open +Status: Feedback Type: Bug Package: Scripting Engine problem PHP Version: 5.4.0alpha3 Block user comment: N Private report: N New Comment: Please try using this snapshot: http://snaps.php.net/php5.4-latest.tar.gz For Windows: http://windows.php.net/snapshots/ Previous Comments: ------------------------------------------------------------------------ [2011-09-06 07:49:39] 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 ) { } ; ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=55616&edit=1