php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18444 arrays sent by html form, the count is duplicate
Submitted: 2002-07-19 23:24 UTC Modified: 2002-07-22 20:32 UTC
From: youngga at hotmail dot com Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 4.2.1 OS: linux
Private report: No CVE-ID: None
 [2002-07-19 23:24 UTC] youngga at hotmail dot com
sorry, my english.

When I send array with http form, the count of array is duplicate at server page.

//My source at http form.....
<select name='my_val[]' size='3' onfocus='set_check()' multiple>
										<option value=' 1'>val1</option>
										<option value=' 2'>val2</option>
										<option value=' 3'>val3</option>
										</select>
//My source at server page...
count(my_val);
//

the count value is different from I selected.

So I have tested on PHP4.1.2 then no troubles.

What is the problem ? 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-20 12:22 UTC] sniper@php.net
In PHP 4.2.0, the 'register_globals' setting default changed to
be off. See http://www.php.net/release_4_2_0.php for more info.
We are sorry about the inconvenience, but this change was a necessary
part of our efforts to make PHP scripting more secure and portable.
 [2002-07-21 01:22 UTC] youngga at hotmail dot com
Thanks your comment.
But I set register_glovals On already.
My test page is www.ftpmail.com/test/test_array.php , please try and check it.
The page source is following.
---------------------------------------------------
<html>

<head>
<title>test_array</title>
</head>

<body>
<table align="center" border="0">
<tr>
<td>
<p>Array form tranasfer test page.

<p>Select value then click submit.</p>

			<p>Use shift or crtl key for multi select.</p>
<form name="files_up" action="<? echo $PHP_SELF; ?>" method="post">
	<select name='test_val[]' size='5' multiple>
	<option value='val1'>val1</option>
	<option value='val2'>val2</option>
	<option value='val3'>val3</option>
	<option value='val4'>val4</option>
	<option value='val5'>val5</option>
	</select>
 <input type="submit" name="sub1" value="submit"> 

</form>
	<?php
	if(!empty($HTTP_POST_VARS["test_val"]))
	{
		$nums = count($HTTP_POST_VARS["test_val"]);
		echo "no of count = ".$nums."<br><br>";
		
		for($i=0; $i < $nums; $i++)
		{
		echo "<br>test_val[".$i."] = ".$HTTP_POST_VARS["test_val"][$i];
		}
	}
	?>
<p>&nbsp;</p>
<p><a href="menu.htm">go to menu</a></p>
		</td>
</tr></table>
</body>
</html>
---------------------------------------------------------
You can see my homepage's phpinfo() at www.ftpmail.com/test.php 
I am looking forward your answer.
 [2002-07-22 20:32 UTC] youngga at hotmail dot com
I changed aparch version from 2.0.39 to 1.3.26 and the problem was disappeared.
But I doubt PHP is well operating.
Above test url is not avaible from now.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Jul 05 00:01:26 2020 UTC