Commit graph

1633 commits

Author SHA1 Message Date
Remi Collet
1c230c27ec
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  NEWS for #66049
  Fix #66049 Typemap can break parsing in parse_packet_soap leading to a segfault
2025-03-21 08:25:23 +01:00
Remi Collet
209f4c296e
Fix #66049 Typemap can break parsing in parse_packet_soap leading to a segfault 2025-03-21 08:23:12 +01:00
Niels Dossche
a85a5ef339
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/soap: fix `make check` being invoked in `ext/soap`
2024-11-08 20:48:06 +01:00
Maximilian Bosch
73c4fa0ea4
ext/soap: fix make check being invoked in ext/soap
On NixOS we run `make` & `make check` inside `ext/soap` which broke the test
like this:

    001+ Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'ext/soap/tests/gh15711.wsdl' : failed to load "ext/soap/tests/gh15711.wsdl": No such file or directory
    002+  in /build/php-8.3.13/ext/soap/tests/gh15711.php:29
    003+ Stack trace:
    004+ #0 /build/php-8.3.13/ext/soap/tests/gh15711.php(29): SoapClient->__construct('ext/soap/tests/...', Array)
    005+ #1 {main}
    006+   thrown in /build/php-8.3.13/ext/soap/tests/gh15711.php on line 29

Fix is to make the path dependant on `__DIR__` as it's the case in other
testcases including WSDLs.

Closes GH-16733.
2024-11-08 20:47:28 +01:00
Niels Dossche
37db2edd26
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16429: Segmentation fault (access null pointer) in SoapClient
2024-10-14 22:00:45 +02:00
Niels Dossche
0b657fea2b
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-16429: Segmentation fault (access null pointer) in SoapClient
2024-10-14 22:00:29 +02:00
Niels Dossche
d613c0ed30
Fix GH-16429: Segmentation fault (access null pointer) in SoapClient
If get_iterator() fails, we should not destroy the object.
Also changes the check to a NULL check to be more defensive, and to
match the VM.

Closes GH-16441.
2024-10-14 21:59:51 +02:00
Niels Dossche
f108c1675e
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16318: Recursive array segfaults soap encoding
2024-10-12 23:30:44 +02:00
Niels Dossche
6ff4a2d7a8
Fix GH-16318: Recursive array segfaults soap encoding
This adds recursion protection to the array encoders.

Closes GH-16347.
2024-10-12 23:20:15 +02:00
Niels Dossche
82d58c4842
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16259: Soap segfault when classmap instantiation fails
2024-10-07 17:43:10 +02:00
Niels Dossche
932406a146
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-16259: Soap segfault when classmap instantiation fails
2024-10-07 17:42:54 +02:00
Niels Dossche
71222f799d
Fix GH-16259: Soap segfault when classmap instantiation fails
Instantiation failure checks were missing.

Closes GH-16273.
2024-10-07 17:42:27 +02:00
Niels Dossche
fa52f5f08c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16256: Assertion failure in ext/soap/php_encoding.c:460
2024-10-06 18:02:33 +02:00
Niels Dossche
2dbc605686
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-16256: Assertion failure in ext/soap/php_encoding.c:460
2024-10-06 18:02:19 +02:00
Niels Dossche
922b9d6798
Fix GH-16256: Assertion failure in ext/soap/php_encoding.c:460
The class map must be an associative array, not a packed array.

Closes GH-16269.
2024-10-06 18:01:50 +02:00
Niels Dossche
ce3869b547
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix Soap leaking http_msg on error
2024-10-06 17:59:49 +02:00
Niels Dossche
66cb6cd3a7
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix Soap leaking http_msg on error
2024-10-06 17:58:51 +02:00
Niels Dossche
a9dada29e7
Fix Soap leaking http_msg on error
Testing all cases is not so easy to do as we would need a server that
redirects from e.g. http to https while SSL is not available.

