mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
Init STRLEN result when deprecation promoted to exception
Move the result initialization before HANDLE_EXCEPTION(), the actual value doesn't matter. This fixes one of the issues report in bug #81190.
This commit is contained in:
parent
36cb48c937
commit
353f963bba
17
Zend/tests/strlen_deprecation_to_exception.phpt
Normal file
17
Zend/tests/strlen_deprecation_to_exception.phpt
Normal file
@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
strlen() null deprecation warning promoted to exception
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
set_error_handler(function($_, $msg) {
|
||||
throw new Exception($msg);
|
||||
});
|
||||
try {
|
||||
strlen(null);
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
strlen(): Passing null to parameter #1 ($string) of type string is deprecated
|
@ -8368,10 +8368,10 @@ ZEND_VM_COLD_CONST_HANDLER(121, ZEND_STRLEN, CONST|TMPVAR|CV, ANY)
|
||||
if (UNEXPECTED(Z_TYPE_P(value) == IS_NULL)) {
|
||||
zend_error(E_DEPRECATED,
|
||||
"strlen(): Passing null to parameter #1 ($string) of type string is deprecated");
|
||||
ZVAL_LONG(EX_VAR(opline->result.var), 0);
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
ZVAL_LONG(EX_VAR(opline->result.var), 0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -5461,10 +5461,10 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_STRLEN_SPEC_CONST
|
||||
if (UNEXPECTED(Z_TYPE_P(value) == IS_NULL)) {
|
||||
zend_error(E_DEPRECATED,
|
||||
"strlen(): Passing null to parameter #1 ($string) of type string is deprecated");
|
||||
ZVAL_LONG(EX_VAR(opline->result.var), 0);
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
ZVAL_LONG(EX_VAR(opline->result.var), 0);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -14648,10 +14648,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_STRLEN_SPEC_TMPVAR_HANDLER(ZEN
|
||||
if (UNEXPECTED(Z_TYPE_P(value) == IS_NULL)) {
|
||||
zend_error(E_DEPRECATED,
|
||||
"strlen(): Passing null to parameter #1 ($string) of type string is deprecated");
|
||||
ZVAL_LONG(EX_VAR(opline->result.var), 0);
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
ZVAL_LONG(EX_VAR(opline->result.var), 0);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -38691,10 +38691,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_STRLEN_SPEC_CV_HANDLER(ZEND_OP
|
||||
if (UNEXPECTED(Z_TYPE_P(value) == IS_NULL)) {
|
||||
zend_error(E_DEPRECATED,
|
||||
"strlen(): Passing null to parameter #1 ($string) of type string is deprecated");
|
||||
ZVAL_LONG(EX_VAR(opline->result.var), 0);
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
ZVAL_LONG(EX_VAR(opline->result.var), 0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user