Skip to content

Commit

Permalink
Added a test case for bug #1083.
Browse files Browse the repository at this point in the history
  • Loading branch information
derickr committed Jan 10, 2015
1 parent 5330799 commit 21583fc
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/bug01083.inc
@@ -0,0 +1,25 @@
<?php


function phpErrorCatcher($no = 0, $str = null, $file = null, $line = 0) {
throw new Exception($str);
}

set_error_handler("phpErrorCatcher", E_ALL);

function my_exception_handler() {
xdebug_break();
}

set_exception_handler("my_exception_handler");



function causeError() {
echo $undefined;
}



causeError();
?>
36 changes: 36 additions & 0 deletions tests/bug01083.phpt
@@ -0,0 +1,36 @@
--TEST--
Test for bug #1083: Segfault while retrieving information about uninitiased var.
--FILE--
<?php
require 'dbgp/dbgpclient.php';

$data = file_get_contents(dirname(__FILE__) . '/bug01083.inc');

$commands = array(
'step_into',
'breakpoint_set -t exception -x Exception',
'run',
'context_get -d 1 -c 0',
);

dbgpRun( $data, $commands );
?>
--EXPECTF--
<?xml version="1.0" encoding="iso-8859-1"?>
<init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///tmp/xdebug-dbgp-test.php" language="PHP" protocol_version="1.0" appid="" idekey=""><engine version=""><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2099 by Derick Rethans]]></copyright></init>

-> step_into -i 1
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="1" status="break" reason="ok"><xdebug:message filename="file:///tmp/xdebug-dbgp-test.php" lineno="4"></xdebug:message></response>

-> breakpoint_set -i 2 -t exception -x Exception
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="2" id=""></response>

-> run -i 3
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="3" status="break" reason="ok"><xdebug:message filename="file:///tmp/xdebug-dbgp-test.php" lineno="5" exception="Exception"><![CDATA[Undefined variable: undefined]]></xdebug:message></response>

-> context_get -i 4 -d 1 -c 0
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="4" context="0"><property name="$undefined" fullname="$undefined" type="uninitialized"></property></response>

0 comments on commit 21583fc

Please sign in to comment.