From:             [EMAIL PROTECTED]
Operating system: Mac OS X 10.4.1
PHP version:      5.0.4
PHP Bug Type:     Unknown/Other Function
Bug description:  token_get_all() inconsistent results?

Description:
------------
It appears that token_get_all() does not report T_OPEN_TAG and
T_WHITESPACE properly, depending on the whitespace following the opening
tag.  For example, when parsing ...

<?php echo $var ?>

... you get T_OPEN_TAG, T_ECHO, T_WHITESPACE, T_VAR, T_WHITESPACE, and
T_CLOSE_TAG.  This is not entirely the expected result (I would expect
T_WHITESPACE between the open tag and the echo).

However, when parsing the functional equivalent...

<?php

echo $var

?>

you get "<", "?", T_STRING ("php"), T_WHITESPACE, T_ECHO, T_WHITESPACE,
T_VAR, T_WHITESPACE, and T_CLOSE_TAG.  In addition, the first whitespace
value reported does not include all the newlines (it drops one).

Although Macs use \r for their newlines natively, the test code uses the
Unix-standard \n, so I don't think it's Mac-related.

If this is in fact a bug, the current behavior makes it difficult to write
a reliable userland code auditor and report proper line numbers.

Am I missing some assumptions behind the behavior of the tokenizer
function?


-- 
Edit bug report at http://bugs.php.net/?id=33093&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=33093&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=33093&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=33093&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=33093&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=33093&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=33093&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=33093&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=33093&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=33093&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=33093&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=33093&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=33093&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=33093&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=33093&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=33093&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=33093&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=33093&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=33093&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=33093&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=33093&r=mysqlcfg

Reply via email to