[xdebug-dev] xdebug xdebug/xdebug.c xdebug/tests/bug00178.phpt - Fixed bug #178: $php_errormsg and Track errors unavailable.

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Sun, 7 May 2006 23:55:49 +0200

Date: Sun May 7 23:55:49 CEST 2006
User: Derick Rethans
Directory: xdebug

Log Message:
[0.40]
- Fixed bug #178: $php_errormsg and Track errors unavailable.

Modified files:
           xdebug/xdebug.c (version: 1.313)
Added files:
           xdebug/tests/bug00178.phpt (new version: 1.1)

[FILE: /xdebug/xdebug.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.312
retrieving revision 1.313
diff -u -r1.312 -r1.313
--- xdebug/xdebug.c:1.312 Sun May 07 19:36:37 2006 GMT
+++ xdebug/xdebug.c Sun May 07 19:55:49 2006 GMT
@@ -1567,7 +1567,9 @@
                                 char *tmp_varname, *tmp_value, *tmp_fancy_value;
 
                                 if (c) {
- php_printf(", ");
+ if (!log_only) {
+ php_printf(", ");
+ }
                                         if (PG(log_errors) && !is_cli) {
                                                 xdebug_str_addl(&log_buffer, ", ", 2, 0);
                                         }
@@ -1914,8 +1916,6 @@
         }
         xdfree(error_type_str);
 
- efree(buffer);
-
         /* Bail out if we can't recover */
         switch (type) {
                 case E_CORE_ERROR:
@@ -1935,6 +1935,19 @@
                         }
                         break;
         }
+
+ if (PG(track_errors) && EG(active_symbol_table)) {
+ zval *tmp;
+
+ ALLOC_ZVAL(tmp);
+ INIT_PZVAL(tmp);
+ Z_STRVAL_P(tmp) = (char *) estrndup(buffer, buffer_len);
+ Z_STRLEN_P(tmp) = buffer_len;
+ Z_TYPE_P(tmp) = IS_STRING;
+ zend_hash_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg"), (void **) & tmp, sizeof(zval *), NULL);
+ }
+
+ efree(buffer);
 }
 
 /* {{{ zend_op_array srm_compile_file (file_handle, type)

[FILE: /xdebug/tests/bug00178.phpt]

--TEST--
Test for bug #178: $php_errormsg and Track errors unavailable
--INI--
xdebug.default_enable=1
xdebug.auto_trace=0
xdebug.trace_options=0
xdebug.trace_output_dir=/tmp
xdebug.collect_return=1
xdebug.collect_params=1
xdebug.auto_profile=0
xdebug.profiler_enable=0
xdebug.dump_globals=0
xdebug.show_mem_delta=0
xdebug.trace_format=0
track_errors=1
display_errors=0
--FILE--
<?php
fsockopen();
echo "> ", $php_errormsg, "\n";
fsockopen( 'localhost', 5000, $errno, $errstr, 0.02 );
echo "> ", $php_errormsg, "\n";
?>
DONE
--EXPECT--
> fsockopen() expects at least 1 parameter, 0 given
> unable to connect to localhost:5000 (Connection refused)
DONE
Received on Sun May 07 2006 - 23:55:56 BST

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