Closes GH-16254.
2024-10-06 17:58:28 +02:00
Niels Dossche
70203c7781
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16237: Segmentation fault when cloning SoapServer
2024-10-05 14:14:20 +02:00
Niels Dossche
eb02ad08da
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-16237: Segmentation fault when cloning SoapServer
2024-10-05 14:13:55 +02:00
Niels Dossche
809a58bc1b
Fix GH-16237: Segmentation fault when cloning SoapServer
Bisect points to 94ee4f9, however this only reveals the problem.
Cloning an object on a lower branch and trying to call its methods
crashes as well. Cloning the object shouldn't be possible in the first
place because there's an engine constraint that when we have a new
object handler we should also have a clone handler. This constraint is
not fulfilled here.

Closes GH-16245.
2024-10-05 14:13:29 +02:00
Christoph M. Becker
e014b5f506
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix failing soap tests on Windows
2024-09-27 19:59:30 +02:00
Christoph M. Becker
6556e59865
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix failing soap tests on Windows
2024-09-27 19:58:30 +02:00
Christoph M. Becker
9f63657765
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix failing soap tests on Windows
2024-09-27 19:57:47 +02:00
Christoph M. Becker
5f3e6e346c
Fix failing soap tests on Windows
These failures are caused by the fix for GHSA-p99j-rfp4-xqvq.  Since
the two bug*.phpt tests don't need the "wsdl" query string, and don't
even need php-cgi, we just remove the `--GET--` section.  The two
server*.phpt tests are harder to fix, since during evaluation of the
`--SKIPIF--` section, the soap extension can be loaded, but it may not
during evaluation of the `--FILE--` section.  So for now, we skip these
tests on Windows altogether.

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Closes GH-16084.
2024-09-27 19:56:19 +02:00
Christoph M. Becker
d6b8ef81d7
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix bug71610.phpt
2024-09-26 13:18:52 +02:00
Christoph M. Becker
70eb8f06ed
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix bug71610.phpt
2024-09-26 13:16:36 +02:00
Christoph M. Becker
de51612ba5
Fix bug71610.phpt
Apparently example.org now rejects POST requests, so we would need to
adjust the test expectation ("Method not allowed").  However, there is
no need for an online test; instead we're just using the CLI test
server.  The serialization is a bit fiddly, but as long as there are
no quotes in `PHP_CLI_SERVER_ADDRESS` we're fine.

Closes GH-16063.
2024-09-26 13:16:00 +02:00
Niels Dossche
1ce07b0957
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15711: SoapClient can't convert BackedEnum to scalar value
  Use get_serialization_string_from_zval() in all encoding functions
  Introduce get_serialization_string_from_zval() and use it in to_xml_string()
2024-09-16 20:51:34 +02:00
Niels Dossche
25289dd08e
Fix GH-15711: SoapClient can't convert BackedEnum to scalar value
Allow SoapClient to use the backing value during response serialization.

