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

2084 Commits

Author SHA1 Message Date
ndossche e8a274e3dd Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Update NEWS for OpenSSL changes
  Fix memory leaks in openssl_cms_encrypt() when push fails
  Fix memory leaks in openssl_pkcs7_encrypt() when push fails
  Fix missing error propagation when php_array_to_X509_sk() fails
  Fix memory leaks in php_array_to_X509_sk() when push fails
  Fix memory leak in php_openssl_load_all_certs_from_file() when push fails

Closes GH-20986.
2026-02-17 21:46:49 +01:00
ndossche f6887f04f6 Fix memory leaks in openssl_cms_encrypt() when push fails 2026-02-17 21:39:51 +01:00
ndossche 556ec77951 Fix memory leaks in openssl_pkcs7_encrypt() when push fails 2026-02-17 21:39:51 +01:00
ndossche ef54becb3e Fix missing error propagation when php_array_to_X509_sk() fails
Execution shouldn't continue if this fails because it can give the wrong
results.
2026-02-17 21:39:51 +01:00
ndossche 01d598aea3 Fix memory leaks in php_array_to_X509_sk() when push fails 2026-02-17 21:39:50 +01:00
ndossche 4b9e80eae9 Fix memory leak in php_openssl_load_all_certs_from_file() when push fails 2026-02-17 21:39:50 +01:00
Niels Dossche 2c08d9a627 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix crash in openssl_x509_parse() when X509_NAME_oneline() fails
  Fix crash when in openssl_x509_parse() when i2s_ASN1_INTEGER() fails
2026-01-23 14:59:35 +01:00
Niels Dossche 62afc7a2fa Fix crash in openssl_x509_parse() when X509_NAME_oneline() fails
The X509_NAME_oneline() function can return NULL, which will cause a
crash when the string length is computed via add_assoc_string().

Closes GH-21010.
2026-01-23 14:59:08 +01:00
Niels Dossche c2eadb4922 Fix crash when in openssl_x509_parse() when i2s_ASN1_INTEGER() fails
The X509_NAME_oneline() function can return NULL,
which will cause a crash when the string length is computed via add_assoc_string().

Closes GH-21011.
2026-01-23 14:58:39 +01:00
Niels Dossche 7d4e430435 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix memory leaks when sk_X509_new_null() fails
2026-01-22 22:47:35 +01:00
Niels Dossche 7754eafb1f Fix memory leaks when sk_X509_new_null() fails
In a lot of places the return value is not checked, and when the
function fails the code continues execution. However, this means that
operations on the stack fail and will cause memory leaks on the objects
that weren't pushed.

We also notice an inconsistency in how these failures are handled.
For example, in one place we explicitly have a fatal error
`php_error_docref(NULL, E_ERROR, "Memory allocation failure");`
but this is the only place to do so.

Closes GH-20957.
2026-01-22 22:37:14 +01:00
David Carlier b6a3852b31 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20802: undefined behavior with invalid SNI_server_certs options.
2026-01-01 21:09:01 +00:00
David Carlier cdcc0c2cd8 Fix GH-20802: undefined behavior with invalid SNI_server_certs options.
close GH-20803
2026-01-01 21:08:35 +00:00
Jakub Zelenka 45451740e3 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-19798: XP_SOCKET XP_SSL: Incorrect condition for Win
2025-10-23 15:26:05 +02:00
Jakub Zelenka 2a0931d347 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-19798: XP_SOCKET XP_SSL: Incorrect condition for Win
2025-10-23 15:22:21 +02:00
Jakub Zelenka eef11e048d Fix GH-19798: XP_SOCKET XP_SSL: Incorrect condition for Win
This fixes incorrect type conversion and subsequent check for Windows
where returned socket is not an int.

It should be noted that this is not really an issue as previous int
would get negative so the check should still work. The issue actually
happens only in master (PHP 8.5) where refactoring has been done and the
type changed.

