179 Commits
Author SHA1 Message Date
ndossche 1d901925f0 Merge branch 'PHP-8.6'
* PHP-8.6:
  [ci skip] Skip test for MSAN
2026-10-27 20:36:52 +01:00
ndossche 76c8a4d13e Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  [ci skip] Skip test for MSAN
2026-10-27 20:36:46 +01:00
ndossche 6c1559d0e5 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  [ci skip] Skip test for MSAN
2026-10-27 20:36:40 +01:00
ndossche de8c44e683 [ci skip] Skip test for MSAN 2026-10-27 20:36:09 +01:00
ndossche 0c2f56bedf Merge branch 'PHP-8.6'
* PHP-8.6:
  Fix GOST and Snefru digests of 512 MiB or more
2026-10-24 10:55:52 +02:00
ndossche 509a3f63e3 Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  Fix GOST and Snefru digests of 512 MiB or more
2026-10-24 10:55:47 +02:00
ndossche 8f6512d3f2 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GOST and Snefru digests of 512 MiB or more
2026-10-24 10:55:20 +02:00
Martin Mirchev 89f4d82157 Fix GOST and Snefru digests of 512 MiB or more
The bit counter update in PHP_GOSTUpdate() and PHP_SNEFRUUpdate() set the
low word one too high when it wrapped, and added at most one carry to the
high word per update. Snefru also computed the bit length of a single
update in 32 bits. The encoded message length, and thus the digest, was
wrong for inputs of 2^29 bytes or more. Compute the counter with 64-bit
arithmetic.

Closes GH-24555.
2026-10-24 10:54:51 +02:00
Ilija Tovilo 9705fda1bb Merge branch 'PHP-8.6' into master
* PHP-8.6:
  Add NEWS entry
  Avoid state corruption via bailout
2026-10-21 16:34:56 +02:00
Ilija Tovilo d6373dfe15 Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  Add NEWS entry
  Avoid state corruption via bailout
2026-10-21 16:33:23 +02:00
Ilija Tovilo c7273b9ba8 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Add NEWS entry
  Avoid state corruption via bailout
2026-10-21 16:30:04 +02:00
Ilija Tovilo 8a94bb3822 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add NEWS entry
  Avoid state corruption via bailout
