Commit graph

251 commits

Author SHA1 Message Date
Gina Peter Banyard
e2dee956b8 ext/soap: Reduce scope of variable 2024-10-17 22:46:34 +01: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
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
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
b7b492b184
Deduplicate URI building code in soap schema code (#15799) 2024-09-09 19:44:09 +02:00
Gina Peter Banyard
5b1b3ae673 ext/soap: Initialize a HashTable of size j
The i seems to be a mistake as everything else uses j
2024-06-27 17:41:23 +01:00
Gina Peter Banyard
ee75f344f8 ext/soap: Add const qualifiers for serialize functions
As serializing something should not affect the value of it
2024-06-27 17:41:23 +01:00
Gina Peter Banyard
ca2b131c6e ext/soap: mark string param of sdl_serialize_key() as const
Add const qualifiers to the variables at the call size
Rename variables when they were shadowing a variable from the outer scope
2024-06-27 17:41:23 +01:00
Gina Peter Banyard
325f8f0cfc ext/soap: Remove cast from macro
Move it to the one call site that requires it
2024-06-27 17:41:23 +01:00
Gina Peter Banyard
0e91b4f5e6 ext/soap: convert int type to size_t where appropriate 2024-06-27 17:41:23 +01:00
Gina Peter Banyard
902c8ceab0 ext/soap: Rename MD5 context variable to not shadow the stream context variable 2024-06-27 17:41:23 +01:00
Gina Peter Banyard
a6a2c66141
ext/soap: Refactor SDL delete functions
Use a common implementation for persistent and non-persistent functions
2024-06-19 02:20:36 +01:00
Gina Peter Banyard
fd2d869642
Clean-up some more headers (#14416)
Remove unused headers (such as php_ini.h for extensions that don't define INI settings)
Use more specific headers when possible
2024-06-08 17:15:36 +01:00
Niels Dossche
37f683a70f Remove unused internal functions in soap 2024-05-31 23:05:33 +02:00
Niels Dossche
e8c6c6f15d Fix signedness issues in soap.c 2024-05-31 23:05:33 +02:00
Máté Kocsis
60336de2ba Migrate SOAP SDL resource to object
Related to https://wiki.php.net/rfc/resource_to_object_conversion and https://github.com/php/php-tasks/issues/6
Closes GH-14121
2024-05-07 09:21:39 +02:00
Niels Dossche
58fc521713 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix libxml2 2.12 build due to API breaks
2023-12-01 18:07:58 +01:00
Niels Dossche
0a39890c96 Fix libxml2 2.12 build due to API breaks
See 1922547860
2023-12-01 18:03:37 +01:00
Niels Dossche
2af22ab786 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12826: Weird pointers issue in nested loops
  Fix GH-12838: [SOAP] Temporary WSDL cache files not being deleted
2023-12-01 17:12:33 +01:00
Niels Dossche
4eee81b509 Fix GH-12838: [SOAP] Temporary WSDL cache files not being deleted
If there are two users that can execute the script that caches a WSDL,
but the script is owned by a single user, then the caching code will
name the cached file with the file owner username and a hash of the uri.
When one of the two tries to rename the file created by the other
process, this does not work because it has no permission to do so.
This then leaves temporary files floating in the temp directory.

To fix the immediate problem, unlink the file after rename has failed.
On the long term, this has to be fixed by taking the username of the
process instead of the username of the file owner.

Closes GH-12841.
2023-12-01 17:10:58 +01:00
Niels Dossche
eed7474fc8 Merge branch 'PHP-8.3'
* PHP-8.3:
  Minor fix in `NEWS` alignment
  Fix bug #75306: Memleak in SoapClient
2023-10-26 19:59:46 +02:00
Niels Dossche
e39538bed0 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix bug #75306: Memleak in SoapClient
2023-10-26 19:59:00 +02:00
Niels Dossche
27797a26ca Fix bug #75306: Memleak in SoapClient
Setting the stream context via php_stream_context_to_zval() will
increase the reference count. So if the new context is created, then it
will end up with a reference count of 2 while it should be 1.

Credits to cmb for the analysis. I arrived at the same patch as he did.

Closes GH-12523.
2023-10-26 19:58:31 +02:00
Niels Dossche
b7bf5e5706 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix incorrect dtor for persistent sdl->encoders
2023-10-25 17:56:53 +02:00
Niels Dossche
07de4b69d4 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix incorrect dtor for persistent sdl->encoders
2023-10-25 17:54:46 +02:00
Niels Dossche
9f7f3b2034 Fix incorrect dtor for persistent sdl->encoders
Closes GH-12515.
2023-10-25 17:53:42 +02:00
Niels Dossche
0493842635
Fix soap crash with ZEND_RC_DEBUG (#12514) 2023-10-24 22:05:41 +02:00
Viktor Vassilyev
e58af7c160 ext/soap: Add support for clark notation for namespaces in class map
Closes GH-12411.
2023-10-23 23:39:28 +02:00
Niels Dossche
1b16646270 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix segfault and assertion failure with refcounted props and arrays
  Fix incorrect uri check in SOAP caching
  Fix bug #66150: SOAP WSDL cache race condition causes Segmentation Fault
2023-10-19 18:32:01 +02:00
Niels Dossche
abf562c417 Fix incorrect uri check in SOAP caching
If i == 0 then the check will compare 0 bytes.
We are supposed to check if the uri is identical.

Closes GH-12479.
2023-10-19 18:29:11 +02:00
Niels Dossche
43e63168e9 Fix bug #66150: SOAP WSDL cache race condition causes Segmentation Fault
When we have two processes both trying to cache a WSDL, they might start
writing the data to the same temporary file, causing file corruption due
to the race condition. Fix this by creating a temporary file first, and
then moving it to the final location. If moving fails then we know
another process finished caching first.

This also fixes #67617 as a consequence of its implementation.

Closes GH-12469.
2023-10-19 18:27:38 +02:00
Arnaud Le Blanc
4df3dd7679
Reduce memory allocated by var_export, json_encode, serialize, and other (#8902)
smart_str uses an over-allocated string to optimize for append operations. Functions that use smart_str tend to return the over-allocated string directly. This results in unnecessary memory usage, especially for small strings.

The overhead can be up to 231 bytes for strings smaller than that, and 4095 for other strings. This can be avoided for strings smaller than `4096 - zend_string header size - 1` by reallocating the string.

This change introduces `smart_str_trim_to_size()`, and calls it in `smart_str_extract()`. Functions that use `smart_str` are updated to use `smart_str_extract()`.

Fixes GH-8896
2022-07-08 14:47:46 +02:00
Christoph M. Becker
08d1593c7d
Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix GH-8538: SoapClient may strip parts of nmtokens
2022-05-23 16:53:16 +02:00
Christoph M. Becker
ee9a3fa762
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-8538: SoapClient may strip parts of nmtokens
2022-05-23 16:51:32 +02:00
Christoph M. Becker
2a13304b2e
Fix GH-8538: SoapClient may strip parts of nmtokens
When stripping the namespace prefix, we can assume that this does not
contain any colons, while the rest of the name may contain colons.
Hence we must not use `strrchr()` but rather `strchr()` instead.

Closes GH-8543.
2022-05-23 16:49:12 +02: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
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
Patrick Allaert
aff365871a Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
KsaR
01b3fc03c3
Update http->https in license (#6945)
1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |
2021-05-06 12:16:35 +02:00
Patrick Allaert
6f38a53940 Remove useless conditional #ifdef
Closes GH-6737

Signed-off-by: George Peter Banyard <girgias@php.net>
2021-02-27 13:23:00 +00:00
Nikita Popov
9576a2ad1e Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix persistent leak on load_wsdl_ex failure
2021-02-02 10:07:19 +01:00
Nikita Popov
f1a988af4b Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix persistent leak on load_wsdl_ex failure
2021-02-02 10:07:04 +01:00
Nikita Popov
51d76c346e Fix persistent leak on load_wsdl_ex failure
Move the load_wsdl_ex call into the zend_try that destroys the
docs hash table. The wsdl will be inserted into docs early on,
and will thus be released on subsequent bailout.
2021-02-02 10:05:35 +01:00
Nikita Popov
800685e2f9 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix build
  crc32 mac build fix
2021-02-01 09:46:39 +01:00
Nikita Popov
c72957b409 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix build
2021-02-01 09:46:27 +01:00
Nikita Popov
ab8177de2c Fix build 2021-02-01 09:46:17 +01:00
Stanislav Malyshev
f2994786f3 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix bug #80672 - Null Dereference in SoapClient
2021-02-01 00:17:02 -08:00
Stanislav Malyshev
d94d0dda29 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix bug #80672 - Null Dereference in SoapClient
2021-01-31 21:42:48 -08:00