php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28788 Bogus form data when forms contains a single input field
Submitted: 2004-06-15 11:31 UTC Modified: 2004-06-23 22:37 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: lsjoberg at aland dot net Assigned:
Status: Not a bug Package: Apache2 related
PHP Version: 5.0.0RC3 OS: Redhat Enterprise Linux
Private report: No CVE-ID: None
 [2004-06-15 11:31 UTC] lsjoberg at aland dot net
Description:
------------
When a HTML form contains a single input field (this could be plain INPUT, HIDDEN, SELECT or just about any time) with an associated value the value is not passed correctly to the receiving PHP script.

This only happends when the form contains exactly one field and when PHP is run as an Apache2 module. (Could not reproduce with PHP running as CGI under caudium).

Reproduce code:
---------------
test.htm:
<html><body>
<form method="POST" action="test.php">
<input name=id value=5>
<input type=submit>
</form></body></html>

test.php:
<?
echo $id;
?>

Expected result:
----------------
The expected result is that the php script should print a 5 and nothing else. (We are using register_globals=On).

Actual result:
--------------
The output of the php-script is '5id=5' instead of '5'.

If a <input type=hidden name=foo> is added to the html form the correct output of 5 is displayed.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-18 20:33 UTC] imprestavel at gameguru dot com dot br
It looks more like a browser issue.
Have you tryed writing conformant html?

I tested with Mozilla/rv1.6 and IE/6.0 on Apache/2.0.49, PHP/5.0.0RC3 (register_globals=On and Off), under Windows2000 and didn't have that problem (with the same no-" html).

What browser are you using?
 [2004-06-19 11:56 UTC] lsjoberg at aland dot net
The original code was fully W3C compliant, the testcase below was stripped down before submitted.

Browsers used was Mozilla and Opera under FreeBSD and Internet Explorer in some Windows flavour.

It feels like a browser bug but since it occured when upgrading from PHP4 to PHP5 without code changes it seems suspicious.

I will do some more testing during next week to see if I can isolate the problem further.
 [2004-06-21 08:46 UTC] lsjoberg at aland dot net
I created a simple test page (http://www.vallnet.se/test.htm) which posts forms to both a PHP script which executes print_r($_POST); and a CGI script which prints its stdin.

When run on a webserver with PHP as a CGI everything executes as expected. The CGI-script prints 'foo=5' and 'foo=5&bar=5' and the PHP-script '[foo] => 5' and '[foo] => 5'/'[bar] => 5'.

The CGI output from the Apache server is the same, but for the form with a single element the PHP output is
Array
(
    [foo] => 5foo=5
)

The PHP output for the 2-field form is however correct, hence it seems to be some part of the apache/php interface that is failing...

The same browser(s) and exactly the same scripts were used during testing.
 [2004-06-21 20:38 UTC] imprestavel at gameguru dot com dot br
Yeah... this is odd.
I can't reproduce it here... Tryed running php as module and cgi.
Let's wait for a word from php team...
 [2004-06-23 22:37 UTC] moriyoshi@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

See bug #18648.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 01 07:01:30 2024 UTC