Allow exceptions in __toString()

RFC: https://wiki.php.net/rfc/tostring_exceptions

And convert some object to string conversion related recoverable
fatal errors into Error exceptions.

Improve exception safety of internal code performing string
conversions.
This commit is contained in:
Nikita Popov 2019-02-26 15:32:18 +01:00
parent 528aa7932a
commit a31f46421d
113 changed files with 1402 additions and 486 deletions

View file

@ -657,7 +657,9 @@ PHP_FUNCTION(sapi_windows_cp_conv)
RETURN_NULL();
}
} else {
convert_to_string(z_in_cp);
if (!try_convert_to_string(z_in_cp)) {
return;
}
in_cp = php_win32_cp_get_by_enc(Z_STRVAL_P(z_in_cp));
if (!in_cp) {
@ -678,7 +680,9 @@ PHP_FUNCTION(sapi_windows_cp_conv)
RETURN_NULL();
}
} else {
convert_to_string(z_out_cp);
if (!try_convert_to_string(z_out_cp)) {
return;
}
out_cp = php_win32_cp_get_by_enc(Z_STRVAL_P(z_out_cp));
if (!out_cp) {