From:             steemann at globalpark dot de
Operating system: Linux 2.4.22
PHP version:      4.3.8
PHP Bug Type:     Unknown/Other Function
Bug description:  token_get_all()

Description:
------------
Don't know if it's a tokenizer issue or something else: 
 
I just wanted to check out the token_get_all() function. 
I tried the test code from the manual page (see code 
below). I am using token_get_all() with a constant input. 
 
Unfortunately, on my box, the result for the test code is 
varying, i. e. tokening a constant string has two 
different results. I found this out it by simple hitting 
reload in the browser multiple times. I've put both 
results I've gotten in the "Actual result" textarea. The 
possibility for each result seems to be about 50%. 
 
 
Environment: 
Configure Command =>  './configure' 
'--with-apxs=/opt/pdp/apache/bin/apxs' 
'--prefix=/opt/pdp/php' '--with-mysql=/opt/pdp/mysql/' 
'--with-config-file-path=/opt/pdp/' 
'--with-iconv=/opt/pdp/iconv/' 
'--with-imagick=/opt/pdp/ImageMagick/' '--with-zlib' 
'--with-gd' '--with-freetype-dir=/usr' 
'--enable-gd-native-ttf' '--enable-gd-imgstrttf' 
'--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--with-dom' 
'--with-dom-xslt' '--with-dom-exslt' '--enable-sysvsem' 
'--enable-sysvshm' '--disable-debug' '--enable-sockets' 
PHP API => 20020918 
PHP Extension => 20020429 
Zend Extension => 20021010 
Debug Build => no 
Thread Safety => disabled 
 
 
Maybe my box is f**ked up?? 

Reproduce code:
---------------
$data="<?php ob_start(); ?>";
foreach(token_get_all($data) as $c)
{
  if(is_array($c))
  {
    print(token_name($c[0]) . ": '".htmlentities($c[1])."'\n");
  }
  else
  {
    print("$c\n");
  }
}


Expected result:
----------------
T_OPEN_TAG: '&lt;?php ' 
T_STRING: 'ob_start' 
( 
) 
; 
T_WHITESPACE: ' ' 
T_CLOSE_TAG: '?&gt;' 

Actual result:
--------------
In about 50% I get: 
---------------------------- 
< 
? 
T_STRING: 'php' 
T_WHITESPACE: ' ' 
T_STRING: 'ob_start' 
( 
) 
; 
T_WHITESPACE: ' ' 
T_CLOSE_TAG: '?&gt;' 
 
 
 
 
the other 50% I get: 
---------------------------- 
T_OPEN_TAG: '&lt;?php ' 
T_STRING: 'ob_start' 
( 
) 
; 
T_WHITESPACE: ' ' 
T_CLOSE_TAG: '?&gt;' 
 

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

Reply via email to