mirror of
https://github.com/twigphp/Twig.git
synced 2026-08-31 04:27:00 +00:00
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
-------
4d98cce4e4 Avoid ord deprecation in PHP 8.5
This commit is contained in:
@@ -272,7 +272,7 @@ final class EscaperRuntime implements RuntimeExtensionInterface
|
||||
* @license https://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
$chr = $matches[0];
|
||||
$ord = \ord($chr);
|
||||
$ord = \ord($chr[0]);
|
||||
|
||||
/*
|
||||
* The following replaces characters undefined in HTML with the
|
||||
|
||||
Reference in New Issue
Block a user