mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Don't use range information from a prototype method
The method may be overridden.
This commit is contained in:
parent
70bb12feec
commit
6bd46d2f68
2 changed files with 25 additions and 1 deletions
|
@ -1463,7 +1463,7 @@ ZEND_API int zend_inference_propagate_range(const zend_op_array *op_array, zend_
|
|||
}
|
||||
|
||||
call_info = func_info->call_map[opline - op_array->opcodes];
|
||||
if (!call_info) {
|
||||
if (!call_info || call_info->is_prototype) {
|
||||
break;
|
||||
}
|
||||
if (call_info->callee_func->type == ZEND_USER_FUNCTION) {
|
||||
|
|
24
Zend/tests/prototype_range.phpt
Normal file
24
Zend/tests/prototype_range.phpt
Normal file
|
@ -0,0 +1,24 @@
|
|||
--TEST--
|
||||
Range information from a prototype method should not be used
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Test
|
||||
{
|
||||
public function getInt(): int { return 0; }
|
||||
|
||||
public function getInt2() {
|
||||
return $this->getInt();
|
||||
}
|
||||
}
|
||||
|
||||
class Test2 extends Test {
|
||||
public function getInt(): int { return 1; }
|
||||
}
|
||||
|
||||
$test2 = new Test2;
|
||||
var_dump($test2->getInt2());
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
Loading…
Add table
Add a link
Reference in a new issue