[dev] Data::imc should split on [\r\n], not just \n

John Morrissey jwm at horde.net
Sun Jan 12 22:22:27 PST 2003


Data::imc should be splitting lines on [\r\n] instead of just \n - if it
doesn't, Data::icalendar can wind up in an infinite loop when viewing .ics
files. Patch attached.

Also, I noticed that the newline character(s) are determined by
Data::getNewline(). This means that any event invitations sent by the user
will use the line terminator preferred by his host OS. Somehow this doesn't
seem right (what about the recipient's platform?), but I can't think of a
clean way to fix it.

john
-- 
John Morrissey          _o            /\         ----  __o
jwm at horde.net        _-< \_          /  \       ----  <  \,
www.horde.net/    __(_)/_(_)________/    \_______(_) /_(_)__
-------------- next part --------------
Index: lib/Data/imc.php
===================================================================
RCS file: /repository/horde/lib/Data/imc.php,v
retrieving revision 1.14
diff -u -u -r1.14 imc.php
--- lib/Data/imc.php	3 Jan 2003 02:33:40 -0000	1.14
+++ lib/Data/imc.php	13 Jan 2003 03:16:43 -0000
@@ -22,7 +22,7 @@
 
     function import($text)
     {
-        $lines = explode("\n", $text);
+        $lines = preg_split('/[\r\n]+/', $text);
         $data = array();
 
         // Unfolding.


More information about the dev mailing list