mirror of
https://github.com/php/php-src.git
synced 2025-08-18 06:58:55 +02:00
Fixed Bug #70557 (Memleak on return type verifying failed)
This commit is contained in:
parent
504cd492e1
commit
1e3333e4bd
4 changed files with 47 additions and 3 deletions
1
NEWS
1
NEWS
|
@ -3,6 +3,7 @@ PHP NEWS
|
||||||
01 Oct 2015, PHP 7.0.0 RC 4
|
01 Oct 2015, PHP 7.0.0 RC 4
|
||||||
|
|
||||||
- Core:
|
- Core:
|
||||||
|
. Fixed bug #70557 (Memleak on return type verifying failed). (Laruence)
|
||||||
. Fixed bug #70555 (fun_get_arg() on unsetted vars return UNKNOW). (Laruence)
|
. Fixed bug #70555 (fun_get_arg() on unsetted vars return UNKNOW). (Laruence)
|
||||||
. Fixed bug #70548 (Redundant information printed in case of uncaught engine
|
. Fixed bug #70548 (Redundant information printed in case of uncaught engine
|
||||||
exception). (Laruence)
|
exception). (Laruence)
|
||||||
|
|
19
Zend/tests/return_types/bug70557.phpt
Normal file
19
Zend/tests/return_types/bug70557.phpt
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
--TEST--
|
||||||
|
Bug #70557 (Memleak on return type verifying failed).
|
||||||
|
--INI--
|
||||||
|
opcache.enable=0
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
function getNumber() : int {
|
||||||
|
return "foo";
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
getNumber();
|
||||||
|
} catch (TypeError $e) {
|
||||||
|
var_dump($e->getMessage());
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
string(72) "Return value of getNumber() must be of the type integer, string returned"
|
|
@ -3923,7 +3923,11 @@ ZEND_VM_HANDLER(124, ZEND_VERIFY_RETURN_TYPE, CONST|TMP|VAR|UNUSED|CV, UNUSED)
|
||||||
zend_verify_return_type(EX(func), retval_ptr, CACHE_ADDR(opline->op2.num));
|
zend_verify_return_type(EX(func), retval_ptr, CACHE_ADDR(opline->op2.num));
|
||||||
|
|
||||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||||
FREE_OP1();
|
if (OP1_TYPE == IS_CONST) {
|
||||||
|
zval_ptr_dtor_nogc(retval_ptr);
|
||||||
|
} else {
|
||||||
|
FREE_OP1();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -7745,7 +7745,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_CONST_
|
||||||
zend_verify_return_type(EX(func), retval_ptr, CACHE_ADDR(opline->op2.num));
|
zend_verify_return_type(EX(func), retval_ptr, CACHE_ADDR(opline->op2.num));
|
||||||
|
|
||||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||||
|
if (IS_CONST == IS_CONST) {
|
||||||
|
zval_ptr_dtor_nogc(retval_ptr);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -13551,7 +13555,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_TMP_UN
|
||||||
zend_verify_return_type(EX(func), retval_ptr, CACHE_ADDR(opline->op2.num));
|
zend_verify_return_type(EX(func), retval_ptr, CACHE_ADDR(opline->op2.num));
|
||||||
|
|
||||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||||
zval_ptr_dtor_nogc(free_op1);
|
if (IS_TMP_VAR == IS_CONST) {
|
||||||
|
zval_ptr_dtor_nogc(retval_ptr);
|
||||||
|
} else {
|
||||||
|
zval_ptr_dtor_nogc(free_op1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -19287,7 +19295,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_VAR_UN
|
||||||
zend_verify_return_type(EX(func), retval_ptr, CACHE_ADDR(opline->op2.num));
|
zend_verify_return_type(EX(func), retval_ptr, CACHE_ADDR(opline->op2.num));
|
||||||
|
|
||||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||||
zval_ptr_dtor_nogc(free_op1);
|
if (IS_VAR == IS_CONST) {
|
||||||
|
zval_ptr_dtor_nogc(retval_ptr);
|
||||||
|
} else {
|
||||||
|
zval_ptr_dtor_nogc(free_op1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -25049,7 +25061,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_UNUSED
|
||||||
zend_verify_return_type(EX(func), retval_ptr, CACHE_ADDR(opline->op2.num));
|
zend_verify_return_type(EX(func), retval_ptr, CACHE_ADDR(opline->op2.num));
|
||||||
|
|
||||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||||
|
if (IS_UNUSED == IS_CONST) {
|
||||||
|
zval_ptr_dtor_nogc(retval_ptr);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -34546,7 +34562,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_CV_UNU
|
||||||
zend_verify_return_type(EX(func), retval_ptr, CACHE_ADDR(opline->op2.num));
|
zend_verify_return_type(EX(func), retval_ptr, CACHE_ADDR(opline->op2.num));
|
||||||
|
|
||||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||||
|
if (IS_CV == IS_CONST) {
|
||||||
|
zval_ptr_dtor_nogc(retval_ptr);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue