php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45645 eval causes "Internal Server Error"
Submitted: 2008-07-28 13:58 UTC Modified: 2008-07-29 17:27 UTC
From: sergey89 at gmail dot com Assigned:
Status: Not a bug Package: PHP options/info functions
PHP Version: 5.2.6 OS: Debian GNU/Linux 4.0r3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: sergey89 at gmail dot com
New email:
PHP Version: OS:

 

 [2008-07-28 13:58 UTC] sergey89 at gmail dot com
Description:
------------
I evaluate broken script with eval function. If display_errors is On i get status 200 in http response, but if is Off i get status 500. It is normal behaviour? error.log is empty.

Reproduce code:
---------------
<?php
ini_set('log_errors', 1);
ini_set('display_errors', 0);
eval('some)broken-code|');

Expected result:
----------------
HTTP/1.x 200 Ok

Actual result:
--------------
HTTP/1.x 500 Internal Server Error

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-28 14:39 UTC] sergey89 at gmail dot com
After eval() script continues executing normally and I see expected result on the page.
 [2008-07-28 20:07 UTC] jani@php.net
Quite logically expected: You want to see errors -> errors are shown -> http status is 200. In case there is nothing to output, you get 500.

 [2008-07-29 11:14 UTC] sergey89 at gmail dot com
Where is the logic?

---
<?php
print 123;
ob_flush();
ini_set('display_errors', 0);
eval('aa|bb/cc');

Out: 123 and status 200

---
<?php
print 123;
ini_set('display_errors', 0);
eval('aa|bb/cc');

Out: 123 and status 500
 [2008-07-29 17:27 UTC] lbarnaud@php.net
In the first example the headers has already been sent (due to ob_flush()), so PHP can't set the HTTP status code.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 07 02:01:30 2024 UTC