Req #16637 [Fbk]: Does not handle Carriage Return (\r)
| From: | tyler dot thackray at gmail dot com | Date: | Thu, 24 Sep 2009 14:34:23 +0000 |
| Subject: | Req #16637 [Fbk]: Does not handle Carriage Return (\r) | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-1724@lists.php.net to get a copy of this message | ||
Edit report at http://pear.php.net/bugs/bug.php?id=16637&edit=1
ID: 16637
Updated by: tyler.thackray@gmail.com
Reported By: tyler dot thackray at gmail dot com
Summary: Does not handle Carriage Return (\r)
Status: Feedback
Type: Feature/Change Request
Package: File_IMC
Operating System: Irrelevant
Package Version: 0.4.0
PHP Version: Irrelevant
Assigned To: till
Roadmap Versions:
New Comment:
I regret to inform you that I really don't have much time to develop a
test or patch, but I can point you in the right direction. As far as a
patch, the code change is very simple.
1. In Build.php in the escape() function, the regex should be
$regex = '(?<!\\\\)([\:\;\,\\n\\r])';
2. In Parse.php in the unescape() function, find and replace should be
$find = array('\:', '\;', '\,', '\n', '\r');
$replace = array(':', ';', ',', "\n", "\r");
For a test, just create a vCard with some \r in it and you will see
what I mean. If you want a real world example, most HTML form <textarea>
will use \r\n for the line break.
Previous Comments:
------------------------------------------------------------------------
[2009-09-24 15:20:20] till
-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: till
Can you supply a patch to what you changed?
Also, would you be able to upload an example or even a test? If a test
is an issue, I'd
be happy to build one
------------------------------------------------------------------------
[2009-09-23 23:00:43] auxone
Description:
------------
Parse::unescape() and Build:escape() do not handle \r as they do \n. In
practice, I've found that often a \r will find it's way into the input
used to build a card. When the card is later parsed, the segment after
the \r is lost.
Because of the way the class is designed, it is easy to escape() the
\r, however it required a very slight change in the unescape() method to
get the \r back. In light of this, I just added the \r to escape() and
unescape() and it is my recommendation that you do the same.
Having said that, I am not expert on IMC standards so perhaps this
would violate that, but what I do know is that in it's current state a
\r breaks cards.
Thanks.
------------------------------------------------------------------------
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=16637&edit=1