Merge branch 'PHP-7.1' into PHP-7.2

This commit is contained in:
Nikita Popov 2018-10-25 16:43:07 +02:00
commit 902ec36710
3 changed files with 29 additions and 3 deletions

3
NEWS
View File

@ -2,6 +2,9 @@ PHP NEWS
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2018, PHP 7.2.13 ?? ??? 2018, PHP 7.2.13
- Opcache:
. Fixed bug #77058 (Type inference in opcache causes side effects). (Nikita)
- SOAP: - SOAP:
. Fixed bug #50675 (SoapClient can't handle object references correctly). . Fixed bug #50675 (SoapClient can't handle object references correctly).
(Cameron Porter) (Cameron Porter)

View File

@ -2019,7 +2019,10 @@ static void handle_type_narrowing(const zend_op_array *op_array, zend_ssa *ssa,
{ {
if (1) { if (1) {
/* Right now, this is always a bug */ /* 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 { } else {
/* if new_type set resets some bits from old_type set /* if new_type set resets some bits from old_type set
* We have completely recalculate types of some dependent SSA variables * We have completely recalculate types of some dependent SSA variables
@ -2539,7 +2542,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
tmp |= MAY_BE_RCN; tmp |= MAY_BE_RCN;
} }
} }
if ((t1 & MAY_BE_ANY) == MAY_BE_LONG) { if ((t1 & (MAY_BE_ANY|MAY_BE_UNDEF)) == MAY_BE_LONG) {
if (!ssa_var_info[ssa_ops[i].op1_use].has_range || if (!ssa_var_info[ssa_ops[i].op1_use].has_range ||
(opline->opcode == ZEND_PRE_DEC && (opline->opcode == ZEND_PRE_DEC &&
(ssa_var_info[ssa_ops[i].op1_use].range.underflow || (ssa_var_info[ssa_ops[i].op1_use].range.underflow ||
@ -2601,7 +2604,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
if (t1 & (MAY_BE_RC1|MAY_BE_RCN)) { if (t1 & (MAY_BE_RC1|MAY_BE_RCN)) {
tmp |= MAY_BE_RC1; tmp |= MAY_BE_RC1;
} }
if ((t1 & MAY_BE_ANY) == MAY_BE_LONG) { if ((t1 & (MAY_BE_ANY|MAY_BE_UNDEF)) == MAY_BE_LONG) {
if (!ssa_var_info[ssa_ops[i].op1_use].has_range || if (!ssa_var_info[ssa_ops[i].op1_use].has_range ||
(opline->opcode == ZEND_PRE_DEC && (opline->opcode == ZEND_PRE_DEC &&
(ssa_var_info[ssa_ops[i].op1_use].range.underflow || (ssa_var_info[ssa_ops[i].op1_use].range.underflow ||

View File

@ -0,0 +1,20 @@
--TEST--
Bug #77058: Type inference in opcache causes side effects
--FILE--
<?php
function myfunc(){
$Nr = 0;
while(1){
$x--;
$x++;
if( ++ $Nr >= 2 ) break;
}
echo "'$Nr' is expected to be 2", PHP_EOL;
}
myfunc();
?>
--EXPECTF--
Notice: Undefined variable: x in %s on line %d
'2' is expected to be 2