[php-src] master: Introduce zend_error_unchecked()
| From: | George Peter Banyard | Date: | Tue, 20 Apr 2021 18:41:40 +0000 |
| Subject: | [php-src] master: Introduce zend_error_unchecked() | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-115711@lists.php.net to get a copy of this message | ||
Author: George Peter Banyard (Girgias)
Date: 2021-04-20T19:41:36+01:00
Commit: https://github.com/php/php-src/commit/d24cf1a4173856691b56181b7ff821cb3846cb17
Raw diff: https://github.com/php/php-src/commit/d24cf1a4173856691b56181b7ff821cb3846cb17.diff
Introduce zend_error_unchecked()
To be used with custom formats like %H as otherwise the compiler complains about unknown formats
Changed paths:
M Zend/zend.c
M Zend/zend.h
Diff:
diff --git a/Zend/zend.c b/Zend/zend.c
index 1914b71650d2..b9663ad329ff 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -489,7 +489,7 @@ static void zend_print_zval_r_to_buf(smart_str *buf, zval *expr, int indent) /*
}
smart_str_appendc(buf, '\n');
}
-
+
if (GC_IS_RECURSIVE(Z_OBJ_P(expr))) {
smart_str_appends(buf, " *RECURSION*");
return;
@@ -1529,6 +1529,17 @@ ZEND_API ZEND_COLD void zend_error(int type, const char *format, ...) {
va_end(args);
}
+ZEND_API ZEND_COLD void zend_error_unchecked(int type, const char *format, ...) {
+ const char *filename;
+ uint32_t lineno;
+ va_list args;
+
+ get_filename_lineno(type, &filename, &lineno);
+ va_start(args, format);
+ zend_error_va_list(type, filename, lineno, format, args);
+ va_end(args);
+}
+
ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_at_noreturn(
int type, const char *filename, uint32_t lineno, const char *format, ...)
{
diff --git a/Zend/zend.h b/Zend/zend.h
index 1785752c5da0..2c2096f8e43a 100644
--- a/Zend/zend.h
+++ b/Zend/zend.h
@@ -327,6 +327,8 @@ extern ZEND_API zend_result (*zend_preload_autoload)(zend_string *filename);
ZEND_API ZEND_COLD void zend_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf,
2, 3);
ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...)
ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
+/* For custom format specifiers like H */
+ZEND_API ZEND_COLD void zend_error_unchecked(int type, const char *format, ...);
/* If filename is NULL the default filename is used. */
ZEND_API ZEND_COLD void zend_error_at(int type, const char *filename, uint32_t lineno, const char
*format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 4, 5);
ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_at_noreturn(int type, const char *filename,
uint32_t lineno, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 4, 5);