summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2018-10-25 16:18:10 +0200
committerNikita Popov <nikita.ppv@gmail.com>2018-10-25 16:36:23 +0200
commite7153e8a2f5ea6e2b2d2b5afe558deebf518f04a (patch)
treec7ad95d31fcd1f81e9f3900fdd6b8d490149119b
parent33fa02ea3823a38034b79bc97b52e6d10bee4d24 (diff)
downloadphp-git-e7153e8a2f5ea6e2b2d2b5afe558deebf518f04a.tar.gz
Improve "narrowing" error message
By including the opcode name.
-rw-r--r--ext/opcache/Optimizer/zend_inference.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c
index 89bd75c1ed..6aa823fdd2 100644
--- a/ext/opcache/Optimizer/zend_inference.c
+++ b/ext/opcache/Optimizer/zend_inference.c
@@ -1927,7 +1927,10 @@ static void handle_type_narrowing(const zend_op_array *op_array, zend_ssa *ssa,
{
if (1) {
/* Right now, this is always a bug */
- zend_error(E_WARNING, "Narrowing occurred during type inference. Please file a bug report on bugs.php.net");
+ int def_op_num = ssa->vars[var].definition;
+ const zend_op *def_opline = def_op_num >= 0 ? &op_array->opcodes[def_op_num] : NULL;
+ const char *def_op_name = def_opline ? zend_get_opcode_name(def_opline->opcode) : "PHI";
+ zend_error(E_WARNING, "Narrowing occurred during type inference of %s. Please file a bug report on bugs.php.net", def_op_name);
} else {
/* if new_type set resets some bits from old_type set
* We have completely recalculate types of some dependent SSA variables