[PHP-CVS] cvs: php-src(PHP_5_3) /main output.c

2009-03-25 Thread Christian Seiler
cseiler Wed Mar 25 23:59:45 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/main   output.c 
  Log:
  - Fixed memory leak in ob_get_clean/ob_get_flush.
  # Not necessary in HEAD because output buffering was completely rewritten
  # there.
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/output.c?r1=1.167.2.3.2.4.2.12&r2=1.167.2.3.2.4.2.13&diff_format=u
Index: php-src/main/output.c
diff -u php-src/main/output.c:1.167.2.3.2.4.2.12 
php-src/main/output.c:1.167.2.3.2.4.2.13
--- php-src/main/output.c:1.167.2.3.2.4.2.12Fri Feb 13 11:48:17 2009
+++ php-src/main/output.c   Wed Mar 25 23:59:45 2009
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: output.c,v 1.167.2.3.2.4.2.12 2009/02/13 11:48:17 davidc Exp $ */
+/* $Id: output.c,v 1.167.2.3.2.4.2.13 2009/03/25 23:59:45 cseiler Exp $ */
 
 #include "php.h"
 #include "ext/standard/head.h"
@@ -867,10 +867,12 @@
/* error checks */
if (!OG(ob_nesting_level)) {
php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed 
to delete and flush buffer. No buffer to delete or flush.");
+   zval_dtor(return_value);
RETURN_FALSE;
}
if (OG(ob_nesting_level) && !OG(active_ob_buffer).status && 
!OG(active_ob_buffer).erase) {
php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed 
to delete buffer %s.", OG(active_ob_buffer).handler_name);
+   zval_dtor(return_value);
RETURN_FALSE;
}
/* flush */
@@ -892,10 +894,12 @@
/* error checks */
if (!OG(ob_nesting_level)) {
php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed 
to delete buffer. No buffer to delete.");
+   zval_dtor(return_value);
RETURN_FALSE;
}
if (OG(ob_nesting_level) && !OG(active_ob_buffer).status && 
!OG(active_ob_buffer).erase) {
php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed 
to delete buffer %s.", OG(active_ob_buffer).handler_name);
+   zval_dtor(return_value);
RETURN_FALSE;
}
/* delete buffer */



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



[PHP-CVS] cvs: php-src(PHP_5_3) /main output.c /tests/output bug46897.phpt

2009-02-13 Thread David Coallier
davidc  Fri Feb 13 11:48:17 2009 UTC

  Added files: (Branch: PHP_5_3)
/php-src/tests/output   bug46897.phpt 

  Modified files:  
/php-src/main   output.c 
  Log:
  - Fixed bug #46897: ob_flush() should fail to flush unerasable buffers
  - Added test for bug46897
  - A memleak has been identified while fixing this bug but the changes
made by this commit do not affect ob_get_clean where the memleak (which
is fixed in HEAD with the new handler) resides.
  - [DOC] New noticed is outputted in ob_flush when the buffer is unerasable
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/output.c?r1=1.167.2.3.2.4.2.11&r2=1.167.2.3.2.4.2.12&diff_format=u
Index: php-src/main/output.c
diff -u php-src/main/output.c:1.167.2.3.2.4.2.11 
php-src/main/output.c:1.167.2.3.2.4.2.12
--- php-src/main/output.c:1.167.2.3.2.4.2.11Wed Jan  7 18:34:18 2009
+++ php-src/main/output.c   Fri Feb 13 11:48:17 2009
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: output.c,v 1.167.2.3.2.4.2.11 2009/01/07 18:34:18 felipe Exp $ */
+/* $Id: output.c,v 1.167.2.3.2.4.2.12 2009/02/13 11:48:17 davidc Exp $ */
 
 #include "php.h"
 #include "ext/standard/head.h"
@@ -774,6 +774,11 @@
RETURN_FALSE;
}

+   if (!OG(active_ob_buffer).status && !OG(active_ob_buffer).erase) {
+   php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed 
to flush buffer %s.", OG(active_ob_buffer).handler_name);
+   RETURN_FALSE;
+   }
+   
php_end_ob_buffer(1, 1 TSRMLS_CC);
RETURN_TRUE;
 }

http://cvs.php.net/viewvc.cgi/php-src/tests/output/bug46897.phpt?view=markup&rev=1.1
Index: php-src/tests/output/bug46897.phpt
+++ php-src/tests/output/bug46897.phpt



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



[PHP-CVS] cvs: php-src(PHP_5_3) /main output.c

2009-01-07 Thread Felipe Pena
felipe  Wed Jan  7 18:34:18 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/main   output.c 
  Log:
  - Checking 0 param in the new way [only in this branch]
  
http://cvs.php.net/viewvc.cgi/php-src/main/output.c?r1=1.167.2.3.2.4.2.10&r2=1.167.2.3.2.4.2.11&diff_format=u
Index: php-src/main/output.c
diff -u php-src/main/output.c:1.167.2.3.2.4.2.10 
php-src/main/output.c:1.167.2.3.2.4.2.11
--- php-src/main/output.c:1.167.2.3.2.4.2.10Wed Dec 31 11:15:47 2008
+++ php-src/main/output.c   Wed Jan  7 18:34:18 2009
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: output.c,v 1.167.2.3.2.4.2.10 2008/12/31 11:15:47 sebastian Exp $ */
+/* $Id: output.c,v 1.167.2.3.2.4.2.11 2009/01/07 18:34:18 felipe Exp $ */
 
 #include "php.h"
 #include "ext/standard/head.h"
