View Issue Details

IDProjectCategoryView StatusLast Update
0001552XdebugUncategorizedpublic2020-03-12 18:01
ReporterRobert Lu Assigned Toderick  
PrioritylowSeverityfeatureReproducibilityalways
Status resolvedResolutionno change required 
Product Version2.6.0 
Target Version2.8.0dev 
Summary0001552: When display_error is On, http status is 200 with Fatal Error
Description

When display_error is On(in php.ini).

If an Exception has been throw in PHP, the HTML result is about Exception information.

But the HTTP status code is 200, not 500.

Steps To Reproduce
  1. make sure display_error is On
  2. write index.php with content:
    <?php
    throw new RuntimeException();
  3. access with nginx -> fpm.
  4. you will see error page with http code 200
TagsNo tags attached.
Operating System
PHP Version7.0-dev

Activities

Robert Lu

2018-05-19 08:21

reporter   ~0004658

It also affects PHP 7.1-dev.

pull request: https://github.com/xdebug/xdebug/pull/420

derick

2019-08-02 13:42

administrator   ~0005100

Last edited: 2019-08-02 13:42

Hi,

you're right, but this is also exactly what PHP without Xdebug does.

I've created a file "foo2.php", with the following contents:


<?php
throw new RuntimeException();

With Xdebug, and the two versions of display_errors, it does this:


derick@singlemalt:/tmp$ php -ddisplay_errors=0 -S localhost:8111
[Fri Aug 2 14:37:56 2019] PHP 7.4.0-dev Development Server (http://localhost:8111) started
[Fri Aug 2 14:37:59 2019] [::1]:47378 Accepted
[Fri Aug 2 14:37:59 2019] [::1]:47378 [500]: GET /foo2.php - Uncaught RuntimeException in /tmp/foo2.php:2
Stack trace:
#0 {main}
thrown in /tmp/foo2.php on line 2
[Fri Aug 2 14:37:59 2019] [::1]:47378 Closing
^C
derick@singlemalt:/tmp$ php -ddisplay_errors=1 -S localhost:8111
[Fri Aug 2 14:38:55 2019] PHP 7.4.0-dev Development Server (http://localhost:8111) started
[Fri Aug 2 14:38:59 2019] [::1]:47394 Accepted
[Fri Aug 2 14:38:59 2019] [::1]:47394 [200]: GET /foo2.php - Uncaught RuntimeException in /tmp/foo2.php:2
Stack trace:
#0 {main}
thrown in /tmp/foo2.php on line 2
[Fri Aug 2 14:38:59 2019] [::1]:47394 Closing

But, without Xdebug (I use the -n argument), it also does the same thing:


derick@singlemalt:/tmp$ php -n -ddisplay_errors=0 -S localhost:8111
[Fri Aug 2 14:39:58 2019] PHP 7.4.0-dev Development Server (http://localhost:8111) started
[Fri Aug 2 14:40:02 2019] [::1]:47400 Accepted
[Fri Aug 2 14:40:02 2019] [::1]:47400 [500]: GET /foo2.php - Uncaught RuntimeException in /tmp/foo2.php:2
Stack trace:
#0 {main}
thrown in /tmp/foo2.php on line 2
[Fri Aug 2 14:40:02 2019] [::1]:47400 Closing
^C
derick@singlemalt:/tmp$ php -n -ddisplay_errors=1 -S localhost:8111
[Fri Aug 2 14:40:08 2019] PHP 7.4.0-dev Development Server (http://localhost:8111) started
[Fri Aug 2 14:40:10 2019] [::1]:47402 Accepted
[Fri Aug 2 14:40:10 2019] [::1]:47402 [200]: GET /foo2.php - Uncaught RuntimeException in /tmp/foo2.php:2
Stack trace:
#0 {main}
thrown in /tmp/foo2.php on line 2
[Fri Aug 2 14:40:10 2019] [::1]:47402 Closing

As Xdebug's behaviour is the same as with normal PHP, there is no bug (on the Xdebug side).

Issue History

Date Modified Username Field Change
2018-05-19 07:24 Robert Lu New Issue
2018-05-19 08:21 Robert Lu Note Added: 0004658
2019-02-02 01:12 derick Status new => acknowledged
2019-02-02 01:12 derick Target Version => 2.7.0
2019-02-12 16:38 derick Assigned To => derick
2019-02-12 16:38 derick Status acknowledged => assigned
2019-03-06 11:38 derick Target Version 2.7.0 => 2.7.0dev
2019-06-28 11:16 derick Target Version 2.7.0dev => 2.8.0dev
2019-08-02 13:41 derick Status assigned => resolved
2019-08-02 13:41 derick Resolution open => no change required
2019-08-02 13:42 derick Note Added: 0005100
2019-08-02 13:42 derick Note Edited: 0005100
2020-03-12 16:55 derick Severity tweak => feature
2020-03-12 18:01 derick Category Feature/Change request => Uncategorized