lbarnaud                Mon Aug 18 04:07:54 2008 UTC

  Added files:                 
    /php-src/tests/lang bug45392.phpt 

  Modified files:              
    /php-src/main       output.c 
  Log:
  Fixed bug #45392 (ob_start()/ob_end_clean() and memory_limit).
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/output.c?r1=1.211&r2=1.212&diff_format=u
Index: php-src/main/output.c
diff -u php-src/main/output.c:1.211 php-src/main/output.c:1.212
--- php-src/main/output.c:1.211 Mon Aug 18 03:54:49 2008
+++ php-src/main/output.c       Mon Aug 18 04:07:54 2008
@@ -19,7 +19,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: output.c,v 1.211 2008/08/18 03:54:49 lbarnaud Exp $ */
+/* $Id: output.c,v 1.212 2008/08/18 04:07:54 lbarnaud Exp $ */
 
 #ifndef PHP_OUTPUT_DEBUG
 #      define PHP_OUTPUT_DEBUG 0
@@ -1275,7 +1275,11 @@
                
                /* pass output along */
                if (context.out.data && context.out.used && !(flags & 
PHP_OUTPUT_POP_DISCARD)) {
-                       php_output_write(context.out.data, context.out.used 
TSRMLS_CC);
+                       /* in case of unclean_shutdown, do not output the 
buffer if it is not
+                       * meant to be until end of script or ob_end_*() call */
+                       if (!CG(unclean_shutdown) || orphan->size) {
+                               php_output_write(context.out.data, 
context.out.used TSRMLS_CC);
+                       }
                }
                
                /* destroy the handler (after write!) */

http://cvs.php.net/viewvc.cgi/php-src/tests/lang/bug45392.phpt?view=markup&rev=1.1
Index: php-src/tests/lang/bug45392.phpt
+++ php-src/tests/lang/bug45392.phpt
--TEST--
Bug #45392 (ob_start()/ob_end_clean() and memory_limit)
--INI--
display_errors=stderr
--FILE--
<?php
echo __LINE__ . "\n";
ini_set('memory_limit', 100);
ob_start(NULL, 10);
echo __LINE__ ."\n";
ob_start();
$i = 0;
while($i++ < 5000)  {
  echo str_repeat("may not be displayed ", 42);
}
ob_end_flush();
ob_end_clean();
?>
--EXPECTF--
2
Fatal error: Allowed memory size of %d bytes exhausted%s
5



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to