]> granicus.if.org Git - php/commitdiff
(PHP quoted_printable_decode) Fixed CR/LF processing for Windows/OS2
authorKirill Maximov <kir@php.net>
Mon, 1 Apr 2002 17:03:01 +0000 (17:03 +0000)
committerKirill Maximov <kir@php.net>
Mon, 1 Apr 2002 17:03:01 +0000 (17:03 +0000)
@ Fixed CR/LF processing for Windows/OS2 in quoted_printable_decode (kir)

ext/standard/quot_print.c
ext/standard/tests/general_functions/002.phpt
ext/standard/tests/general_functions/006.phpt [new file with mode: 0644]

index e480f1ae5afc79fa61980d7933c2bd9e5f70be66..1009018bf87a547c52c1f7f2d59ee1d45200e38b 100644 (file)
@@ -44,6 +44,10 @@ static char php_hex2int(int c)
        {
                return c - 'A' + 10;
        }
+    else if ( c >= 'a' && c <= 'f' )
+    {
+        return c - 'a' + 10;
+    }
        else
        {
                return -1;
@@ -102,7 +106,7 @@ PHP_FUNCTION(quoted_printable_decode)
                     /* End of line reached */
                     i += k;
                 }
-                else if ( (str_in[i+k] == 10) && (str_in[i+k+1] == 13))
+                else if ( (str_in[i+k] == 13) && (str_in[i+k+1] == 10))
                 {
                     /* CRLF */
                     i += k+2;
index d78bdb9afaaed8f09927fefaee7a608bc05589c5..8ab1a72f072b576ddd7f158d3cf8d7777fd19bee 100644 (file)
@@ -3,11 +3,11 @@ quoted_printable_decode() function test
 --POST--
 --GET--
 --FILE--
-<?php echo quoted_printable_decode("=FAwow-factor=C1=D0=D5=DD=C5=CE=CE=D9=C5=0A=        
-=20=D4=CF=D2=C7=CF=D7=D9=C5=       
+<?php echo quoted_printable_decode("=FAwow-factor=C1=d0=D5=DD=C5=CE=CE=D9=C5=0A=        
+=20=D4=cf=D2=C7=CF=D7=D9=C5=       
 =20=           
 =D0=
 =D2=CF=C5=CB=D4=D9"); ?>
 --EXPECT--
 úwow-factorÁÐÕÝÅÎÎÙÅ
- ÔÏÒÇÏ×ÙÅ ÐÒÏÅËÔÙ
\ No newline at end of file
+ ÔÏÒÇÏ×ÙÅ ÐÒÏÅËÔÙ
diff --git a/ext/standard/tests/general_functions/006.phpt b/ext/standard/tests/general_functions/006.phpt
new file mode 100644 (file)
index 0000000..9db1ca3
--- /dev/null
@@ -0,0 +1,13 @@
+--TEST--
+quoted_printable_decode() function test with CR/LF
+--POST--
+--GET--
+--FILE--
+<?php echo quoted_printable_decode("=FAwow-factor=C1=D0=D5=DD=C5=CE=CE=D9=C5=0A=        
+=20=D4=CF=D2=C7=CF=D7=D9=C5=       
+=20=           
+=D0=
+=D2=CF=C5=CB=D4=D9"); ?>
+--EXPECT--
+úwow-factorÁÐÕÝÅÎÎÙÅ
+ ÔÏÒÇÏ×ÙÅ ÐÒÏÅËÔÙ