Skip to content

Commit c2523ed

Browse files
committed
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: Fix phpGH-19021: improve tidyOptGetCategory detection
2 parents 1cb166c + b5c4435 commit c2523ed

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ PHP NEWS
3939
exposes INDIRECTs). (nielsdos)
4040
. Improve __unserialize() hardening for SplHeap/SplPriorityQueue. (nielsdos)
4141

42+
- Tidy:
43+
. Fixed GH-19021 (improved tidyOptGetCategory detection).
44+
(arjendekorte, David Carlier, Peter Kokot)
45+
4246
- URI:
4347
. Fixed bug GH-20088 (Heap-use-after-free in PHP URI WHATWG parser
4448
during malformed URL processing). (lexborisov)

ext/tidy/config.m4

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,34 @@ if test "$PHP_TIDY" != "no"; then
5757
[],
5858
[-L$TIDY_LIBDIR])
5959

60-
dnl The tidyOptGetCategory function (added in libtidy 5.4.0) if only useable
61-
dnl if TidyInternalCategory (added in libtidy 5.6.0) is also present.
62-
PHP_CHECK_LIBRARY([$TIDY_LIB_NAME], [tidyInternalCategory],
63-
[AC_DEFINE([HAVE_TIDYOPTGETCATEGORY], [1],
64-
[Define to 1 if Tidy library has the 'tidyOptGetCategory' function.])],
65-
[],
66-
[-L$TIDY_LIBDIR])
67-
6860
PHP_ADD_LIBRARY_WITH_PATH([$TIDY_LIB_NAME],
6961
[$TIDY_LIBDIR],
7062
[TIDY_SHARED_LIBADD])
7163
PHP_ADD_INCLUDE([$TIDY_INCDIR])
7264

65+
old_CPPFLAGS=$CPPFLAGS
66+
CPPFLAGS=-I$TIDY_INCDIR
67+
68+
dnl The tidyOptGetCategory function (added in tidy-html5 5.4.0) is only
69+
dnl useable if TidyInternalCategory (added in tidy-html5 5.6.0) is also
70+
dnl present.
71+
AC_CACHE_CHECK([for tidyOptGetCategory], [php_ac_cv_have_tidyoptgetcategory],
72+
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <tidy.h>],[
73+
TidyDoc doc = tidyCreate();
74+
TidyOption badopt = tidyGetOptionByName(doc, "<bad>");
75+
Bool v = (tidyOptGetCategory(badopt) == TidyInternalCategory);
76+
(void)v;
77+
tidyRelease(doc);
78+
])],
79+
[php_ac_cv_have_tidyoptgetcategory=yes],
80+
[php_ac_cv_have_tidyoptgetcategory=no])
81+
])
82+
AS_VAR_IF([php_ac_cv_have_tidyoptgetcategory], [yes],
83+
[AC_DEFINE([HAVE_TIDYOPTGETCATEGORY], [1],
84+
[Define to 1 if tidyOptGetCategory is available.])])
85+
86+
CPPFLAGS=$old_CPPFLAGS
87+
7388
dnl Add -Wno-ignored-qualifiers as this is an issue upstream. Fixed in
7489
dnl tidy-html5 5.7.20: https://github.com/htacg/tidy-html5/issues/866
7590
PHP_NEW_EXTENSION([tidy],

0 commit comments

Comments
 (0)