]> granicus.if.org Git - php/commitdiff
MFB: fix #43927 (koi8r is missing from html_entity_decode())
authorAntony Dovgal <tony2001@php.net>
Mon, 28 Jan 2008 23:08:07 +0000 (23:08 +0000)
committerAntony Dovgal <tony2001@php.net>
Mon, 28 Jan 2008 23:08:07 +0000 (23:08 +0000)
patch by andy at demos dot su

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

index 7ddcd2daab8f2197c2b0667f42791d528d54b7f1..6e3e50ceb5803a8344e00a808a57e4ad9f55f97b 100644 (file)
@@ -958,6 +958,7 @@ PHPAPI char *php_unescape_html_entities(char *orig, int oldlen, int *newlen, int
                                        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..a2e8d05
--- /dev/null
@@ -0,0 +1,16 @@
+--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;"
+--UEXPECT--
+unicode(4) "&lt;"
+unicode(5) "&#38;"
+unicode(8) "&#38;lt;"