Closes GH-19881
2025-10-23 15:11:14 +02:00
Shivam Mathur 94f2bb0dd5 [skip ci] Fix Windows test for openssl-3.5 upgrade (#19384)
* Fix Windows test for openssl-3.5 upgrade

* Update ext/openssl/tests/check_default_conf_path.phpt

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
2025-10-21 03:24:13 +02:00
Ilija Tovilo b8ba8593b1 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  [skip ci] Also skip check_default_conf_path.phpt on Windows & 8.2
  Revert "Fix Windows test for openssl-3.5 upgrade (#19384)"
2025-10-21 01:25:30 +02:00
Ilija Tovilo ed8a45c8e9 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Also skip check_default_conf_path.phpt on Windows & 8.2
  Revert "Fix Windows test for openssl-3.5 upgrade (#19384)"
2025-10-21 01:25:24 +02:00
Ilija Tovilo b751582705 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [skip ci] Also skip check_default_conf_path.phpt on Windows & 8.2
  Revert "Fix Windows test for openssl-3.5 upgrade (#19384)"
2025-10-21 01:25:06 +02:00
Ilija Tovilo f65a574a36 [skip ci] Also skip check_default_conf_path.phpt on Windows & 8.2
I don't know why the output is different only in 8.2. Revert for now to make CI
happy.
2025-10-21 01:23:58 +02:00
Ilija Tovilo 3f6c86a885 Revert "Fix Windows test for openssl-3.5 upgrade (#19384)"
This reverts commit 0e17dcfe54.
2025-10-21 01:23:29 +02:00
Ilija Tovilo 1bfe9340b7 [skip ci] Skip openssl tests currently failing on 8.2 2025-10-21 00:55:08 +02:00
Ilija Tovilo 43621e1e3c Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix Windows test for openssl-3.5 upgrade (#19384)
2025-10-21 00:40:27 +02:00
Ilija Tovilo 5d8a3925d2 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix Windows test for openssl-3.5 upgrade (#19384)
2025-10-21 00:40:21 +02:00
Shivam Mathur 0e17dcfe54 Fix Windows test for openssl-3.5 upgrade (#19384)
* Fix Windows test for openssl-3.5 upgrade

* Update ext/openssl/tests/check_default_conf_path.phpt

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>

---------

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
2025-10-21 00:40:14 +02:00
Jakub Zelenka 2e4dca57dc Fix GH-19994: openssl_get_cipher_methods inconsistent with fetched methods (#20167)
This is fixed by libctx work so this just adds test to confirm it.

The actual fix is 2f5ef4d2b7 .
2025-10-14 19:20:25 +02:00
Jakub Zelenka 43970e3c86 Fix missing libctx in x509 info read bio 2025-10-14 18:13:15 +02:00
Jakub Zelenka dcc4b0ff07 Fix build when --with-openssl-legacy-provider set
It was missing proper backend init split.

Closes GH-19930
2025-09-23 12:26:04 +02:00
Tim Düsterhus e23c6222da uri: Clean up naming of remaining public symbols (#19917)
* uri: Rename `uri_object_t` to `php_uri_object`

* uri: Rename `uri_(read|write)_component_*` to `php_uri_property_(read|write)_*_helper`

* uri: Rename `URI_SERIALIZED_PROPERTY_NAME` to `PHP_URI_SERIALIZE_URI_FIELD_NAME`

* uri: Rename `uri_internal_t` to `php_uri_internal`

* uri: Use proper `php_uri_ce_` prefix for all CEs

* uri: Make the object handlers `static` and remove them from the header
2025-09-23 09:19:56 +02:00
Gina Peter Banyard b4ed215299 core: Warn when non-representable floats are coerced to int (#19760)
RFC: https://wiki.php.net/rfc/warnings-php-8-5#casting_out_of_range_floats_to_int
2025-09-21 23:53:16 +01:00
Jakub Zelenka 2e9cdb2c5a Fix missing OpenSSL libctx name fetch conversions (#19830) 2025-09-13 22:51:07 +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
Daniel Scherzer 3f3a266a2b gen_stub: Infer constants' types from values (#19568)
Don't require `@var` with a type when the type can be inferred from a literal
value in the stub file.
2025-09-03 18:26:43 -07: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
Jakub Zelenka ba97d8636a Merge branch 'PHP-8.4' 2025-08-12 17:30:07 +02:00
Jakub Zelenka c8a4207400 Merge branch 'PHP-8.3' into PHP-8.4 2025-08-12 17:29:18 +02:00
Jakub Zelenka 2b415e416e Fix GH-19245: Success error message on TLS stream accept failure
This overwrites the previous message from the successful accept call.

Closes GH-19246
2025-08-12 17:28:33 +02:00
Jakub Zelenka 20c8c12d9e Fix #81724: openssl_cms_encrypt only allows specific ciphers
The allows cipher_algo to be specified as a string. It means the not
only predefined ID ciphers are available which means that also auth
enveloped data can be created using AES GCM.

Closes GH-19459
2025-08-12 15:52:09 +02:00
Jakub Zelenka 10834d1572 Fix #47728: Add missing openssl constants
This adds PKCS7_NOSMIMECAP, PKCS7_CRLFEOL, PKCS7_NOCRL and
PKCS7_NO_DUAL_CONTENT constants. They might be potentially useful
in some scenarious.

Test is not added as it is not clear if there is much need for those and
it would require much bigger effort just to test OpenSSL functionality.

Closes GH-19450
2025-08-11 20:46:14 +02:00
Jakub Zelenka c5f79b8cf9 Use OpenSSL libctx for various BIO readers (#19448)
This converts mostly PEM readers but also DER for CMS
2025-08-11 18:21:38 +02:00
Jakub Zelenka 702d18de99 Implement #80495: Enable to set padding in openssl_(sign|verify)
This adds support for RSA PSS padding.

Closes GH-19432
2025-08-11 13:11:10 +02:00
Gina Peter Banyard 284e622506 ext/openssl: Deprecate $key_length parameter of openssl_pkey_derive() (#19421)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_key_length_parameter_of_openssl_pkey_derive
2025-08-09 22:55:53 +01:00
Jakub Zelenka 731d36ac61 Fix OpenSSL fetching of alias ciphers
This does not seem like an issue as the aliases seem to be already
fetched most of the time. But there might be cases when it could be
failing like it was failing for MD in GH-19369.

It should be noted that the test does not fail without this change but
it seems useful anyway so it is added as part of this change. I
actually have not found the case where alias is not fetched for cipher
but there might be some.

Closes GH-19437
2025-08-09 23:03:26 +02:00
Jakub Zelenka 066a977840 Clean up test for GH-19369 - openssl_sign issue 2025-08-09 23:02:46 +02:00
Jakub Zelenka c8d7318daf Fix GH-19369: openssl_sign() - support for alias digest algs broken
Closes GH-19436
2025-08-09 22:06:59 +02:00
Jakub Zelenka c064fc4fe8 Fix php_openssl_pkey_derive merge issue 2025-08-09 18:25:42 +02:00
Jakub Zelenka 75931a2ce3 Merge branch 'PHP-8.4' 2025-08-09 18:02:10 +02:00