#43358 [Com]: 500 HTTP error when eval()'d code contains a notice/warning

From: Date: Tue, 26 Feb 2008 11:31:05 +0000
Subject: #43358 [Com]: 500 HTTP error when eval()'d code contains a notice/warning
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-122717@lists.php.net to get a copy of this message
ID: 43358 Comment by: zorfling at hotmail dot com Reported By: andrea dot spacca at gmail dot com Status: Open Bug Type: *General Issues Operating System: Gentoo PHP Version: 5.2.5 New Comment: Hi, I've been having the same problem and thought I'd post my workaround. If you simply overwrite the headers to return a 200, it works. eg header("Content-type: text/html", true, 200); (second arg is to overwrite the current header) NB This needs to be called AFTER the eval that causes the issue. Hope this helps, Chris Previous Comments: ------------------------------------------------------------------------ [2007-12-17 22:28:38] not at public dot com This is an existing bug. Having the same error on 2.5.4 on FreeBSD. A failed eval results in a 500 error, although when calling error_log() on the last line of the code, the php script does reach and execute that. The script is executed correctly, and the response from the server also includes the ( correct ) output of the script without any php errors, but after the 500 header ofcourse. Browsers hang on the error and don't show the output. ------------------------------------------------------------------------ [2007-11-21 13:41:33] andrea at spacca dot org here you can test the http response on our enviroment: http://89.186.95.3/test/testBug.cgi ------------------------------------------------------------------------ [2007-11-21 10:23:41] andrea at spacca dot org from our httpd.conf: LoadModule php5_module etc etc AddType application/x-httpd-php .php .cgi ------------------------------------------------------------------------ [2007-11-21 10:13:12] andrea dot spacca at gmail dot com Description: ------------ When E_NOTICE or E_WARNING happen in eval'd code the script return 500 HTTP respons even on not blank pages PS: third time i have to open the bug, 'cause jani@php.net continue to close it as bogus without wait my reply to his comments. i'll put, as soon as possibile, a script online on our server so you could test the behaviour on the enviroment where we reproduce the bug Reproduce code: --------------- <?php eval('$pluto = "test ".UNDEFINED_CONST." test";'); echo 'AFTER'; ?> Expected result: ---------------- Apache Access Log: 192.168.1.1 - - [20/Nov/2007:16:09:23 +0100] "GET /testBug.cgi HTTP/1.1" 200 25 Actual result: -------------- Apache Access Log: 192.168.1.1 - - [20/Nov/2007:16:09:23 +0100] "GET /testBug.cgi HTTP/1.1" 500 25 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43358&edit=1

« previous php.bugs (#122717) next »