Skip to content

Commit 75a8bfe

Browse files
committed
ext/soap: Don't call readfile() userland function
We can perform the operation directly, moreover there is no risk of a user disabling the readfile function and defining their own messing up what we are doing.
1 parent d8d1cb4 commit 75a8bfe

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

ext/soap/soap.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,19 +1307,14 @@ PHP_METHOD(SoapServer, handle)
13071307
sapi_add_header(hdr, sizeof("Location: ")+strlen(service->sdl->source)-1, 1);
13081308
efree(hdr);
13091309
*/
1310-
zval readfile, readfile_ret, param;
13111310

13121311
sapi_add_header("Content-Type: text/xml; charset=utf-8", sizeof("Content-Type: text/xml; charset=utf-8")-1, 1);
1313-
ZVAL_STRING(&param, service->sdl->source);
1314-
ZVAL_STRING(&readfile, "readfile");
1315-
if (call_user_function(EG(function_table), NULL, &readfile, &readfile_ret, 1, &param ) == FAILURE) {
1316-
soap_server_fault("Server", "Couldn't find WSDL", NULL, NULL, NULL);
1312+
php_stream *stream = php_stream_open_wrapper_ex(service->sdl->source, "rb", REPORT_ERRORS, NULL, /* context */ NULL);
1313+
if (stream) {
1314+
php_stream_passthru(stream);
1315+
php_stream_close(stream);
13171316
}
13181317

1319-
zval_ptr_dtor(&param);
1320-
zval_ptr_dtor_str(&readfile);
1321-
zval_ptr_dtor(&readfile_ret);
1322-
13231318
SOAP_SERVER_END_CODE();
13241319
return;
13251320
} else {

0 commit comments

Comments
 (0)