Skip to content

Commit f0a35e2

Browse files
committed
ext/soap: Check services are not empty via an if guard
1 parent 81132bb commit f0a35e2

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

ext/soap/php_sdl.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -708,11 +708,14 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri)
708708
zend_hash_init(&ctx.services, 0, NULL, NULL, 0);
709709

710710
zend_try {
711-
load_wsdl_ex(this_ptr, struri, &ctx, false);
712-
schema_pass2(&ctx);
711+
load_wsdl_ex(this_ptr, struri, &ctx, false);
712+
schema_pass2(&ctx);
713+
714+
uint32_t n = zend_hash_num_elements(&ctx.services);
715+
if (n == 0) {
716+
soap_error0(E_ERROR, "Parsing WSDL: Couldn't bind to service");
717+
}
713718

714-
uint32_t n = zend_hash_num_elements(&ctx.services);
715-
if (n > 0) {
716719
zend_hash_internal_pointer_reset(&ctx.services);
717720
for (uint32_t i = 0; i < n; i++) {
718721
xmlNodePtr service, tmp;
@@ -1126,13 +1129,10 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri)
11261129

11271130
zend_hash_move_forward(&ctx.services);
11281131
}
1129-
} else {
1130-
soap_error0(E_ERROR, "Parsing WSDL: Couldn't bind to service");
1131-
}
11321132

1133-
if (ctx.sdl->bindings == NULL || ctx.sdl->bindings->nNumOfElements == 0) {
1134-
soap_error0(E_ERROR, "Parsing WSDL: Could not find any usable binding services in WSDL.");
1135-
}
1133+
if (ctx.sdl->bindings == NULL || ctx.sdl->bindings->nNumOfElements == 0) {
1134+
soap_error0(E_ERROR, "Parsing WSDL: Could not find any usable binding services in WSDL.");
1135+
}
11361136

11371137
} zend_catch {
11381138
/* Avoid persistent memory leak. */

0 commit comments

Comments
 (0)