View Issue Details

IDProjectCategoryView StatusLast Update
0002177XdebugStep Debuggingpublic2023-05-24 16:26
Reporteralxmrz Assigned Toderick  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionno change required 
Product Version3.2.1 
Summary0002177: Segmentation fault on recursion
Description

Segmentation fault occurs on infinite recursion when xdebug is installed and xdebug.mode=debug.

Steps To Reproduce

Run code:
function callMe()
{
callMe();
}

callMe();

Tagserror, php 8.1
Operating SystemUbuntu
PHP Version8.1.0-8.1.4

Activities

derick

2023-05-24 16:26

administrator   ~0006567

Last edited: 2023-05-24 16:26

This is expected behaviour. If you create a infinite recursion than PHP can run out of stack space, which it does here. In most situations when Xdebug is not loaded, you run out of normal system memory before this stack overflow happens, which is why you wouldn't see it without xdebug loaded in most cases.

There is a workaround though, through Xdebug's develop mode. If you set xdebug.mode=develop,debug, the result of this will be an error like:

Fatal error: Uncaught Error: Xdebug has detected a possible infinite loop, and aborted your script with a stack depth of '256' frames in Standard input code on line 4

Error: Xdebug has detected a possible infinite loop, and aborted your script with a stack depth of '256' frames in Standard input code on line 4

Call Stack:
    7.6736     439624   1. {main}() Standard input code:0
    7.6736     439624   2. callMe() Standard input code:7
…

Which should then give a good hint as to how to fix your code.

Issue History

Date Modified Username Field Change
2023-04-30 19:26 alxmrz New Issue
2023-04-30 19:26 alxmrz Tag Attached: error
2023-04-30 19:26 alxmrz Tag Attached: php 8.1
2023-05-24 16:26 derick Assigned To => derick
2023-05-24 16:26 derick Status new => resolved
2023-05-24 16:26 derick Resolution open => no change required
2023-05-24 16:26 derick Note Added: 0006567
2023-05-24 16:26 derick Note Edited: 0006567