[PHP-CVS] cvs: php4 /ext/standard basic_functions.c var.c /main output.c

2002-10-06 Thread Zeev Suraski

zeevSun Oct  6 08:02:54 2002 EDT

  Modified files:  
/php4/ext/standard  basic_functions.c var.c 
/php4/main  output.c 
  Log:
  Revert the implicit_flush mess.
  
  Do not revert it again under any circumstances!
  
  Yasuo/anybody else - if there are issues with implicit_flush, please inform
  me and I will fix them.
  
  
Index: php4/ext/standard/basic_functions.c
diff -u php4/ext/standard/basic_functions.c:1.524 
php4/ext/standard/basic_functions.c:1.525
--- php4/ext/standard/basic_functions.c:1.524   Sun Oct  6 05:06:24 2002
+++ php4/ext/standard/basic_functions.c Sun Oct  6 08:02:52 2002
 -17,7 +17,7 
+--+
  */
 
-/* $Id: basic_functions.c,v 1.524 2002/10/06 09:06:24 zeev Exp $ */
+/* $Id: basic_functions.c,v 1.525 2002/10/06 12:02:52 zeev Exp $ */
 
 #include php.h
 #include php_streams.h
 -2076,7 +2076,6 
convert_to_string(expr);
 
if (i) {
-   php_output_set_status(0 TSRMLS_CC);
php_start_ob_buffer (NULL, 0, 1 TSRMLS_CC);
}
 
 -2093,7 +2092,6 
if (i) {
php_ob_get_buffer (return_value TSRMLS_CC);
php_end_ob_buffer (0, 0 TSRMLS_CC);
-   php_output_set_status(1 TSRMLS_CC);
} else {
RETURN_TRUE;
}
Index: php4/ext/standard/var.c
diff -u php4/ext/standard/var.c:1.148 php4/ext/standard/var.c:1.149
--- php4/ext/standard/var.c:1.148   Thu Oct  3 09:32:00 2002
+++ php4/ext/standard/var.c Sun Oct  6 08:02:52 2002
 -349,7 +349,6 
}

if (return_output) {
-   php_output_set_status(0 TSRMLS_CC);
php_start_ob_buffer (NULL, 0, 1 TSRMLS_CC);
}

 -358,7 +357,6 
if (return_output) {
php_ob_get_buffer (return_value TSRMLS_CC);
php_end_ob_buffer (0, 0 TSRMLS_CC);
-   php_output_set_status(1 TSRMLS_CC);
}
 }
 /* }}} */
Index: php4/main/output.c
diff -u php4/main/output.c:1.140 php4/main/output.c:1.141
--- php4/main/output.c:1.140Sun Oct  6 05:06:24 2002
+++ php4/main/output.c  Sun Oct  6 08:02:53 2002
 -18,7 +18,7 
+--+
 */
 
