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/proc_open.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/proc_open.c')
| -rw-r--r-- | ext/standard/proc_open.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index 326cfc1431..d76e1595f3 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -552,7 +552,9 @@ PHP_FUNCTION(proc_open) } else { if ((ztype = zend_hash_index_find(Z_ARRVAL_P(descitem), 0)) != NULL) { - convert_to_string_ex(ztype); + if (!try_convert_to_string(ztype)) { + goto exit_fail; + } } else { php_error_docref(NULL, E_WARNING, "Missing handle qualifier in array"); goto exit_fail; @@ -563,7 +565,9 @@ PHP_FUNCTION(proc_open) zval *zmode; if ((zmode = zend_hash_index_find(Z_ARRVAL_P(descitem), 1)) != NULL) { - convert_to_string_ex(zmode); + if (!try_convert_to_string(zmode)) { + goto exit_fail; + } } else { php_error_docref(NULL, E_WARNING, "Missing mode parameter for 'pipe'"); goto exit_fail; @@ -602,14 +606,18 @@ PHP_FUNCTION(proc_open) descriptors[ndesc].mode = DESC_FILE; if ((zfile = zend_hash_index_find(Z_ARRVAL_P(descitem), 1)) != NULL) { - convert_to_string_ex(zfile); + if (!try_convert_to_string(zfile)) { + goto exit_fail; + } } else { php_error_docref(NULL, E_WARNING, "Missing file name parameter for 'file'"); goto exit_fail; } if ((zmode = zend_hash_index_find(Z_ARRVAL_P(descitem), 2)) != NULL) { - convert_to_string_ex(zmode); + if (!try_convert_to_string(zmode)) { + goto exit_fail; + } } else { php_error_docref(NULL, E_WARNING, "Missing mode parameter for 'file'"); goto exit_fail; |
