php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32225 Tokenizer fails after fatal error until timeout or apache restart
Submitted: 2005-03-07 19:23 UTC Modified: 2005-09-02 08:52 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: paul dot laughlin at ingramentertainment dot com Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: PHP 5.1.0-dev (built: Mar 22 2005 15:40:32) OS: Gentoo Linux 2.6.10
Private report: No CVE-ID: None
 [2005-03-07 19:23 UTC] paul dot laughlin at ingramentertainment dot com
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
)



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-07 20:04 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-03-20 18:11 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2005-03-22 22:55 UTC] paul dot laughlin at ingramentertainment dot com
Tested this problem with the snapshot as instructed.  This is still a problem in the snapshot.

THank you
 [2005-04-12 20:29 UTC] gary dot every at ingramentertainment dot com
There has been no input on this bug for over a month. Is anyone looking into it? 
We're depending heavily on the tokenizer to parse our template, and this could easily cause serious issues with our next major release of our B2B website.

Gary Every
 [2005-05-17 13:33 UTC] gary dot every at ingramentertainment dot com
The token_get_all seems to still be broken. We are developing a site that will be promoted into production in September. Is anyone else experiencing this problem? 

Gary Every
 [2005-08-18 23:44 UTC] gevery at gmail dot com
As this issue has drawn no attention, we've been forced to write our own parser. Paul Laughlin has done a wonderful job at providing a very lightweight extension that is configurable through the php.ini to allow for increased buffer size of the "largest expected page" 

Thank you, Paul!
G.~
 [2005-09-02 08:52 UTC] sniper@php.net
As you went and invented your own PHP version 
(there is no such thing as 'PHP 5.1.0-dev (built: Mar 22 2005 15:40:32)', this report was lost.

PHP versions start with 3,4,5 or 6. They're not supposed to be prefixed with anything in this bug system..

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 23:01:28 2024 UTC