-/* $Id: output.c,v 1.140 2002/10/06 09:06:24 zeev Exp $ */
+/* $Id: output.c,v 1.141 2002/10/06 12:02:53 zeev Exp $ */
 
 #include php.h
 #include ext/standard/head.h
 -94,10 +94,7 
 
 
 /* {{{ php_output_set_status
-   Toggle output status. Use this function for internal functions uses
-   buffers. If you don't implict flush (both php.ini implicit_flush and 
ob_impilict_flush())
-   may flush your php_printf() output.
-   status: 0 for disable output, 1 for enable.*/
+   Toggle output status.  Do NOT use in application code, only in SAPIs where 
+appropriate. */
 PHPAPI void php_output_set_status(zend_bool status TSRMLS_DC)
 {
OG(disable_output) = !status;
 -592,9 +589,8 
target[text_length]=0;
 
/* If implicit_flush is On or chunked buffering, send contents to next buffer 
and return. */
-   if (OG(implicit_flush) || (OG(active_ob_buffer).chunk_size
-OG(active_ob_buffer).text_length = 
OG(active_ob_buffer).chunk_size))
-   {
+   if (OG(active_ob_buffer).chunk_size
+OG(active_ob_buffer).text_length = 
+OG(active_ob_buffer).chunk_size) {
zval *output_handler = OG(active_ob_buffer).output_handler;

if (output_handler) {



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




Re: [PHP-CVS] cvs: php4 /ext/standard basic_functions.c var.c /main

2002-10-04 Thread Zeev Suraski

At 18:00 03/10/2002, Yasuo Ohgaki wrote:
Zeev Suraski wrote:
OG(implicit_flush) != PG(implicit_flush)

That's a myth.  What exactly do you think is the difference between 
them?  PG(implicit_flush) sets the value for OG(implicit_flush).  It's 
simply the cache value for the INI directive implicit_flush, whereas 
OG(implicit_flush) is the de-facto value that the output layer uses.

Let's get this behind us:

 From main.c, php_request_startup():

 } else if (PG(implicit_flush)) {
 php_start_implicit_flush(TSRMLS_C);
 }


 From output.c:
PHPAPI void php_start_implicit_flush(TSRMLS_D)
{
 OG(implicit_flush)=1;
}

Come again, how different are these two?

Why is it necessary to explicitly disable output in all of the places 
where you added set_status() calls??

To prevent implicit_flushing.

implicit_flush should have NOTHING, NOT A THING to do with output buffering 
that's done by PHP.  Hence, these calls are BOGUS.


As Derick noticed.

?php var_exprot('var'); ?

prints out exported var w/o it.

Right, but only because of your patch that pays attention to implicit_flush 
inside PHP's output buffering layer.

Please revert the patch!  And *KEEP* it reverted.  If there are still 
bugs/crashes/issues once this bogus code is reverted, I volunteer to fix 
it.  (I'm not reverting it myself since in order for this to finally end, I 
don't want yet another cycle of revert-recommit...)

Zeev


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




[PHP-CVS] cvs: php4 /ext/standard basic_functions.c var.c /main output.c /sapi/cli php_cli.c

2002-10-03 Thread Derick Rethans

derick  Thu Oct  3 06:35:34 2002 EDT

  Modified files:  
/php4/main  output.c 
/php4/ext/standard  var.c basic_functions.c 
/php4/sapi/cli  php_cli.c 
  Log:
  - Revert changed to implicit_flush behavior. The new behavior was not
intended in the first place.
  
  
Index: php4/main/output.c
diff -u php4/main/output.c:1.134 php4/main/output.c:1.135
--- php4/main/output.c:1.134Thu Oct  3 04:54:13 2002
+++ php4/main/output.c  Thu Oct  3 06:35:32 2002
 -18,7 +18,7 
+--+
 */
 
-/* $Id: output.c,v 1.134 2002/10/03 08:54:13 yohgaki Exp $ */
+/* $Id: output.c,v 1.135 2002/10/03 10:35:32 derick Exp $ */
 
 #include php.h
 #include ext/standard/head.h
 -596,11 +596,8 
/* If implicit_flush is On, send contents to next buffer and return.
   Both PG() and OG() should be used since we should flush implicitly
   always when implicit_flush is enabled in php.ini */
-   if (PG(implicit_flush) || OG(implicit_flush)
-   /* Also flush after each chunk if output is chunked */
-   || (OG(active_ob_buffer).chunk_size
-OG(active_ob_buffer).text_length = 
OG(active_ob_buffer).chunk_size)
-   ) {
+   if (OG(active_ob_buffer).chunk_size
+OG(active_ob_buffer).text_length = 
+OG(active_ob_buffer).chunk_size) {
zval *output_handler = OG(active_ob_buffer).output_handler;
 
if (output_handler) {
Index: php4/ext/standard/var.c
diff -u php4/ext/standard/var.c:1.146 php4/ext/standard/var.c:1.147
--- php4/ext/standard/var.c:1.146   Thu Oct  3 04:54:45 2002
+++ php4/ext/standard/var.c Thu Oct  3 06:35:33 2002
 -342,23 +342,21 
 PHP_FUNCTION(var_export)
 {
zval *var;
-   zend_bool return_output = 0;
+   zend_bool i = 0;

-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z|b, var, 
return_output) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z|b, var, i) == 
+FAILURE) {
return;
}

-   if (return_output) {
-   php_output_set_status(0 TSRMLS_CC);
+   if (i) {
php_start_ob_buffer (NULL, 0, 1 TSRMLS_CC);
}

php_var_export(var, 1 TSRMLS_CC);
 
-   if (return_output) {
+   if (i) {
php_ob_get_buffer (return_value TSRMLS_CC);
php_end_ob_buffer (0, 0 TSRMLS_CC);
-   php_output_set_status(1 TSRMLS_CC);
}
 }
 /* }}} */
Index: php4/ext/standard/basic_functions.c
diff -u php4/ext/standard/basic_functions.c:1.519 
php4/ext/standard/basic_functions.c:1.520
--- php4/ext/standard/basic_functions.c:1.519   Thu Oct  3 05:19:31 2002
+++ php4/ext/standard/basic_functions.c Thu Oct  3 06:35:33 2002
 -17,7 +17,7 
+--+
  */
 
-/* $Id: basic_functions.c,v 1.519 2002/10/03 09:19:31 yohgaki Exp $ */
+/* $Id: basic_functions.c,v 1.520 2002/10/03 10:35:33 derick Exp $ */
 
 #include php.h
 #include php_streams.h
 -2077,7 +2077,6 
convert_to_string(expr);
 
if (i) {
-   php_output_set_status(0 TSRMLS_CC);
php_start_ob_buffer (NULL, 0, 1 TSRMLS_CC);
}
 
 -2094,7 +2093,6 
if (i) {
php_ob_get_buffer (return_value TSRMLS_CC);
php_end_ob_buffer (0, 0 TSRMLS_CC);
-   php_output_set_status(1 TSRMLS_CC);
} else {
RETURN_TRUE;
}
Index: php4/sapi/cli/php_cli.c
diff -u php4/sapi/cli/php_cli.c:1.34 php4/sapi/cli/php_cli.c:1.35
--- php4/sapi/cli/php_cli.c:1.34Thu Oct  3 05:57:53 2002
+++ php4/sapi/cli/php_cli.c Thu Oct  3 06:35:33 2002
 -466,6 +466,7 
SG(options) |= SAPI_OPTION_NO_CHDIR;
zend_alter_ini_entry(register_argc_argv, 19, 1, 1, PHP_INI_SYSTEM, 
PHP_INI_STAGE_ACTIVATE);
zend_alter_ini_entry(html_errors, 12, 0, 1, PHP_INI_SYSTEM, 
PHP_INI_STAGE_ACTIVATE);
+   zend_alter_ini_entry(implicit_flush, 15, 1, 1, PHP_INI_SYSTEM, 
+PHP_INI_STAGE_ACTIVATE);
zend_alter_ini_entry(max_execution_time, 19, 0, 1, PHP_INI_SYSTEM, 
PHP_INI_STAGE_ACTIVATE);
 
zend_uv.html_errors = 0; /* tell the engine we're in non-html mode */



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




Re: [PHP-CVS] cvs: php4 /ext/standard basic_functions.c var.c /main

2002-10-03 Thread Yasuo Ohgaki

Zeev Suraski wrote:
 Yasuo,
 
 Can you explain how come the output buffering code pays any attention to 
 implicit_flush, when I repeatedly said that output buffering and 
 implicit_flush are COMPLETELY unrelated?

This patch has nothing to do with implicit_flush ini directive.
Isn't ob_implicit_flush() written by you? Or is it written by
others?

--
Yasuo Ohgaki

 
 Zeev
 
 At 16:32 03/10/2002, Yasuo Ohgaki wrote:
 
 yohgaki Thu Oct  3 09:32:02 2002 EDT

   Modified files:
 /php4/ext/standard  basic_functions.c var.c
 /php4/main  output.c
   Log:
   Fixed broken code by Derick.
   ob_implicit_flush() and ob_flush_all() are stopped working.
   var_dump() and hightlisht_string() outputs buffer contents wrongly
   with ob_implicit_flush().

   Everyone should be happy now.
   It was only OG(implicit_flush) interpretation issue after all.



 Index: php4/ext/standard/basic_functions.c
 diff -u php4/ext/standard/basic_functions.c:1.521 
 php4/ext/standard/basic_functions.c:1.522
 --- php4/ext/standard/basic_functions.c:1.521   Thu Oct  3 06:42:57 2002
 +++ php4/ext/standard/basic_functions.c Thu Oct  3 09:31:59 2002
  -17,7 +17,7 
 
 +--+
   */

 -/* $Id: basic_functions.c,v 1.521 2002/10/03 10:42:57 andrey Exp $ */
 +/* $Id: basic_functions.c,v 1.522 2002/10/03 13:31:59 yohgaki Exp $ */

  #include php.h
  #include php_streams.h
  -2077,6 +2077,7 
 convert_to_string(expr);

 if (i) {
 +   php_output_set_status(0 TSRMLS_CC);
 php_start_ob_buffer (NULL, 0, 1 TSRMLS_CC);
 }

  -2093,6 +2094,7 
 if (i) {
 php_ob_get_buffer (return_value TSRMLS_CC);
 php_end_ob_buffer (0, 0 TSRMLS_CC);
 +   php_output_set_status(1 TSRMLS_CC);
 } else {
 RETURN_TRUE;
 }
 Index: php4/ext/standard/var.c
 diff -u php4/ext/standard/var.c:1.147 php4/ext/standard/var.c:1.148
 --- php4/ext/standard/var.c:1.147   Thu Oct  3 06:35:33 2002
 +++ php4/ext/standard/var.c Thu Oct  3 09:32:00 2002
  -342,21 +342,23 
  PHP_FUNCTION(var_export)
  {
 zval *var;
 -   zend_bool i = 0;
 +   zend_bool return_output = 0;

 -   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z|b, 
 var, i) == FAILURE) {
 +   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z|b, 
 var, return_output) == FAILURE) {
 return;
 }

 -   if (i) {
 +   if (return_output) {
 +   php_output_set_status(0 TSRMLS_CC);
 php_start_ob_buffer (NULL, 0, 1 TSRMLS_CC);
 }

 php_var_export(var, 1 TSRMLS_CC);

 -   if (i) {
 +   if (return_output) {
 php_ob_get_buffer (return_value TSRMLS_CC);
 php_end_ob_buffer (0, 0 TSRMLS_CC);
 +   php_output_set_status(1 TSRMLS_CC);
 }
  }
  /* }}} */
 Index: php4/main/output.c
 diff -u php4/main/output.c:1.137 php4/main/output.c:1.138
 --- php4/main/output.c:1.137Thu Oct  3 07:56:10 2002
 +++ php4/main/output.c  Thu Oct  3 09:32:01 2002
  -18,7 +18,7 
 
 +--+
  */

 -/* $Id: output.c,v 1.137 2002/10/03 11:56:10 jmoore Exp $ */
 +/* $Id: output.c,v 1.138 2002/10/03 13:32:01 yohgaki Exp $ */

  #include php.h
  #include ext/standard/head.h
  -591,10 +591,12 
 memcpy(target, text, text_length);
 target[text_length]=0;

 -   if (OG(active_ob_buffer).chunk_size
 -OG(active_ob_buffer).text_length = 
 OG(active_ob_buffer).chunk_size) {
 +   /* If implicit_flush is On, send contents to next buffer and 
 return. */
 +   if (OG(implicit_flush) || OG(active_ob_buffer).chunk_size
 +OG(active_ob_buffer).text_length = 
 OG(active_ob_buffer).chunk_size)
 +   {
 zval *output_handler = 
 OG(active_ob_buffer).output_handler;
 -
 +
 if (output_handler) {
 output_handler-refcount++;
 }



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



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