mirror of
https://github.com/php/php-src.git
synced 2024-09-23 10:57:26 +00:00
Merge branch 'PHP-7.1'
This commit is contained in:
commit
feb828ffb0
@ -309,6 +309,12 @@ static zend_bool opline_supports_assign_contraction(
|
||||
&& (opline->op2_type != IS_CV || opline->op2.var != cv_var);
|
||||
}
|
||||
|
||||
if (opline->opcode == ZEND_CAST) {
|
||||
/* CAST to array/object may initialize the result to an empty array/object before
|
||||
* reading the expression. */
|
||||
return opline->extended_value != IS_ARRAY && opline->extended_value != IS_OBJECT;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
37
ext/opcache/tests/bug74442.phpt
Normal file
37
ext/opcache/tests/bug74442.phpt
Normal file
@ -0,0 +1,37 @@
|
||||
--TEST--
|
||||
Bug #74442: Opcached version produces a nested array
|
||||
--FILE--
|
||||
<?php
|
||||
class Schema_Base {
|
||||
public function addField($typeclass, array $params = null) {
|
||||
$field = new $typeclass($params);
|
||||
return $field;
|
||||
}
|
||||
}
|
||||
|
||||
class Field_Base {
|
||||
public function __construct(array $params = null) {
|
||||
if (! is_array($params)) {
|
||||
$params = (array) $params;
|
||||
}
|
||||
call_user_func_array(array($this, 'acceptParams'), $params);
|
||||
}
|
||||
}
|
||||
|
||||
class Field_Integer extends Field_Base {
|
||||
protected function acceptParams($bytes = 4) {
|
||||
echo print_r($bytes, true);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$schema = new Schema_Base;
|
||||
$schema->addField('Field_Integer');
|
||||
} catch (Throwable $ex) {
|
||||
echo "CAUGHT EXCEPTION";
|
||||
echo (string)$ex;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
4
|
Loading…
Reference in New Issue
Block a user