1
0
mirror of https://github.com/php/php-src.git synced 2026-04-30 03:33:17 +02:00
Commit Graph

1717 Commits

Author SHA1 Message Date
Niels Dossche 7f9b6a8c2a Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20011: Array of SoapVar of unknown type causes crash
2025-10-02 19:41:59 +02:00
Niels Dossche 19f345c824 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-20011: Array of SoapVar of unknown type causes crash
2025-10-02 19:39:25 +02:00
Niels Dossche eab2c2007b Fix GH-20011: Array of SoapVar of unknown type causes crash
We "guess" the type in this case, consistent with what a SoapVar would
do outside of an array.

Closes GH-20030.
2025-10-02 19:38:44 +02:00
Niels Dossche 8987c0b661 Fix uninitialized soap lang_en string on ZTS
Replaces GH-19772.
Closes GH-19772.
Fixes GH-19773.
Closes GH-19819.
2025-09-29 16:11:29 +02:00
Niels Dossche 469aa255ae Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-19784: SoapServer memory leak
2025-09-13 10:15:52 +02:00
Niels Dossche 61265c2b92 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-19784: SoapServer memory leak
2025-09-13 10:15:46 +02:00
Niels Dossche d30dd1b47b Fix GH-19784: SoapServer memory leak
Closes GH-19818.
2025-09-13 10:15:22 +02:00
Tim Düsterhus 26eac7de17 uri: Clean up naming of public symbols (#19794)
* uri: Rename `uri_recomposition_mode_t` to `php_uri_recomposition_mode`

* uri: Align the names of the `php_uri_recomposition_mode` values

* uri: Rename `uri_component_read_mode_t` to `php_uri_component_read_mode`

* uri: Align the names of the `php_uri_component_read_mode` values

* uri: Rename `uri_property_name_t` to `php_uri_property_name`

* uri: Align the names of the `php_uri_property_name` values

* uri: Rename `uri_property_handler_t` to `php_uri_property_handler`

* uri: Rename `uri_(read|write)_t` to `php_uri_property_handler_(read|write)`

* uri: Rename `php_uri_property_handler`’s `(read|write)_func` to `read|write`

The `_func` is implied by the data type and the name of the struct.

* uri: Rename `uri_parser_t` to `php_uri_parser`

* uri: Shorten the names of `php_uri_parser` fields

The `_uri` suffix is implied, because this is an URI parser.
2025-09-11 12:10:41 +02:00
Tim Düsterhus 1faaa7224d uri: Remove useless layer of indirection in php_uri_get_parser() (#19774)
By using the `zend_hash_*()` functions directly, we can benefit from the
precalculated hash value in the given `zend_string *uri_parser_name`. We need
to deconstify the parameter, since the function might calculate the hash, thus
modifying the `zend_string*`.
2025-09-09 22:02:30 +02:00
Tim Düsterhus 49faa4df75 uri: Always use const pointers when referring to uri_parser_t (#19623)
The actual parser definitions are all `const` and must never be modified. Make
sure to always use `const` pointers.
2025-08-30 21:04:50 +02:00
Máté Kocsis e9c92a9739 ext/uri: Use the term "URI parser" instead of "URI handler" (#19530) 2025-08-21 07:23:47 +02:00
Máté Kocsis 1cff1815d0 Add internal URI handling API (#19073)
Part of https://github.com/php/php-src/pull/14461. Related to https://wiki.php.net/rfc/url_parsing_api.
2025-08-19 18:35:09 +02:00
Florian Engelhardt 29b38a1ced Fix GH-19226: Segfault when spawning new thread in soap extension
Closes GH-19228.
2025-07-24 11:56:43 +02:00
DanielEScherzer 1eadf553f1 Arginfo: avoid using temporary zvals for initializing attribute values (#19141)
Instead of
* adding a zval on the stack
* initializing it
* copying the value to the attribute

Just initialize the value directly in the zend_attribute_arg
2025-07-21 13:33:51 -07:00
Niels Dossche d7f9caf37c Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18640: heap-use-after-free ext/soap/php_encoding.c:299:32 in soap_check_zval_ref
2025-07-20 19:50:01 +02:00
Niels Dossche f8196a5db5 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18640: heap-use-after-free ext/soap/php_encoding.c:299:32 in soap_check_zval_ref
2025-07-20 19:49:56 +02:00
Niels Dossche 6cc4ae1f1d Fix GH-18640: heap-use-after-free ext/soap/php_encoding.c:299:32 in soap_check_zval_ref
For attributes, relying on the ref_map doesn't make sense the first
place as you can't really refer to attributes from attributes.
The code therefore assumes that the node is unique, which is broken.

Closes GH-19181.
2025-07-20 19:49:22 +02:00
Niels Dossche 03a9f03822 Migrate from xmlNewNode to xmlNewDocNode (#19182)
The former is discouraged [1].

[1] https://gnome.pages.gitlab.gnome.org/libxml2/html/tree_8h.html#aa39c05fb472571ed00e38c065e67d2ec
2025-07-19 23:29:04 +02:00
Daniel Scherzer 142e378618 Arginfo: add and use known strings for attribute values 2025-07-14 17:31:22 -07:00
Niels Dossche f6380e4a38 Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/soap/php_http.c: Fix memory leak of header value
2025-07-10 22:32:58 +02:00
Niels Dossche de7a212630 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/soap/php_http.c: Fix memory leak of header value
2025-07-10 22:32:52 +02:00
Gina Peter Banyard 85a49d4198 ext/soap/php_http.c: Fix memory leak of header value 2025-07-10 22:32:31 +02:00
DanielEScherzer 9225cb45ac Make zend_register_*_constant() functions return pointers, use them (#19029)
Have each of the specialized methods for registering a constant return a
pointer to the registered constant the same way that the generic
`zend_register_constant()` function does, and use those in the generated
arginfo files to avoid needing to search for a constant that was just
registered in order to add attributes to it.
2025-07-07 12:23:52 -07:00
Niels Dossche aa0e8bf568 Use ZVAL_NULL() directly for Z_CLIENT_USE_PROXY_P()
This is just a `?int` property, no need to do anything fancy.
2025-07-03 20:37:10 +02:00
Niels Dossche 8fdd434bb5 Don't deref soap private properties
They are private and can't be made references.
2025-07-03 20:37:10 +02:00
Niels Dossche e6e0887005 soap: Avoid redundant copying of http body string 2025-07-03 20:28:38 +02:00
Niels Dossche 32f0d24e1f soap: Get decompression function directly from function table and call it
The code is already looking up the entry in the function table anyway,
so might as well use it directly.
This simplifies the code and avoids a redundant lookup.
2025-07-03 20:28:38 +02:00
Niels Dossche 51149b65ad Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18990, bug #81029, bug #47314: SOAP HTTP socket not closing on object destruction
  Fix leak when path is too long in ZipArchive::extractTo()
  curl: Remove incorrect string release on error
2025-07-02 18:47:53 +02:00
Niels Dossche 764154dc75 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18990, bug #81029, bug #47314: SOAP HTTP socket not closing on object destruction
  Fix leak when path is too long in ZipArchive::extractTo()
  curl: Remove incorrect string release on error
2025-07-02 18:46:37 +02:00
Niels Dossche 69328ba304 Fix GH-18990, bug #81029, bug #47314: SOAP HTTP socket not closing on object destruction
Currently the resource is attached to the object and its refcount is
increased. This means that the refcount to the resource is 2 instead of
1 as expected. A refcount of 2 is necessary in the current code because
of how the error handling works: by using convert_to_null() the resource
actually goes to rc_dtor_func(), dropping its refcount to 1. So on error
the refcount is correct.
To solve the issue, let `stream` conceptually be a borrow of the
resource with refcount 1, and just use ZVAL_NULL() to prevent calling
rc_dtor_func() on the resource.

Closes GH-19001.
2025-07-02 18:44:05 +02:00
Ahmed Lekssays dd060656d3 Fix GHSA-453j-q27h-5p8x
Libxml versions prior to 2.13 cannot correctly handle a call to
xmlNodeSetName() with a name longer than 2G. It will leave the node
object in an invalid state with a NULL name. This later causes a NULL
pointer dereference when using the name during message serialization.

To solve this, implement a workaround that resets the name to the
sentinel name if this situation arises.

Versions of libxml of 2.13 and higher are not affected.

This can be exploited if a SoapVar is created with a fully qualified
name that is longer than 2G. This would be possible if some application
code uses a namespace prefix from an untrusted source like from a remote
SOAP service.

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2025-07-01 09:35:03 -07:00
Ilija Tovilo 49d94cced0 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GHSA-453j-q27h-5p8x
  Fix GHSA-hrwm-9436-5mv3: pgsql escaping no error checks
  Fix GHSA-3cr5-j632-f35r: Null byte in hostnames
2025-07-01 17:48:00 +02:00
Ahmed Lekssays a179e39c38 Fix GHSA-453j-q27h-5p8x
Libxml versions prior to 2.13 cannot correctly handle a call to
xmlNodeSetName() with a name longer than 2G. It will leave the node
object in an invalid state with a NULL name. This later causes a NULL
pointer dereference when using the name during message serialization.

To solve this, implement a workaround that resets the name to the
sentinel name if this situation arises.

Versions of libxml of 2.13 and higher are not affected.

This can be exploited if a SoapVar is created with a fully qualified
name that is longer than 2G. This would be possible if some application
code uses a namespace prefix from an untrusted source like from a remote
SOAP service.

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2025-07-01 23:01:17 +09:00
DanielEScherzer 171501b93f Replace @deprecated with #[\Deprecated] for internal constants (#18780)
Only covers constants declared via stub files, others will be handled
separately in a later commit.

Does not include the intl extension, since that had some errors relating to the
cpp code; that extension will be updated separately.
2025-06-26 11:27:15 -07:00
Gina Peter Banyard 091308cb3e ext/soap: Remove bool type coercions in tests 2025-06-21 22:19:03 +02:00
Niels Dossche 9859d837ca Implement request #61105: Support Soap 1.2 SoapFault Reason Text lang attribute
This is on the border line of a bugfix and a new feature.
Anyway, this is necessary to fix compatibility with .NET clients.

Closes GH-18701.
2025-06-21 00:18:08 +02:00
Niels Dossche f46f42b2b2 Implement request #55503: Extend __getTypes to support enumerations (#18704)
Co-authored-by: datibbaw <datibbaw@php.net>
2025-06-04 17:46:57 +02:00
Niels Dossche 3cb7d1bd8a Remove custom UTF-8 check function from ext/libxml
This was originally introduced as a workaround for a libxml2 bug [1].
This bug has been fixed for more than a decade [2], and we can use the
libxml2 API again. We bumped our version requirement for libxml2 beyond
that in 7.4 [3].

[1] 7e53511ec8
[2] https://github.com/GNOME/libxml2/commit/3ffe90ea1cbd4fd8eb2eb162d7940a445f1455d6
[3] https://github.com/php/php-src/commit/74235ca5f3fae3325175cf0e68cd7e28c86e1378

Closes GH-18706.
2025-05-30 10:40:23 +02:00
Niels Dossche 56abb316eb Fix bug #70951: Segmentation fault on invalid WSDL cache
We mix in the endianness and the zend_long size to make sure cache files
can't be used on incompatible architectures.

Closes GH-18707.
2025-05-30 00:04:06 +02:00
Niels Dossche 615b9803bb Get rid of redundant SOAP globals (#18702)
The copy doesn't make sense, remove it.
2025-05-29 20:14:57 +02:00
Niels Dossche c267caa542 Deduplicate XML parsing code for SOAP (#18700)
* Deduplicate XML parsing code for SOAP

* Apply suggestions from code review

Co-authored-by: Gina Peter Banyard <girgias@php.net>

---------

Co-authored-by: Gina Peter Banyard <girgias@php.net>
2025-05-29 18:35:19 +02:00
Niels Dossche bd47c14c50 Also allow XSD_1999_NAMESPACE 2025-05-29 18:26:46 +02:00
Niels Dossche c44196143a Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix potential NULL deref
2025-05-29 16:57:47 +02:00
Niels Dossche dd856d5ad9 Fix potential NULL deref
Backported from GH-18697.
2025-05-29 16:57:32 +02:00
Niels Dossche 6399012cee Fix namespace handling of WSDL and XML schema in SOAP
`attr_is_equal_ex` makes no sense: attributes never inherit the
namespace of their element. Yet this is wrongly used as a combo for
checking both the node namespace and attribute namespace.
Furthermore, not all nodes have the proper namespace check.
Fix all of this by reworking the helpers and auditing the calls to the
namespace helpers.

Closes GH-16320.
Closes bug #68576.
Closes GH-18697.
2025-05-29 16:55:41 +02:00
Gina Peter Banyard c9e571560f ext/soap: Refactor to_zval_bool() (#18696)
- Early return style
- Improve logic to get rid of unnecessary comparisons
- Do not use convert_to_boolean API
2025-05-29 15:29:55 +01:00
Gina Peter Banyard 407c9781f9 ext/soap: Replace single usage of CHECK_XML_NULL with FIND_XML_NULL (#18698)
This removes the implicit assumption about the variable name of the zval
Moreover, nearby the FIND_XML_NULL macro is used anyway.
2025-05-29 15:07:35 +01:00
Niels Dossche 8b4edf0229 Remove unused function in soap 2025-05-29 10:02:43 +02:00
Niels Dossche 21691cb19b Remove uncommented init/cleanup code
This is irrelevant and is done by ext/libxml.
2025-05-29 10:02:43 +02:00
Niels Dossche 564df33ac1 Add FIXME 2025-05-29 10:02:43 +02:00