From 12d204c9d6eb8400e2624756b9b6e9fdac2dcc78 Mon Sep 17 00:00:00 2001 From: Calvin Buckley Date: Tue, 4 Aug 2026 12:21:49 -0300 Subject: [PATCH 1/2] standard: use sole user of php_error_docref_unchecked After GH-22390 was merged, we can now use a %pS format specifier for zend_string without having to use the unchecked variant (so that gcc et al doesn't complain that %S should be for wchar_t*). --- ext/standard/array.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/standard/array.c b/ext/standard/array.c index 2d1dd584906a..fe74e1e7881d 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -2579,7 +2579,7 @@ static void php_compact_var(HashTable *eg_active_symbol_table, zval *return_valu zend_hash_update(Z_ARRVAL_P(return_value), Z_STR_P(entry), &data); } } else { - php_error_docref_unchecked(NULL, E_WARNING, "Undefined variable $%S", Z_STR_P(entry)); + php_error_docref(NULL, E_WARNING, "Undefined variable $%pS", Z_STR_P(entry)); } } else if (Z_TYPE_P(entry) == IS_ARRAY) { if (Z_REFCOUNTED_P(entry)) { From 6147e7eb98ad3924bd9f20c8c664833248b526ec Mon Sep 17 00:00:00 2001 From: Calvin Buckley Date: Tue, 4 Aug 2026 12:26:51 -0300 Subject: [PATCH 2/2] main: Remove php_error_docref_unchecked There are no external users AFAIK, and now no internal users. --- main/main.c | 17 ++++------------- main/php.h | 1 - 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/main/main.c b/main/main.c index 753625643508..2eb55c5cff07 100644 --- a/main/main.c +++ b/main/main.c @@ -1241,21 +1241,12 @@ PHPAPI ZEND_COLD void php_verror(const char *docref, int type, const char *forma /* {{{ php_error_docref */ /* Generate an error which links to docref or the php.net documentation if docref is NULL */ -#define php_error_docref_impl(docref, type, format) do {\ - va_list args; \ - va_start(args, format); \ - php_verror(docref, type, format, args); \ - va_end(args); \ - } while (0) - PHPAPI ZEND_COLD void php_error_docref(const char *docref, int type, const char *format, ...) { - php_error_docref_impl(docref, type, format); -} - -PHPAPI ZEND_COLD void php_error_docref_unchecked(const char *docref, int type, const char *format, ...) -{ - php_error_docref_impl(docref, type, format); + va_list args; + va_start(args, format); + php_verror(docref, type, format, args); + va_end(args); } /* }}} */ diff --git a/main/php.h b/main/php.h index 5186868e612f..275d07309ca1 100644 --- a/main/php.h +++ b/main/php.h @@ -304,7 +304,6 @@ PHPAPI ZEND_COLD void php_verror(const char *docref, int type, const char *forma /* PHPAPI void php_error(int type, const char *format, ...); */ PHPAPI ZEND_COLD void php_error_docref(const char *docref, int type, const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 3, 4); -PHPAPI ZEND_COLD void php_error_docref_unchecked(const char *docref, int type, const char *format, ...); END_EXTERN_C() #define zenderror phperror