MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001531XdebugUsage problems (Wrong Results)public2018-03-02 22:032018-03-03 14:44
ReporterCharlotteDunois 
Assigned Toderick 
PrioritynormalSeveritymajorReproducibilityalways
StatusassignedResolutionopen 
Platformx64OSWindowsOS Version7
Product Version2.6.0 
Target VersionFixed in Version 
Summary0001531: Xdebug var_dump sends HTTP header in CLI
DescriptionWhen using Xdebug's var_dump, it seems to send a Content-Type header on each usage even though it's run in CLI. The script in Steps To Reproduce always yields a "Cannot modify header information - headers already sent by" warning.
Steps To Reproduce<?php
function invokeDump($result) {
    ob_start('mb_output_handler');
    
    var_dump($result);
    $result = ob_get_clean();
    
    $result = explode("\n", str_replace("\r", "", $result));
    array_shift($result);
    $result = implode(PHP_EOL, $result);
    
    return $result;
}

echo invokeDump('hello');
echo invokeDump(null);
TagsNo tags attached.
Operating SystemWindows 7 Ultimate x64
PHP Version7.2.0-7.2.4
Attached Files? file icon phpinfo.php [^] (17 bytes) 2018-03-03 14:39
txt file icon phpinfo.txt [^] (33,624 bytes) 2018-03-03 14:39 [Show Content]

- Relationships

-  Notes
(0004603)
derick (administrator)
2018-03-03 12:12

I can't reproduce this with the CLI binary, but I can with the CGI binary. Although the latter doesn't show a "headers already sent by" warning either.

Are you sure you're running the CLI binary? Type the following on the command line:

php -v

And then also to see what the script really outputs:

php yourscript.php

Please include both command's outputs to this report.
(0004605)
CharlotteDunois (reporter)
2018-03-03 12:30

C:\>php -v
PHP 7.2.0 (cli) (built: Nov 28 2017 23:48:49) ( ZTS MSVC15 (Visual C++ 2017) x64 )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2017 Zend Technologies
    with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans

C:\>php test.php
C:\test.php:5:
string(5) "hello"
PHP Warning: Cannot modify header information - headers already sent by (output started at C:\test.php:
11) in C:\test.php on line 6
PHP Stack trace:
PHP 1. {main}() C:\test.php:0
PHP 2. invokeDump() C:\test.php:12
PHP 3. ob_get_clean() C:\test.php:6
PHP 4. mb_output_handler() C:\test.php:6
C:\test.php:5:
NULL
(0004606)
CharlotteDunois (reporter)
2018-03-03 12:34

v22014041588617949:~# php -v
PHP 7.2.0-1+0~20171201111145.14+jessie~1.gbp47ee8a (cli) (built: Dec 7 2017 18:17:03) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.2.0-1+0~20171201111145.14+jessie~1.gbp47ee8a, Copyright (c) 1999-2017, by Zend Technologies
    with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans

v22014041588617949:~# php test.php
string(5) "hello"
PHP Warning: Cannot modify header information - headers already sent by (output started at /root/test.php:15) in /root/test.php on line 6
PHP Stack trace:
PHP 1. {main}() /root/test.php:0
PHP 2. invokeDump() /root/test.php:16
PHP 3. ob_get_clean() /root/test.php:6
PHP 4. mb_output_handler() /root/test.php:6
NULL
(0004607)
derick (administrator)
2018-03-03 13:12

This is curious. The line numbers between your Windows output and Linux output don't match. And I still have no luck reproducing this. I'm wondering whether you have made mbstring settings or something like that.

Can you for the Linux case, add the output of "php -i" as an attachment to this report?

And I would also like to know on what sort of system this. Linux distribution, where the Debian package came from, and how you installed Xdebug (package, pecl, self-compile).
(0004609)
CharlotteDunois (reporter)
2018-03-03 14:44

Uh yeah, in the linux case I removed the lines manipulating $result (explode, etc.), they aren't really necessary for the repro...

OS: Debian Jessie
PHP package is from deb.sury.org
Xdebug is installed via pecl.
The php info is uploaded as phpinfo.txt (I uploaded the wrong file first :D).

- Issue History
Date Modified Username Field Change
2018-03-02 22:03 CharlotteDunois New Issue
2018-03-03 12:12 derick Note Added: 0004603
2018-03-03 12:12 derick Assigned To => derick
2018-03-03 12:12 derick Status new => feedback
2018-03-03 12:30 CharlotteDunois Note Added: 0004605
2018-03-03 12:30 CharlotteDunois Status feedback => assigned
2018-03-03 12:34 CharlotteDunois Note Added: 0004606
2018-03-03 13:12 derick Note Added: 0004607
2018-03-03 13:12 derick Status assigned => feedback
2018-03-03 14:39 CharlotteDunois File Added: phpinfo.php
2018-03-03 14:39 CharlotteDunois File Added: phpinfo.txt
2018-03-03 14:44 CharlotteDunois Note Added: 0004609
2018-03-03 14:44 CharlotteDunois Status feedback => assigned


Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker