unset($_SESSION['varname']) work with 4.3.3 but not 4.1.2


#1

the below code does not delete session vars on 4.1.2 but works on 4.3.3. How do I fix this issue?

function closeSale()
{

          session_start();

	$temp = $_SESSION['current_sale_customer_id'];
	unset( $_SESSION['current_sale_customer_id'], $temp );

	$temp1 = $_SESSION['items_in_sale'];
	unset( $_SESSION['items_in_sale'], $temp1 );

	$temp2 = $_SESSION['current_item_search'];
	unset( $_SESSION['current_item_search'], $temp2 );
	
	$temp3 = $_SESSION['current_customer_search'];
	unset( $_SESSION['current_customer_search'], $temp3 );


}

#2

My guess is that your 4.1.2 server has register_globals on, and 4.3.3 has register_globals off.

Since PHP 4.2.0, the default value for the PHP directive register_globals is off. The PHP community encourages all to not rely on this directive but instead use other means, such as the superglobals.
http://www.php.net/manual/en/ref.session.php

Since there are “defects” in 4.2.3 and earlier, you should probably upgrade the 4.1.2 server to at least 4.3.1