Mantis - Quercus
Viewing Issue Advanced Details
2091 major always 10-18-07 23:56 10-19-07 13:53
koreth  
ferg  
normal  
closed 3.1.3  
fixed  
none    
none 3.1.4  
0002091: Output buffering goes into infinite loop if output exceeds a certain size
<?php
function stash_it($text) {
  global $output;
  $output = $text;
}
ob_start('stash_it');
for ($i = 0; $i < 10000; $i++) {
  print " - $i";
}
ob_end_flush();
print $output;

Vanilla PHP prints the numbers 0 to 9999. Quercus gets caught in an infinite loop calling ob_end_flush -- it looks like a link list entry manages to point to itself as the next item. (OutputBuffer.getContents()).

If you reduce the maximum number to, say, 1000, this works fine under Quercus.

Notes
(0002370)
koreth   
10-19-07 10:21   
Adding "return null;" to the end of the callback function clears this problem up, so this may be a difference in default return value semantics in Quercus vs. PHP rather than an output buffering issue per se (but the test case as posted does act differently in the two environments and does make Quercus go into an infinite loop.)
(0002371)
ferg   
10-19-07 13:53   
php/1l1-