1
0
mirror of https://github.com/php/php-src.git synced 2026-03-29 03:32:20 +02:00
Commit Graph

1526 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Ilija Tovilo
65a101f3a7 Disable LSAN for crashing SOAP tests (GH-14562) 2024-08-14 11:44:03 +02:00
Christoph M. Becker
56703e5390 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix test expectation
2024-08-13 19:25:04 +02:00
Christoph M. Becker
1b52ecd78a Fix test expectation 2024-08-13 19:23:53 +02:00
Niels Dossche
1d56340831 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Revert "Fix bug #69280: SoapClient classmap doesn't support fully qualified class name (#14398)"
2024-08-07 10:03:35 +02:00
Niels Dossche
28290655e8 Revert "Fix bug #69280: SoapClient classmap doesn't support fully qualified class name (#14398)"
This reverts commit 476706165a.

Although the fix is correct, people are relying on the bug and their
code stopped working, see GH-15252.
2024-08-07 10:03:12 +02:00
Niels Dossche
e681d933d4 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix SoapFault property destruction
2024-08-05 22:03:21 +02:00
Niels Dossche
11fbe8801b Fix SoapFault property destruction
Two issues:
1) We should not modify the object when we pass invalid values
2) We should reset the properties to their default value otherwise we
   get a UAF.

Regressed in df219ccf9d

Closes GH-15248.
2024-08-05 22:02:51 +02:00
Niels Dossche
d3caedd6d2 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix bug #55639: Digest autentication dont work
2024-07-17 19:31:54 +02:00
Niels Dossche
911dc5b46c Fix bug #55639: Digest autentication dont work
RFC 2617 and 7616 describe that for the "Authorization" header we should
not put the qop nor nc value inside quotes. This differs from the
WWW-Authenticate header, which may have been the source of the confusion
in the implementation. While the version with quotes seems to work fine
in some cases, clearly not all servers accept the non-standard form.
To fix the issue, simply removing the quotes of those two header fields
of the client request to be in line with the RFC suffices.

I refer further to example 3.5 in RFC 2617 and example 3.9.1 in
RFC 7616.

RFC 2617: https://datatracker.ietf.org/doc/html/rfc2617
RFC 7616: https://datatracker.ietf.org/doc/html/rfc7616

Closes GH-14328.
2024-07-17 19:23:10 +02:00
Niels Dossche
ecf0bb0fd1 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [ci skip] NEWS
  Backport libxml2 2.13.2 fixes (#14816)
2024-07-04 15:37:35 +02:00
Niels Dossche
4fe821311c Backport libxml2 2.13.2 fixes (#14816)
Backproted from https://github.com/php/php-src/pull/14789
2024-07-04 15:29:50 +02:00
Gina Peter Banyard
e9b36438ed Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  ext/soap: Fix memory leaks when calling SoapFault::__construct() twice
2024-06-16 23:01:36 +01:00
Gina Peter Banyard
df219ccf9d ext/soap: Fix memory leaks when calling SoapFault::__construct() twice 2024-06-16 23:00:59 +01:00
Niels Dossche
98c8518b39 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix bug #76232: SoapClient Cookie Header Semicolon
2024-06-01 17:38:00 +02:00
Niels Dossche
1b1677a8f1 Fix bug #76232: SoapClient Cookie Header Semicolon
According to RFC 6265 [1] the cookies must be separated by "; " not ";",
and it must not end with ";".

[1] https://datatracker.ietf.org/doc/html/rfc6265

Closes GH-14406.
2024-06-01 17:37:30 +02:00
Niels Dossche
d11a3c6579 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix bug #69280: SoapClient classmap doesn't support fully qualified class name (#14398)
2024-06-01 13:31:02 +02:00
Niels Dossche
476706165a Fix bug #69280: SoapClient classmap doesn't support fully qualified class name (#14398)
There's a hash table that maps type names to class name, but names with
a leading backslash are not supported. The engine has logic to strip
away the leading backslash that we should replicate here.

It works by checking if we need to make an actual copy in case an
unexpected (e.g. invalid data or leading backslash) situations are
detected. Upon making a copy we normalize the data in the table.

Furthermore, previously the code assumed that the key was always valid
and that the structure was a non-packed hash table. This isn't
necessarily the case. The new code fixes this as well.

Closes GH-14398.
2024-06-01 13:29:26 +02:00
Niels Dossche
cac4290fb6 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix memory leaks with string function name lookups
2024-05-31 21:23:13 +02:00
Niels Dossche
18233e0f2e Fix memory leaks with string function name lookups
There's a few leaks where the string is copied for lowercasing but not released.
Where possible, use the _lc functionality of zend_hash to do the lookup
to avoid the leaks that currently exist with the manual lowercasing.

Closes GH-14390.
2024-05-31 21:22:37 +02:00
Niels Dossche
2b1097a87d Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix reading zlib ini settings in ext-soap
  Fix memory leak if calling SoapServer::setClass() twice
  Fix memory leak if calling SoapServer::setObject() twice
  Fix missing error restore code in ext-soap (#14379)
  Fix GH-14368: Test failure in ext/session/tests/gh13856.phpt (#14378)
2024-05-31 18:26:22 +02:00
Niels Dossche
89c4db9c22 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.
2024-05-31 18:21:34 +02:00
Niels Dossche
23912f55eb Fix memory leak if calling SoapServer::setClass() twice
Closes GH-14381.
2024-05-31 18:21:00 +02:00
Niels Dossche
51bb9c2c2a Fix memory leak if calling SoapServer::setObject() twice
Closes GH-14380.
2024-05-31 18:20:37 +02:00