Skip to content

Commit d24cf1a

Browse files
committed
Introduce zend_error_unchecked()
To be used with custom formats like %H as otherwise the compiler complains about unknown formats
1 parent 950bb84 commit d24cf1a

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

Zend/zend.c

+12-1
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ static void zend_print_zval_r_to_buf(smart_str *buf, zval *expr, int indent) /*
489489
}
490490
smart_str_appendc(buf, '\n');
491491
}
492-
492+
493493
if (GC_IS_RECURSIVE(Z_OBJ_P(expr))) {
494494
smart_str_appends(buf, " *RECURSION*");
495495
return;
@@ -1529,6 +1529,17 @@ ZEND_API ZEND_COLD void zend_error(int type, const char *format, ...) {
15291529
va_end(args);
15301530
}
15311531

1532+
ZEND_API ZEND_COLD void zend_error_unchecked(int type, const char *format, ...) {
1533+
const char *filename;
1534+
uint32_t lineno;
1535+
va_list args;
1536+
1537+
get_filename_lineno(type, &filename, &lineno);
1538+
va_start(args, format);
1539+
zend_error_va_list(type, filename, lineno, format, args);
1540+
va_end(args);
1541+
}
1542+
15321543
ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_at_noreturn(
15331544
int type, const char *filename, uint32_t lineno, const char *format, ...)
15341545
{

Zend/zend.h

+2
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,8 @@ extern ZEND_API zend_result (*zend_preload_autoload)(zend_string *filename);
327327

328328
ZEND_API ZEND_COLD void zend_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
329329
ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
330+
/* For custom format specifiers like H */
331+
ZEND_API ZEND_COLD void zend_error_unchecked(int type, const char *format, ...);
330332
/* If filename is NULL the default filename is used. */
331333
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);
332334
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);

0 commit comments

Comments
 (0)