Bug #60523 [Opn->Ana]: PHP Errors are not reported in browsers using built-in SAPI
| From: | derick@php.net | Date: | Wed, 14 Dec 2011 14:49:20 +0000 |
| Subject: | Bug #60523 [Opn->Ana]: PHP Errors are not reported in browsers using built-in SAPI | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-165860@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60523&edit=1
ID: 60523
Updated by: derick@php.net
Reported by: lolautruche at gmail dot com
Summary: PHP Errors are not reported in browsers using
built-in SAPI
-Status: Open
+Status: Analyzed
Type: Bug
Package: Built-in web server
Operating System: Mac OS X 10.7.2 (Lion)
PHP Version: 5.4SVN-2011-12-14 (snap)
Block user comment: N
Private report: N
New Comment:
To follow up on that:
Without the router, php_cli_server_dispatch_script is used and php_execute_script
(sapi/cli/php_cli_server.c:1838) is run. With the router, php_cli_server_dispatch_router is used and
zend_execute_scripts is run (sapi/cli/php_cli_server.c:1951). The former sets
PG(during_request_startup) = 0; but the latter never does. Hence for the whole request,
PG(during_request_startup) = 1 as set by php_request_startup in main/main.c:1520. The comment on
line 1565 (/* We turn this off in php_execute_script() */) explains why php_execute_script (which
wraps zend_execute_scripts, main/main.c:2476) sets it to 0.
The php_cli_server_dispatch_router function should do PG(during_request_startup) = 0 somewhere
before it calls zend_execute_scripts (I think).
Previous Comments:
------------------------------------------------------------------------
[2011-12-14 14:28:14] lolautruche at gmail dot com
Description:
------------
Hi
Using new built-in SAPI with a router script, if a fatal error occurs (or any
other notice/warning), it is reported in the PHP webserver log but not to the
browser.
It makes errors harder to detect.
According to DerickR : "With a router, PG(during_request_startup) isn't set to 0"
Test script:
---------------
- Make a test.php script forcing a fatal error
- Make a router script named router.php, requiring test.php
- Start built-in webserver : php -S localhost:8000 router.php
- Go to http://localhost:8000 with your browser
test.php :
<code>
// Forcing a fatal error
$foo = null;
$foo->bar();
</code>
router.php :
<code>
require_once 'test.php';
</code>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60523&edit=1