1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

ext/tidy: anticipate tidyOptIsReadOnly retirement.

using tidyOptGetCategory when possible.

related GH-18751

close GH-18763
This commit is contained in:
David Carlier
2025-06-04 19:22:06 +01:00
parent 08a9579883
commit e13ba36abb
3 changed files with 10 additions and 0 deletions

1
NEWS
View File

@@ -44,6 +44,7 @@ PHP NEWS
- Tidy:
. Fix memory leak in tidy output handler on error. (nielsdos)
. Fix tidyOptIsReadonly deprecation, using tidyOptGetCategory. (David Carlier)
05 Jun 2025, PHP 8.3.22

View File

@@ -62,6 +62,11 @@ if test "$PHP_TIDY" != "no"; then
AC_DEFINE(HAVE_TIDYRELEASEDATE,1,[ ])
], [], [])
PHP_CHECK_LIBRARY($TIDY_LIB_NAME,tidyOptGetCategory,
[
AC_DEFINE(HAVE_TIDYOPTGETCATEGORY,1,[ ])
], [], [])
PHP_ADD_LIBRARY_WITH_PATH($TIDY_LIB_NAME, $TIDY_LIBDIR, TIDY_SHARED_LIBADD)
PHP_ADD_INCLUDE($TIDY_INCDIR)

View File

@@ -232,7 +232,11 @@ static int _php_tidy_set_tidy_opt(TidyDoc doc, char *optname, zval *value)
return FAILURE;
}
#if defined(HAVE_TIDYOPTGETCATEGORY)
if (tidyOptGetCategory(opt) == TidyInternalCategory) {
#else
if (tidyOptIsReadOnly(opt)) {
#endif
php_error_docref(NULL, E_WARNING, "Attempting to set read-only option \"%s\"", optname);
return FAILURE;
}