PHP 5.0.3 Variable Bug or Something More?

php.internals

Chris Cowan

21 years ago
I've ran across some strangeness which I can't figure out. When I run the following code I get a Seg Fault / Bus Error in my apache log (SegFault on Linux and Bus Error on Mac OS X). $rate_id = Core_Request::get('rate_id','integer',true); $plan_id = Core_Request::get('plan_id','integer',true); $min_seats = Core_Request::get('min_seats','integer',true); $max_seats = Core_Request::get('max_seats','integer',true); $rate = Core_Request::get('rate','float',true); $DB = Core_DB::getInstance(); $query = "update subscription_prices set "; $query .= "min_seats = $min_seats , "; $query .= "max_seats = $max_seats , "; $query .= "rate = $rate "; $query .= "where plan_id = $plan_id "; $query .= "and rate_id = $rate_id "; $DB->query($query); $DB->commit(); When I change the variable from $max_seats to $_max the error goes away. Also it appears that the $DB->query(); and $DB->commit(); calls are being executed and the session is being written to the database. I've also had this happen on the following: $flat_rate = Core_Request::get('flat_rate','float',true); $flat_seats = Core_Request::get('flat_seats','integer',true); $plan_id = Core_Request::get('plan_id','integer',true); $DB = Core_DB::getInstance(); $query = "update subscription_plans set "; $query .= "flat_seats = $flat_seats , "; $query .= "flat_rate = $flat_rate "; $query .= "where plan_id = $plan_id "; $DB->query($query); $DB->commit(); To fix this I ended up changing the name of the variables from $flat_seats and $flat_rate to $seats and $rates to get the bus error to disappear. I've tested this on Mac OS X Client 10.3.7 running Apache 1.3.33 and PHP 5.0.3 as well as Debian Linux with the same set up. Here is the output from "ktrace httpd -X" with the crash at the bottom. http://www.fwi-archive.com/~chris/debug.txt Let me know if you need any more information. Chris Cowan

Derick Rethans

21 years ago
On Wed, 2 Feb 2005, Chris Cowan wrote:
> I've ran across some strangeness which I can't figure out. When I run > the following code I get a Seg Fault / Bus Error in my apache log > (SegFault on Linux and Bus Error on Mac OS X).
Make a short reproducing script, not relying on external resources and file a bug in our bugsystem, please. Derick
-- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org