diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2018-07-15 23:06:38 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2018-07-15 23:06:38 +0200 |
commit | 0f8c1ee76d5d2aa90bf667215e41eed60ca6cbcd (patch) | |
tree | 316b6663784beb3ccae245697f2a695face41427 /ext | |
parent | 141072a838b32f4eba33166666209508ef36ccba (diff) | |
download | php-git-0f8c1ee76d5d2aa90bf667215e41eed60ca6cbcd.tar.gz |
Fix #73817: Incorrect entries in get_html_translation_table
Due to incorrect string termination and length handling, several HTML
entities missed the trailing semicolon.
We also fix the obviously wrong expectations in two already existing
tests.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/standard/html.c | 3 | ||||
-rw-r--r-- | ext/standard/tests/strings/bug73817.phpt | 14 | ||||
-rw-r--r-- | ext/standard/tests/strings/get_html_translation_table_basic5.phpt | 130 | ||||
-rw-r--r-- | ext/standard/tests/strings/get_html_translation_table_basic6.phpt | 2 |
4 files changed, 81 insertions, 68 deletions
diff --git a/ext/standard/html.c b/ext/standard/html.c index 62b070bcb1..7d6567f9bc 100644 --- a/ext/standard/html.c +++ b/ext/standard/html.c @@ -1598,8 +1598,7 @@ static inline void write_s3row_data( written_k2 = write_octet_sequence((unsigned char*)&key[written_k1], charset, spe_cp); memcpy(&entity[1], mcpr[i].normal_entry.entity, l); entity[l + 1] = ';'; - entity[l + 1] = '\0'; - add_assoc_stringl_ex(arr, key, written_k1 + written_k2, entity, l + 1); + add_assoc_stringl_ex(arr, key, written_k1 + written_k2, entity, l + 2); } } } diff --git a/ext/standard/tests/strings/bug73817.phpt b/ext/standard/tests/strings/bug73817.phpt new file mode 100644 index 0000000000..3ca5762fcf --- /dev/null +++ b/ext/standard/tests/strings/bug73817.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #73817 (Incorrect entries in get_html_translation_table) +--FILE-- +<?php +$entities = get_html_translation_table( HTML_ENTITIES, ENT_QUOTES | ENT_HTML5); +foreach ($entities as $entity) { + if (substr($entity, -1) !== ';') { + var_dump($entity); + } +} +?> +===DONE=== +--EXPECT-- +===DONE=== diff --git a/ext/standard/tests/strings/get_html_translation_table_basic5.phpt b/ext/standard/tests/strings/get_html_translation_table_basic5.phpt index c7a9622fb7..e60443050d 100644 --- a/ext/standard/tests/strings/get_html_translation_table_basic5.phpt +++ b/ext/standard/tests/strings/get_html_translation_table_basic5.phpt @@ -273,27 +273,27 @@ Array [≢] => ≢ [≭] => ≭ [≠] => ≠ - [≧̸] => &NotGreaterFullEqual - [≫̸] => &NotGreaterGreater + [≧̸] => ≧̸ + [≫̸] => ≫̸ [≹] => ≹ - [⧏̸] => &NotLeftTriangleBar + [⧏̸] => ⧏̸ [≮] => ≮ [≰] => ≰ - [⪢̸] => &NotNestedGreaterGreater - [⪡̸] => &NotNestedLessLess - [⪯̸] => &NotPrecedesEqual + [⪢̸] => ⪢̸ + [⪡̸] => ⪡̸ + [⪯̸] => ⪯̸ [⋠] => ⋠ - [⧐̸] => &NotRightTriangleBar + [⧐̸] => ⧐̸ [⋭] => ⋭ - [⊏̸] => &NotSquareSubset + [⊏̸] => ⊏̸ [⋢] => ⋢ - [⊐̸] => &NotSquareSuperset + [⊐̸] => ⊐̸ [⋣] => ⋣ [⊈] => ⊈ [⊁] => ⊁ - [⪰̸] => &NotSucceedsEqual + [⪰̸] => ⪰̸ [⋡] => ⋡ - [≿̸] => &NotSucceedsTilde + [≿̸] => ≿̸ [⊉] => ⊉ [≁] => ≁ [𝒩] => 𝒩 @@ -394,7 +394,7 @@ Array [Т] => Т [𝔗] => 𝔗 [Θ] => Θ - [ ] => &ThickSpace + [ ] =>    [ ] =>   [≅] => ≅ [𝕋] => 𝕋 @@ -469,7 +469,7 @@ Array [á] => á [ă] => ă [∾] => ∾ - [∾̳] => &acE + [∾̳] => ∾̳ [∿] => ∿ [â] => â [а] => а @@ -552,8 +552,8 @@ Array [░] => ░ [▓] => ▓ [█] => █ - [=⃥] => &bne - [≡⃥] => &bnequiv + [=⃥] => =⃥ + [≡⃥] => ≡⃥ [⌐] => ⌐ [𝕓] => 𝕓 [⋈] => ⋈ @@ -616,7 +616,7 @@ Array [⩋] => ⩋ [⩇] => ⩇ [⩀] => ⩀ - [∩︀] => &caps + [∩︀] => ∩︀ [⁁] => ⁁ [⩍] => ⩍ [č] => č @@ -668,7 +668,7 @@ Array [⩊] => ⩊ [⊍] => ⊍ [⩅] => ⩅ - [∪︀] => &cups + [∪︀] => ∪︀ [↷] => ↷ [⤼] => ⤼ [⋞] => ⋞ @@ -772,7 +772,7 @@ Array [ffl] => ffl [𝔣] => 𝔣 [fi] => fi - [fj] => &fjlig + [fj] => fj [♭] => ♭ [fl] => fl [▱] => ▱ @@ -814,7 +814,7 @@ Array [⪀] => ⪀ [⪂] => ⪂ [⪄] => ⪄ - [⋛︀] => &gesl + [⋛︀] => ⋛︀ [⪔] => ⪔ [𝔤] => 𝔤 [≫] => ≫ @@ -841,7 +841,7 @@ Array [⥸] => ⥸ [⋗] => ⋗ [⋛] => ⋛ - [≩︀] => &gvertneqq + [≩︀] => ≩︀ [⇔] => ⇔ [ ] =>   [½] => ½ @@ -940,7 +940,7 @@ Array [⪫] => ⪫ [⤙] => ⤙ [⪭] => ⪭ - [⪭︀] => &lates + [⪭︀] => ⪭︀ [⤌] => ⤌ [❲] => ❲ [{] => { @@ -965,7 +965,7 @@ Array [⩿] => ⩿ [⪁] => ⪁ [⪃] => ⪃ - [⋚︀] => &lesg + [⋚︀] => ⋚︀ [⪓] => ⪓ [⋖] => ⋖ [⋚] => ⋚ @@ -1022,7 +1022,7 @@ Array [◃] => ◃ [⥊] => ⥊ [⥦] => ⥦ - [≨︀] => &lvertneqq + [≨︀] => ≨︀ [∺] => ∺ [¯] => ¯ [♂] => ♂ @@ -1046,42 +1046,42 @@ Array [𝓂] => 𝓂 [μ] => μ [⊸] => ⊸ - [⋙̸] => &nGg - [≫⃒] => &nGt + [⋙̸] => ⋙̸ + [≫⃒] => ≫⃒ [⇍] => ⇍ - [⋘̸] => &nLl - [≪⃒] => &nLt - [≪̸] => &nLtv + [⋘̸] => ⋘̸ + [≪⃒] => ≪⃒ + [≪̸] => ≪̸ [⊯] => ⊯ [⊮] => ⊮ [∇] => ∇ [ń] => ń - [∠⃒] => &nang - [⩰̸] => &napE - [≋̸] => &napid + [∠⃒] => ∠⃒ + [⩰̸] => ⩰̸ + [≋̸] => ≋̸ [ʼn] => ʼn [≉] => ≉ [♮] => ♮ [ℕ] => ℕ [ ] => - [≎̸] => &nbump - [≏̸] => &nbumpe + [≎̸] => ≎̸ + [≏̸] => ≏̸ [⩃] => ⩃ [ň] => ň [ņ] => ņ [≇] => ≇ - [⩭̸] => &ncongdot + [⩭̸] => ⩭̸ [⩂] => ⩂ [н] => н [–] => – [⇗] => ⇗ [⤤] => ⤤ - [≐̸] => &nedot - [≂̸] => &nesim + [≐̸] => ≐̸ + [≂̸] => ≂̸ [∄] => ∄ [𝔫] => 𝔫 [≱] => ≱ - [⩾̸] => &nges + [⩾̸] => ⩾̸ [≵] => ≵ [≯] => ≯ [⇎] => ⇎ @@ -1089,41 +1089,41 @@ Array [⋼] => ⋼ [⋺] => ⋺ [њ] => њ - [≦̸] => &nlE + [≦̸] => ≦̸ [‥] => ‥ [↚] => ↚ [↮] => ↮ - [⩽̸] => &nles + [⩽̸] => ⩽̸ [≴] => ≴ [⋪] => ⋪ [⋬] => ⋬ [𝕟] => 𝕟 [¬] => ¬ [∉] => ∉ - [⋹̸] => ¬inE - [⋵̸] => ¬indot + [⋹̸] => ⋹̸ + [⋵̸] => ⋵̸ [⋷] => ⋷ [⋶] => ⋶ [∌] => ∌ [⋾] => ⋾ [⋽] => ⋽ [∦] => ∦ - [⫽⃥] => &nparsl - [∂̸] => &npart + [⫽⃥] => ⫽⃥ + [∂̸] => ∂̸ [⨔] => ⨔ [⊀] => ⊀ [⇏] => ⇏ [↛] => ↛ - [⤳̸] => &nrarrc - [↝̸] => &nrarrw + [⤳̸] => ⤳̸ + [↝̸] => ↝̸ [𝓃] => 𝓃 [∤] => ∤ [≄] => ≄ [⊄] => ⊄ - [⫅̸] => &nsubE + [⫅̸] => ⫅̸ [⊅] => ⊅ - [⊃⃒] => &nsupset - [⫆̸] => &nsupseteqq + [⊃⃒] => ⊃⃒ + [⫆̸] => ⫆̸ [ñ] => ñ [≸] => ≸ [⋫] => ⋫ @@ -1133,18 +1133,18 @@ Array [ ] =>   [⊭] => ⊭ [⤄] => ⤄ - [≍⃒] => &nvap + [≍⃒] => ≍⃒ [⊬] => ⊬ - [≥⃒] => &nvge - [>⃒] => &nvgt + [≥⃒] => ≥⃒ + [>⃒] => >⃒ [⧞] => ⧞ [⤂] => ⤂ - [≤⃒] => &nvle - [<⃒] => &nvlt - [⊴⃒] => &nvltrie + [≤⃒] => ≤⃒ + [<⃒] => <⃒ + [⊴⃒] => ⊴⃒ [⤃] => ⤃ - [⊵⃒] => &nvrtrie - [∼⃒] => &nvsim + [⊵⃒] => ⊵⃒ + [∼⃒] => ∼⃒ [⇖] => ⇖ [⤣] => ⤣ [↖] => ↖ @@ -1254,7 +1254,7 @@ Array [⇛] => ⇛ [⤜] => ⤜ [⥤] => ⥤ - [∽̱] => &race + [∽̱] => ∽̱ [ŕ] => ŕ [⦳] => ⦳ [⦒] => ⦒ @@ -1364,7 +1364,7 @@ Array [⌣] => ⌣ [⪪] => ⪪ [⪬] => ⪬ - [⪬︀] => &smtes + [⪬︀] => ⪬︀ [ь] => ь [/] => / [⧄] => ⧄ @@ -1372,9 +1372,9 @@ Array [𝕤] => 𝕤 [♠] => ♠ [⊓] => ⊓ - [⊓︀] => &sqcaps + [⊓︀] => ⊓︀ [⊔] => ⊔ - [⊔︀] => &sqcups + [⊔︀] => ⊔︀ [⊏] => ⊏ [⊐] => ⊐ [▪] => ▪ @@ -1501,7 +1501,7 @@ Array [⫩] => ⫩ [⦜] => ⦜ [ϰ] => ϰ - [⫌︀] => &varsupsetneqq + [⫌︀] => ⫌︀ [⊲] => ⊲ [в] => в [⊢] => ⊢ @@ -1510,13 +1510,13 @@ Array [⋮] => ⋮ [|] => | [𝔳] => 𝔳 - [⊂⃒] => &vnsub + [⊂⃒] => ⊂⃒ [𝕧] => 𝕧 [⊳] => ⊳ [𝓋] => 𝓋 - [⫋︀] => &vsubnE - [⊊︀] => &vsubne - [⊋︀] => &vsupne + [⫋︀] => ⫋︀ + [⊊︀] => ⊊︀ + [⊋︀] => ⊋︀ [⦚] => ⦚ [ŵ] => ŵ [⩟] => ⩟ diff --git a/ext/standard/tests/strings/get_html_translation_table_basic6.phpt b/ext/standard/tests/strings/get_html_translation_table_basic6.phpt index ad1c5986ab..52ba2f44f3 100644 --- a/ext/standard/tests/strings/get_html_translation_table_basic6.phpt +++ b/ext/standard/tests/strings/get_html_translation_table_basic6.phpt @@ -81,7 +81,7 @@ Array [^] => ^ [_] => _ [`] => ` - [fj] => &fjlig + [fj] => fj [{] => { [|] => | [}] => } |