It feels like there is a bug in php somewhere.  I'm trying to debug 
this myself before filing a report and am in over my head.  The
short version of my question may be "How do I set a watch on
SG(sapi_headers).http_response_code in the gdb?"
I think I need to debug it myself because I haven't been able to 
reproduce it in a simple case.  The following simple case works:

<?php
// In the real application there is a lot of code before this.
$x = eval('$y=0+;');
if ($x === false) {
    $x = 'Unknown';
}
// In the real application there is a lot of code between the
// above and the below.
print "x is $x\n";
?>

That always gives success.
In my big ugly application, I get a response code 500 if the eval
is given poorly formed code.  The exact same request is processed
happily if the eval of poorly formed code is commented out or
replaced with an eval of good code.  The poorly formed code can be 
as simple as the above example ('$y=0+;').

I've rebuilt apache 1.3.37 so that I can use gdb.  (I'm using
php 5.4.3)  After about 10 hours I've only gotten as far as 
learning that r->status becomes 500 while the headers are being 
prepared at the time of the print.  That happens in mod_php5.c
on line 231: r->status = SG(sapi_headers).http_response_code;
I guess my next step is to find out when 
SG(sapi_headers).http_response_code became 500.  Given that
the problem appears/goes away based on whether the eval is
given bad code, I'm guessing the response_code is being affected
by the eval(), but I'd like to be more concrete about it and
maybe even be able to come up with a fix (or at least a good
enough description that someone who really understands internals
can come up with a fix without much trouble).

Perhaps I've completely misunderstood something about php and
should be directing this to a different list.  My confidence
is high that a bad eval() shouldn't ruin the page, so I'm here
looking for debugging advice.  If I'm in the wrong place, I
apologize.

Thanks for any pointers!

- Todd


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to