# PHP 5.0.3 Variable Bug or Something More?

- Thread: https://externals.io/message/14543
- Original archive: https://news-web.php.net/php.internals/14543
- Started by Chris Cowan on 2005-02-02T23:11:26+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #14543 — Chris Cowan — 2005-02-02T23:11:26+00:00

URL: https://externals.io/message/14543#14543

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

---

## #14556 — Derick Rethans — 2005-02-03T07:59:50+00:00

URL: https://externals.io/message/14543#14556 · In reply to: #14543

> 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
