|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-07-22 15:13 UTC] andy at boeckler dot org
Description:
------------
I'm getting Ajax-Request-Failures since PHP5 throws HTTP-500 Errors back.
This was not the case before upgrading from PHP4.
This is annoying:
* E_STRICT are filtered out
* when display_errors is ON, the request is OK!
* display_errors ON is no option on a productionserver
It only works, when ob_flush() is called before exit() (see staticFunc2)
Reproduce code:
---------------
<?php
error_reporting(E_ALL & ~E_NOTICE); // NO E_STRICT is in here
ini_set('display_errors', 'off');
//ini_set('display_errors', 'on');
class Test {
public staticFunc() { echo 'boo'; exit(); }
public staticFunc2() { echo 'boo'; ob_flush(); exit(); }
}
Test::staticFunc();
?>
Expected result:
----------------
HTTP 200
Actual result:
--------------
HTTP 500, w/o ob_flush() when display_errors is off
HTTP 200, w/o ob_flush() when display_errors is ON
HTTP 200, with ob_flush()
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 21:00:01 2025 UTC |
Sorry .. the code example goes in the wrong direction I've narrowed the actual issue. It has to do with evaled code. The @eval-Function is not catched properly. <?php error_reporting(E_ALL & ~E_NOTICE); class Test { function func1() { // HTTP 500 ini_set('display_errors', 'off'); @eval('completely wrong'); echo 'boo'; exit(); } function func2() { //HTTP 200 ini_set('display_errors', 'on'); @eval('completely wrong'); echo 'boo'; exit(); } function func3() { // HTTP 200 and HTTP 500 with output buffering ini_set('display_errors', 'off'); echo 'noerror'; @eval('completely wrong'); echo 'boo'; exit(); } } Test::func1(); //Test::func2(); //Test::func3(); ?>