Last active
June 8, 2022 12:39
-
-
Save ivangrozni/81d8ba32bef96dbcb3b1a92c6dd3d3f8 to your computer and use it in GitHub Desktop.
drupal core 9.3.14 php8.1 compatibilty issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/core/lib/Drupal/Component/Utility/UrlHelper.php b/core/lib/Drupal/Component/Utility/UrlHelper.php | |
index b23a213518..90bedaff53 100644 | |
--- a/core/lib/Drupal/Component/Utility/UrlHelper.php | |
+++ b/core/lib/Drupal/Component/Utility/UrlHelper.php | |
@@ -211,12 +211,12 @@ public static function encodePath($path) { | |
* TRUE or FALSE, where TRUE indicates an external path. | |
*/ | |
public static function isExternal($path) { | |
- $colonpos = strpos($path, ':'); | |
+ $colonpos = strpos((string) $path, ':'); | |
// Some browsers treat \ as / so normalize to forward slashes. | |
- $path = str_replace('\\', '/', $path); | |
+ $path = str_replace('\\', '/', (string) $path); | |
// If the path starts with 2 slashes then it is always considered an | |
// external URL without an explicit protocol part. | |
- return (strpos($path, '//') === 0) | |
+ return (strpos((string) $path, '//') === 0) | |
// Leading control characters may be ignored or mishandled by browsers, | |
// so assume such a path may lead to an external location. The \p{C} | |
// character class matches all UTF-8 control, unassigned, and private | |
@@ -226,7 +226,7 @@ public static function isExternal($path) { | |
// (/), hash (#) or question_mark (?) before the colon (:) occurrence - | |
// if any - as this would clearly mean it is not a URL. | |
|| ($colonpos !== FALSE | |
- && !preg_match('![/?#]!', substr($path, 0, $colonpos)) | |
+ && !preg_match('![/?#]!', substr((string) $path, 0, $colonpos)) | |
&& static::stripDangerousProtocols($path) == $path); | |
} | |
diff --git a/core/lib/Drupal/Core/Utility/Token.php b/core/lib/Drupal/Core/Utility/Token.php | |
index a250d5892b..75487fd8b5 100644 | |
--- a/core/lib/Drupal/Core/Utility/Token.php | |
+++ b/core/lib/Drupal/Core/Utility/Token.php | |
@@ -243,7 +243,7 @@ public function scan($text) { | |
: # : - separator | |
([^\[\]]+) # match $name not containing [ or ] | |
\] # ] - pattern end | |
- /x', $text, $matches); | |
+ /x', (string) $text, $matches); | |
$types = $matches[1]; | |
$tokens = $matches[2]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment