Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60717 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45330 invoked from network); 1 Jun 2012 16:50:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Jun 2012 16:50:14 -0000 Authentication-Results: pb1.pair.com header.from=truth@proposaltech.com; sender-id=softfail Authentication-Results: pb1.pair.com smtp.mail=truth@proposaltech.com; spf=softfail; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain proposaltech.com does not designate 66.94.236.17 as permitted sender) X-PHP-List-Original-Sender: truth@proposaltech.com X-Host-Fingerprint: 66.94.236.17 nm15-vm0.access.bullet.mail.mud.yahoo.com Received: from [66.94.236.17] ([66.94.236.17:41474] helo=nm15-vm0.access.bullet.mail.mud.yahoo.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A5/A4-45898-5C2F8CF4 for ; Fri, 01 Jun 2012 12:50:13 -0400 Received: from [66.94.237.196] by nm15.access.bullet.mail.mud.yahoo.com with NNFMP; 01 Jun 2012 16:50:11 -0000 Received: from [98.139.244.49] by tm7.access.bullet.mail.mud.yahoo.com with NNFMP; 01 Jun 2012 16:50:11 -0000 Received: from [127.0.0.1] by smtp111.sbc.mail.bf1.yahoo.com with NNFMP; 01 Jun 2012 16:50:11 -0000 X-Yahoo-Newman-Id: 240283.98951.bm@smtp111.sbc.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: l85Pwx8VM1kZkjJ5bvz8XXtATXI82Im6yaGhkn6_Sf2eOr2 F.Z2dLKLRZ8EYi89Jp0RUnLos0XC5eKdcdUhvSN4IexElcwtOyq8lngOnMXZ gSEzL2v12kqaxTlfmRRkGmPIs4O8hLRh9MQwg4n3AAYJr6VeSin3QTeIGl8Y Cn054EnT4MLltaPnxlBfwcxzwcSuY8MTRynDxBbceJ1IQzJp3D5A17P7z2Ig 9BZldDK2.uMuzntNBh4P4eOgfyPsAvPjtVT1No.Q64sx0Dud0eJvzwY3eEow c94394N3IgLqebVoL_G5.1BytIrDxdc7GvW_vHk9evMX2awz85pN55WuALnV sVeDG3lJN3ogqzQuVva_hcKpXSGNIJacajcMzGsjN4qDf7p9fp5w8.Kzxn5u qxuNtvcV2l0PZn40ZqnEtrH0rJmxQssKDCDLYkUpsz4WYO7gB_SJuoEut_V5 eKvE3u.tNqnjL8eYKi7KslkWjDQvhU0Bd4tKD605w8617f2mbxAqLQGo3U1T OjO6AitY- X-Yahoo-SMTP: jWG9jiaswBBOCHlPTWD9zJWRnNyiDJE- Received: from [192.168.2.102] (truth@70.230.205.60 with login) by smtp111.sbc.mail.bf1.yahoo.com with SMTP; 01 Jun 2012 09:50:10 -0700 PDT To: internals@lists.php.net In-Reply-To: <1338526836.9578.94.camel@inspiron> References: <1338526062.9578.83.camel@inspiron> <1338526836.9578.94.camel@inspiron> Content-Type: text/plain; charset="ISO-8859-1" Date: Fri, 01 Jun 2012 09:50:09 -0700 Message-ID: <1338569409.27086.36.camel@inspiron> Mime-Version: 1.0 X-Mailer: Evolution 2.30.1.2 Content-Transfer-Encoding: 7bit Subject: Was php bug (IMHO). Have fix. Re: Bad eval() leading to response code 500 From: truth@proposaltech.com (Todd Ruth) eval() does indeed set the response code to 500 upon failure. Is that a bug? I'll file a report because I don't believe leaving the response code at 500 is consistent with the statement from the php.net page about eval(): "If there is a parse error in the evaluated code, eval() returns FALSE and execution of the following code continues normally." I don't think leaving the the response code at 500 is consistent with "continues normally". I believe the fix is one line, adding "&& EG(current_execute_data)->opline->extended_value != ZEND_EVAL" to the "if" clauses before setting the error header in main.c at line 1132. In case anyone finds my post from last night while doing a search of the archives, I'll explain more below and answer my question about debugging. What I didn't realize at the time of my post last night is that browsers don't mind receiving a 500 as long as everything else looks good. For example, the following web page: looks fine in a browser so I assumed (oops!) that it was returning code 200. If you try doing a wget on that example, it complains about the response code 500. (My big ugly application uses AJAX and the 500 caused my AJAX framework to reject the page.) Other than the code 500, everything seems to proceed normally. All of the other code is executed normally. The content of the web page is normal and is displayed well in a browser unless you have something checking for unhappy response codes. The answer to my question about watching the headers in the debugger turned out to be pretty easy: watch sapi_globals.sapi_headers watch sapi_globals.sapi_headers.http_response_code It would not have been so simple with ZTS on. (In that case, the TSRM macros come in to play.)