ID: 32261 Updated by: [EMAIL PROTECTED] Reported By: takayana at egate1 dot com -Status: Open +Status: Bogus Bug Type: Session related Operating System: Windows2000, Windows XP Pro PHP Version: 4.3.10 New Comment:
Switch register_globals = off.. Previous Comments: ------------------------------------------------------------------------ [2005-03-14 06:25:39] takayana at egate1 dot com I'm sorry. Because I think that the explanation is insufficient of the operation of the code, operation is explained. The code also changed. (http://www.egate1.com/docs/.tmp/code2.txt) 1.test_web1.php, test_web2.php, test_web3.php, test_web4.php, test_web5.php, and test_class.php are made from code2.txt. 2.Please execute test_web1.php. (5)is operated from following(1). (1) From a mini_data class Object 20 pieces are created.(array) Each object no variable It substitutes from 1 to 20. It $_SESSION['data'] It carries out. (test_web1.php) for($i=0; $i<20; $i++) { $data[$i] = new mini_data(); $data[$i]->no = ($i+1); } $_SESSION['data'] = $data; (2) Create one object of a mini_data class and it is the value of no variable of the object. It is made 4. The object $_SESSION['data1'] It substitutes. (test_web2.php) $data = new mini_data(); $data->no = 4; $_SESSION['data1'] = $data; (3)$_SESSION['data1'] $_SESSION['data'] It substitutes. (test_web3.php) $data = $_SESSION['data']; $data1 = $_SESSION['data1']; $max = count($data); for($i=0; $i<$max; $i++) { if ( $data1->no == $data[$i]->no ) { $data[$i] = $data1; break; } } $_SESSION['data'] = $data; (4)$_SESSION['data'] At a head no variable value The object of the mini_data class of 31 is added. (test_web4.php) $data = $_SESSION['data']; $data2 = new mini_data(); $data2->no = 31; array_unshift($data, $data2); $_SESSION['data'] = $data; (5)no variable value The object of the mini_data class of 3 is created. $_SESSION['data1'] It substitutes. (test_web5.php) $data3 = new mini_data(); $data3->no = 3; $_SESSION['data1'] = $data3; With PHP4.2.3 or PHP4.3.9 $_SESSION['data'] no variable value of each array: 31, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10...20 Although I think that it becomes and this is normal operation With PHP4.3.10 $_SESSION['data'] no variable value of each array: 31, 1, 2, 3, 3, 5, 6, 7, 8, 9, 10...20 It becomes and is doubled by 3. 4 will be lost. ------------------------------------------------------------------------ [2005-03-10 11:58:17] takayana at egate1 dot com Description: ------------ By a Session variable Operation by PHP4.3.10 carries out different operation from a low-ranking version. When the following 6 files are created and test_web1.php is performed, in the case of a low rank version (for example, PHP4.3.9) $_SESSION '[data]' Arrangement id value 31, 1, 2, 3, 4, and 5 ... Although set to 20, in the case of PHP4.3.10, it is. 31, 1, 2, 3, 3, and 5 ... It will be set to 20. Reproduce code: --------------- http://www.egate1.com/docs/.tmp/code.txt ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32261&edit=1