Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 8.5.0alpha2

- URI:
. Return the singleton UrlValidationErrorType instances from Uri\WhatWg\Url
instead of creating new objects that are different from the singleton.
(timwolla)

03 Jul 2025, PHP 8.5.0alpha1

Expand Down
1 change: 0 additions & 1 deletion ext/curl/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -1412,7 +1412,6 @@ static inline CURLcode add_simple_field(curl_mime *mime, zend_string *string_key
part = curl_mime_addpart(mime);
if (part == NULL) {
zend_tmp_string_release(tmp_postval);
zend_string_release_ex(string_key, 0);
return CURLE_OUT_OF_MEMORY;
}
if ((form_error = curl_mime_name(part, ZSTR_VAL(string_key))) != CURLE_OK
Expand Down
2 changes: 1 addition & 1 deletion ext/random/randomizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ PHP_METHOD(Random_Randomizer, getFloat)
RETVAL_DOUBLE(php_random_gammasection_open_open(randomizer->engine, min, max));

if (UNEXPECTED(isnan(Z_DVAL_P(return_value)))) {
zend_value_error("The given interval is empty, there are no floats between argument #1 ($min) and argument #2 ($max).");
zend_value_error("The given interval is empty, there are no floats between argument #1 ($min) and argument #2 ($max)");
RETURN_THROWS();
}

Expand Down
2 changes: 1 addition & 1 deletion ext/random/tests/03_randomizer/methods/getFloat_error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,4 @@ Random\Randomizer::getFloat(): Argument #2 ($max) must be finite
Random\Randomizer::getFloat(): Argument #2 ($max) must be greater than argument #1 ($min)
Random\Randomizer::getFloat(): Argument #2 ($max) must be greater than argument #1 ($min)
Random\Randomizer::getFloat(): Argument #2 ($max) must be greater than argument #1 ($min)
The given interval is empty, there are no floats between argument #1 ($min) and argument #2 ($max).
The given interval is empty, there are no floats between argument #1 ($min) and argument #2 ($max)
20 changes: 9 additions & 11 deletions ext/soap/php_http.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,9 +506,9 @@ int make_http_soap_request(zval *this_ptr,
zend_string_equals(orig->host, phpurl->host) &&
orig->port == phpurl->port))) {
} else {
ZVAL_NULL(Z_CLIENT_HTTPSOCKET_P(this_ptr));
php_stream_close(stream);
convert_to_null(Z_CLIENT_HTTPURL_P(this_ptr));
convert_to_null(Z_CLIENT_HTTPSOCKET_P(this_ptr));
convert_to_null(Z_CLIENT_USE_PROXY_P(this_ptr));
stream = NULL;
use_proxy = 0;
Expand All @@ -517,9 +517,9 @@ int make_http_soap_request(zval *this_ptr,

/* Check if keep-alive connection is still opened */
if (stream != NULL && php_stream_eof(stream)) {
ZVAL_NULL(Z_CLIENT_HTTPSOCKET_P(this_ptr));
php_stream_close(stream);
convert_to_null(Z_CLIENT_HTTPURL_P(this_ptr));
convert_to_null(Z_CLIENT_HTTPSOCKET_P(this_ptr));
convert_to_null(Z_CLIENT_USE_PROXY_P(this_ptr));
stream = NULL;
use_proxy = 0;
Expand All @@ -528,9 +528,7 @@ int make_http_soap_request(zval *this_ptr,
if (!stream) {
stream = http_connect(this_ptr, phpurl, use_ssl, context, &use_proxy);
if (stream) {
php_stream_auto_cleanup(stream);
ZVAL_RES(Z_CLIENT_HTTPSOCKET_P(this_ptr), stream->res);
GC_ADDREF(stream->res);
php_stream_to_zval(stream, Z_CLIENT_HTTPSOCKET_P(this_ptr));
ZVAL_LONG(Z_CLIENT_USE_PROXY_P(this_ptr), use_proxy);
} else {
php_url_free(phpurl);
Expand Down Expand Up @@ -686,9 +684,9 @@ int make_http_soap_request(zval *this_ptr,

if (UNEXPECTED(php_random_bytes_throw(&nonce, sizeof(nonce)) != SUCCESS)) {
ZEND_ASSERT(EG(exception));
ZVAL_NULL(Z_CLIENT_HTTPSOCKET_P(this_ptr));
php_stream_close(stream);
convert_to_null(Z_CLIENT_HTTPURL_P(this_ptr));
convert_to_null(Z_CLIENT_HTTPSOCKET_P(this_ptr));
convert_to_null(Z_CLIENT_USE_PROXY_P(this_ptr));
smart_str_free(&soap_headers_z);
smart_str_free(&soap_headers);
Expand Down Expand Up @@ -904,9 +902,9 @@ int make_http_soap_request(zval *this_ptr,
if (request != buf) {
zend_string_release_ex(request, 0);
}
ZVAL_NULL(Z_CLIENT_HTTPSOCKET_P(this_ptr));
php_stream_close(stream);
convert_to_null(Z_CLIENT_HTTPURL_P(this_ptr));
convert_to_null(Z_CLIENT_HTTPSOCKET_P(this_ptr));
convert_to_null(Z_CLIENT_USE_PROXY_P(this_ptr));
add_soap_fault(this_ptr, "HTTP", "Failed Sending HTTP SOAP request", NULL, NULL, SOAP_GLOBAL(lang_en));
smart_str_free(&soap_headers_z);
Expand All @@ -929,8 +927,8 @@ int make_http_soap_request(zval *this_ptr,
if (request != buf) {
zend_string_release_ex(request, 0);
}
ZVAL_NULL(Z_CLIENT_HTTPSOCKET_P(this_ptr));
php_stream_close(stream);
convert_to_null(Z_CLIENT_HTTPSOCKET_P(this_ptr));
convert_to_null(Z_CLIENT_USE_PROXY_P(this_ptr));
add_soap_fault(this_ptr, "HTTP", "Error Fetching http headers", NULL, NULL, SOAP_GLOBAL(lang_en));
smart_str_free(&soap_headers_z);
Expand Down Expand Up @@ -982,11 +980,11 @@ int make_http_soap_request(zval *this_ptr,
if (request != buf) {
zend_string_release_ex(request, 0);
}
ZVAL_NULL(Z_CLIENT_HTTPSOCKET_P(this_ptr));
php_stream_close(stream);
if (http_headers) {
zend_string_release_ex(http_headers, 0);
}
convert_to_null(Z_CLIENT_HTTPSOCKET_P(this_ptr));
convert_to_null(Z_CLIENT_USE_PROXY_P(this_ptr));
if (http_msg) {
efree(http_msg);
Expand Down Expand Up @@ -1117,9 +1115,9 @@ int make_http_soap_request(zval *this_ptr,
if (request != buf) {
zend_string_release_ex(request, 0);
}
ZVAL_NULL(Z_CLIENT_HTTPSOCKET_P(this_ptr));
php_stream_close(stream);
zend_string_release_ex(http_headers, 0);
convert_to_null(Z_CLIENT_HTTPSOCKET_P(this_ptr));
convert_to_null(Z_CLIENT_USE_PROXY_P(this_ptr));
add_soap_fault(this_ptr, "HTTP", "Error Fetching http body, No Content-Length, connection closed or chunked data", NULL, NULL, SOAP_GLOBAL(lang_en));
if (http_msg) {
Expand All @@ -1134,8 +1132,8 @@ int make_http_soap_request(zval *this_ptr,
}

if (http_close) {
ZVAL_NULL(Z_CLIENT_HTTPSOCKET_P(this_ptr));
php_stream_close(stream);
convert_to_null(Z_CLIENT_HTTPSOCKET_P(this_ptr));
convert_to_null(Z_CLIENT_USE_PROXY_P(this_ptr));
stream = NULL;
}
Expand Down
58 changes: 58 additions & 0 deletions ext/soap/tests/bugs/gh18990.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
--TEST--
GH-18990 (SOAP HTTP socket not closing on object destruction)
--INI--
soap.wsdl_cache_enabled=0
--EXTENSIONS--
soap
--SKIPIF--
<?php
require __DIR__.'/../../../standard/tests/http/server.inc';
http_server_skipif();
--FILE--
<?php
require __DIR__.'/../../../standard/tests/http/server.inc';

$wsdl = file_get_contents(__DIR__.'/../server030.wsdl');

$soap = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://testuri.org" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:getItemsResponse><getItemsReturn SOAP-ENC:arrayType="ns1:Item[10]" xsi:type="ns1:ItemArray"><item xsi:type="ns1:Item"><text xsi:type="xsd:string">text0</text></item><item xsi:type="ns1:Item"><text xsi:type="xsd:string">text1</text></item><item xsi:type="ns1:Item"><text xsi:type="xsd:string">text2</text></item><item xsi:type="ns1:Item"><text xsi:type="xsd:string">text3</text></item><item xsi:type="ns1:Item"><text xsi:type="xsd:string">text4</text></item><item xsi:type="ns1:Item"><text xsi:type="xsd:string">text5</text></item><item xsi:type="ns1:Item"><text xsi:type="xsd:string">text6</text></item><item xsi:type="ns1:Item"><text xsi:type="xsd:string">text7</text></item><item xsi:type="ns1:Item"><text xsi:type="xsd:string">text8</text></item><item xsi:type="ns1:Item"><text xsi:type="xsd:string">text9</text></item></getItemsReturn></ns1:getItemsResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
EOF;

$responses = [
"data://text/plain,HTTP/1.1 200 OK\r\n".
"Content-Type: text/xml;charset=utf-8\r\n".
"Connection: Keep-Alive\r\n".
"Content-Length: ".strlen($wsdl)."\r\n".
"\r\n".
$wsdl,

"data://text/plain,HTTP/1.1 200 OK\r\n".
"Content-Type: text/xml;charset=utf-8\r\n".
"Connection: Keep-Alive\r\n".
"Content-Length: ".strlen($soap)."\r\n".
"\r\n".
$soap,
];

['pid' => $pid, 'uri' => $uri] = http_server($responses);

$options = [
'trace' => false,
'location' => $uri,
];

$cnt = count(get_resources());

$client = new SoapClient($uri, $options);

var_dump(count($client->getItems()));

http_server_kill($pid);

unset($client);
var_dump(count(get_resources()) - $cnt);
?>
--EXPECT--
int(10)
int(0)
Loading