[xdebug-dev] xdebug xdebug/xdebug_handler_dbgp.c - fix issue where output would be duplicated in some instances. always check for headers being written first.

From: Shane Caraveo <shane[@]caraveo.com>
Date: Thu, 15 Jul 2004 04:16:48 +0200

Date: Thu Jul 15 04:16:47 CEST 2004
User: Shane Caraveo
Directory: xdebug

Log Message:
[0.5]
- fix issue where output would be duplicated in some instances. always check for headers being written first.
Modified files:
           xdebug/xdebug_handler_dbgp.c (version: 1.48)

[FILE: /xdebug/xdebug_handler_dbgp.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- xdebug/xdebug_handler_dbgp.c:1.47 Wed Jul 14 21:58:48 2004 GMT
+++ xdebug/xdebug_handler_dbgp.c Thu Jul 15 00:16:47 2004 GMT
@@ -23,6 +23,7 @@
 #endif
 
 #include "php.h"
+#include "SAPI.h"
 
 #include "ext/standard/php_string.h"
 #include "ext/standard/url.h"
@@ -796,7 +797,7 @@
         return 0;
 }
 
-static int _xdebug_body_write(const char *str, uint str_length TSRMLS_DC)
+static int _xdebug_header_write(const char *str, uint str_length TSRMLS_DC)
 {
         zend_unset_timeout(TSRMLS_C);
         if (XG(stdout_redirected) != 0) {
@@ -805,11 +806,14 @@
 
         /* let PHP also send it out, as it may be needed */
         zend_set_timeout(EG(timeout_seconds));
- return XG(stdio).php_body_write(str, str_length TSRMLS_CC);
+ return XG(stdio).php_header_write(str, str_length TSRMLS_CC);
 }
 
-static int _xdebug_header_write(const char *str, uint str_length TSRMLS_DC)
+static int _xdebug_body_write(const char *str, uint str_length TSRMLS_DC)
 {
+ if (!SG(headers_sent)) {
+ return _xdebug_header_write(str, str_length TSRMLS_CC);
+ }
         zend_unset_timeout(TSRMLS_C);
         if (XG(stdout_redirected) != 0) {
                 _xdebug_send_stream("stdout", str, str_length TSRMLS_CC);
@@ -817,7 +821,7 @@
 
         /* let PHP also send it out, as it may be needed */
         zend_set_timeout(EG(timeout_seconds));
- return XG(stdio).php_header_write(str, str_length TSRMLS_CC);
+ return XG(stdio).php_body_write(str, str_length TSRMLS_CC);
 }
 
 DBGP_FUNC(stderr)
@@ -1534,7 +1538,7 @@
 
 char *xdebug_dbgp_get_revision(void)
 {
- return "$Revision: 1.47 $";
+ return "$Revision: 1.48 $";
 }
 
 int xdebug_dbgp_cmdloop(xdebug_con *context TSRMLS_DC)
Received on Thu Jul 15 2004 - 04:16:53 BST

This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:02 BST