For Programmers: Free Programming Magazines  


Home > Archive > PHP Installation > January 2008 > Re: [PHP-INSTALL] Interesting POST error









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PHP-INSTALL] Interesting POST error
Keith Roberts

2008-01-10, 8:03 am

Is this what you are looking for Jesse:

<html>

<head>
<title>Wiki Text Tester</title>
</head>

<body>

<?php

echo "Contents of \$_POST array: <br />";

while (list($key, $value) = each($_POST))
{
echo "$key: $value <br />";
}

?>

<br />

<form method="post" action="" accept-charset="utf-8">

<textarea name="wikitext" cols="80" rows="10">
<?php echo $_POST['wikitext'] ?>
</textarea>

<input type="submit" />
</form>

</body>
</html>

The above also works with <html> or html in the text area.

I tried your code on my machine but it was doing strange
things to the URL for the page.

HTH

Keith Roberts

-----------------------------------------------------------------
Websites:
http://www.karsites.net
http://www.raised-from-the-dead.org.uk

All email addresses are challenge-response protected with
TMDA [http://tmda.net]
-----------------------------------------------------------------

On Wed, 9 Jan 2008, Jesse Santana wrote:

> To: php-install@lists.php.net
> From: Jesse Santana <jsantana@csulb.edu>
> Subject: [PHP-INSTALL] Interesting POST error
>
> One of our developers has brought an interesting problem to my attention.
> I'll start off by describing our environment. We are running a Solaris 10
> server with apache 2.2.6. PHP version 5.2.5 is loaded as a module and
> appears to be working fine. However, our developer ran into a problem
> using dokuwiki. When he submits a form with a <html> tag in it, he
> receives a 400 error. He threw together this little script to verify the
> problem:
>
> <html>
> <body>
> <?php
> echo sprintf("%s", $_POST['wikitext']);
> ?>
> <br />
> <form method="post" action="<?=$_SERVER['PHP_SELF']?>"
> accept-charset="utf-8">
> <textarea name="wikitext" style="height: 300px;" cols="80"
> rows="10"></textarea>
>
> <input type="submit"/>
> </form>
> </body>
> </html>
>
> This can be viewed here: http://eagles.its.csulb.edu/php/PostTest.php
>
> As you can see, the script does nothing more than take what is submitted
> and display it on the screen. However, if you type in <html> then click
> on the Submit Query button, you will get a 400 error.
>
> Does anyone know why this is occurring? Am I looking at some php.ini
> parameter change to fix this?
>
> Jesse
>
> Jesse Santana
> Project Lead - Enterprise Services Group
> Information Technology Services
> California State University, Long Beach
> 1250 Bellflower Blvd.
> Long Beach, CA 90840
> Office: (562)985-8511
> Fax: (562)985-8855
>

Jesse Santana

2008-01-10, 7:06 pm

Keith,

I get the exact same result. Take a look at this URL:
http://eagles.its.csulb.edu/~jsantana/PostTest2.php

This is the code you sent me. It works with plain text but if I submit
<html>, I get the 400 error I mentioned in my original posting.

Jesse

Jesse Santana
Project Lead - Enterprise Services Group
Information Technology Services
California State University, Long Beach
1250 Bellflower Blvd.
Long Beach, CA 90840
Office: (562)985-8511
Fax: (562)985-8855




Keith Roberts <keith@karsites.net>
01/10/2008 02:55 AM
Please respond to
Keith Roberts <keith@karsites.net>


To
php-install@lists.php.net
cc

Subject
Re: [PHP-INSTALL] Interesting POST error






Is this what you are looking for Jesse:

<html>

<head>
<title>Wiki Text Tester</title>
</head>

<body>

<?php

echo "Contents of \$_POST array: <br />";

while (list($key, $value) = each($_POST))
{
echo "$key: $value <br />";
}

?>

<br />

<form method="post" action="" accept-charset="utf-8">

<textarea name="wikitext" cols="80" rows="10">
<?php echo $_POST['wikitext'] ?>
</textarea>

<input type="submit" />
</form>

</body>
</html>

The above also works with <html> or html in the text area.

I tried your code on my machine but it was doing strange
things to the URL for the page.

HTH

Keith Roberts

-----------------------------------------------------------------
Websites:
http://www.karsites.net
http://www.raised-from-the-dead.org.uk

All email addresses are challenge-response protected with
TMDA [http://tmda.net]
-----------------------------------------------------------------

On Wed, 9 Jan 2008, Jesse Santana wrote:

> To: php-install@lists.php.net
> From: Jesse Santana <jsantana@csulb.edu>
> Subject: [PHP-INSTALL] Interesting POST error
>
> One of our developers has brought an interesting problem to my

attention.
> I'll start off by describing our environment. We are running a Solaris

10
> server with apache 2.2.6. PHP version 5.2.5 is loaded as a module and
> appears to be working fine. However, our developer ran into a problem
> using dokuwiki. When he submits a form with a <html> tag in it, he
> receives a 400 error. He threw together this little script to verify

the
> problem:
>
> <html>
> <body>
> <?php
> echo sprintf("%s", $_POST['wikitext']);
> ?>
> <br />
> <form method="post" action="<?=$_SERVER['PHP_SELF']?>"
> accept-charset="utf-8">
> <textarea name="wikitext" style="height: 300px;" cols="80"
> rows="10"></textarea>
>
> <input type="submit"/>
> </form>
> </body>
> </html>
>
> This can be viewed here: http://eagles.its.csulb.edu/php/PostTest.php
>
> As you can see, the script does nothing more than take what is submitted
> and display it on the screen. However, if you type in <html> then click
> on the Submit Query button, you will get a 400 error.
>
> Does anyone know why this is occurring? Am I looking at some php.ini
> parameter change to fix this?
>
> Jesse
>
> Jesse Santana
> Project Lead - Enterprise Services Group
> Information Technology Services
> California State University, Long Beach
> 1250 Bellflower Blvd.
> Long Beach, CA 90840
> Office: (562)985-8511
> Fax: (562)985-8855
>



Jesse Santana

2008-01-10, 7:06 pm

Keith,

Another interesting addition to all of this, both your code and my
developers original code work on our PHP v4 instance.

Jesse

Jesse Santana
Project Lead - Enterprise Services Group
Information Technology Services
California State University, Long Beach
1250 Bellflower Blvd.
Long Beach, CA 90840
Office: (562)985-8511
Fax: (562)985-8855




Keith Roberts <keith@karsites.net>
01/10/2008 02:55 AM
Please respond to
Keith Roberts <keith@karsites.net>


To
php-install@lists.php.net
cc

Subject
Re: [PHP-INSTALL] Interesting POST error






Is this what you are looking for Jesse:

<html>

<head>
<title>Wiki Text Tester</title>
</head>

<body>

<?php

echo "Contents of \$_POST array: <br />";

while (list($key, $value) = each($_POST))
{
echo "$key: $value <br />";
}

?>

<br />

<form method="post" action="" accept-charset="utf-8">

<textarea name="wikitext" cols="80" rows="10">
<?php echo $_POST['wikitext'] ?>
</textarea>

<input type="submit" />
</form>

</body>
</html>

The above also works with <html> or html in the text area.

I tried your code on my machine but it was doing strange
things to the URL for the page.

HTH

Keith Roberts

-----------------------------------------------------------------
Websites:
http://www.karsites.net
http://www.raised-from-the-dead.org.uk

All email addresses are challenge-response protected with
TMDA [http://tmda.net]
-----------------------------------------------------------------

On Wed, 9 Jan 2008, Jesse Santana wrote:

> To: php-install@lists.php.net
> From: Jesse Santana <jsantana@csulb.edu>
> Subject: [PHP-INSTALL] Interesting POST error
>
> One of our developers has brought an interesting problem to my

attention.
> I'll start off by describing our environment. We are running a Solaris

10
> server with apache 2.2.6. PHP version 5.2.5 is loaded as a module and
> appears to be working fine. However, our developer ran into a problem
> using dokuwiki. When he submits a form with a <html> tag in it, he
> receives a 400 error. He threw together this little script to verify

the
> problem:
>
> <html>
> <body>
> <?php
> echo sprintf("%s", $_POST['wikitext']);
> ?>
> <br />
> <form method="post" action="<?=$_SERVER['PHP_SELF']?>"
> accept-charset="utf-8">
> <textarea name="wikitext" style="height: 300px;" cols="80"
> rows="10"></textarea>
>
> <input type="submit"/>
> </form>
> </body>
> </html>
>
> This can be viewed here: http://eagles.its.csulb.edu/php/PostTest.php
>
> As you can see, the script does nothing more than take what is submitted
> and display it on the screen. However, if you type in <html> then click
> on the Submit Query button, you will get a 400 error.
>
> Does anyone know why this is occurring? Am I looking at some php.ini
> parameter change to fix this?
>
> Jesse
>
> Jesse Santana
> Project Lead - Enterprise Services Group
> Information Technology Services
> California State University, Long Beach
> 1250 Bellflower Blvd.
> Long Beach, CA 90840
> Office: (562)985-8511
> Fax: (562)985-8855
>



Keith Roberts

2008-01-10, 7:06 pm

On Thu, 10 Jan 2008, Jesse Santana wrote:

> To: Keith Roberts <keith@karsites.net>
> From: Jesse Santana <jsantana@csulb.edu>
> Subject: Re: [PHP-INSTALL] Interesting POST error
>
> Keith,
>
> Another interesting addition to all of this, both your code and my
> developers original code work on our PHP v4 instance.


It might be a bug in PHP 5.2.5, as I had problems with that
version. I downgraded to 5.2.4 - that's what I used to test
my code on.

However the code you posted did not work for me on 5.2.4

Regards

Keith

[color=darkred]
> Jesse
>
> Jesse Santana
> Project Lead - Enterprise Services Group
> Information Technology Services
> California State University, Long Beach
> 1250 Bellflower Blvd.
> Long Beach, CA 90840
> Office: (562)985-8511
> Fax: (562)985-8855
>
>
>
>
> Keith Roberts <keith@karsites.net>
> 01/10/2008 02:55 AM
> Please respond to
> Keith Roberts <keith@karsites.net>
>
>
> To
> php-install@lists.php.net
> cc
>
> Subject
> Re: [PHP-INSTALL] Interesting POST error
>
>
>
>
>
>
> Is this what you are looking for Jesse:
>
> <html>
>
> <head>
> <title>Wiki Text Tester</title>
> </head>
>
> <body>
>
> <?php
>
> echo "Contents of \$_POST array: <br />";
>
> while (list($key, $value) = each($_POST))
> {
> echo "$key: $value <br />";
> }
>
> ?>
>
> <br />
>
> <form method="post" action="" accept-charset="utf-8">
>
> <textarea name="wikitext" cols="80" rows="10">
> <?php echo $_POST['wikitext'] ?>
> </textarea>
>
> <input type="submit" />
> </form>
>
> </body>
> </html>
>
> The above also works with <html> or html in the text area.
>
> I tried your code on my machine but it was doing strange
> things to the URL for the page.
>
> HTH
>
> Keith Roberts
>
> -----------------------------------------------------------------
> Websites:
> http://www.karsites.net
> http://www.raised-from-the-dead.org.uk
>
> All email addresses are challenge-response protected with
> TMDA [http://tmda.net]
> -----------------------------------------------------------------
>
> On Wed, 9 Jan 2008, Jesse Santana wrote:
>
> attention.
> 10
> the
Keith Roberts

2008-01-10, 7:06 pm

I have tested the link you gave me, and it works OK untill I
enter <html> into the textarea. I get a 400 error as well:

Bad Request

Your browser sent a request that this server could not
understand.
Apache/2.2.0 (Solaris) Server at eagles.its.csulb.edu Port 80

Using the Tidy extension with Firefox 2 on my machine tells
me that the DOCTYPE is missing. So I added that to my local
copy like so:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>
....

As you said the script works OK on PHP 4. I would try
downgrading to PHP 5.2.4 and see if that cures the problem.

HTH

Keith Roberts

On Thu, 10 Jan 2008, Jesse Santana wrote:

> To: Keith Roberts <keith@karsites.net>
> From: Jesse Santana <jsantana@csulb.edu>
> Subject: Re: [PHP-INSTALL] Interesting POST error
>
> Keith,
>
> I get the exact same result. Take a look at this URL:
> http://eagles.its.csulb.edu/~jsantana/PostTest2.php
>
> This is the code you sent me. It works with plain text but if I submit
> <html>, I get the 400 error I mentioned in my original posting.
>
> Jesse
>
> Jesse Santana
> Project Lead - Enterprise Services Group
> Information Technology Services
> California State University, Long Beach
> 1250 Bellflower Blvd.
> Long Beach, CA 90840
> Office: (562)985-8511
> Fax: (562)985-8855
>
>
>
>
> Keith Roberts <keith@karsites.net>
> 01/10/2008 02:55 AM
> Please respond to
> Keith Roberts <keith@karsites.net>
>
>
> To
> php-install@lists.php.net
> cc
>
> Subject
> Re: [PHP-INSTALL] Interesting POST error
>
>
>
>
>
>
> Is this what you are looking for Jesse:
>
> <html>
>
> <head>
> <title>Wiki Text Tester</title>
> </head>
>
> <body>
>
> <?php
>
> echo "Contents of \$_POST array: <br />";
>
> while (list($key, $value) = each($_POST))
> {
> echo "$key: $value <br />";
> }
>
> ?>
>
> <br />
>
> <form method="post" action="" accept-charset="utf-8">
>
> <textarea name="wikitext" cols="80" rows="10">
> <?php echo $_POST['wikitext'] ?>
> </textarea>
>
> <input type="submit" />
> </form>
>
> </body>
> </html>
>
> The above also works with <html> or html in the text area.
>
> I tried your code on my machine but it was doing strange
> things to the URL for the page.
>
> HTH
>
> Keith Roberts
>
> -----------------------------------------------------------------
> Websites:
> http://www.karsites.net
> http://www.raised-from-the-dead.org.uk
>
> All email addresses are challenge-response protected with
> TMDA [http://tmda.net]
> -----------------------------------------------------------------
>
> On Wed, 9 Jan 2008, Jesse Santana wrote:
>
> attention.
> 10
> the
>
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com