2026-10-21 16:27:03 +02:00
Jorg Sowa 6885c8ea7f Merge branch 'PHP-8.6' into master 2026-10-19 12:12:47 +02:00
Jorg Sowa 286bc3cb1c Merge branch 'PHP-8.5' into PHP-8.6 2026-10-19 12:12:46 +02:00
Jorg Sowa a2d7bd6151 Merge branch 'PHP-8.4' into PHP-8.5 2026-10-19 12:12:43 +02:00
Jorg Sowa 17f94f0a4c Fix xxh64 seed deprecation emitted when no seed is given
Closes GH-24412
2026-10-19 12:12:37 +02:00
Marc Bennewitz f5d89c8394 Fix mhash_keygen_s2k() $length truncation to int (#23951)
A $length above INT_MAX was truncated to int before the range check,
so e.g. 2**32 + 16 silently returned 16 bytes. Throw a ValueError instead.
2026-09-27 23:48:58 +02:00
Jordi Kroon 3036712be9 tree: Add #[\SensitiveParameter] to more functions taking secrets (#23782)
* ext/sodium: add SensitiveParameter to missing functions

* ext/phar: add SensitiveParameter to missing functions

* ext/snmp: add SensitiveParameter to missing functions

* ext/sqlite3: add SensitiveParameter to missing functions

* ext/hash: add SensitiveParameter to missing functions
2026-09-21 12:19:04 +01:00
Louis-ArnaudandNickSdot df2090a393 ext/hash: report argument #2 ($filename) for null bytes in hash_file() (#23534)
php_hash_do_hash() hardcodes argument index 1 in the isfilename branch,
so hash_file() blames $algo for a null byte carried by $filename.
hash_file() is the only caller passing isfilename = 1, and its filename
is argument #2; php_hash_do_hash_hmac() already uses 2 for the same
check.

Co-authored-by: NickSdot <32384907+NickSdot@users.noreply.github.com>
2026-09-02 07:28:59 +01:00
David Carlier 759829bc2f Merge branch 'PHP-8.5'
* PHP-8.5:
  ext/hash: Fix buffer overflow in hash_pbkdf2() with a large output length
2026-09-01 19:32:51 +01:00
David Carlier fbef051534 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  ext/hash: Fix buffer overflow in hash_pbkdf2() with a large output length
2026-09-01 19:32:43 +01:00
Lazizbek Ergashev 13f5c4bda2 ext/hash: Fix buffer overflow in hash_pbkdf2() with a large output length
hash_pbkdf2() sized the digest buffer with ceil((float) length / 2.0) and
the block count with ceil((float) digest_length / (float) ops->digest_size).
A float carries 24 bits of mantissa, so past 2^24 the conversion rounds and
both counts come out wrong: rounding up makes zend_bin2hex() write past the
end of the return string, rounding down leaves the tail of the string
uninitialized. hash_pbkdf2('md5', 'password', 'salt', 1, 268435473) writes
8 bytes out of bounds under ASAN.

Both counts are exact in integer arithmetic, so this replaces them with
round-up divisions, which also avoids the signed overflow with an output
length of PHP_INT_MAX. <math.h> had no other user in the file.

Close GH-23380
2026-09-01 19:32:38 +01:00
NickSdot aa8b895315 ext/hash: cleaned up test (#23041) 2026-08-07 13:05:14 +01:00
NickSdot 1da3a6398b Applied fixers to improve test robustness to extensions with no code owners (#23018)
* ext/bz2: applied fixers to improve test robustness

* ext/calendar: applied fixers to improve test robustness

* ext/exif: applied fixers to improve test robustness

* ext/fileinfo: applied fixers to improve test robustness

* ext/filter: applied fixers to improve test robustness

* ext/ftp: applied fixers to improve test robustness

* ext/hash: applied fixers to improve test robustness

* ext/iconv: applied fixers to improve test robustness

* ext/ldap: applied fixers to improve test robustness

* ext/pcre: applied fixers to improve test robustness

* ext/posix: applied fixers to improve test robustness

* ext/readline: applied fixers to improve test robustness

* ext/shmop: applied fixers to improve test robustness

* ext/snmp: applied fixers to improve test robustness

* ext/sodium: applied fixers to improve test robustness

* ext/sqlite3: applied fixers to improve test robustness

* ext/sysvmsg: applied fixers to improve test robustness

* ext/sysvsem: applied fixers to improve test robustness

* ext/sysvshm: applied fixers to improve test robustness

* ext/tidy: applied fixers to improve test robustness

* ext/tokenizer: applied fixers to improve test robustness

* ext/zend_test: applied fixers to improve test robustness

* ext/zlib: applied fixers to improve test robustness
2026-08-04 13:10:07 +01:00
Gina Peter Banyard 34c686a5b4 stream: remove path parameter in stream error functions (#22792)
Instead rely on the mechanism gated by the error_include_args INI to display them.

This actually aligns the behaviour of what was accepted in https://wiki.php.net/rfc/display_error_function_args.
2026-07-19 16:15:01 +01:00
Daniel Scherzer b360cf8c28 ext/hash: Add #[\Deprecated] to MHASH_* constants (#19565) 2025-08-25 01:52:25 -07:00
Jorg Adam Sowa e11a702c05 ext/hash: tests for md5 and sha1 compatibility (#18525)
Add test cases to check compatibility between the `hash("algo")` and `md5()`/`sha1()` functions.
2025-05-09 13:08:58 +01:00
Gina Peter Banyard b48fdcb6e6 Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/hash: Fix deprecation message output for new tests
2024-11-10 20:35:04 +00:00
Gina Peter Banyard 883d3c8113 ext/hash: Fix deprecation message output for new tests 2024-11-10 20:34:45 +00:00
Gina Peter Banyard 46431487f7 Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/hash: Fix GH-16711: Segfault in mhash()
  ext/hash: Add failing tests for GH-16711
2024-11-10 20:17:28 +00:00
Gina Peter Banyard c1d67c2415 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/hash: Fix GH-16711: Segfault in mhash()
  ext/hash: Add failing tests for GH-16711
2024-11-10 20:17:09 +00:00
Gina Peter Banyard 1b379f5e55 ext/hash: Fix GH-16711: Segfault in mhash()
Closes GH-16713
2024-11-10 20:15:44 +00:00
Gina Peter Banyard fc8f30d312 ext/hash: Add failing tests for GH-16711 2024-11-10 20:14:21 +00:00
Christoph M. Becker 2b10cd1beb Deprecate mhash constants
The mhash functions already have been deprecated as of PHP 8.1.0[1],
but the respective constants appear to have been missed.  We catch up
on that.

[1] <https://wiki.php.net/rfc/deprecations_php_8_1#mhash_function_family>

Closes GH-16569.
2024-11-02 01:07:03 +01:00
Niels Dossche 7ae7b4e388 Correctly specify secret instead of seed in ext/hash deprecation message (#15557)
Reference: https://github.com/php/php-src/commit/74eff98c84b26a8088fb56b5be748a3e0e1da419#r145528001
2024-08-23 19:37:57 +02:00
Gina Peter Bnayard 5853cdb73d Use "must not" instead of "cannot" wording 2024-08-21 21:12:17 +01:00
Niels Dossche 74eff98c84 Deprecate passing incorrect data types for options to ext/hash functions (#15236)
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_incorrect_data_types_for_options_to_exthash_functions
2024-08-06 19:13:09 +02:00
Niels Dossche bb299a03e9 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix crash when converting array data for array in shm in xxh3
2024-08-05 22:07:06 +02:00
Niels Dossche ca84662c87 Fix crash when converting array data for array in shm in xxh3
Closes GH-15237.
2024-08-05 22:06:11 +02:00
29f98e7485 Replace @deprecated by #[\Deprecated] for internal functions / class constants (#14750)
Co-authored-by: Gina Peter Banyard <girgias@php.net>
Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2024-07-10 16:47:31 +02:00
Tim Düsterhus ac54d1c039 hash: Add simple HashContext::__debugInfo() implementation (#14644)
* hash: Add simply HashContext::__debugInfo() implementation

* NEWS/UPGRADING
2024-06-27 19:29:37 +02:00
Niels Dossche 5df473d2c7 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-12223: Entity reference produces infinite loop in var_dump/print_r
  Fix GH-12192: SimpleXML infinite loop when getName() is called within foreach
  Fix GH-12186: segfault copying/cloning a finalized HashContext
2023-09-16 21:24:20 +02:00
Max Semenik 10f5a06d3c Fix GH-12186: segfault copying/cloning a finalized HashContext
Closes GH-12186.
Closes GH-12187.
2023-09-16 21:18:27 +02:00
Niels Dossche e6730565b6 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11180: hash_file() appears to be restricted to 3 arguments
2023-05-07 17:37:25 +02:00
Niels Dossche baa07f3de3 Fix GH-11180: hash_file() appears to be restricted to 3 arguments
Closes GH-11198.
2023-05-07 17:33:28 +02:00
George Peter Banyard dd5c5ca7a5 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Handle exceptions from __toString in XXH3's initialization
  Fix phpdbg segmentation fault in case of malformed input
2023-01-17 14:16:18 +00:00
Niels Dossche 7463e70b1e Handle exceptions from __toString in XXH3's initialization
The initialization routine for XXH3 was not prepared for exceptions from seed.
Fix this by using try_convert_to_string.

For discussion, please see: GH-10305

Closes GH-10352

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-01-17 14:14:12 +00:00
Tim Düsterhus 0d4147f0fb Mark parameter in ext/hash as sensitive 2022-06-13 11:09:12 +02:00
Christoph M. Becker 187f5a362d Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix #81714: segfault when serializing finalized HashContext
2022-04-05 13:36:07 +02:00
Christoph M. Becker c2eafc29f5 Fix #81714: segfault when serializing finalized HashContext
We must not allow to serialize already finalized `HashContext`s, since
the internal context is already freed.  Since there is not much point
in serializing finalized `HashContext`s, we just bail out in that case.

Closes GH-8265.
2022-04-05 13:25:22 +02:00