]> granicus.if.org Git - php/commitdiff
MFH: fix #43927 (koi8r is missing from html_entity_decode())
authorAntony Dovgal <tony2001@php.net>
Tue, 29 Jan 2008 13:39:03 +0000 (13:39 +0000)
committerAntony Dovgal <tony2001@php.net>
Tue, 29 Jan 2008 13:39:03 +0000 (13:39 +0000)
patch by andy at demos dot su

NEWS
ext/standard/html.c
ext/standard/tests/strings/bug43927.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 00690ffab960367a839efa1fb118a9d152477e0c..a04bc3ad45b0bccfef92afea8930af45d7f70380 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,8 @@ PHP                                                                        NEWS
 
 - Fixed bug #43954 (Memory leak when sending the same HTTP status code
   multiple times). (Scott)
+- Fixed bug #43927 (koi8r is missing from html_entity_decode()). 
+  (andy at demos dot su, Tony)
 - Fixed faulty fix for bug #40189 (endless loop in zlib.inflate stream filter). 
   (Greg)
 - Fixed bug #43912 (Interbase column names are truncated to 31 characters).
index fc7fa13db295c7f243714234bb1876a763f1fe5d..7c99b8f3b1f2d76bfbb9bccfceeb0caad5614c4e 100644 (file)
@@ -954,6 +954,7 @@ PHPAPI char *php_unescape_html_entities(unsigned char *old, int oldlen, int *new
                                        case cs_cp1251:
                                        case cs_8859_5:
                                        case cs_cp866:
+                                       case cs_koi8r:
                                                replacement[0] = k;
                                                replacement[1] = '\0';
                                                replacement_len = 1;
diff --git a/ext/standard/tests/strings/bug43927.phpt b/ext/standard/tests/strings/bug43927.phpt
new file mode 100644 (file)
index 0000000..b780c4a
--- /dev/null
@@ -0,0 +1,12 @@
+--TEST--
+Bug #43927 (koi8r is missing from html_entity_decode())
+--FILE--
+<?php
+var_dump(html_entity_decode("&amp;lt;", ENT_COMPAT, 'koi8-r'));
+var_dump(html_entity_decode("&amp;#38;", ENT_COMPAT, 'koi8-r'));
+var_dump(html_entity_decode("&amp;#38;lt;", ENT_COMPAT, 'koi8-r'));
+?>
+--EXPECT--
+string(4) "&lt;"
+string(5) "&#38;"
+string(8) "&#38;lt;"