diff options
| author | Nikita Popov <nikita.ppv@gmail.com> | 2019-02-26 15:32:18 +0100 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-06-05 14:25:07 +0200 |
| commit | a31f46421d7bf6f55dd9ac5876b8e2eacf7e0708 (patch) | |
| tree | 24ffd7c5ae5e321c3994048fdd0fd9f68ae7457c /ext/standard/head.c | |
| parent | 528aa7932a839fc6319979c34aa372805d8dc41c (diff) | |
| download | php-git-a31f46421d7bf6f55dd9ac5876b8e2eacf7e0708.tar.gz | |
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.
Diffstat (limited to 'ext/standard/head.c')
| -rw-r--r-- | ext/standard/head.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/ext/standard/head.c b/ext/standard/head.c index e8b5d5b171..f1b2fa4e8b 100644 --- a/ext/standard/head.c +++ b/ext/standard/head.c @@ -258,10 +258,12 @@ PHP_FUNCTION(setcookie) } } - if (php_setcookie(name, value, expires, path, domain, secure, httponly, samesite, 1) == SUCCESS) { - RETVAL_TRUE; - } else { - RETVAL_FALSE; + if (!EG(exception)) { + if (php_setcookie(name, value, expires, path, domain, secure, httponly, samesite, 1) == SUCCESS) { + RETVAL_TRUE; + } else { + RETVAL_FALSE; + } } if (expires_or_options && Z_TYPE_P(expires_or_options) == IS_ARRAY) { @@ -311,10 +313,12 @@ PHP_FUNCTION(setrawcookie) } } - if (php_setcookie(name, value, expires, path, domain, secure, httponly, samesite, 0) == SUCCESS) { - RETVAL_TRUE; - } else { - RETVAL_FALSE; + if (!EG(exception)) { + if (php_setcookie(name, value, expires, path, domain, secure, httponly, samesite, 0) == SUCCESS) { + RETVAL_TRUE; + } else { + RETVAL_FALSE; + } } if (expires_or_options && Z_TYPE_P(expires_or_options) == IS_ARRAY) { |
