From 8e58828e89d3978773544085999f6aaab2d41e46 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 10 Apr 2022 10:45:52 +0200 Subject: [PATCH] Add debug assertion on type narrowing This ensures that this will show up as a fuzzing failure. --- Zend/Optimizer/zend_inference.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Zend/Optimizer/zend_inference.c b/Zend/Optimizer/zend_inference.c index 3cc5e3f505f..a498926f41d 100644 --- a/Zend/Optimizer/zend_inference.c +++ b/Zend/Optimizer/zend_inference.c @@ -1862,6 +1862,9 @@ static void emit_type_narrowing_warning(const zend_op_array *op_array, zend_ssa zend_error_at( E_WARNING, op_array->filename, lineno, "Narrowing occurred during type inference of %s. Please file a bug report on https://github.com/php/php-src/issues", def_op_name); +#if ZEND_DEBUG + ZEND_ASSERT(0 && "Narrowing during type inference"); +#endif } ZEND_API uint32_t ZEND_FASTCALL zend_array_type_info(const zval *zv)