Solved

POST data being mangled during POST operations under Apache

Posted on 2003-11-26
3
245 Views
Last Modified: 2010-04-20
Hi everyone.  I'm offering up 500 points for this one as it's got me completely and utterly stumped, and I need a solution.  I'm going to be very stringent in awarding these points, as the solution must work completely.  First person to solve it completely gets 500 points.

This is the situation:

I'm running Apache 2.0 with PHP 4.2.2 on a Dell Precision 340 running RedHat 9.

I've been writing a Content Management System for some time now, and I've recently noticed something strange happening, and it's only happened since I moved development of the CMS from a temporary server to my workstation (temporarily until a permanent home for the CMS is acquired here).

At times when I'm attempting to update data within the CMS (say, a stylesheet snippet, content block, etc.) when I submit the form the POST operation mangles the code.

That is to say, it's taking some of the original code, and appending it to the end of the complete block of the original code.

Here's an example of the good input:  http://web.unbc.ca/~gossep/good_code.txt

And here's an example of the garbage output:  http://web.unbc.ca/~gossep/bad_code.txt

Additionally, the mangling of the code is slightly different depending on which browser you try this with.

As you can see, part of the POSTed code has been appended to the end of the original code.  This is not happening with all code, but only with certain snippets.  The one common thing I've been able to pinpoint it to is perhaps the length of the code segment in question.  I unfortunately do not have time to built a POSTed piece of code one character at a time to figure out if this is indeed the case.

Additionally, this seems to also happen with images that are uploaded via the CMS as well.

To see how it mangles some of the images, please view the images at http://web.unbc.ca/~gossep/sample_images/.  The images which were mangled are named [filename]_uploaded.ext so you can see the originals and the mangled images.

My initial thoughts were that it must be something in my code, but that's simply not the case.  For both text posts and image uploads I created bare-bones forms (nothing more than the form tags, a textarea and submit button for the former, and the form tags, file input and upload button for the latter) and on my machine the problem still occurs but on others it does not.

I'm not overly concerened that this will be a problem in the long run, since the CMS will be going to its permanent home within the next couple of months, and I've run a number of tests on other workstations and these problems do not occur.

However, right now it's proving very difficult for me in development, since I will often need to make changes to a template or other code chunk, in which case I need to copy the code from the CMS to notepad (the CMS requires IE5.5 so I'm accessing it via our tss box) escape all necessary characters and then copy it into a manual sql query.

I look forward to replies to this problem.

GOOD LUCK!

Cheers,
Pablo Gosse
0
Comment
Question by:pablogosse
3 Comments
 
LVL 2

Accepted Solution

by:
JClawson earned 500 total points
ID: 10806430
That is quite a strange problem... .Assuming your code is correct, it sounds like somthing is wrong in either apache or PHP.  Perhaps a file was somhow corrupted... who knows.  First I would suggest updating PHP to 4.3.5 or 4.3.6.  Hopefully this will fix it.  If that doesn't work ty reinstalling apache... or vice-versa.  I imagine a fresh reinstall should fix it.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
This video discusses moving either the default database or any database to a new volume.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now