ID: 18251
Comment by: dbucher at horus dot ch
Reported By: jazar at zacks dot com
Status: Bogus
Bug Type: Variables related
Operating System: WindowsXP, Linux
PHP Version: 4.1.2
New Comment:
I have exactely the same problem.
For some people they have the problem 9 out of 10 times,
they can't use the script at all.
Personnally, some days I have the problem 1/4 times, some
other days almost never.
I'm using $_POST['xxx']
And PHP Version 4.1.2
Under Linux (none) 2.4.20-6um #1 SMP Fri Jun 6 10:15:19 EDT 2003 i686
unknown
safe_mode
Previous Comments:
------------------------------------------------------------------------
[2003-01-11 02:54:14] tagg_maiwald at yahoo dot com
Ack.
1. First form name = foo
2. Second (last) print_r: print_r ($_GET)
------------------------------------------------------------------------
[2003-01-11 02:49:04] tagg_maiwald at yahoo dot com
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>
------------------------------------------------------------------------
[2002-12-15 06:44:10] roberto_orenstein at yahoo dot com dot br
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] jazar at zacks dot com
The answer will be "We are not support previous PHP versions" ;-)
------------------------------------------------------------------------
[2002-11-28 14:00:39] sk at pilonet dot de
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
------------------------------------------------------------------------
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