Bug #81154 [Fbk]: Segmentation fault on instanciating SoapClient
| From: | cmb@php.net | Date: | Thu, 17 Jun 2021 10:03:27 +0000 |
| Subject: | Bug #81154 [Fbk]: Segmentation fault on instanciating SoapClient | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-234455@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=81154&edit=1
ID: 81154
Updated by: cmb@php.net
Reported by: arnaud dot lepeltier at cogifor dot Com
Summary: Segmentation fault on instanciating SoapClient
Status: Feedback
Type: Bug
Package: SOAP related
Operating System: linux
PHP Version: 8.0.7
Block user comment: N
Private report: N
New Comment:
I can reproduce the segfault, and the following patch prevents it.
ext/soap/soap.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index 7429aebbf7..232f3bf05a 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -4827,7 +4827,9 @@ static void type_to_string(sdlTypePtr type, smart_str *buf, int level) /* {{{
*/
} else {
smart_str_appendl(buf, "UNKNOWN ", 8);
}
- smart_str_appends(buf, attr->name);
+ if (attr->name) {
+ smart_str_appends(buf, attr->name);
+ }
smart_str_appendl(buf, ";\n", 2);
} ZEND_HASH_FOREACH_END();
}
I have no idea, though, whether that is the proper fix.
Previous Comments:
------------------------------------------------------------------------
[2021-06-17 09:46:36] requinix@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php
for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php
for Win32
Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.
It seems to hang for me after the START SCRIPT, with and without the cache.
If there is a loop then the segfault could be a stack overflow trying to load the schemas (readily
identifiable from a backtrace) however I don't think that would explain the EXC_BAD_ACCESS in
strlen posted in that thread.
------------------------------------------------------------------------
[2021-06-17 09:02:56] arnaud dot lepeltier at cogifor dot Com
Description:
------------
When instanciating a Soap Client for a large wsdl,
I encounter a segmentation fault.
This has been tested on php8.0 and php 7.4.
Enabling/disabling the wsdl cache has no effect.
increasing the memory limit has no effect
initial ticket at: https://github.com/phpro/soap-client/issues/373
Test script:
---------------
<?php
echo PHP_EOL, "START SCRIPT";
$url = 'https://service-test.protel.io/services/ProtelApiService.ProtelApiServiceHttpsSoap12Endpoint?wsdl';
$client = new SoapClient($url, [
'cache_wsdl'=>WSDL_CACHE_NONE
]);
echo PHP_EOL, "SOAP CLIENT CREATED";
$client->__getTypes();
echo PHP_EOL, "GET TYPES DONE";
Expected result:
----------------
START SCRIPT
SOAP CLIENT CREATED
GET TYPES DONE
Actual result:
--------------
SOAP CLIENT CREATEDErreur de segmentation (core dumped)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81154&edit=1