Bug #60523 [Csd]: PHP Errors are not reported in browsers using built-in SAPI
| From: | lolautruche at gmail dot com | Date: | Mon, 19 Dec 2011 10:31:40 +0000 |
| Subject: | Bug #60523 [Csd]: 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-165964@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
User updated by: lolautruche at gmail dot com
Reported by: lolautruche at gmail dot com
Summary: PHP Errors are not reported in browsers using
built-in SAPI
Status: Closed
Type: Bug
Package: Built-in web server
Operating System: Mac OS X 10.7.2 (Lion)
PHP Version: 5.4SVN-2011-12-14 (snap)
Assigned To: moriyoshi
Block user comment: N
Private report: N
New Comment:
Perfect, thanks !
Previous Comments:
------------------------------------------------------------------------
[2011-12-16 19:25:28] laruence@php.net
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
Moriyoshi, I fix this for you, hope you don't mind, thanks :)
------------------------------------------------------------------------
[2011-12-16 19:24:43] laruence@php.net
Automatic comment from SVN on behalf of laruence
Revision: http://svn.php.net/viewvc/?view=revision&revision=321074
Log: Fixed bug #60523 (PHP Errors are not reported in browsers using built-in SAPI)
------------------------------------------------------------------------
[2011-12-14 14:49:19] derick@php.net
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).
------------------------------------------------------------------------
[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