[PHP-CVS] [php-src] master: Remove `php_error_docref_unchecked` (#23042)
[email protected] (Calvin Buckley via GitHub) Tue, 4 Aug 2026 21:08:10 +0000
| Newsgroups | php.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: Calvin Buckley (NattyNarwhal)
Committer: GitHub (web-flow)
Pusher: NattyNarwhal
Date: 2026-08-04T18:08:07-03:00
Commit: https://github.com/php/php-src/commit/02334db9bbaea349f342a88495e65699b4a4c8d1
Raw diff: https://github.com/php/php-src/commit/02334db9bbaea349f342a88495e65699b4a4c8d1.diff
Remove `php_error_docref_unchecked` (#23042)
* standard: remove 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*).
* main: Remove php_error_docref_unchecked
There are no external users AFAIK, and now no internal users.
Changed paths:
M ext/standard/array.c
M main/main.c
M main/php.h
Diff:
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)) {
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