From: paul dot laughlin at ingramentertainment dot com
Operating system: Gentoo Linux 2.6.10
PHP version: 5.0.3
PHP Bug Type: Reproducible crash
Bug description: Tokenizer fails after fatal error until timeout or apache
restart
Description:
------------
If you have a fatal error it breaks token_get_all until an apache
restart...
Reproduce code:
---------------
-- Sample Token file <test.file>
Some HTML
<? TEST_TAG ?>
Some More HTML
<? Another_TAG ?>
More HTML
-- End Sample Token File
-- PHP Script --
<?php
$rawData = file_get_contents('test.file');
foreach (token_get_all($rawData) as $token) {
echo '<pre>';
print_r($token);
echo '</pre>';
}
?>
-- End PHP Script --
If you introduce a parse error as follows, fix the error and reload you
get broken output until apache restart.
<?php
broken...
$rawData = file_get_contents('test.file');
foreach (token_get_all($rawData) as $token) {
echo '<pre>';
print_r($token);
echo '</pre>';
}
?>
Expected result:
----------------
Array
(
[0] => 310
[1] => Some HTML
)
Array
(
[0] => 365
[1] =>
Array
(
[0] => 368
[1] =>
)
Array
(
[0] => 306
[1] => TEST_TAG
)
Array
(
[0] => 368
[1] =>
)
Array
(
[0] => 367
[1] => ?>
)
Array
(
[0] => 310
[1] => Some More HTML
)
Array
(
[0] => 365
[1] =>
Array
(
[0] => 368
[1] =>
)
Array
(
[0] => 306
[1] => Another_TAG
)
Array
(
[0] => 368
[1] =>
)
Array
(
[0] => 367
[1] => ?>
)
Array
(
[0] => 310
[1] => More HTML
)
Actual result:
--------------
Array
(
[0] => 306
[1] => Some
)
Array
(
[0] => 368
[1] =>
)
Array
(
[0] => 306
[1] => HTML
)
Array
(
[0] => 368
[1] =>
)
<
?
Array
(
[0] => 368
[1] =>
)
Array
(
[0] => 306
[1] => TEST_TAG
)
Array
(
[0] => 368
[1] =>
)
Array
(
[0] => 367
[1] => ?>
)
Array
(
[0] => 310
[1] => Some More HTML
)
Array
(
[0] => 365
[1] =>
Array
(
[0] => 368
[1] =>
)
Array
(
[0] => 306
[1] => Another_TAG
)
Array
(
[0] => 368
[1] =>
)
Array
(
[0] => 367
[1] => ?>
)
Array
(
[0] => 310
[1] => More HTML
)
--
Edit bug report at http://bugs.php.net/?id=32225&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32225&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=32225&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=32225&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32225&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32225&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32225&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32225&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32225&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32225&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32225&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=32225&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=32225&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32225&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32225&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32225&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32225&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32225&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32225&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32225&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32225&r=mysqlcfg