Red Hat Bugzilla – Bug 85386
Redhat 8.0's apache has post irregularities
Last modified: 2007-04-18 12:51:44 EDT
Description of problem:
Red hat distributes Apache Webserver 2.0.40 with Redhat 8.0, and has not
released a newer version in it's updates. This version of apache (perhaps in
concert with PHP 4.2.2, also distributed in RH8.0 updates) appears to have a
bug in how it handles POST requests. In particular, the content of the post
request (which takes the form "key1=val1&key2=val2..", I believe) appears to
be chopped up randomly and rearranged before PHP parses the values out. Thus,
incoming variables take on values like:
echo "text= '$text'";
'Here is somtext=Here is some example text'
(in real examples, this may take several hundred characters to replicate)
This was discussed in PHP's bug list, (PHP BUG #18648,
http://bugs.php.net/bug.php?id=18648 ) appears to be an apache bug, and they
report that the latest build of apache (2.0.44) seems to fix the problem. The
last comment confirms that RH8.0 ships with 2.0.40, and that someone should
notify RedHat. (I venture this is the appropriate place :)
I've searched apache's bug list and found no substantial counterpart, but
apache doesn't recommend posting bugs on software versions they do not
consider "up to date". See apache bug #15808,
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15808 for an example of this
I'd recommend either releasing a newer version of apache in updates, or a new
patchlevel for 2.0.40 addressing this issue. (I'm not really a packager, but I
play one on tv :)
Version-Release number of selected component (if applicable):
httpd 2.0.40-11, tested against php 4.2.2-8.0.7
Steps to Reproduce:
1. build a simple web form with a textarea element (lets say it's named "foo")
and a submit button, that submits using POST method.
1a. To aid reproduceability, make sure the textarea is the only named form
element, no name for the submit button.
1b. Some people have suggested that multiple named form elements either make
the bug go away or else make it harder to spot (corrupting variables you don't
use), either way diminishing reproduceability
2. in response page, using php, <? print_r($_POST) ?>
2a. Some have reported php_info() confirms the error when it dumps incoming
POST values, I haven't tried that.
3. Enter several kilobytes of data, just to be sure, into the text area and
submit the form.
PHP will report that $_POST['foo'] contains a value with portions copied and
spliced around, perhaps delimited by "foo=".
PHP should report that $_POST['foo'] matches your input text, give or take the
effects of magic quotes and the like.
Fair discussion of the problem:
PHP BUG #18648, http://bugs.php.net/bug.php?id=18648
I've added a bug note in apache's bugzilla just in case:
Apache bug #17549
Can you attach your httpd.conf and php.conf? Previous reports of this have been
due to a configuration error: adding an AddType for PHP, alonside the <Files
*.php> section in php.conf
Created attachment 91245 [details]
This is the http.conf on my machine, sensitive info [snip]ped out
Created attachment 91246 [details]
php.ini from my system
$%&@, I'm sorry. I attached the http.conf and php.ini from the machine we were
having troubles with, but we've already reinstalled that machine with FreeBSD
so those files won't directly apply :(
They might be of some help, all of our unconventional settings are in them at
least. Actually, if you can adapt those configuration files to work on an out-
of-the-box copy of Redhat 8.0 (and probably 9.0 if you haven't
upgraded/patched php or apache) then you should be running a nearly perfect
functional replica of our affected machine at the time.
As you can see, we don't have a <Files *.php> section, and we AddType for some
file masks other than *.php, but all of my test files were simple php files.
Adtly, of course, <Files..> and Addtype are directives in httpd.conf, not
Moving our stuff to a FreeBSD machine with Apache 2.0.44 and php 4.3.1
resolved the issue for us.
In the meantime, I remain curious why Redhat always sees fit to package
software so old that the makers of the software generally refuse to support
it? As the packager, you shouldn't have to try and track down software bugs
like this (quite slowly mind you, while your customers all switch
distributions ;) when you can simply keep up to date instead and let the
software developers field the bug reports.
It's one thing if you'll hang back a major revision to avoid experimental
code, but the third digit in a version number (2.0.40 vs 2.0.44) represents
bug *fixes* for crying out loud :P
Similar problem exists with apache and mod_perl in 9.0. Specifically, if the
POST data is sent in more than one TCP packet, only the contents of the first
packet is read from STDIN. I verified that if I read STDIN manually, all the
data are there. However, if I use CGI.pm to read STDIN, it eventually calls the
perl read() functions, which apparently misbehaves.
After installing from source mod_perl-1_99-09 and httpd 2.0.45 the problem went
away, which suggests that perl itself is not to blame, because the same Redhat
version of perl was used.
I think this is a very serious problem and should be solved asap.
Same problem here: mod_perl + httpd on both Red Hat Linux 8.0 and 9. Any
workaround (apart from using GET instead of POST)?
There can be problems using POST if configured using an "AddType" *and*
SetOutputFilter - this is covered in bug 82967. If mod_perl suffers from
similar problems, please file bugs against mod_perl.
*** This bug has been marked as a duplicate of 82967 ***
Changed to 'CLOSED' state since 'RESOLVED' has been deprecated.