Remove some unnecessary error handler setting

A few non-standard exceptions thrown on zpp failures will change to
TypeError due to this.
This commit is contained in:
Nikita Popov 2019-03-06 11:46:34 +01:00
parent 86ef425177
commit 6bfb119e18
2 changed files with 26 additions and 37 deletions

View file

@ -1111,12 +1111,12 @@ PHP_METHOD(SoapServer, __construct)
zend_long cache_wsdl; zend_long cache_wsdl;
HashTable *typemap_ht = NULL; HashTable *typemap_ht = NULL;
SOAP_SERVER_BEGIN_CODE();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|a", &wsdl, &options) == FAILURE) { 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) { if (Z_TYPE_P(wsdl) != IS_STRING && Z_TYPE_P(wsdl) != IS_NULL) {
php_error_docref(NULL, E_ERROR, "Invalid parameters"); php_error_docref(NULL, E_ERROR, "Invalid parameters");
} }
@ -2267,12 +2267,12 @@ PHP_METHOD(SoapClient, __construct)
HashTable *typemap_ht = NULL; HashTable *typemap_ht = NULL;
zval *this_ptr = ZEND_THIS; zval *this_ptr = ZEND_THIS;
SOAP_CLIENT_BEGIN_CODE();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|a", &wsdl, &options) == FAILURE) { 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) { 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"); php_error_docref(NULL, E_ERROR, "$wsdl must be string or null");
} }

View file

@ -1344,15 +1344,12 @@ SPL_METHOD(SplFileInfo, setFileClass)
{ {
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS); spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
zend_class_entry *ce = spl_ce_SplFileObject; 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) == FAILURE) {
return;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == SUCCESS) {
intern->file_class = ce;
} }
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); spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
zend_class_entry *ce = spl_ce_SplFileInfo; 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) == FAILURE) {
return;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == SUCCESS) {
intern->info_class = ce;
} }
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); spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
zend_class_entry *ce = intern->info_class; 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) == FAILURE) {
return;
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);
} }
zend_restore_error_handling(&error_handling); spl_filesystem_object_create_type(ZEND_NUM_ARGS(), intern, SPL_FS_INFO, ce, return_value);
} }
/* }}} */ /* }}} */
@ -1398,13 +1389,14 @@ SPL_METHOD(SplFileInfo, getPathInfo)
{ {
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS); spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
zend_class_entry *ce = intern->info_class; 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) {
size_t path_len; size_t path_len;
char *path = spl_filesystem_object_get_pathname(intern, &path_len); char *path;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == FAILURE) {
return;
}
path = spl_filesystem_object_get_pathname(intern, &path_len);
if (path) { if (path) {
char *dpath = estrndup(path, path_len); char *dpath = estrndup(path, path_len);
path_len = php_dirname(dpath, path_len); path_len = php_dirname(dpath, path_len);
@ -1412,9 +1404,6 @@ SPL_METHOD(SplFileInfo, getPathInfo)
efree(dpath); efree(dpath);
} }
} }
zend_restore_error_handling(&error_handling);
}
/* }}} */ /* }}} */
/* {{{ proto SplFileInfo::_bad_state_ex(void) */ /* {{{ proto SplFileInfo::_bad_state_ex(void) */