View Issue Details

IDProjectCategoryView StatusLast Update
0002213XdebugStep Debuggingpublic2025-12-04 14:50
ReporterZobo Assigned To 
PrioritynormalSeverityfeatureReproducibilityhave not tried
Status closedResolutionfixed 
Product Version3.2.2 
Target Version3.5devFixed in Version3.5.0 
Summary0002213: Expose __EXCEPTION virtual variable for current EG(exception)
Description

In some cases it is useful to have access to the last thrown exception. Add a feature flag (virtual_exception_value) that, when an exception is active, adds the current exception object value as separate entry in the return variables in the top stack frame online. The name of this pseudo variable will be $__EXCEPTION.

Steps To Reproduce
<?php

throw new \Exception("TEST");
breakpoint_set -t exception -x *
run
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="run" transaction_id="2" status="break" reason="ok"><xdebug:message filename="file:///C:/local_disk/zobo/Projects/vscode-php-debug/TEST/ex.php" lineno="5" exception="Exception"><![CDATA[TEST]]></xdebug:message></response>
TagsNo tags attached.
Operating System
PHP Version8.2.0-8.2.9

Activities

Zobo

2023-11-16 14:12

reporter   ~0006680

Proposing patch: https://github.com/xdebug/xdebug/pull/922

derick

2025-04-11 10:56

administrator   ~0007246

Thanks for the patch! I have merged this now.