Skip to content

Commit cf87925

Browse files
committed
bug #4724 Avoid ord deprecation notice in PHP 8.5 (iquito)
This PR was merged into the 3.x branch. Discussion ---------- Avoid ord deprecation notice in PHP 8.5 Change the one usage of `ord()` in Twig where a multibyte character can trigger the new deprecation in PHP 8.5, which is in the `html_attr` escape functionality in EscaperRuntime, currently leading to: ``` ord(): Providing a string that is not one byte long is deprecated. Use ord($str[0]) instead" ``` This small change fixes it. There are no other usages of `ord()` in Twig which lead to this deprecation notice. Commits ------- 4d98cce Avoid ord deprecation in PHP 8.5
2 parents 537b4f2 + 4d98cce commit cf87925

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Runtime/EscaperRuntime.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ public function escape($string, string $strategy = 'html', ?string $charset = nu
272272
* @license https://framework.zend.com/license/new-bsd New BSD License
273273
*/
274274
$chr = $matches[0];
275-
$ord = \ord($chr);
275+
$ord = \ord($chr[0]);
276276

277277
/*
278278
* The following replaces characters undefined in HTML with the

0 commit comments

Comments
 (0)