Skip to content

Commit b2e616b

Browse files
committed
Fix tests
1 parent aba067a commit b2e616b

File tree

4 files changed

+18
-42
lines changed

4 files changed

+18
-42
lines changed

ext/soap/php_http.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ int make_http_soap_request(zval *this_ptr,
436436
}
437437

438438
tmp = zend_read_property(Z_OBJCE_P(this_ptr), Z_OBJ_P(this_ptr), "_stream_context", sizeof("_stream_context")-1, 1, &rv);
439-
if (tmp != NULL) {
439+
if (tmp != NULL && Z_TYPE_P(tmp) != IS_NULL) {
440440
context = php_stream_context_from_zval(tmp, 0);
441441
}
442442

ext/soap/soap.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2218,7 +2218,7 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act
22182218
ZVAL_OBJ(&exception_object, EG(exception));
22192219
msg = zval_get_string(zend_read_property(zend_ce_error, Z_OBJ(exception_object), "message", sizeof("message")-1, 0, &rv));
22202220
/* change class */
2221-
EG(exception)->ce = soap_fault_class_entry;
2221+
EG(exception)->ce = soap_fault_class_entry; // TODO Why does it sigterm when all SoapFault properties are declared?
22222222
set_soap_fault(&exception_object, NULL, "Client", ZSTR_VAL(msg), NULL, NULL, NULL);
22232223
zend_string_release_ex(msg, 0);
22242224
} else if (
@@ -3777,12 +3777,14 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function
37773777
char *hdr_ns = h->hdr?h->hdr->ns:NULL;
37783778
char *hdr_name = Z_TYPE(h->function_name) == IS_STRING
37793779
? Z_STRVAL(h->function_name) : NULL;
3780+
bool is_header = 0;
37803781

37813782
if (Z_TYPE(h->retval) == IS_OBJECT &&
37823783
instanceof_function(Z_OBJCE(h->retval), soap_header_class_entry)) {
37833784
zval *tmp;
37843785
sdlSoapBindingFunctionHeaderPtr hdr;
37853786
smart_str key = {0};
3787+
is_header = 1;
37863788

37873789
tmp = zend_read_property(soap_header_class_entry, Z_OBJ(h->retval), "namespace", sizeof("namespace")-1, 1, &rv);
37883790
if (tmp != NULL && Z_TYPE_P(tmp) == IS_STRING) {
@@ -3820,7 +3822,9 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function
38203822
if (serialize_response_call2(head, h->function, Z_STRVAL(h->function_name), uri, hdr_ret, version, 0, &xmlHdr) == SOAP_ENCODED) {
38213823
use = SOAP_ENCODED;
38223824
}
3823-
set_soap_header_attributes(xmlHdr, &h->retval, version);
3825+
if (is_header) {
3826+
set_soap_header_attributes(xmlHdr, &h->retval, version);
3827+
}
38243828
} else {
38253829
xmlNodePtr xmlHdr = master_to_xml(hdr_enc, hdr_ret, hdr_use, head);
38263830
if (hdr_name) {
@@ -3830,7 +3834,9 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function
38303834
xmlNsPtr nsptr = encode_add_ns(xmlHdr,hdr_ns);
38313835
xmlSetNs(xmlHdr, nsptr);
38323836
}
3833-
set_soap_header_attributes(xmlHdr, &h->retval, version);
3837+
if (is_header) {
3838+
set_soap_header_attributes(xmlHdr, &h->retval, version);
3839+
}
38343840
}
38353841
}
38363842
h = h->next;

ext/soap/soap.stub.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,23 @@ public function __construct(string $namespace, string $name, mixed $data = UNKNO
3838
class SoapFault extends Exception
3939
{
4040
/** @var string */
41-
public $faultstring;
41+
public $faultstring = "";
4242

4343
/** @var string|null */
4444
public $faultcode;
4545

4646
/** @var string|null */
47-
public $faultcodens;
47+
//public $faultcodens;
4848

4949
/** @var string|null */
50-
public $faultactor;
50+
//public $faultactor;
5151

52-
public mixed $detail = null;
52+
//public mixed $detail = null;
5353

5454
/** @var string|null */
55-
public $_name;
55+
//public $_name;
5656

57-
public mixed $headerfault = null;
57+
//public mixed $headerfault = null;
5858

5959
public function __construct(array|string|null $code, string $string, ?string $actor = null, mixed $details = null, ?string $name = null, mixed $headerFault = null) {}
6060

ext/soap/soap_arginfo.h

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: a88843aad714f9120a38f4cfda0e58e5dd4af7b7 */
2+
* Stub hash: 409379e1ef2ad85cc968034427ded4575504f5e8 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_use_soap_error_handler, 0, 0, _IS_BOOL, 0)
55
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, enable, _IS_BOOL, 0, "true")
@@ -301,7 +301,7 @@ static zend_class_entry *register_class_SoapFault(zend_class_entry *class_entry_
301301
class_entry = zend_register_internal_class_ex(&ce, class_entry_Exception);
302302

303303
zval property_faultstring_default_value;
304-
ZVAL_NULL(&property_faultstring_default_value);
304+
ZVAL_EMPTY_STRING(&property_faultstring_default_value);
305305
zend_string *property_faultstring_name = zend_string_init("faultstring", sizeof("faultstring") - 1, 1);
306306
zend_declare_property_ex(class_entry, property_faultstring_name, &property_faultstring_default_value, ZEND_ACC_PUBLIC, NULL);
307307
zend_string_release(property_faultstring_name);
@@ -312,36 +312,6 @@ static zend_class_entry *register_class_SoapFault(zend_class_entry *class_entry_
312312
zend_declare_property_ex(class_entry, property_faultcode_name, &property_faultcode_default_value, ZEND_ACC_PUBLIC, NULL);
313313
zend_string_release(property_faultcode_name);
314314

315-
zval property_faultcodens_default_value;
316-
ZVAL_NULL(&property_faultcodens_default_value);
317-
zend_string *property_faultcodens_name = zend_string_init("faultcodens", sizeof("faultcodens") - 1, 1);
318-
zend_declare_property_ex(class_entry, property_faultcodens_name, &property_faultcodens_default_value, ZEND_ACC_PUBLIC, NULL);
319-
zend_string_release(property_faultcodens_name);
320-
321-
zval property_faultactor_default_value;
322-
ZVAL_NULL(&property_faultactor_default_value);
323-
zend_string *property_faultactor_name = zend_string_init("faultactor", sizeof("faultactor") - 1, 1);
324-
zend_declare_property_ex(class_entry, property_faultactor_name, &property_faultactor_default_value, ZEND_ACC_PUBLIC, NULL);
325-
zend_string_release(property_faultactor_name);
326-
327-
zval property_detail_default_value;
328-
ZVAL_NULL(&property_detail_default_value);
329-
zend_string *property_detail_name = zend_string_init("detail", sizeof("detail") - 1, 1);
330-
zend_declare_typed_property(class_entry, property_detail_name, &property_detail_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ANY));
331-
zend_string_release(property_detail_name);
332-
333-
zval property__name_default_value;
334-
ZVAL_NULL(&property__name_default_value);
335-
zend_string *property__name_name = zend_string_init("_name", sizeof("_name") - 1, 1);
336-
zend_declare_property_ex(class_entry, property__name_name, &property__name_default_value, ZEND_ACC_PUBLIC, NULL);
337-
zend_string_release(property__name_name);
338-
339-
zval property_headerfault_default_value;
340-
ZVAL_NULL(&property_headerfault_default_value);
341-
zend_string *property_headerfault_name = zend_string_init("headerfault", sizeof("headerfault") - 1, 1);
342-
zend_declare_typed_property(class_entry, property_headerfault_name, &property_headerfault_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ANY));
343-
zend_string_release(property_headerfault_name);
344-
345315
return class_entry;
346316
}
347317

0 commit comments

Comments
 (0)