From: Operating system: All PHP version: Irrelevant Package: *General Issues Bug Type: Bug Bug description:the string replacement of CRLF does not work consistently
Description: ------------ No matter how many ways CRLF (\r\n) has been tried to be replaced in a PHP script by <BR>, it does not produce a consistent result. This happens especially when trying to parse returned whois information. The $info in the following script will work with some parsing of the whois info with a string replacement of a CRLF (\r\n) on one domain (registrar) and yet on a different domain it will not work at all. I have looked at the differing outputs (depending on domain name) with a HEX editor and I know for a fact that there is a replacement problem with CRLF and php. I have tried A LOT of various scripts from people having the same problem, with no further success. The replacement of \r\n should be straight forward as in other languages but it is not in php. Perhaps a special function should be made for the task of replacemet of CRLF with another character. Have a look at the code below. Try different domain names and notice how the CRLF is parsed (with your own code to parse $info) on some domain information it will work and yet other domains it will not parse the CRLF (HEX-ODOA)! This is an ongoing problem for other people as well. Test script: --------------- <?php require_once "Net/Whois.php"; $whois = new Net_Whois(); /* You can add other NIC server as a second parameter. */ $info = $whois->query('example.com'); echo($info); ?> Expected result: ---------------- Please fix this string replacement problem _PLEASE. -- Edit bug report at http://bugs.php.net/bug.php?id=54732&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54732&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54732&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54732&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=54732&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54732&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=54732&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=54732&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=54732&r=needscript Try newer version: http://bugs.php.net/fix.php?id=54732&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=54732&r=support Expected behavior: http://bugs.php.net/fix.php?id=54732&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=54732&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=54732&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=54732&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54732&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=54732&r=dst IIS Stability: http://bugs.php.net/fix.php?id=54732&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=54732&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=54732&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=54732&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=54732&r=mysqlcfg