どなたかご存知の方がいたら、教えて下さい。
PHP Version 4.3.9からPHP Version 5.1.6に移行を行い、
互換モード(zend.ze1_compatibility_mode On)で稼動させているのですが、
以下の不具合?が発生しています。
php4とphp5+(zend.ze1_compatibility_mode=On)の違い
関数に配列を渡す場合、コピーが作られますが、配列の要素がクラス
の場合、
  ・php4ではクラスをコピー(clone)しています。
  ・php5では参照となっています。
変数への代入も同じでした。
<?php
class X { var $n; }
$a = array(new X(), new X());
$a[0]->n = 100;
$a[1]->n = 140;
$b = $a;
$b[0] = new X();
$b[0]->n = 500;
$b[1]->n = 1000;
?>
<html>
<body><?php var_dump($a); ?><br /><?php var_dump($b); ?></body>
</html>
--
上記の結果は a[1]には(代入していないはずの)1000が表示されます。
※テストしたアプリ
<?php
require_once('z.php');
function init()
{
	$ret = new clsX();
	$ret->t = 0;
	$a = array();
	$e = new clsP();
	$e->p1 = 10000;
	array_push($a, $e);
	$e->p1 = 15000;
	array_push($a, $e);
	$e->p1 = 40000;
	array_push($a, $e);
	$ret->a = $a;
	return $ret;
}
session_destroy();
session_start();
$x = init();
setSess("X", $x);
?>
<html>
<head>
</head>
<body>
count=<?php echo $x->t; ?><br />
<?php foreach ($x->a as $v) { ?>
p1=<?php echo $v->p1; ?> p2=<?php echo $v->p2; ?><br />
<?php } ?>
<form action="y.php" method="post"><input type="submit" value="Next" /></form>
</body>
</html>
<?php
require_once('z.php');
function iss_calc_estimate_with_rate($t_estimate_detail_list, $t_lease){
  for($i = 0; $i<count($t_estimate_detail_list); $i++){
    $t_estimate_detail_list[$i]->p1 = $t_estimate_detail_list[$i]->p1 * $t_lease;
    $t_estimate_detail_list[$i]->p2 = $t_estimate_detail_list[$i]->p1 * 0.05;
  }
  return $t_estimate_detail_list;
}
//$sessBefore = nl2br(htmlspecialchars(var_export($_SESSION, true)));
$sessBefore = htmlspecialchars(serialize($_SESSION));
$x = getSess("X");
$x->t++;
setSess("X", $x);
$tmp = iss_calc_estimate_with_rate($x->a, 0.5);
setSess("X", $x);
setSess("tmp", $tmp);
//$sessAfter = nl2br(htmlspecialchars(var_export($_SESSION, true)));
$sessAfter = htmlspecialchars(serialize($_SESSION));
?>
<html>
<head>
</head>
<body>
count=<?php echo $x->t; ?><br />
<?php foreach ($x->a as $v) { ?>
p1=<?php echo $v->p1; ?> p2=<?php echo $v->p2; ?><br />
<?php } ?>
<form action="y.php" method="post"><input type="submit" value="Next" /></form>
<form action="x.php" method="post"><input type="submit" value="Init" /></form>
<hr />
<table width="100%">
<tr>
<td width="50%"><?php echo $sessBefore; ?></td>
<td width="50%"><?php echo $sessAfter; ?></td>
</tr>
</table>
</body>
</html>
<?php
session_cache_limiter("none");
session_start();
function getSess($key)
{
	return $_SESSION[$key];
}
function setSess($key, $val)
{
	return $_SESSION[$key] = $val;
}
class clsX
{
	var $t;
	var $a;
	function clsX()
	{
		$this->t = null;
		$this->a = null;
	}
}
class clsP
{
	var $p1;
	var $p2;
	function clsP()
	{
		$this->p1 = null;
		$this->p2 = null;
	}
}
?>
			