@@ -558,11 +558,10 @@
  */
 PHP_FUNCTION(ob_list_handlers)
 {
-   if (ZEND_NUM_ARGS()!=0) {
-   ZEND_WRONG_PARAM_COUNT();
-   RETURN_FALSE;
+   if (zend_parse_parameters_none() == FAILURE) {
+   return;
}
-
+   
array_init(return_value);
if (OG(ob_nesting_level)) {
if (OG(ob_nesting_level)>1) {



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



[PHP-CVS] cvs: php-src(PHP_5_3) /main output.c

2008-08-18 Thread Antony Dovgal
tony2001Mon Aug 18 07:46:31 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/main   output.c 
  Log:
  reverted because of test failures
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/output.c?r1=1.167.2.3.2.4.2.8&r2=1.167.2.3.2.4.2.9&diff_format=u
Index: php-src/main/output.c
diff -u php-src/main/output.c:1.167.2.3.2.4.2.8 
php-src/main/output.c:1.167.2.3.2.4.2.9
--- php-src/main/output.c:1.167.2.3.2.4.2.8 Mon Aug 18 04:08:17 2008
+++ php-src/main/output.c   Mon Aug 18 07:46:31 2008
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: output.c,v 1.167.2.3.2.4.2.8 2008/08/18 04:08:17 lbarnaud Exp $ */
+/* $Id: output.c,v 1.167.2.3.2.4.2.9 2008/08/18 07:46:31 tony2001 Exp $ */
 
 #include "php.h"
 #include "ext/standard/head.h"
@@ -336,13 +336,7 @@
 PHPAPI void php_end_ob_buffers(zend_bool send_buffer TSRMLS_DC)
 {
while (OG(ob_nesting_level)!=0) {
-   /* 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);
-   }
+   php_end_ob_buffer(send_buffer, 0 TSRMLS_CC);
}
 }
 /* }}} */



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



[PHP-CVS] cvs: php-src(PHP_5_3) /main output.c /tests/lang bug45392.phpt

2008-08-17 Thread Arnaud Le Blanc
lbarnaudMon Aug 18 04:08:17 2008 UTC

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

  Modified files:  
/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/main/output.c?r1=1.167.2.3.2.4.2.7&r2=1.167.2.3.2.4.2.8&diff_format=u
Index: php-src/main/output.c
diff -u php-src/main/output.c:1.167.2.3.2.4.2.7 
php-src/main/output.c:1.167.2.3.2.4.2.8
--- php-src/main/output.c:1.167.2.3.2.4.2.7 Sat Aug  2 04:46:07 2008
+++ php-src/main/output.c   Mon Aug 18 04:08:17 2008
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: output.c,v 1.167.2.3.2.4.2.7 2008/08/02 04:46:07 felipe Exp $ */
+/* $Id: output.c,v 1.167.2.3.2.4.2.8 2008/08/18 04:08:17 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--

--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



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /main output.c

2008-07-17 Thread Johannes Schlüter
On Tue, 2008-07-15 at 17:29 +0200, "Hannes Magnusson" wrote:
> > to the new API, so we can only guess. And return null is the better
> > guess from MPOV.
> 
> Some of those functions have been using that API for years...
> Why would you need to guess anything anyway?

Reading the old ode should be enough, in this case they used both - at
least some of the returned null if the argcount was wrong and false if
zend_get_parameter failed for some random reason. And then I'd say NULL
is better.

johannes


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



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /main output.c

2008-07-15 Thread Hannes Magnusson
On Tue, Jul 15, 2008 at 15:18, Lars Strojny <[EMAIL PROTECTED]> wrote:
> Hi Hannes,
>
> Am Dienstag, den 15.07.2008, 15:07 +0200 schrieb Hannes Magnusson:
>> I see no point in breaking bc just to break it.
>
> that's how it is done elsewhere too. The issue is, there are no tests to
> tell us how the behaviour was before the parameter handling was changed

Which is why it is good practice to write the tests before changing anything.

> to the new API, so we can only guess. And return null is the better
> guess from MPOV.

Some of those functions have been using that API for years...
Why would you need to guess anything anyway?

-Hannes

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



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /main output.c

2008-07-15 Thread Lars Strojny
Hi Hannes,

Am Dienstag, den 15.07.2008, 15:07 +0200 schrieb Hannes Magnusson:
> I see no point in breaking bc just to break it.

that's how it is done elsewhere too. The issue is, there are no tests to
tell us how the behaviour was before the parameter handling was changed
to the new API, so we can only guess. And return null is the better
guess from MPOV.
cu, Lars


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


Re: [PHP-CVS] cvs: php-src(PHP_5_3) /main output.c

2008-07-15 Thread Hannes Magnusson
On Tue, Jul 15, 2008 at 11:09, Lars Strojny <[EMAIL PROTECTED]> wrote:
> lstrojnyTue Jul 15 09:09:09 2008 UTC
>
>  Modified files:  (Branch: PHP_5_3)
>/php-src/main   output.c
>  Log:
>  Return null on when param parsing errors occur

Why?
I see no point in breaking bc just to break it.
Admittedly its not a major issue, but it is still completely pointless.

-Hannes

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



[PHP-CVS] cvs: php-src(PHP_5_3) /main output.c

2008-07-15 Thread Lars Strojny
lstrojnyTue Jul 15 09:09:09 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/main   output.c 
  Log:
  Return null on when param parsing errors occur
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/output.c?r1=1.167.2.3.2.4.2.4&r2=1.167.2.3.2.4.2.5&diff_format=u
Index: php-src/main/output.c
diff -u php-src/main/output.c:1.167.2.3.2.4.2.4 
php-src/main/output.c:1.167.2.3.2.4.2.5
--- php-src/main/output.c:1.167.2.3.2.4.2.4 Tue Jul 15 08:50:04 2008
+++ php-src/main/output.c   Tue Jul 15 09:09:09 2008
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: output.c,v 1.167.2.3.2.4.2.4 2008/07/15 08:50:04 lstrojny Exp $ */
+/* $Id: output.c,v 1.167.2.3.2.4.2.5 2008/07/15 09:09:09 lstrojny Exp $ */
 
 #include "php.h"
 #include "ext/standard/head.h"
@@ -738,15 +738,14 @@
zval *output_handler=NULL;
long chunk_size=0;
zend_bool erase=1;
-   int argc = ZEND_NUM_ARGS();
-   
-   if (zend_parse_parameters(argc TSRMLS_CC, "|zlb", &output_handler, 
&chunk_size, &erase) == FAILURE) {
-   RETURN_FALSE;
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|zlb", 
&output_handler, &chunk_size, &erase) == FAILURE) {
+   return;
}
 
if (chunk_size < 0)
chunk_size = 0;
-   
+
if (php_start_ob_buffer(output_handler, chunk_size, erase 
TSRMLS_CC)==FAILURE) {
RETURN_FALSE;
}
@@ -965,12 +964,12 @@
Return the status of the active or all output buffers */
 PHP_FUNCTION(ob_get_status)
 {
-   int argc = ZEND_NUM_ARGS();
zend_bool full_status = 0;
-   
-   if (zend_parse_parameters(argc TSRMLS_CC, "|b", &full_status) == 
FAILURE )
-   RETURN_FALSE;
-   
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", 
&full_status) == FAILURE ) {
+   return;
+   }
+
array_init(return_value);
 
if (full_status) {
@@ -1002,7 +1001,7 @@
long flag = 1;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flag) == 
FAILURE) {
-   RETURN_FALSE;
+   return;
}
 
if (flag) {
@@ -1053,7 +1052,7 @@
int name_len, value_len;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &name, 
&name_len, &value, &value_len) == FAILURE) {
-   RETURN_FALSE;
+   return;
}
 
if (php_url_scanner_add_var(name, name_len, value, value_len, 1 
TSRMLS_CC) == SUCCESS) {



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



[PHP-CVS] cvs: php-src(PHP_5_3) /main output.c

2008-07-15 Thread Lars Strojny
lstrojnyTue Jul 15 08:50:04 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/main   output.c 
  Log:
  New parameter parsing API
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/output.c?r1=1.167.2.3.2.4.2.3&r2=1.167.2.3.2.4.2.4&diff_format=u
Index: php-src/main/output.c
diff -u php-src/main/output.c:1.167.2.3.2.4.2.3 
php-src/main/output.c:1.167.2.3.2.4.2.4
--- php-src/main/output.c:1.167.2.3.2.4.2.3 Mon Mar 10 22:12:33 2008
+++ php-src/main/output.c   Tue Jul 15 08:50:04 2008
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: output.c,v 1.167.2.3.2.4.2.3 2008/03/10 22:12:33 felipe Exp $ */
+/* $Id: output.c,v 1.167.2.3.2.4.2.4 2008/07/15 08:50:04 lstrojny Exp $ */
 
 #include "php.h"
 #include "ext/standard/head.h"
@@ -999,24 +999,12 @@
Turn implicit flush on/off and is equivalent to calling flush() after every 
output call */
 PHP_FUNCTION(ob_implicit_flush)
 {
-   zval **zv_flag;
-   int flag;
+   long flag = 1;
 
-   switch(ZEND_NUM_ARGS()) {
-   case 0:
-   flag = 1;
-   break;
-   case 1:
-   if (zend_get_parameters_ex(1, &zv_flag)==FAILURE) {
-   RETURN_FALSE;
-   }
-   convert_to_long_ex(zv_flag);
-   flag = Z_LVAL_PP(zv_flag);
-   break;
-   default:
-   ZEND_WRONG_PARAM_COUNT();
-   break;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flag) == 
FAILURE) {
+   RETURN_FALSE;
}
+
if (flag) {
php_start_implicit_flush(TSRMLS_C);
} else {



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