Commit graph

619 commits

Author SHA1 Message Date
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
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
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
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
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
Niels Dossche
6aa66e0806
Fix missing error restore code in ext-soap (#14379)
The begin and end macros should be paired, but some of the end macro
calls were missing.
2024-05-31 18:19:00 +02:00
George Peter Banyard
d5ad75108e
More usage of known zend_str instead of C string (#11381) 2023-06-08 13:03:29 +01:00
Ilija Tovilo
9d5f2f1343
Use new ZSTR_INIT_LITERAL macro (#10879) 2023-03-20 16:19:05 +01:00
Máté Kocsis
7936c8085e
Fix GH-8329 Print true/false instead of bool in error and debug messages (#8385) 2023-01-23 10:52:14 +01:00
Christoph M. Becker
d758f58672
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-9720: Null pointer dereference while serializing the response
2022-10-13 16:08:50 +02:00
Christoph M. Becker
aba82c74d9
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-9720: Null pointer dereference while serializing the response
2022-10-13 16:08:34 +02:00
Christoph M. Becker
24c297086d
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-9720: Null pointer dereference while serializing the response
2022-10-13 16:00:36 +02:00
Christoph M. Becker
e440e37fa8
Fix GH-9720: Null pointer dereference while serializing the response
When traversing the result array, we need to cater to `param_name`
possibly being `NULL`.  Prior to PHP 7.0.0, this was implicitly done
because `param_name` was of type `char*`.

Closes GH-9739.
2022-10-13 15:56:08 +02:00
Bob Weinand
a01dd9feda Revert "Port all internally used classes to use default_object_handlers"
This reverts commit 94ee4f9834.

The commit was a bit too late to be included in PHP 8.2 RC1. Given it's a massive ABI break, we decide to postpone the change to PHP 8.3.
2022-09-14 11:13:23 +02:00
Bob Weinand
94ee4f9834 Port all internally used classes to use default_object_handlers
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2022-08-31 16:45:27 +02:00
Máté Kocsis
a05a6c555d
Declare ext/soap constants in stubs (#9124) 2022-07-25 16:40:41 +02:00
Christoph M. Becker
14319c203c
Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix GH-8578: Error on wrong parameter on SoapHeader constructor
2022-05-19 11:08:27 +02:00
Christoph M. Becker
dd89acaf49
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-8578: Error on wrong parameter on SoapHeader constructor
2022-05-19 11:07:29 +02:00
robertnisipeanu
8735ae9d13
Fix GH-8578: Error on wrong parameter on SoapHeader constructor
Closes GH-8579.
2022-05-19 11:03:49 +02:00
Nikita Popov
c5d6f59e96 Use custom object instead of resource for soap server service
The "service" resource is a purely internal structure used by
SoapServer, which userland code cannot interact with. Instead of
storing it as a resource in an object propperty, use a custom
object structure instead.
2021-11-28 18:37:29 +01:00
Dmitry Stogov
90b7bde615 Use more compact representation for packed arrays.
- for packed arrays we store just an array of zvals without keys.
- the elements of packed array are accessible throuf as ht->arPacked[i]
  instead of ht->arData[i]
- in addition to general ZEND_HASH_FOREACH_* macros, we introduced similar
  familied for packed (ZEND_HASH_PACKED_FORECH_*) and real hashes
  (ZEND_HASH_MAP_FOREACH_*)
- introduced an additional family of macros to access elements of array
  (packed or real hashes) ZEND_ARRAY_ELEMET_SIZE, ZEND_ARRAY_ELEMET_EX,
  ZEND_ARRAY_ELEMET, ZEND_ARRAY_NEXT_ELEMENT, ZEND_ARRAY_PREV_ELEMENT
- zend_hash_minmax() prototype was changed to compare only values

Because of smaller data set, this patch may show performance improvement
on some apps and benchmarks that use packed arrays. (~1% on PHP-Parser)

TODO:
    - sapi/phpdbg needs special support for packed arrays (WATCH_ON_BUCKET).
    - zend_hash_sort_ex() may require converting packed arrays to hash.
2021-11-03 15:18:26 +03:00
Tim Starling
c96be7b8f2 Use ASCII lower case for misc case folding
Use ASCII case conversion instead of locale-dependent case conversion in
the following places:

* grapheme_stripos() and grapheme_strripos() in the "fast" path
* ldap_get_entries()
* oci_pconnect() for case folding of parameters when constructing a key
  into the connection or session pool
* SoapClient: case folding of function names
* get_meta_tags(): case conversion of property names
* http stream wrapper: header names
* phpinfo(): anchor names
* php_verror(): docref URLs
* rfc1867.c: Content-Type boundary parameter name
* streams.c: stream protocol names

Using locale-dependent case folding for these cases is either
unnecessary or actively incorrect. These functions could have
misbehaved when used with certain locales (e.g. Turkish).

Closes GH-7511.
2021-09-24 09:20:08 +02:00
Nikita Popov
841d0b30eb Slightly clean up cookies handling
Make the property always an array with an empty array default.
Properly separate the array on modification to compensate.
2021-08-20 14:27:24 +02:00
Nikita Popov
50484b59cd Move derefs into accessor macros
These derefs are mostly there to be defensive, but clutter the
code somewhat. Move them directly into the access macros.
2021-08-20 14:15:23 +02:00
Nikita Popov
e6c6abf6b4 Declare remaining SoapClient properties 2021-08-20 12:50:19 +02:00
Nikita Popov
b3b1658492 Remove dead code
This was checking for the headerfault property, but not actually
doing anything with it.
2021-08-20 12:28:58 +02:00
Nikita Popov
aa4898ef2e Use separate property to request digit auth
Currently, _digest is used both to request that digest auth be
used (_digest == null) and to later store the _digest parameters.

This relies on the ability to distinguish between _digest being
null and it being not set, which is not present with declared
properties. (Well, technically it is, we could just leave it
uninitialized, but that would be non-idiomatic.)

Resolve this by splitting into separate _use_digest and _digest
properties.
2021-08-20 10:41:36 +02:00
Nikita Popov
32d663e198 Declare SoapFault properties 2021-08-20 10:08:22 +02:00
Nikita Popov
44befbdc01 Don't convert Error exception to SoapFault
Error exceptions should generally not be converted into domain-
specific exception types. They indicate programming errors that
should not be handled locally.
2021-08-20 10:06:11 +02:00
Nikita Popov
018cb891cf Declare some SoapClient properties
This is only a subset of all properties for now (those without
underscore).
2021-08-19 16:15:41 +02:00
Nikita Popov
e861cb5c31 Simplify some strtolower operations in ext/soap 2021-08-19 16:10:30 +02:00
Nikita Popov
e6d4b3077d Simplify constructor invocation in ext/soap
Use ce->constructor and zend_call_known_instance_method. There
is no need to look up a method with the same name as the class
anymore.
2021-08-19 16:04:43 +02:00
Nikita Popov
7d4f2f5392 Declare SoapHeader properties 2021-08-19 14:27:09 +02:00
Nikita Popov
bdf8b9ed2d Declare SoapServer::$service property 2021-08-19 14:10:21 +02:00
Nikita Popov
c58c926034 Declare SoapVar properties 2021-08-19 12:35:37 +02:00
Nikita Popov
030bb36ed7 Declare SoapParam properties 2021-08-19 11:48:56 +02:00
Nikita Popov
9491694903 Deprecate SoapClient ssl_method option
Instead use ssl stream context options instead. The direct
equivalent would be crypto_method, but min_proto_version /
max_proto_version are recommended instead.

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-14 09:36:26 +02:00