ID: 18251
Comment by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Status: Bogus
Bug Type: Variables related
Operating System: WindowsXP, Linux
PHP Version: 4.1.2
New Comment:
I did encounter a similar coding error: queried the $_POST array
multiple times, came up empty subsequent times.
CODE FIX: reset($_POST)
HTTP SERVER/PHP TEST SCRIPT:
<html>
<body>
<h1>posttest.php</h1>
<form name="bar" method="post" action="posttest.php">
<p>
<input name="foo_a" type="checkbox"> Foo A<br>
<input name="foo_b" type="checkbox"> Foo B<br>
<input name="foo_c" type="checkbox"> Foo C<br>
<input name="foo_d" type="checkbox"> Foo D<br>
<input name="bar[]" type="text" value="bar i"> Bar 1 <br>
<input name="bar[]" type="text" value="bar ii"> Bar 2 <br>
<input name="bar[]" type="text" value="bar iii"> Bar 3 <br>
<input name="bar[]" type="text" value="bar iv"> Bar 4 <br>
<input type="submit" value=" Submit Foos ">
</p>
</form>
<form name="bar" method="post" action="posttest.php">
<p>
<?php
function get_foos()
{ $i_counter=0;
if (isset($_POST)&&(0<count($_POST)))
{ $sz_ret = "<br> method = post";
while (list ($cgi_foo, $cgi_on) = each ($_POST))
{ if (is_array($cgi_on))
{ while (list ($cgi_bar, $cgi_val) = each ($cgi_on))
{ $sz_ret .=
"\n".'<br>'.$cgi_foo.'--'.$cgi_bar.'<input type="text"
name="'.$cgi_foo.'['.$cgi_bar.']" value="'.$cgi_val.'">';
}
} elseif (('on'==$cgi_on)&&('foo_'==substr($cgi_foo,0,4)))
{ $sz_ret .= "\n".'<br>'.$cgi_foo.'<input type="text"
name="'.$cgi_foo.'" value="'.$cgi_on.'">';
} else
{ $sz_ret .= "\n<br>got: '$cgi_foo', '$cgi_on'";
}
$i_counter++;
}
if (1>$i_counter)
{ echo "\n<pre>\n";
print_r ($_POST);
echo "\n</pre>\n";
}
} elseif (isset($_GET)&&(0<count($_GET)))
{ $sz_ret = "<br> method = get";
while (list ($cgi_foo, $cgi_on) = each ($_GET))
{ if (is_array($cgi_on))
{ while (list ($cgi_bar, $cgi_val) = each ($cgi_on))
{ $sz_ret .=
"\n".'<br>'.$cgi_foo.'--'.$cgi_bar.'<input type="text"
name="'.$cgi_foo.'['.$cgi_bar.']" value="'.$cgi_val.'">';
}
} elseif (('on'==$cgi_on)&&('foo_'==substr($cgi_foo,0,4)))
{ $sz_ret .= "\n".'<br>'.$cgi_foo.'<input type="text"
name="'.$cgi_foo.'" value="'.$cgi_on.'">';
} else
{ $sz_ret .= "\n<br>got: '$cgi_foo', '$cgi_on'";
}
$i_counter++;
}
if (1>$i_counter)
{ echo "\n<pre>\n";
print_r ($_POST);
echo "\n</pre>\n";
}
} else
{ $sz_ret .= "<br> no data extracted";
}
$sz_ret .= "<br>i_counter = $i_counter";
return $sz_ret;
}
print get_foos();
?>
<br><input type="submit" value=" Submit Bazs ">
</p>
</form>
</body></html>
Previous Comments:
------------------------------------------------------------------------
[2002-12-15 06:44:10] [EMAIL PROTECTED]
Running php 4.2.3 on apache 1.3.27 on Win2k.
In some pages my POST variables make it to the next page missing the
first 4 character's. If I send "test_data", I'll get only "_data" on
the other side. The funny thing is that it only happens in one machine.
I have two other machines with the same configuration and nothing wrong
happens. And it appears that this bug happens only with array from form
variables.
Any thoughts???
------------------------------------------------------------------------
[2002-11-29 14:20:38] [EMAIL PROTECTED]
The answer will be "We are not support previous PHP versions" ;-)
------------------------------------------------------------------------
[2002-11-28 14:00:39] [EMAIL PROTECTED]
My problem might be affected by this bug.
I'm using PHP 4.2.3 (sapi) on Windows 2000 Server running Apache 1.3.27
as Webserver.
My form:
<form action="/test.php" name="test" method="post">
<input type="text" name="start" size="20" maxlength="20"
value="100">
<input type="submit" name="submit" value="Speichern">
</form>
Then I'm dumping $_POST, where the following happens:
When input was an integer from 1-999 it is displayed correctly. From
1000 on the corresponding post value is "false". Inserting "abcdefgh"
in the form results in "efgh"...
Any Ideas?
Copying that example to my debian system, running PHP 4.2.3 on an
apache 1.3.26, the result is fine and works as expected.
Hope that helps finding another bug,
Stefan
------------------------------------------------------------------------
[2002-07-09 18:08:31] [EMAIL PROTECTED]
Update to 4.2.1. If this happens with it too, then reopen
this report.
------------------------------------------------------------------------
[2002-07-09 18:04:24] [EMAIL PROTECTED]
I meet this problem 1/100 (aproximetly) post actions
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/18251
--
Edit this bug report at http://bugs.php.net/?id=18251&edit=1