[php-src] master: Merge branch 'PHP-8.5' into PHP-8.6

From: Date: Mon, 02 Nov 2026 15:33:34 +0000
Subject: [php-src] master: Merge branch 'PHP-8.5' into PHP-8.6
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-143217@lists.php.net to get a copy of this message
Author: Arnaud Le Blanc (arnaud-lb) Date: 2026-11-02T16:32:54+01:00 Commit: https://github.com/php/php-src/commit/cda88b49783790ea49a7e1dacc17e85b58c75e77 Raw diff: https://github.com/php/php-src/commit/cda88b49783790ea49a7e1dacc17e85b58c75e77.diff Merge branch 'PHP-8.5' into PHP-8.6 * PHP-8.5: Fix ZEND_LONG_UINT_OVFL() accepting negative values on 32-bit platforms (#24778) Changed paths: A ext/mbstring/tests/retry_limit_negative.phpt A ext/standard/tests/strings/sapi_windows_cp_negative_codepage.phpt M NEWS M Zend/zend_range_check.h Diff: diff --git a/NEWS b/NEWS index e7906d480d41..42912edae904 100644 --- a/NEWS +++ b/NEWS @@ -84,6 +84,10 @@ PHP NEWS - LDAP: . Fix crash in ldap_exop_sync() when $response_data is omitted. (lacatoire) +- MBString: + . Fixed negative mbstring.regex_stack_limit and mbstring.regex_retry_limit + on 32bit platforms. (Marc Bennewitz) + - MySQLnd: . Fixed bug GH-24609 (OK packets without an info message rejected on x32 builds). (lazerg) @@ -233,6 +237,8 @@ PHP NEWS - Windows: . Fixed bug GH-25009 (GetConsoleTitleW() buffer size passed in bytes). (Lazizbek Ergashev) + . Fixed sapi_windows_cp_set() and sapi_windows_cp_conv() accepting a negative + codepage on 32bit platforms. (Marc Bennewitz) - Zip: . Reject broken libzip versions 1.3.1, 1.7.0 and 1.12.0 during Windows diff --git a/Zend/zend_range_check.h b/Zend/zend_range_check.h index 8db867434399..ed61097419f2 100644 --- a/Zend/zend_range_check.h +++ b/Zend/zend_range_check.h @@ -46,7 +46,7 @@ # define ZEND_LONG_INT_OVFL(zl) (0) # define ZEND_LONG_INT_UDFL(zl) (0) # define ZEND_LONG_EXCEEDS_INT(zlong) (0) -# define ZEND_LONG_UINT_OVFL(zl) (0) +# define ZEND_LONG_UINT_OVFL(zl) UNEXPECTED((zl) < 0) #endif /* size_t vs (unsigned) int checks. */ diff --git a/ext/mbstring/tests/retry_limit_negative.phpt b/ext/mbstring/tests/retry_limit_negative.phpt new file mode 100644 index 000000000000..b498a7463d28 --- /dev/null +++ b/ext/mbstring/tests/retry_limit_negative.phpt @@ -0,0 +1,25 @@ +--TEST-- +Oniguruma retry limit is not set from a negative mbstring.regex_retry_limit +--EXTENSIONS-- +mbstring +--SKIPIF-- +<?php +if (!function_exists('mb_ereg')) die('skip mb_ereg not available'); +if (@version_compare(MB_ONIGURUMA_VERSION, '6.9.3') < 0) { + die('skip requires Oniguruma >= 6.9.3'); +} +?> +--INI-- +error_reporting=E_ALL & ~E_DEPRECATED +mbstring.regex_retry_limit=-1 +--FILE-- +<?php +/* A negative limit must leave the default of Oniguruma in place, rather than + * being converted to an unsigned int of UINT_MAX. This match needs more + * retries than the default allows for. */ +$regex = 'A(B|C+)+D|AC+X'; +$str = 'A' . str_repeat('C', 24) . 'X'; +var_dump(mb_ereg($regex, $str)); +?> +--EXPECT-- +bool(false) diff --git a/ext/standard/tests/strings/sapi_windows_cp_negative_codepage.phpt b/ext/standard/tests/strings/sapi_windows_cp_negative_codepage.phpt new file mode 100644 index 000000000000..997685f34ef3 --- /dev/null +++ b/ext/standard/tests/strings/sapi_windows_cp_negative_codepage.phpt @@ -0,0 +1,37 @@ +--TEST-- +sapi_windows_cp_set() and sapi_windows_cp_conv() must reject a negative codepage +--SKIPIF-- +<?php +if (PHP_OS_FAMILY !== 'Windows') die('skip for Windows only'); +?> +--FILE-- +<?php +try { + sapi_windows_cp_set(-1); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; +} + +try { + sapi_windows_cp_set(PHP_INT_MIN); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; +} + +try { + sapi_windows_cp_conv(-1, 65001, 'php'); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; +} + +try { + sapi_windows_cp_conv(65001, -1, 'php'); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; +} +?> +--EXPECT-- +ValueError: sapi_windows_cp_set(): Argument #1 ($codepage) must be between 0 and 4294967295 +ValueError: sapi_windows_cp_set(): Argument #1 ($codepage) must be between 0 and 4294967295 +ValueError: sapi_windows_cp_conv(): Argument #1 ($in_codepage) must be between 0 and 4294967295 +ValueError: sapi_windows_cp_conv(): Argument #2 ($out_codepage) must be between 0 and 4294967295

« previous php.cvs (#143217) next »