Skip to content

Commit 89c4db9

Browse files
committed
Fix reading zlib ini settings in ext-soap
zend_ini_long() actually expects the length without the NUL byte, but we're passing the length *with* the NUL byte. This mess can actually be avoided altogether by using INI_INT, so use that instead. Closes GH-14382.
1 parent 23912f5 commit 89c4db9

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ PHP NEWS
3131
. Fix missing error restore code. (nielsdos)
3232
. Fix memory leak if calling SoapServer::setObject() twice. (nielsdos)
3333
. Fix memory leak if calling SoapServer::setClass() twice. (nielsdos)
34+
. Fix reading zlib ini settings in ext-soap. (nielsdos)
3435

3536
- Sodium:
3637
. Fix memory leaks in ext/sodium on failure of some functions. (nielsdos)

ext/soap/soap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,7 +1527,7 @@ PHP_METHOD(SoapServer, handle)
15271527
sapi_add_header("Content-Type: text/xml; charset=utf-8", sizeof("Content-Type: text/xml; charset=utf-8")-1, 1);
15281528
}
15291529

1530-
if (zend_ini_long("zlib.output_compression", sizeof("zlib.output_compression"), 0)) {
1530+
if (INI_INT("zlib.output_compression")) {
15311531
sapi_add_header("Connection: close", sizeof("Connection: close")-1, 1);
15321532
} else {
15331533
snprintf(cont_len, sizeof(cont_len), "Content-Length: %d", size);
@@ -1676,7 +1676,7 @@ static void soap_server_fault_ex(sdlFunctionPtr function, zval* fault, soapHeade
16761676
if (use_http_error_status) {
16771677
sapi_add_header("HTTP/1.1 500 Internal Server Error", sizeof("HTTP/1.1 500 Internal Server Error")-1, 1);
16781678
}
1679-
if (zend_ini_long("zlib.output_compression", sizeof("zlib.output_compression"), 0)) {
1679+
if (INI_INT("zlib.output_compression")) {
16801680
sapi_add_header("Connection: close", sizeof("Connection: close")-1, 1);
16811681
} else {
16821682
snprintf(cont_len, sizeof(cont_len), "Content-Length: %d", size);

0 commit comments

Comments
 (0)