From 15c22c69e44d78ca11e09a4f1c77d0af58f5f7d3 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 13 Oct 2020 14:06:13 +0200 Subject: [PATCH] [String] fix "is too large" ValueError on PHP 8 --- src/Symfony/Component/String/UnicodeString.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/String/UnicodeString.php b/src/Symfony/Component/String/UnicodeString.php index 81bf8ea56b605..16945b70a4407 100644 --- a/src/Symfony/Component/String/UnicodeString.php +++ b/src/Symfony/Component/String/UnicodeString.php @@ -268,7 +268,7 @@ public function slice(int $start = 0, int $length = null): AbstractString { $str = clone $this; try { - $str->string = (string) grapheme_substr($this->string, $start, $length ?? \PHP_INT_MAX); + $str->string = (string) grapheme_substr($this->string, $start, $length ?? 2147483647); } catch (\ValueError $e) { $str->string = ''; } @@ -280,8 +280,8 @@ public function splice(string $replacement, int $start = 0, int $length = null): { $str = clone $this; $start = $start ? \strlen(grapheme_substr($this->string, 0, $start)) : 0; - $length = $length ? \strlen(grapheme_substr($this->string, $start, $length ?? \PHP_INT_MAX)) : $length; - $str->string = substr_replace($this->string, $replacement, $start, $length ?? \PHP_INT_MAX); + $length = $length ? \strlen(grapheme_substr($this->string, $start, $length ?? 2147483647)) : $length; + $str->string = substr_replace($this->string, $replacement, $start, $length ?? 2147483647); normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string); if (false === $str->string) { @@ -293,7 +293,7 @@ public function splice(string $replacement, int $start = 0, int $length = null): public function split(string $delimiter, int $limit = null, int $flags = null): array { - if (1 > $limit = $limit ?? \PHP_INT_MAX) { + if (1 > $limit = $limit ?? 2147483647) { throw new InvalidArgumentException('Split limit must be a positive integer.'); } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy