php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23635 token_get_all returns incorrect result
Submitted: 2003-05-15 01:56 UTC Modified: 2003-05-15 12:24 UTC
From: davey@php.net Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.3.2RC2 OS: Win32 (XP)
Private report: No CVE-ID: None
 [2003-05-15 01:56 UTC] davey@php.net
With token_get_all(), the return on win32 is slightly different to on *nix. The difference is with all those characters that do not have a T_FOO name, which results in them not being in an array, my problem is that the character in there is not correct.

Win32 var_dump output:
[29]=>
string(3) "; U"

*nix var_dump output:
[29]=>
string(1) ";"

require_once 'PEAR/Command/Common.php'U is the printed output on win32

require_once 'PEAR/Command/Common.php'; is the printed output for the same line on *nix (FBSD 4.4).

Every single one of these characters is
string(3) "CHAR U" which makes it impossible to even work around using str_replace or the like.

I believe the U is a \r or some such... not *too* sure. I think that might be mozillas way of showing unknown characters within <pre> output.

Sample script:

<?php
    $tokens = token_get_all(file_get_contents($_SERVER['SCRIPT_FILENAME']));
    echo "<pre>";
    var_dump($tokens);
    echo "</pre>";
?>

- Davey

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-15 02:04 UTC] davey@php.net
Using PHP 4.3.1 on the *nix server, forgot to mention that.

- Davey
 [2003-05-15 12:24 UTC] sniper@php.net
You're propably saving the script in some weird type,
I couldn't reproduce this with latest stable snapshot..

 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Oct 06 18:00:01 2026 UTC