Emit EXT_STMT after each pipe stage, and attach the TMP var that holds the intermediary result #19377
+22
−7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The following script:
Creates the following opcodes for the
testPipes()
function (without this patch):If users set a breakpoint on line
4 $result = "Hello World"
, then Xdebug realises this and moves it to line5
. This is because Xdebug only breaks onEXT_STMT
lines, and is clever enough to adjust the breakpoint.However, if you then would use "step over" then it would immediately go to line 10, as that's where the next
EXT_STMT
op is created. This means it is not possible to inspect the intermediary values being passed from pipe element to pipe element.This patch changes the opcode generation to add additional
EXT_STMT
opcodes in between each state:The
EXT_STMT
in op 4, 9, 14, and 21 are new, and also have as theirop1
value the intermediate pipe value.This allows Xdebug to break here, and show the contents of this hinted variable.
This however does not work (yet) for the closure wrapped stages as these are handled differently. Ideally they all have a similar
DECLARE_LAMBDA_FUNCTION/BIND_LEXICAL/INIT_DYNAMIC_CALL
set, but instead PHP creates nested closures instead:I can currently work around this by always breaking upon the return of a user-land closure, but this is not ideal. Instead, I would like to have an EXT_STMT in the original function just like in between
htmlentities
/strtolower
/str_split
).