View Issue Details

IDProjectCategoryView StatusLast Update
0000958XdebugUncategorizedpublic2017-03-19 22:15
Reporterericol Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionwon't fix 
Product Version2.2.1 
Summary0000958: XDebug doesn't breakpoint at code called by preg_replace (Might affect other functions)
Description

If you make preg_replace call a function when replacing some text, any breakpoint set in the function isn't honoured.

Steps To Reproduce

In this code, place a breakpoint in line 5 ("echo $txt") and another in line 8 ("return 'h';"). Execution stops at line 5, but not at line 8.

<?php

$txt="AaAaAaAaAa";
$txt=preg_replace(array('/[a-z]/e'), array("replace(\"$1\")"), $txt);
echo $txt;

function replace($txt) {
return 'h';
}
?>

TagsDoesn't Break
Operating SystemWindows 7
PHP Version5.3.1

Activities

derick

2013-07-09 07:59

administrator   ~0002533

Could you create an accompanying remote debugging log with such a debugging session with that script? You can make one by turning on xdebug.remote_log=c:\temp\xdebug.log (or similar name of course).

ericol

2013-08-06 17:51

reporter   ~0002553

Hey,
apologies on the late response. I saw the email and thought about doing that later, and then completely forgot about it.
Attached is the log, hope that helps.

derick

2013-10-09 18:36

administrator   ~0002573

I've had a look at this and I can see what is wrong. Requires hackyness for preg replace and "regexp code" in filename checks.

derick

2017-03-19 22:15

administrator   ~0004236

I had a look at this again, and the /e modifier is no longer available in PHP 7.x for preg_replace - instead, you need to use preg_match_replace.

As this is sort of a new feature, which would only apply for PHP 5, I have decided not to add this new "hacky" functionality that relies on string matching a filename.