Closes GH-15803.
2024-09-16 20:47:36 +02:00
Niels Dossche
ca66a11c36
Use get_serialization_string_from_zval() in all encoding functions 2024-09-16 20:46:52 +02:00
Niels Dossche
56fea5995d
Introduce get_serialization_string_from_zval() and use it in to_xml_string()
For now this new function only returns a copy of the string, but its
functionality will be expanded by later commits.
to_xml_string() now uses this function and the memory management is
simplified as well.
2024-09-16 20:46:52 +02:00
Niels Dossche
cc0464268d
Avoid copying the local name in SOAP's parse_namespace() (#15862)
The local name is either the entire input or is the last part, so we
never need to make a copy.
2024-09-12 22:41:45 +02:00
Niels Dossche
306a51951f
Avoid allocating memory in soap get_function() (#15843) 2024-09-11 23:50:53 +02:00
Niels Dossche
c9862ba56e
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix bug #62900: Wrong namespace on xsd import error message
2024-09-11 09:21:59 +02:00
Niels Dossche
a0749bb473
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix bug #62900: Wrong namespace on xsd import error message
2024-09-11 09:19:51 +02:00
Niels Dossche
7a67fb0315
Fix bug #62900: Wrong namespace on xsd import error message
The one error message indeed had a wrong namespace, and in general they
weren't very descriptive, this also makes them more descriptive.

Furthermore, two additional bugs were fixed:
- Persistent memory leak of `location`.
- UAF issues when printing the error message.

Closes GH-15830.
2024-09-11 09:12:51 +02:00
Niels Dossche
520fce5607
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix bug #73182: PHP SOAPClient does not support stream context HTTP headers in array form
2024-09-10 20:24:57 +02:00
Niels Dossche
2a95e3f02b
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix bug #73182: PHP SOAPClient does not support stream context HTTP headers in array form
2024-09-10 20:24:48 +02:00
Niels Dossche
72a2cbcc7f
Fix bug #73182: PHP SOAPClient does not support stream context HTTP headers in array form
This code is modelled after how `http_fopen_wrapper.c` does things,
which apparently is just looping over the array and handling each string
the same way as if we passed a header string directly.

Also fixes a potential crash in `php_sdl.c` but without adding support
for header arrays there (yet) because the code is untested.

Closes GH-15817.
2024-09-10 20:24:14 +02:00
Niels Dossche
8bcfc8cc13
Implement request #47317: SoapServer::__getLastResponse()
Convenient for debugging.

Closes GH-15792.
2024-09-09 20:07:29 +02:00
Niels Dossche
5048a0650a
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix SOAP test failure on libxml2 2.13
2024-09-09 20:04:39 +02:00
Niels Dossche
1fdd79caf7
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix SOAP test failure on libxml2 2.13
2024-09-09 20:04:30 +02:00
Niels Dossche
979e68a2ec
Fix SOAP test failure on libxml2 2.13
libxml2 2.13 has different formatting behaviour: it outputs `<faultcode/>`
instead of `<faultcode></faultcode>`, and similarly for `env:Value`.
Normalize the output.

Closes GH-15801.
2024-09-09 20:04:15 +02:00
Niels Dossche
b7b492b184
Deduplicate URI building code in soap schema code (#15799) 2024-09-09 19:44:09 +02:00
Niels Dossche
7771ec07e5
Fix bug #61525: SOAP functions require at least one space after HTTP header colon
HTTP/1.1 does not require a single whitespace after the colon, and
SoapServer does implement HTTP/1.1. The header value is already correctly
whitespace-trimmed, so no behaviour change happens w.r.t. header values.

Closes GH-15793.
2024-09-08 10:42:30 +02:00
DanielEScherzer
53cb89670c
Generated arginfo header files: remove empty zend_function_entry arrays (#15705)
When a class (or enum) has no methods, rather than using an array that only
contains `ZEND_FE_END`, use `NULL` for the functions. The implementation of
class registration for internal classes, `do_register_internal_class()` in
zend_API.c, already skips classes where the functions are `NULL`. By removing
these unneeded arrays, we can reduce the size of the header files, while also
removing an unneeded call to zend_register_functions() for each internal class
with no extra methods.
2024-09-03 23:19:53 +02:00
Máté Kocsis
8d12f666ae
Fix registration of internal readonly child classes (#15459)
Currently, internal classes are registered with the following code:

INIT_CLASS_ENTRY(ce, "InternalClass", class_InternalClass_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
class_entry->ce_flags |= ...;

This has worked well so far, except if InternalClass is readonly. It is because some inheritance checks are run by zend_register_internal_class_ex before ZEND_ACC_READONLY_CLASS is added to ce_flags.

The issue is fixed by adding a zend_register_internal_class_with_flags() zend API function that stubs can use from now on. This function makes sure to add the flags before running any checks. Since the new API is not available in lower PHP versions, gen_stub.php has to keep support for the existing API for PHP 8.3 and below.
2024-08-24 12:36:54 +02:00
Gina Peter Bnayard
5853cdb73d Use "must not" instead of "cannot" wording 2024-08-21 21:12:17 +01:00
Gina Peter Bnayard
e7c4d54d65 Use new helper function for "cannot be empty" ValueErrors 2024-08-21 21:12:17 +01:00