1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

2114 Commits

Author SHA1 Message Date
Weilin Du
2918caee20 ext/*: Remove break after return (#21485) 2026-03-23 20:30:13 +01:00
ndossche
a6a7b3923a Merge branch 'PHP-8.5'
* PHP-8.5:
  openssl: Fix missing error propagation for BIO_printf() calls
2026-03-21 10:36:04 +01:00
ndossche
0d7ce4c037 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  openssl: Fix missing error propagation for BIO_printf() calls
2026-03-21 10:35:59 +01:00
ndossche
f92d54b6b5 openssl: Fix missing error propagation for BIO_printf() calls
Since these go through a file, this can fail.
For some of these, the error is already checked but not propagated to
userland, causing a "true" return value but an incomplete file.
For others, the error is not checked and can also lead to an incomplete
file.
Solve this by always propagating failure, especially as the other write
calls are already checked for failure.

Closes GH-21360.
2026-03-21 10:35:34 +01:00
Arshid
a2fc8feb4c ext/openssl: openssl: use zend_string_init() instead of manual allocation (#21436) 2026-03-14 05:13:55 +00:00
ndossche
e9b3ea82b5 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-21083: Skip private_key_bits validation for EC/curve-based keys
2026-03-12 22:02:01 +01:00
ndossche
757dadcf1f Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-21083: Skip private_key_bits validation for EC/curve-based keys
2026-03-12 22:01:21 +01:00
Ilia Alshanetsky
7950482562 Fix GH-21083: Skip private_key_bits validation for EC/curve-based keys
openssl_pkey_new() checks private_key_bits >= 384 before generating any
key. For EC, X25519, ED25519, X448, and ED448 the size is inherent to
the curve or algorithm, so this check doesn't apply and causes failures
when default_bits is missing from openssl.cnf (which is the case in
OpenSSL 3.6's default config).

Skip the minimum-bits check for key types that don't use private_key_bits.

Closes GH-21387.
2026-03-12 21:53:22 +01:00
Peter Kokot
f99ca6347f Windows build: Use GREP_HEADER() instead of CHECK_FUNC_IN_HEADER() (#21315)
This removes the following unused compile definitions:

- HAVE_OSSL_SET_MAX_THREADS
- HAVE_ARGON2ID_HASH_RAW

The CHECK_FUNC_IN_HEADER() function defines the 'HAVE_<FUNCTION>'
compile definitions to 0 or 1, but these aren't used in the code.
Defining such preprocessor macros makes it difficult to track and sync
with other build systems.
2026-03-06 14:11:20 +01:00
Alexandre Daubois
11a95749b1 Convert more zend_parse_parameters_none() to fast ZPP (#21330) 2026-03-04 14:07:46 +01:00
ndossche
5a608bb1ba Merge branch 'PHP-8.5'
* PHP-8.5:
  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
2026-02-17 21:47:55 +01:00
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
fb5d4784fe Merge branch 'PHP-8.5'
* PHP-8.5:
  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 15:00:22 +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
61845cc016 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix memory leaks when sk_X509_new_null() fails
2026-01-22 22:47:51 +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
Arnaud Le Blanc
65b4073922 Include the actual stub name in generated arginfo headers (#20993) 2026-01-21 20:57:00 +01:00
Steve Wall
c1d2875a82 Implement GH-20310: No critical extension indication in openssl_x509_parse() output
This add criticalExtensions field to openssl_x509_parse() output that
provides name of all critical extensions.

Closes #20310
Closes #20311
2026-01-14 22:59:10 +01:00
David Carlier
8c4f806fe8 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-20802: undefined behavior with invalid SNI_server_certs options.
2026-01-01 21:10:33 +00: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
ab5c2a826a Use long conversion for stream context keepalive int values (#20805)
This is consistent with http and ssl wrappers where int values
are converted in this way.
2025-12-30 22:08:35 +01:00
Jakub Zelenka
0fd8aae6e8 Fix TCP_KEEPALIVE no inheriting for accepted sockets on MacOS 2025-12-30 16:53:22 +01:00
Jakub Zelenka
040ea4ab5f Revert "Fix GH-7737: openssl_seal/openssl_open do not handle tagged algorithm…" (#20698)
This reverts commit 2ee5e6b432.
2025-12-13 11:42:10 +01:00
Sara Golemon
2ee5e6b432 Fix GH-7737: openssl_seal/openssl_open do not handle tagged algorithms (#20687)
This commit adds a seventh parameter to both two OpenSSL functions:
* openssl_seal(): The new parameter is by-ref and is populated with the computed tag.
* openssl_open(): The new parameter is by-value to provide the computed tag.

Closes GH-7737
2025-12-12 14:06:01 -06:00
Jakub Zelenka
b3d846521b Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-19798: XP_SOCKET XP_SSL: Incorrect condition for Win
2025-10-23 15:28:55 +02: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
Ilija Tovilo
02d187d766 Merge branch 'PHP-8.5'
* PHP-8.5:
  [skip ci] Fix Windows test for openssl-3.5 upgrade (#19384)
2025-10-21 03:24:52 +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
17652409b8 Merge branch 'PHP-8.5'
* PHP-8.5:
  [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:36 +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
Tim Düsterhus
6da93a86f2 zend_API: Remove CHECK*NULL_PATH (#20155)
* tree-wide: Replace `CHECK_NULL_PATH()` by `zend_char_has_nul_byte()`

The former is a direct alias of the latter with a more explicit name and the
former is explicitly documented as a “compatibility” alias.

* tree-wide: Replace `CHECK_ZVAL_NULL_PATH()` by its definition

The former is explicitly documented as a “compatibility” alias.

* zend_API: Remove `CHECK*NULL_PATH`

The `CHECK_ZVAL_NULL_PATH()` macro is unsafe, because it implicitly assumes
that the given `zval*` is `IS_STRING`.

Based on a GitHub search there does not seem to be any user outside of PHP, all
hits were just forks / copies of php-src.
2025-10-15 10:24:22 +02:00