[xdebug-dev] xdebug xdebug/xdebug.c xdebug/tests/bug00265.phpt - Fixed bug #265: XDebug breaks error_get_last() .

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Tue, 22 May 2007 22:33:36 +0200

Date: Tue May 22 22:33:33 CEST 2007
User: Derick Rethans
Directory: xdebug

Log Message:
[0.25]
- Fixed bug #265: XDebug breaks error_get_last() .

Modified files:
           xdebug/xdebug.c (version: 1.386)
Added files:
           xdebug/tests/bug00265.phpt (new version: 1.1)

[FILE: /xdebug/xdebug.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.385
retrieving revision 1.386
diff -u -r1.385 -r1.386
--- xdebug/xdebug.c:1.385 Wed May 16 14:11:24 2007 GMT
+++ xdebug/xdebug.c Tue May 22 18:33:27 2007 GMT
@@ -2177,6 +2177,18 @@
 
         error_type_str = xdebug_error_type(type);
 
+ /* Store last error message for error_get_last() */
+ if (PG(last_error_message)) {
+ free(PG(last_error_message));
+ }
+ if (PG(last_error_file)) {
+ free(PG(last_error_file));
+ }
+ PG(last_error_type) = type;
+ PG(last_error_message) = strdup(buffer);
+ PG(last_error_file) = strdup(error_filename);
+ PG(last_error_lineno) = error_lineno;
+
 #if PHP_MAJOR_VERSION >= 5
         /* according to error handling mode, suppress error, throw exception or show it */
         if (PG(error_handling) != EH_NORMAL) {

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

--TEST--
Test for bug #265: Xdebug's error handler breaks error_get_last().
--SKIPIF--
<?php if (!extension_loaded("xdebug")) print "skip"; ?>
<?php if(version_compare(zend_version(), "2.0.0-dev", '<')) echo "skip Zend Engine 2 needed\n"; ?>
--INI--
--FILE--
<?php
register_shutdown_function( 'f' );
function f(){
            var_dump(error_get_last());
}
$a = $b;
var_dump(error_get_last());
$a = $b['no'];
var_dump(error_get_last());
gabba();
?>
--EXPECTF--
Notice: Undefined variable: b in %sbug00265.php on line 6

Call Stack:
%w%f %w%d 1. {main}() %sbug00265.php:0

array(4) {
  ["type"]=>
  int(8)
  ["message"]=>
  string(21) "Undefined variable: b"
  ["file"]=>
  string(46) "%sbug00265.php"
  ["line"]=>
  int(6)
}

Notice: Undefined variable: b in %sbug00265.php on line 8

Call Stack:
%w%f %w%d 1. {main}() %sbug00265.php:0

array(4) {
  ["type"]=>
  int(8)
  ["message"]=>
  string(21) "Undefined variable: b"
  ["file"]=>
  string(46) "%sbug00265.php"
  ["line"]=>
  int(8)
}

Fatal error: Call to undefined function gabba() in %sbug00265.php on line 10

Call Stack:
%w%f %w%d 1. {main}() %sbug00265.php:0

array(4) {
  ["type"]=>
  int(1)
  ["message"]=>
  string(34) "Call to undefined function gabba()"
  ["file"]=>
  string(46) "%sbug00265.php"
  ["line"]=>
  int(10)
}
Received on Tue May 22 2007 - 22:33:48 BST

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