From: test2 at nicolap dot lautre dot net Operating system: linux PHP version: 5.0.4 PHP Bug Type: Safe Mode/open_basedir Bug description: new line unix "\n" in hidden html are not recorded
Description: ------------ Hello, run the following script and enter in the text area the value : line 1 line 2 <?php $out .= '<form action="test3.php" method="post">'; $out .= '<textarea name="body" rows="10" cols="70">'; if (isset($_POST['body'])) { $out .= $_POST['body']; $out .= '</textarea><br /><br />'."\n"; } else { $out .= '</textarea><br /><br />'."\n"; } if (isset($_POST['body2']) && !empty($_POST['body2'])) { if (strcmp($body, $body2)) { $out .= "strings are the same !"; } else { $out .= "strings are not the same !<br/>". $_POST['body']."<br/>". $_POST['body2']."<br/>"; } } else { $out .= '<input type="hidden" name="body2"'.' value="'.$_POST['body'].'">'."\n"; } $out .= '<input type="submit" name="submit" value ="record">'; $out .= "</form>"; echo $out; ?> It always shows the same thing : "strings are not the same !" . The character new line "\n" is not recorded when it is coming from a hidden tag in html form. I am using safe_mode and php 5.0.4. Nicolas Reproduce code: --------------- <?php $out .= '<form action="test3.php" method="post">'; $out .= '<textarea name="body" rows="10" cols="70">'; if (isset($_POST['body'])) { $out .= $_POST['body']; $out .= '</textarea><br /><br />'."\n"; } else { $out .= '</textarea><br /><br />'."\n"; } if (isset($_POST['body2']) && !empty($_POST['body2'])) { if (strcmp($body, $body2)) { $out .= "strings are the same !"; } else { $out .= "strings are not the same !<br/>". $_POST['body']."<br/>". $_POST['body2']."<br/>"; } } else { $out .= '<input type="hidden" name="body2"'.' value="'.$_POST['body'].'">'."\n"; } $out .= '<input type="submit" name="submit" value ="record">'; $out .= "</form>"; echo $out; ?> Expected result: ---------------- If you enter the 2 following lines in the text area : line1 line2 The result of the script always shows : strings are not the same ! line1 line2 line1 line2 Out that should show this : strings are the same ! -- Edit bug report at http://bugs.php.net/?id=34027&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34027&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34027&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34027&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=34027&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=34027&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34027&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34027&r=needscript Try newer version: http://bugs.php.net/fix.php?id=34027&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34027&r=support Expected behavior: http://bugs.php.net/fix.php?id=34027&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34027&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34027&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=34027&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34027&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=34027&r=dst IIS Stability: http://bugs.php.net/fix.php?id=34027&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34027&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34027&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34027&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34027&r=mysqlcfg