diff options
author | Dmitry Stogov <dmitry@zend.com> | 2017-12-04 17:22:28 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2017-12-04 17:22:28 +0300 |
commit | 3503dc7482674ed16e72c09135dc0c0f5d19245f (patch) | |
tree | 1e262cccbe971ca72d90dab3e26ceb84b5a3cba3 /ext/opcache | |
parent | 5a0eb2446c694a981584f28975209971f8b51b19 (diff) | |
parent | 5934bff91337b876195e9290b0811240052be7a3 (diff) | |
download | php-git-3503dc7482674ed16e72c09135dc0c0f5d19245f.tar.gz |
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
Fixed bug #75608 ("Narrowing occurred during type inference" error)
Diffstat (limited to 'ext/opcache')
-rw-r--r-- | ext/opcache/Optimizer/zend_inference.c | 4 | ||||
-rw-r--r-- | ext/opcache/tests/bug75608.phpt | 33 |
2 files changed, 35 insertions, 2 deletions
diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c index d5f018c418..dd49cc1a03 100644 --- a/ext/opcache/Optimizer/zend_inference.c +++ b/ext/opcache/Optimizer/zend_inference.c @@ -2926,7 +2926,7 @@ static int zend_update_type_info(const zend_op_array *op_array, break; case ZEND_FE_FETCH_R: case ZEND_FE_FETCH_RW: - tmp = (t2 & MAY_BE_REF); + tmp = t2; if (t1 & MAY_BE_OBJECT) { if (opline->opcode == ZEND_FE_FETCH_RW) { tmp |= MAY_BE_REF | MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF; @@ -2951,7 +2951,7 @@ static int zend_update_type_info(const zend_op_array *op_array, } UPDATE_SSA_TYPE(tmp, ssa_ops[i].op2_def); if (ssa_ops[i].result_def >= 0) { - tmp = 0; + tmp = (ssa_ops[i].result_use >= 0) ? RES_USE_INFO() : 0; if (t1 & MAY_BE_OBJECT) { tmp |= MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF; } diff --git a/ext/opcache/tests/bug75608.phpt b/ext/opcache/tests/bug75608.phpt new file mode 100644 index 0000000000..875e102ac8 --- /dev/null +++ b/ext/opcache/tests/bug75608.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #75608 ("Narrowing occurred during type inference" error) +--FILE-- +<?php +class ReactionRatingService +{ + public function calculateBoostPoints() + { + while ($reaction = $reactions) { + $reactionRatings = $this->validFunction(); + + $totalWeight = 0; + $runningScore = 0; + $queue = []; + foreach ($reactionRatings as $ratingData) { + if ($runningScore != $reaction['Score']) { + if ( ! $ratingData['BoostEarned']) { + $queue[] = $ratingData['UserID']; + } + } else { + foreach ($queue as $userId) { + $userBoostPointsRecalculate[$userId][] = $reaction['ID']; + } + } + $totalWeight += $ratingData['Weight']; + } + } + } +} +?> +OK +--EXPECT-- +OK |