View Issue Details

IDProjectCategoryView StatusLast Update
0001477XdebugUncategorizedpublic2017-12-17 14:38
ReporterLanaZem Assigned Toderick  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionnot fixable 
Product Version2.5.5 
Summary0001477: Stream 'stdout' doesn't send all output to IDE
Description

'stdout' options configured to copy all output skips output for 'xdebug_debug_zval_stdout(...)' and 'file_put_contents(...)' methods.

https://xdebug.org/docs-dbgp.php#stdout-stderr

Steps To Reproduce

1) Create php file
<?php
echo "Regular output";
xdebug_debug_zval_stdout("Xdebug stdout");
file_put_contents('php://stdout', "Log information");

2) Enable stdout with "stdout -i 1 -c 1"

<- stdout -i 5 -c 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug&quot; command="stdout" transaction_id="5" success="1"></response>

3) Execute debugger

I expect to see all "Regular output", "Xdebug stdout" and "Log information" streams but only "Regular output" will be here.

Additional Information

Reproducible for Xdebug 2.5.5 + PHP 7.1.1.

Logs are attached.

TagsNo tags attached.
Attached Files
xdebug_7_2.5.log (4,571 bytes)   
Log opened at 2017-10-04 09:20:06
I: Connecting to configured address/port: localhost:9000.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///home/user/PhpstormProjects/xdebug_notifications/app/stdout.php" language="PHP" xdebug:language_version="7.1.1" protocol_version="1.0" appid="9822" idekey="XDEBUG_ECLIPSE"><engine version="2.5.5"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2017 by Derick Rethans]]></copyright></init>

<- feature_set -i 1 -n show_hidden -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="show_hidden" success="1"></response>

<- feature_set -i 2 -n max_depth -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="max_depth" success="1"></response>

<- feature_set -i 3 -n max_children -v 100
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="max_children" success="1"></response>

<- feature_set -i 4 -n extended_properties -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" status="starting" reason="ok"><error code="3"><message><![CDATA[invalid or missing options]]></message></error></response>

<- stdout -i 5 -c 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stdout" transaction_id="5" success="1"></response>

<- status -i 6
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="status" transaction_id="6" status="starting" reason="ok"></response>

<- step_into -i 7
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="7" status="break" reason="ok"><xdebug:message filename="file:///home/user/PhpstormProjects/xdebug_notifications/app/stdout.php" lineno="3"></xdebug:message></response>

<- eval -i 8 -- aXNzZXQoJF9TRVJWRVJbJ1BIUF9JREVfQ09ORklHJ10p
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="8"><property type="bool"><![CDATA[0]]></property></response>

<- eval -i 9 -- aXNzZXQoJF9TRVJWRVJbJ1NFUlZFUl9OQU1FJ10p
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="9"><property type="bool"><![CDATA[1]]></property></response>

<- eval -i 10 -- KHN0cmluZykoJF9TRVJWRVJbJ1NFUlZFUl9OQU1FJ10p
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="10"><property type="string" size="9" encoding="base64"><![CDATA[bG9jYWxob3N0]]></property></response>

<- eval -i 11 -- KHN0cmluZykoJF9TRVJWRVJbJ1NFUlZFUl9QT1JUJ10p
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="11"><property type="string" size="4" encoding="base64"><![CDATA[ODA4MQ==]]></property></response>

<- eval -i 12 -- KHN0cmluZykoJF9TRVJWRVJbJ1JFUVVFU1RfVVJJJ10p
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="12"><property type="string" size="15" encoding="base64"><![CDATA[L2FwcC9zdGRvdXQucGhw]]></property></response>

<- breakpoint_set -i 13 -t line -f file:///home/user/PhpstormProjects/xdebug_notifications/app/test.php -n 9
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="13" id="98220001"></response>

<- stack_get -i 14
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="14"><stack where="{main}" level="0" type="file" filename="file:///home/user/PhpstormProjects/xdebug_notifications/app/stdout.php" lineno="3"></stack></response>

<- run -i 15
-> <stream xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" type="stdout" encoding="base64"><![CDATA[UmVndWxhciBvdXRwdXQ=]]></stream>

-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="15" status="stopping" reason="ok"></response>

<- run -i 16
Log closed at 2017-10-04 09:20:06

xdebug_7_2.5.log (4,571 bytes)   
Operating System
PHP Version7.1.0-7.1.4

Activities

LanaZem

2017-10-04 09:37

reporter   ~0004433

I've added php script file with incorrect 'xdebug_debug_zval_stdout' usage.

Here's the right one, the ouput from 'xdebug_debug_zval_stdout' still won't be sent:

<?php
echo "Regular output";
$a = array(1, 2, 3);
xdebug_debug_zval_stdout('a');
file_put_contents('php://stdout', "Log information");

langemeijer

2017-10-06 14:38

reporter   ~0004436

Hi Derick,

A bit of context for this issue: LanaZem is working to fix my feature request in PhpStorm: Xdebug stdout redirection, and show it in the 'Console' tab on the debugger panel.

https://youtrack.jetbrains.com/issue/WI-18714

derick

2017-12-17 14:38

administrator   ~0004518

Hi,

I have had a look, and I don't think this is something I can fix. Most normal output in PHP goes through it's SAPI layer, which Xdebug can hook into to intercept output. However, direct output to stdout, which is what xdebug_debug_zval_stdout() and file_put_contents("php://stdout", ...) do, does not go through the SAPI layer, and hence Xdebug can't intercept it. Which means I can't send it over the debugging protocol.

cheers,
Derick

Issue History

Date Modified Username Field Change
2017-10-04 09:29 LanaZem New Issue
2017-10-04 09:29 LanaZem File Added: xdebug_7_2.5.log
2017-10-04 09:37 LanaZem Note Added: 0004433
2017-10-06 14:38 langemeijer Note Added: 0004436
2017-12-17 14:38 derick Note Added: 0004518
2017-12-17 14:38 derick Status new => resolved
2017-12-17 14:38 derick Resolution open => not fixable
2017-12-17 14:38 derick Assigned To => derick
2020-03-12 16:35 derick Category Usage problems (Wrong Results) => Variable Display
2020-03-12 16:38 derick Category Variable Display => Uncategorized