]> granicus.if.org Git - php/commitdiff
Fix #73817: Incorrect entries in get_html_translation_table
authorChristoph M. Becker <cmbecker69@gmx.de>
Sun, 15 Jul 2018 21:06:38 +0000 (23:06 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Sun, 15 Jul 2018 21:06:38 +0000 (23:06 +0200)
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.

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

diff --git a/NEWS b/NEWS
index edd60bd1f41ce8e36b21c19351c1d9753d014774..e359a8c646bd1446e484002f111ebfab47456a6e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,9 @@ PHP                                                                        NEWS
 - PDO_Firebird:
   . Fixed bug #76488 (Memory leak when fetching a BLOB field). (Simonov Denis)
 
+- Standard:
+  . Fixed bug #73817 (Incorrect entries in get_html_translation_table). (cmb)
+
 - Zip:
   . Fixed bug #76524 (ZipArchive memory leak (OVERWRITE flag and empty archive)).
     (Timur Ibragimov)
index 62b070bcb13ffaf98eb330afc445ddf0650c187b..7d6567f9bcf67e885b4d0a9e3b13081eea78d7f4 100644 (file)
@@ -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 (file)
index 0000000..3ca5762
--- /dev/null
@@ -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===
index c7a9622fb7fd2d3075bc794d012a119f6ee84311..e60443050d1e1c60bac4c3d1b709f87348f2307b 100644 (file)
@@ -273,27 +273,27 @@ Array
     [≢] => &NotCongruent;
     [≭] => &NotCupCap;
     [≠] => &NotEqual;
-    [≧̸] => &NotGreaterFullEqual
-    [≫̸] => &NotGreaterGreater
+    [≧̸] => &NotGreaterFullEqual;
+    [≫̸] => &NotGreaterGreater;
     [≹] => &NotGreaterLess;
-    [⧏̸] => &NotLeftTriangleBar
+    [⧏̸] => &NotLeftTriangleBar;
     [≮] => &NotLess;
     [≰] => &NotLessEqual;
-    [⪢̸] => &NotNestedGreaterGreater
-    [⪡̸] => &NotNestedLessLess
-    [⪯̸] => &NotPrecedesEqual
+    [⪢̸] => &NotNestedGreaterGreater;
+    [⪡̸] => &NotNestedLessLess;
+    [⪯̸] => &NotPrecedesEqual;
     [⋠] => &NotPrecedesSlantEqual;
-    [⧐̸] => &NotRightTriangleBar
+    [⧐̸] => &NotRightTriangleBar;
     [⋭] => &NotRightTriangleEqual;
-    [⊏̸] => &NotSquareSubset
+    [⊏̸] => &NotSquareSubset;
     [⋢] => &NotSquareSubsetEqual;
-    [⊐̸] => &NotSquareSuperset
+    [⊐̸] => &NotSquareSuperset;
     [⋣] => &NotSquareSupersetEqual;
     [⊈] => &NotSubsetEqual;
     [⊁] => &NotSucceeds;
-    [⪰̸] => &NotSucceedsEqual
+    [⪰̸] => &NotSucceedsEqual;
     [⋡] => &NotSucceedsSlantEqual;
-    [≿̸] => &NotSucceedsTilde
+    [≿̸] => &NotSucceedsTilde;
     [⊉] => &NotSupersetEqual;
     [≁] => &NotTilde;
     [𝒩] => &Nscr;
@@ -394,7 +394,7 @@ Array
     [Т] => &Tcy;
     [𝔗] => &Tfr;
     [Θ] => &Theta;
-    [  ] => &ThickSpace
+    [  ] => &ThickSpace;
     [ ] => &ThinSpace;
     [≅] => &TildeFullEqual;
     [𝕋] => &Topf;
@@ -469,7 +469,7 @@ Array
     [á] => &aacute;
     [ă] => &abreve;
     [∾] => &ac;
-    [∾̳] => &acE
+    [∾̳] => &acE;
     [∿] => &acd;
     [â] => &acirc;
     [а] => &acy;
@@ -552,8 +552,8 @@ Array
     [░] => &blk14;
     [▓] => &blk34;
     [█] => &block;
-    [=⃥] => &bne
-    [≡⃥] => &bnequiv
+    [=⃥] => &bne;
+    [≡⃥] => &bnequiv;
     [⌐] => &bnot;
     [𝕓] => &bopf;
     [⋈] => &bowtie;
@@ -616,7 +616,7 @@ Array
     [⩋] => &capcap;
     [⩇] => &capcup;
     [⩀] => &capdot;
-    [∩︀] => &caps
+    [∩︀] => &caps;
     [⁁] => &caret;
     [⩍] => &ccaps;
     [č] => &ccaron;
@@ -668,7 +668,7 @@ Array
     [⩊] => &cupcup;
     [⊍] => &cupdot;
     [⩅] => &cupor;
-    [∪︀] => &cups
+    [∪︀] => &cups;
     [↷] => &curarr;
     [⤼] => &curarrm;
     [⋞] => &curlyeqprec;
@@ -772,7 +772,7 @@ Array
     [ffl] => &ffllig;
     [𝔣] => &ffr;
     [fi] => &filig;
-    [fj] => &fjlig
+    [fj] => &fjlig;
     [♭] => &flat;
     [fl] => &fllig;
     [▱] => &fltns;
@@ -814,7 +814,7 @@ Array
     [⪀] => &gesdot;
     [⪂] => &gesdoto;
     [⪄] => &gesdotol;
-    [⋛︀] => &gesl
+    [⋛︀] => &gesl;
     [⪔] => &gesles;
     [𝔤] => &gfr;
     [≫] => &gg;
@@ -841,7 +841,7 @@ Array
     [⥸] => &gtrarr;
     [⋗] => &gtrdot;
     [⋛] => &gtreqless;
-    [≩︀] => &gvertneqq
+    [≩︀] => &gvertneqq;
     [⇔] => &hArr;
     [ ] => &hairsp;
     [½] => &half;
@@ -940,7 +940,7 @@ Array
     [⪫] => &lat;
     [⤙] => &latail;
     [⪭] => &late;
-    [⪭︀] => &lates
+    [⪭︀] => &lates;
     [⤌] => &lbarr;
     [❲] => &lbbrk;
     [{] => &lbrace;
@@ -965,7 +965,7 @@ Array
     [⩿] => &lesdot;
     [⪁] => &lesdoto;
     [⪃] => &lesdotor;
-    [⋚︀] => &lesg
+    [⋚︀] => &lesg;
     [⪓] => &lesges;
     [⋖] => &lessdot;
     [⋚] => &lesseqgtr;
@@ -1022,7 +1022,7 @@ Array
     [◃] => &ltri;
     [⥊] => &lurdshar;
     [⥦] => &luruhar;
-    [≨︀] => &lvertneqq
+    [≨︀] => &lvertneqq;
     [∺] => &mDDot;
     [¯] => &macr;
     [♂] => &male;
@@ -1046,42 +1046,42 @@ Array
     [𝓂] => &mscr;
     [μ] => &mu;
     [⊸] => &mumap;
-    [⋙̸] => &nGg
-    [≫⃒] => &nGt
+    [⋙̸] => &nGg;
+    [≫⃒] => &nGt;
     [⇍] => &nLeftarrow;
-    [⋘̸] => &nLl
-    [≪⃒] => &nLt
-    [≪̸] => &nLtv
+    [⋘̸] => &nLl;
+    [≪⃒] => &nLt;
+    [≪̸] => &nLtv;
     [⊯] => &nVDash;
     [⊮] => &nVdash;
     [∇] => &nabla;
     [ń] => &nacute;
-    [∠⃒] => &nang
-    [⩰̸] => &napE
-    [≋̸] => &napid
+    [∠⃒] => &nang;
+    [⩰̸] => &napE;
+    [≋̸] => &napid;
     [ʼn] => &napos;
     [≉] => &napprox;
     [♮] => &natur;
     [ℕ] => &naturals;
     [ ] => &nbsp;
-    [≎̸] => &nbump
-    [≏̸] => &nbumpe
+    [≎̸] => &nbump;
+    [≏̸] => &nbumpe;
     [⩃] => &ncap;
     [ň] => &ncaron;
     [ņ] => &ncedil;
     [≇] => &ncong;
-    [⩭̸] => &ncongdot
+    [⩭̸] => &ncongdot;
     [⩂] => &ncup;
     [н] => &ncy;
     [–] => &ndash;
     [⇗] => &neArr;
     [⤤] => &nearhk;
-    [≐̸] => &nedot
-    [≂̸] => &nesim
+    [≐̸] => &nedot;
+    [≂̸] => &nesim;
     [∄] => &nexist;
     [𝔫] => &nfr;
     [≱] => &ngeq;
-    [⩾̸] => &nges
+    [⩾̸] => &nges;
     [≵] => &ngsim;
     [≯] => &ngtr;
     [⇎] => &nhArr;
@@ -1089,41 +1089,41 @@ Array
     [⋼] => &nis;
     [⋺] => &nisd;
     [њ] => &njcy;
-    [≦̸] => &nlE
+    [≦̸] => &nlE;
     [‥] => &nldr;
     [↚] => &nleftarrow;
     [↮] => &nleftrightarrow;
-    [⩽̸] => &nles
+    [⩽̸] => &nles;
     [≴] => &nlsim;
     [⋪] => &nltri;
     [⋬] => &nltrie;
     [𝕟] => &nopf;
     [¬] => &not;
     [∉] => &notin;
-    [⋹̸] => &notinE
-    [⋵̸] => &notindot
+    [⋹̸] => &notinE;
+    [⋵̸] => &notindot;
     [⋷] => &notinvb;
     [⋶] => &notinvc;
     [∌] => &notniva;
     [⋾] => &notnivb;
     [⋽] => &notnivc;
     [∦] => &nparallel;
-    [⫽⃥] => &nparsl
-    [∂̸] => &npart
+    [⫽⃥] => &nparsl;
+    [∂̸] => &npart;
     [⨔] => &npolint;
     [⊀] => &npr;
     [⇏] => &nrArr;
     [↛] => &nrarr;
-    [⤳̸] => &nrarrc
-    [↝̸] => &nrarrw
+    [⤳̸] => &nrarrc;
+    [↝̸] => &nrarrw;
     [𝓃] => &nscr;
     [∤] => &nshortmid;
     [≄] => &nsime;
     [⊄] => &nsub;
-    [⫅̸] => &nsubE
+    [⫅̸] => &nsubE;
     [⊅] => &nsup;
-    [⊃⃒] => &nsupset
-    [⫆̸] => &nsupseteqq
+    [⊃⃒] => &nsupset;
+    [⫆̸] => &nsupseteqq;
     [ñ] => &ntilde;
     [≸] => &ntlg;
     [⋫] => &ntriangleright;
@@ -1133,18 +1133,18 @@ Array
     [ ] => &numsp;
     [⊭] => &nvDash;
     [⤄] => &nvHarr;
-    [≍⃒] => &nvap
+    [≍⃒] => &nvap;
     [⊬] => &nvdash;
-    [≥⃒] => &nvge
-    [>⃒] => &nvgt
+    [≥⃒] => &nvge;
+    [>⃒] => &nvgt;
     [⧞] => &nvinfin;
     [⤂] => &nvlArr;
-    [≤⃒] => &nvle
-    [<⃒] => &nvlt
-    [⊴⃒] => &nvltrie
+    [≤⃒] => &nvle;
+    [<⃒] => &nvlt;
+    [⊴⃒] => &nvltrie;
     [⤃] => &nvrArr;
-    [⊵⃒] => &nvrtrie
-    [∼⃒] => &nvsim
+    [⊵⃒] => &nvrtrie;
+    [∼⃒] => &nvsim;
     [⇖] => &nwArr;
     [⤣] => &nwarhk;
     [↖] => &nwarrow;
@@ -1254,7 +1254,7 @@ Array
     [⇛] => &rAarr;
     [⤜] => &rAtail;
     [⥤] => &rHar;
-    [∽̱] => &race
+    [∽̱] => &race;
     [ŕ] => &racute;
     [⦳] => &raemptyv;
     [⦒] => &rangd;
@@ -1364,7 +1364,7 @@ Array
     [⌣] => &smile;
     [⪪] => &smt;
     [⪬] => &smte;
-    [⪬︀] => &smtes
+    [⪬︀] => &smtes;
     [ь] => &softcy;
     [/] => &sol;
     [⧄] => &solb;
@@ -1372,9 +1372,9 @@ Array
     [𝕤] => &sopf;
     [♠] => &spadesuit;
     [⊓] => &sqcap;
-    [⊓︀] => &sqcaps
+    [⊓︀] => &sqcaps;
     [⊔] => &sqcup;
-    [⊔︀] => &sqcups
+    [⊔︀] => &sqcups;
     [⊏] => &sqsub;
     [⊐] => &sqsupset;
     [▪] => &squarf;
@@ -1501,7 +1501,7 @@ Array
     [⫩] => &vBarv;
     [⦜] => &vangrt;
     [ϰ] => &varkappa;
-    [⫌︀] => &varsupsetneqq
+    [⫌︀] => &varsupsetneqq;
     [⊲] => &vartriangleleft;
     [в] => &vcy;
     [⊢] => &vdash;
@@ -1510,13 +1510,13 @@ Array
     [⋮] => &vellip;
     [|] => &vert;
     [𝔳] => &vfr;
-    [⊂⃒] => &vnsub
+    [⊂⃒] => &vnsub;
     [𝕧] => &vopf;
     [⊳] => &vrtri;
     [𝓋] => &vscr;
-    [⫋︀] => &vsubnE
-    [⊊︀] => &vsubne
-    [⊋︀] => &vsupne
+    [⫋︀] => &vsubnE;
+    [⊊︀] => &vsubne;
+    [⊋︀] => &vsupne;
     [⦚] => &vzigzag;
     [ŵ] => &wcirc;
     [⩟] => &wedbar;
index ad1c5986abbbd221159b6c52bce3a39d155bbbc9..52ba2f44f324288954666d62c1b4c7fe80a909bc 100644 (file)
@@ -81,7 +81,7 @@ Array
     [^] => &Hat;
     [_] => &lowbar;
     [`] => &grave;
-    [fj] => &fjlig
+    [fj] => &fjlig;
     [{] => &lbrace;
     [|] => &vert;
     [}] => &rcub;