Skip to content

Commit

Permalink
Fixed PHP8.1 deprecation errors in upper modifier #788
Browse files Browse the repository at this point in the history
  • Loading branch information
wisskid committed Sep 10, 2022
1 parent 1bc7c72 commit f8f97b4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed
- Fixed PHP8.1 deprecation errors in modifiers (upper, explode, number_format and replace) [#755](https://github.com/smarty-php/smarty/pull/755) and [#788](https://github.com/smarty-php/smarty/pull/788)

## [4.2.0] - 2022-08-01

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions libs/plugins/modifiercompiler.upper.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
function smarty_modifiercompiler_upper($params)
{
if (Smarty::$_MBSTRING) {
return 'mb_strtoupper(' . $params[ 0 ] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')';
return 'mb_strtoupper(' . $params[ 0 ] . ' ?? \'\', \'' . addslashes(Smarty::$_CHARSET) . '\')';
}
// no MBString fallback
return 'strtoupper(' . $params[ 0 ] . ')';
return 'strtoupper(' . $params[ 0 ] . ' ?? \'\')';
}

0 comments on commit f8f97b4

Please sign in to comment.