Skip to content

Commit c71ab2c

Browse files
committed
ext/tidy: anticipate tidyOptIsReadOnly retirement.
using tidyOptGetCategory when possible. related phpGH-18751
1 parent 08a9579 commit c71ab2c

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

ext/tidy/config.m4

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ if test "$PHP_TIDY" != "no"; then
6262
AC_DEFINE(HAVE_TIDYRELEASEDATE,1,[ ])
6363
], [], [])
6464

65+
PHP_CHECK_LIBRARY($TIDY_LIB_NAME,tidyOptGetCategory,
66+
[
67+
AC_DEFINE(HAVE_TIDYOPTGETCATEGORY,1,[ ])
68+
], [], [])
69+
6570
PHP_ADD_LIBRARY_WITH_PATH($TIDY_LIB_NAME, $TIDY_LIBDIR, TIDY_SHARED_LIBADD)
6671
PHP_ADD_INCLUDE($TIDY_INCDIR)
6772

ext/tidy/tidy.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,11 @@ static int _php_tidy_set_tidy_opt(TidyDoc doc, char *optname, zval *value)
232232
return FAILURE;
233233
}
234234

235+
#if defined(HAVE_TIDYOPTGETCATEGORY)
236+
if (tidyOptGetCategory(opt) == TidyInternalCategory) {
237+
#else
235238
if (tidyOptIsReadOnly(opt)) {
239+
#endif
236240
php_error_docref(NULL, E_WARNING, "Attempting to set read-only option \"%s\"", optname);
237241
return FAILURE;
238242
}

0 commit comments

Comments
 (0)