#34056 [NoF-Opn]: Passing a string variable results in incorrect length
ID: 34056 User updated by: David at Caulkett dot com Reported By: David at Caulkett dot com -Status: No 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 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. Previous Comments: [2005-08-17 01:00:04] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to Open. [2005-08-09 22:58:32] [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 [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=34056edit=1
#34056 [Fbk-Opn]: Passing a string variable results in incorrect length
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=34056edit=1
#34056 [NEW]: Passing a string variable results in incorrect length
From: David at Caulkett dot com Operating system: Linux 2.4.22-1.2199.nptlsmp PHP version: 4.3.11 PHP Bug Type: Strings related Bug description: Passing a string variable results in incorrect length 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 bug report at http://bugs.php.net/?id=34056edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34056r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34056r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34056r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=34056r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=34056r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34056r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34056r=needscript Try newer version: http://bugs.php.net/fix.php?id=34056r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34056r=support Expected behavior: http://bugs.php.net/fix.php?id=34056r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34056r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34056r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=34056r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34056r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=34056r=dst IIS Stability: http://bugs.php.net/fix.php?id=34056r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34056r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34056r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34056r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34056r=mysqlcfg