View Issue Details

IDProjectCategoryView StatusLast Update
0002213XdebugStep Debuggingpublic2025-04-11 10:56
ReporterZobo Assigned Toderick  
PrioritynormalSeverityfeatureReproducibilityhave not tried
Status closedResolutionfixed 
Product Version3.2.2 
Target Version3.5devFixed in Version3.5dev 
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.

Issue History

Date Modified Username Field Change
2023-11-15 17:32 Zobo New Issue
2023-11-16 14:12 Zobo Note Added: 0006680
2023-11-30 10:42 derick Severity minor => feature
2023-11-30 10:42 derick Target Version => 3.4dev
2024-03-28 09:14 derick Assigned To => derick
2024-03-28 09:14 derick Status new => confirmed
2025-04-11 10:36 derick Summary Give access to thrown Exception object => Expose __EXCEPTION virtual variable for current EG(exception)
2025-04-11 10:36 derick Description Updated
2025-04-11 10:36 derick Steps to Reproduce Updated
2025-04-11 10:37 derick Target Version 3.4dev => 3.5dev
2025-04-11 10:56 derick Status confirmed => closed
2025-04-11 10:56 derick Resolution open => fixed
2025-04-11 10:56 derick Fixed in Version => 3.5dev
2025-04-11 10:56 derick Note Added: 0007246