Skip to content

Commit e13ba36

Browse files
committed
ext/tidy: anticipate tidyOptIsReadOnly retirement.
using tidyOptGetCategory when possible. related GH-18751 close GH-18763
1 parent 08a9579 commit e13ba36

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ PHP NEWS
4444

4545
- Tidy:
4646
. Fix memory leak in tidy output handler on error. (nielsdos)
47+
. Fix tidyOptIsReadonly deprecation, using tidyOptGetCategory. (David Carlier)
4748

4849
05 Jun 2025, PHP 8.3.22
4950

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)