ID:               34056
 User updated by:  David at Caulkett dot com
 Reported By:      David at Caulkett dot com
-Status:           Feedback
+Status:           Open
 Bug Type:         Strings related
 Operating System: Linux 2.4.22-1.2199.nptlsmp
 PHP Version:      4.3.11
 New Comment:

The problem has to do with passing of arguments from one page to
another using POST.  Therefore it is difficult to condense a
demonstration to ONE file.  However, I did provide the simple example
code showing the sequence in ONE file.

I spent a great deal of time narrowing the problem to a simple test
case. The example code was provided in ONE FILE but requires BY THE
NATURE OF THE PROBLEM to be executed over several pages in order to
demonstrate the problem.

It is not possible to provide a snapshot and I can't make it much
simpler in ONE FILE as shown under "Reproduce Code."


Previous Comments:
------------------------------------------------------------------------

[2005-10-09 16:40:45] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

Either you try the snapshot or provide short example script.
(one file only!!)


------------------------------------------------------------------------

[2005-10-09 15:17:11] David at Caulkett dot com

The problem ocurred on a server handled by http://support.coastinc.com/
 PHP version is 4.3.10 .

I am unable to provide a snapshot of the server.

The test case is simple and hard demonstrable at
http://www.reportillegals.com/test1.php.  

IMHO, either PHP has a bug or the PHP installation is bad.  My guess is
there is a PHP bug.

------------------------------------------------------------------------

[2005-08-09 20:40:21] David at Caulkett dot com

Description:
------------
Actually PHP is version 4.3.10.
Passing a string variable from test1 to test2 works fine.  Passing the
same string from test2 to test3 results in an incorrect length.  The
length is 30 greater than it should be.  PHP seems to be padding the
string with 30 spaces which is likely the length of the original INPUT
statement.  The problem is fixed by removing the extra spaces with the
trim function.

The test programs are at:
http://www.reportillegals.com/test1.php
http://www.reportillegals.com/test2.php
http://www.reportillegals.com/test3.php

The source of the programs are at:
http://www.reportillegals.com/test1.txt
http://www.reportillegals.com/test2.txt
http://www.reportillegals.com/test3.txt





Reproduce code:
---------------
TEST1 CODE:
<html>
<body>
<form method="POST" name="emailcomments"
action="http://www.reportillegals.com/test2.php";>
  <input type="text" name="User_Email_Address" >
  <input type="submit" value="PHP Bug Test1 - Enter email address and
remember the no. of chars">
</form>
</body>
</html>

TEST2 CODE:
<html>
<body>
<?php
$length = strlen ( $User_Email_Address );
echo "length=" . $length;
?>
<form method="POST" name="emailcomments"
action="http://www.reportillegals.com/test3.php";>
<input type="hidden" name="User_Email_Address" value="
              <?php print $User_Email_Address;?>
              ">
   <input type="submit" value="PHP Bug Test2 - Length should be what
you just entered. Just click Submit">
</form>
</body>
</html>

TEST3 CODE:
<html>
<body>
<?php
$length = strlen ( $User_Email_Address );
echo "length=" . $length ."<br>";
echo "length is incorrect.  it is whatever you entered +30" . "<br>";
$User_Email_Address = trim ($User_Email_Address);
$length = strlen ( $User_Email_Address );
echo "length=" . $length ."<br>";
echo "length is now correct after using the trim function.". "<br>";
?>
</body>
</html>

Expected result:
----------------
The length in test2 and test3 should be the same number of characters
as entered in test1.

Actual result:
--------------
The length is whatever was entered + 30.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=34056&edit=1

Reply via email to