lbarnaud                Mon Aug 18 04:09:38 2008 UTC

  Added files:                 (Branch: PHP_5_2)
    /php-src/tests/lang bug45392.phpt 

  Modified files:              
    /php-src    NEWS 
    /php-src/main       output.c 
  Log:
  MFH: Fixed bug #45392 (ob_start()/ob_end_clean() and memory_limit).
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1199&r2=1.2027.2.547.2.1200&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1199 php-src/NEWS:1.2027.2.547.2.1200
--- php-src/NEWS:1.2027.2.547.2.1199    Wed Aug 13 19:43:48 2008
+++ php-src/NEWS        Mon Aug 18 04:09:37 2008
@@ -43,6 +43,7 @@
   before shutdown) (basant dot kukreja at sun dot com)
 - Fixed bug #45406 (session.serialize_handler declared by shared extension 
   fails). (Kalle, oleg dot grenrus at dynamoid dot com)
+- Fixed bug #45392 (ob_start()/ob_end_clean() and memory_limit). (Arnaud)
 - Fixed bug #45352 (Segmentation fault because of tick function on second
   request). (Dmitry)
 - Fixed bug #45312 (Segmentation fault on second request for array functions).
http://cvs.php.net/viewvc.cgi/php-src/main/output.c?r1=1.167.2.3.2.5&r2=1.167.2.3.2.6&diff_format=u
Index: php-src/main/output.c
diff -u php-src/main/output.c:1.167.2.3.2.5 php-src/main/output.c:1.167.2.3.2.6
--- php-src/main/output.c:1.167.2.3.2.5 Mon Dec 31 07:20:15 2007
+++ php-src/main/output.c       Mon Aug 18 04:09:37 2008
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: output.c,v 1.167.2.3.2.5 2007/12/31 07:20:15 sebastian Exp $ */
+/* $Id: output.c,v 1.167.2.3.2.6 2008/08/18 04:09:37 lbarnaud Exp $ */
 
 #include "php.h"
 #include "ext/standard/head.h"
@@ -336,7 +336,13 @@
 PHPAPI void php_end_ob_buffers(zend_bool send_buffer TSRMLS_DC)
 {
        while (OG(ob_nesting_level)!=0) {
-               php_end_ob_buffer(send_buffer, 0 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) && !OG(active_ob_buffer).chunk_size) {
+                       php_end_ob_buffer(0, 0 TSRMLS_CC);
+               } else {
+                       php_end_ob_buffer(send_buffer, 0 TSRMLS_CC);
+               }
        }
 }
 /* }}} */

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