Skip to content

Commit 6bfb119

Browse files
committed
Remove some unnecessary error handler setting
A few non-standard exceptions thrown on zpp failures will change to TypeError due to this.
1 parent 86ef425 commit 6bfb119

File tree

2 files changed

+26
-37
lines changed

2 files changed

+26
-37
lines changed

ext/soap/soap.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,12 +1111,12 @@ PHP_METHOD(SoapServer, __construct)
11111111
zend_long cache_wsdl;
11121112
HashTable *typemap_ht = NULL;
11131113

1114-
SOAP_SERVER_BEGIN_CODE();
1115-
11161114
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|a", &wsdl, &options) == FAILURE) {
1117-
php_error_docref(NULL, E_ERROR, "Invalid parameters");
1115+
return;
11181116
}
11191117

1118+
SOAP_SERVER_BEGIN_CODE();
1119+
11201120
if (Z_TYPE_P(wsdl) != IS_STRING && Z_TYPE_P(wsdl) != IS_NULL) {
11211121
php_error_docref(NULL, E_ERROR, "Invalid parameters");
11221122
}
@@ -2267,12 +2267,12 @@ PHP_METHOD(SoapClient, __construct)
22672267
HashTable *typemap_ht = NULL;
22682268
zval *this_ptr = ZEND_THIS;
22692269

2270-
SOAP_CLIENT_BEGIN_CODE();
2271-
22722270
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|a", &wsdl, &options) == FAILURE) {
2273-
php_error_docref(NULL, E_ERROR, "Invalid parameters");
2271+
return;
22742272
}
22752273

2274+
SOAP_CLIENT_BEGIN_CODE();
2275+
22762276
if (Z_TYPE_P(wsdl) != IS_STRING && Z_TYPE_P(wsdl) != IS_NULL) {
22772277
php_error_docref(NULL, E_ERROR, "$wsdl must be string or null");
22782278
}

ext/spl/spl_directory.c

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,15 +1344,12 @@ SPL_METHOD(SplFileInfo, setFileClass)
13441344
{
13451345
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
13461346
zend_class_entry *ce = spl_ce_SplFileObject;
1347-
zend_error_handling error_handling;
1348-
1349-
zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling);
13501347

1351-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == SUCCESS) {
1352-
intern->file_class = ce;
1348+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == FAILURE) {
1349+
return;
13531350
}
13541351

1355-
zend_restore_error_handling(&error_handling);
1352+
intern->file_class = ce;
13561353
}
13571354
/* }}} */
13581355

@@ -1362,15 +1359,12 @@ SPL_METHOD(SplFileInfo, setInfoClass)
13621359
{
13631360
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
13641361
zend_class_entry *ce = spl_ce_SplFileInfo;
1365-
zend_error_handling error_handling;
13661362

1367-
zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling );
1368-
1369-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == SUCCESS) {
1370-
intern->info_class = ce;
1363+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == FAILURE) {
1364+
return;
13711365
}
13721366

1373-
zend_restore_error_handling(&error_handling);
1367+
intern->info_class = ce;
13741368
}
13751369
/* }}} */
13761370

@@ -1380,15 +1374,12 @@ SPL_METHOD(SplFileInfo, getFileInfo)
13801374
{
13811375
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
13821376
zend_class_entry *ce = intern->info_class;
1383-
zend_error_handling error_handling;
1384-
1385-
zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling);
13861377

1387-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == SUCCESS) {
1388-
spl_filesystem_object_create_type(ZEND_NUM_ARGS(), intern, SPL_FS_INFO, ce, return_value);
1378+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == FAILURE) {
1379+
return;
13891380
}
13901381

1391-
zend_restore_error_handling(&error_handling);
1382+
spl_filesystem_object_create_type(ZEND_NUM_ARGS(), intern, SPL_FS_INFO, ce, return_value);
13921383
}
13931384
/* }}} */
13941385

@@ -1398,22 +1389,20 @@ SPL_METHOD(SplFileInfo, getPathInfo)
13981389
{
13991390
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
14001391
zend_class_entry *ce = intern->info_class;
1401-
zend_error_handling error_handling;
1402-
1403-
zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling);
1392+
size_t path_len;
1393+
char *path;
14041394

1405-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == SUCCESS) {
1406-
size_t path_len;
1407-
char *path = spl_filesystem_object_get_pathname(intern, &path_len);
1408-
if (path) {
1409-
char *dpath = estrndup(path, path_len);
1410-
path_len = php_dirname(dpath, path_len);
1411-
spl_filesystem_object_create_info(intern, dpath, path_len, 1, ce, return_value);
1412-
efree(dpath);
1413-
}
1395+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == FAILURE) {
1396+
return;
14141397
}
14151398

1416-
zend_restore_error_handling(&error_handling);
1399+
path = spl_filesystem_object_get_pathname(intern, &path_len);
1400+
if (path) {
1401+
char *dpath = estrndup(path, path_len);
1402+
path_len = php_dirname(dpath, path_len);
1403+
spl_filesystem_object_create_info(intern, dpath, path_len, 1, ce, return_value);
1404+
efree(dpath);
1405+
}
14171406
}
14181407
/* }}} */
14191408

0 commit comments

Comments
 (0)