Commit graph

661 commits

Author SHA1 Message Date
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
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
Niels Dossche
306a51951f
Avoid allocating memory in soap get_function() (#15843) 2024-09-11 23:50:53 +02:00
Niels Dossche
8bcfc8cc13
Implement request #47317: SoapServer::__getLastResponse()
Convenient for debugging.

Closes GH-15792.
2024-09-09 20:07:29 +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
Gina Peter Banyard
42497c1ea5
ext/soap: Deprecate passing an int to SoapServer::addFunction() (#15310)
Also deprecate SOAP_FUNCTIONS_ALL constant.

RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_soap_functions_all_constant_and_passing_it_to_soapserveraddfunction
2024-08-09 17:41:02 +01:00
Niels Dossche
027b210d42
Merge branch 'PHP-8.3'
* PHP-8.3:
  Revert "Fix bug #69280: SoapClient classmap doesn't support fully qualified class name (#14398)"
2024-08-07 10:04:58 +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
0c7cd92414
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix SoapFault property destruction
2024-08-05 22:04:10 +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
Arnaud Le Blanc
11accb5cdf
Preferably include from build dir (#13516)
* Include from build dir first

This fixes out of tree builds by ensuring that configure artifacts are included
from the build dir.

Before, out of tree builds would preferably include files from the src dir, as
the include path was defined as follows (ignoring includes from ext/ and sapi/) :

    -I$(top_builddir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/main
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM
    -I$(top_builddir)/

As a result, an out of tree build would include configure artifacts such as
`main/php_config.h` from the src dir.

After this change, the include path is defined as follows:

    -I$(top_builddir)/main
    -I$(top_builddir)
    -I$(top_srcdir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM

* Fix extension include path for out of tree builds

* Include config.h with the brackets form

`#include "config.h"` searches in the directory containing the including-file
before any other include path. This can include the wrong config.h when building
out of tree and a config.h exists in the source tree.

Using `#include <config.h>` uses exclusively the include path, and gives
priority to the build dir.
2024-06-26 00:26:43 +02:00
Gina Peter Banyard
7a1eded24d
ext/soap: Use zend_string for name parameter of set_soap_fault() 2024-06-19 02:23:08 +01:00
Gina Peter Banyard
cd61f16ad8
ext/soap: Refactor verify_soap_headers_array()
Make its duty only to check if the provided HashTable is valid
2024-06-19 02:23:08 +01:00
Gina Peter Banyard
062353ce2d
ext/soap: prevent needless computation of strlen() 2024-06-19 02:20:36 +01:00
Gina Peter Banyard
073491bfd8
ext/soap: Refactor SOAP call methods implementation 2024-06-19 02:20:36 +01:00
Gina Peter Banyard
4626c17f41
ext/soap: SoapServer::addSoapHeader() does not need bailout handler wrapper
As this methods never uses the bailout mechanism
2024-06-19 02:20:36 +01:00
Gina Peter Banyard
2459b3ae0d
ext/soap: SoapServer::addFunction() does not need bailout handler wrapper
As this methods never uses the bailout mechanism
2024-06-19 02:20:36 +01:00
Gina Peter Banyard
ce1bb1afa8
ext/soap: SoapServer::getFunctions() does not need bailout handler wrapper
As this methods never uses the bailout mechanism
2024-06-19 02:20:35 +01:00
Gina Peter Banyard
a99a790ad0
ext/soap: SoapServer::setObject() does not need bailout handler wrapper
As this methods never uses the bailout mechanism
2024-06-19 02:20:35 +01:00
Gina Peter Banyard
5a961cbf77
ext/soap: SoapServer::setClass() does not need bailout handler wrapper
As this methods never uses the bailout mechanism
2024-06-19 02:20:35 +01:00
Gina Peter Banyard
8269caab53
ext/soap: SoapServer::setPersistence() does not need bailout handler wrapper
As this methods never uses the bailout mechanism
2024-06-19 02:20:35 +01:00
Gina Peter Banyard
572b2b71cd
ext/soap: Use bool type for _bailout variable 2024-06-19 02:20:35 +01:00
Gina Peter Banyard
b71951baae
ext/soap: Use bool as return type instead of int for do_request() 2024-06-19 02:20:35 +01:00
Gina Peter Banyard
a888c4f0ff
Merge branch 'PHP-8.3'
* PHP-8.3:
  ext/soap: Fix memory leaks when calling SoapFault::__construct() twice
2024-06-16 23:01:52 +01: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
Peter Kokot
cf469133a5
Fix ZEND_DEBUG condition (#14408)
ZEND_DEBUG is always defined by the build system automatically, either
to value 0 or value 1.
2024-06-01 16:07:48 +02:00
Niels Dossche
61191dc313
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix bug #69280: SoapClient classmap doesn't support fully qualified class name (#14398)
2024-06-01 13:32:58 +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
e8c6c6f15d Fix signedness issues in soap.c 2024-05-31 23:05:33 +02:00
Niels Dossche
ca7a0df35e Make some things const that can be const in soap 2024-05-31 23:05:33 +02:00
Niels Dossche
7834bd1a59 Fix parameter name warning 2024-05-31 23:05:33 +02:00
Niels Dossche
62cdaac280
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix memory leaks with string function name lookups
2024-05-31 21:23:20 +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
59651ee722
Avoid string duplication in Soap function response (#14391) 2024-05-31 21:19:56 +02:00
Niels Dossche
e4246433fb
Fix signedness and argument order issues with argc handling in soap (#14389) 2024-05-31 21:16:21 +02:00
Niels Dossche
3096c71594
Fix build warning in release mode
This isn't warned on by default, and can break the build if werror is
used.
2024-05-31 19:56:30 +02:00
Niels Dossche
a58c3a7eb1
Merge branch 'PHP-8.3'
* PHP-8.3:
  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:27:22 +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