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.
This commit is contained in:
Christoph M. Becker 2018-07-15 23:06:38 +02:00
parent 141072a838
commit 0f8c1ee76d
5 changed files with 84 additions and 68 deletions

3
NEWS
View file

@ -9,6 +9,9 @@ PHP NEWS
- PDO_Firebird: - PDO_Firebird:
. Fixed bug #76488 (Memory leak when fetching a BLOB field). (Simonov Denis) . 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: - Zip:
. Fixed bug #76524 (ZipArchive memory leak (OVERWRITE flag and empty archive)). . Fixed bug #76524 (ZipArchive memory leak (OVERWRITE flag and empty archive)).
(Timur Ibragimov) (Timur Ibragimov)

View file

@ -1598,8 +1598,7 @@ static inline void write_s3row_data(
written_k2 = write_octet_sequence((unsigned char*)&key[written_k1], charset, spe_cp); written_k2 = write_octet_sequence((unsigned char*)&key[written_k1], charset, spe_cp);
memcpy(&entity[1], mcpr[i].normal_entry.entity, l); memcpy(&entity[1], mcpr[i].normal_entry.entity, l);
entity[l + 1] = ';'; entity[l + 1] = ';';
entity[l + 1] = '\0'; add_assoc_stringl_ex(arr, key, written_k1 + written_k2, entity, l + 2);
add_assoc_stringl_ex(arr, key, written_k1 + written_k2, entity, l + 1);
} }
} }
} }

View file

@ -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===

View file

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

View file

@ -81,7 +81,7 @@ Array
[^] => &Hat; [^] => &Hat;
[_] => &lowbar; [_] => &lowbar;
[`] => &grave; [`] => &grave;
[fj] => &fjlig [fj] => &fjlig;
[{] => &lbrace; [{] => &lbrace;
[|] => &vert; [|] => &vert;
[}] => &rcub; [}] => &rcub;