Skip to content

Commit

Permalink
Fixed PHP8.1 deprecation errors in strip_tags (#803)
Browse files Browse the repository at this point in the history
  • Loading branch information
wisskid authored Sep 22, 2022
1 parent 9eea30e commit 612bd3f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Output buffer is now cleaned for internal PHP errors as well, not just for Exceptions [#514](https://github.com/smarty-php/smarty/issues/514)
- Fixed recursion and out of memory errors when caching in complicated template set-ups using inheritance and includes [#801](https://github.com/smarty-php/smarty/pull/801)
- Fixed PHP8.1 deprecation errors in strip_tags
- Fix Variable Usage in Exception message when unable to load subtemplate [#808](https://github.com/smarty-php/smarty/pull/808)
- Fixed PHP8.1 deprecation notices for strftime [#672](https://github.com/smarty-php/smarty/issues/672)
- Fixed PHP8.1 deprecation errors passing null to parameter in trim [#807](https://github.com/smarty-php/smarty/pull/807)
Expand Down
4 changes: 2 additions & 2 deletions libs/plugins/modifiercompiler.strip_tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
function smarty_modifiercompiler_strip_tags($params)
{
if (!isset($params[ 1 ]) || $params[ 1 ] === true || trim($params[ 1 ], '"') === 'true') {
return "preg_replace('!<[^>]*?>!', ' ', {$params[0]})";
return "preg_replace('!<[^>]*?>!', ' ', {$params[0]} ?: '')";
} else {
return 'strip_tags(' . $params[ 0 ] . ')';
return 'strip_tags((string) ' . $params[ 0 ] . ')';
}
}

0 comments on commit 612bd3f

Please sign in to comment.