summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-03-06 11:46:34 +0100
committerNikita Popov <nikita.ppv@gmail.com>2019-03-11 11:32:20 +0100
commit6bfb119e18e5241b6719a4ad69223d91c465a58e (patch)
tree79b591036c38c4517275654756af7c014721c2ca /ext
parent86ef425177aa5b1585dee1c4d9779a57c7e8a8b7 (diff)
downloadphp-git-6bfb119e18e5241b6719a4ad69223d91c465a58e.tar.gz
Remove some unnecessary error handler setting
A few non-standard exceptions thrown on zpp failures will change to TypeError due to this.
Diffstat (limited to 'ext')
-rw-r--r--ext/soap/soap.c12
-rw-r--r--ext/spl/spl_directory.c51
2 files changed, 26 insertions, 37 deletions
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index 6f495b6bd1..1b27ec1e90 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -1111,12 +1111,12 @@ PHP_METHOD(SoapServer, __construct)
zend_long cache_wsdl;
HashTable *typemap_ht = NULL;
- SOAP_SERVER_BEGIN_CODE();
-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|a", &wsdl, &options) == FAILURE) {
- php_error_docref(NULL, E_ERROR, "Invalid parameters");
+ return;
}
+ SOAP_SERVER_BEGIN_CODE();
+
if (Z_TYPE_P(wsdl) != IS_STRING && Z_TYPE_P(wsdl) != IS_NULL) {
php_error_docref(NULL, E_ERROR, "Invalid parameters");
}
@@ -2267,12 +2267,12 @@ PHP_METHOD(SoapClient, __construct)
HashTable *typemap_ht = NULL;
zval *this_ptr = ZEND_THIS;
- SOAP_CLIENT_BEGIN_CODE();
-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|a", &wsdl, &options) == FAILURE) {
- php_error_docref(NULL, E_ERROR, "Invalid parameters");
+ return;
}
+ SOAP_CLIENT_BEGIN_CODE();
+
if (Z_TYPE_P(wsdl) != IS_STRING && Z_TYPE_P(wsdl) != IS_NULL) {
php_error_docref(NULL, E_ERROR, "$wsdl must be string or null");
}
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index e690b94615..416cbd014e 100644
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -1344,15 +1344,12 @@ SPL_METHOD(SplFileInfo, setFileClass)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
zend_class_entry *ce = spl_ce_SplFileObject;
- zend_error_handling error_handling;
-
- zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling);
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == SUCCESS) {
- intern->file_class = ce;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == FAILURE) {
+ return;
}
- zend_restore_error_handling(&error_handling);
+ intern->file_class = ce;
}
/* }}} */
@@ -1362,15 +1359,12 @@ SPL_METHOD(SplFileInfo, setInfoClass)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
zend_class_entry *ce = spl_ce_SplFileInfo;
- zend_error_handling error_handling;
- zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling );
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == SUCCESS) {
- intern->info_class = ce;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == FAILURE) {
+ return;
}
- zend_restore_error_handling(&error_handling);
+ intern->info_class = ce;
}
/* }}} */
@@ -1380,15 +1374,12 @@ SPL_METHOD(SplFileInfo, getFileInfo)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
zend_class_entry *ce = intern->info_class;
- zend_error_handling error_handling;
-
- zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling);
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == SUCCESS) {
- spl_filesystem_object_create_type(ZEND_NUM_ARGS(), intern, SPL_FS_INFO, ce, return_value);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == FAILURE) {
+ return;
}
- zend_restore_error_handling(&error_handling);
+ spl_filesystem_object_create_type(ZEND_NUM_ARGS(), intern, SPL_FS_INFO, ce, return_value);
}
/* }}} */
@@ -1398,22 +1389,20 @@ SPL_METHOD(SplFileInfo, getPathInfo)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
zend_class_entry *ce = intern->info_class;
- zend_error_handling error_handling;
-
- zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling);
+ size_t path_len;
+ char *path;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == SUCCESS) {
- size_t path_len;
- char *path = spl_filesystem_object_get_pathname(intern, &path_len);
- if (path) {
- char *dpath = estrndup(path, path_len);
- path_len = php_dirname(dpath, path_len);
- spl_filesystem_object_create_info(intern, dpath, path_len, 1, ce, return_value);
- efree(dpath);
- }
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == FAILURE) {
+ return;
}
- zend_restore_error_handling(&error_handling);
+ path = spl_filesystem_object_get_pathname(intern, &path_len);
+ if (path) {
+ char *dpath = estrndup(path, path_len);
+ path_len = php_dirname(dpath, path_len);
+ spl_filesystem_object_create_info(intern, dpath, path_len, 1, ce, return_value);
+ efree(dpath);
+ }
}
/* }}} */