Skip to content

Commit b5c4435

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Fix phpGH-19021: improve tidyOptGetCategory detection
2 parents d992cd8 + ebbb1b4 commit b5c4435

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
@@ -63,6 +63,10 @@ PHP NEWS
6363
. Partially fixed bug GH-16317 (SimpleXML does not allow __debugInfo() overrides
6464
to work). (nielsdos)
6565

66+
- Tidy:
67+
. Fixed GH-19021 (improved tidyOptGetCategory detection).
68+
(arjendekorte, David Carlier, Peter Kokot)
69+
6670
- XMLReader:
6771
. Fix arginfo/zpp violations when LIBXML_SCHEMAS_ENABLED is not available.
6872
(nielsdos)

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)