Skip to content

Commit

Permalink
Merge pull request #12 from sroehrl/php81-adoption
Browse files Browse the repository at this point in the history
Add php8.1 to testing
  • Loading branch information
sroehrl authored Mar 11, 2022
2 parents ac73c3d + 435a1a5 commit bfd1c04
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 2,002 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ env:
- XDEBUG_MODE=coverage

language: php
dist: bionic
php:
- '7.4'
- '8.0'
- '8.1.0'

before_script:
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-dist
Expand Down
6 changes: 3 additions & 3 deletions Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ static function embrace($content, $array)
$saveOpening = preg_quote(TemplateFunctions::getDelimiters()[0]);
$saveClosing = preg_quote(TemplateFunctions::getDelimiters()[1]);
foreach ($flatArray as $flatKey => $value){
$value = is_null($value) ? '' : $value;
$flatKey = preg_replace('/[\/\.\\\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:\-]/', "\\\\$0",$flatKey);
// PATCHED: direct function injection is not allowed anymore
$content = preg_replace("/$saveOpening\s*$flatKey\s*$saveClosing/", $value, $content);
$content = TemplateFunctions::tryClosures($flatArray, $content, false);

Expand Down Expand Up @@ -134,11 +134,11 @@ static function nodeStringify(\DOMElement $domNode): string

/**
* @param $array
* @param bool $parentKey
* @param string|null $parentKey
*
* @return array
*/
static function flattenArray($array, $parentKey = false): array
static function flattenArray($array, string $parentKey = null): array
{
$answer = [];
foreach ($array as $key => $value) {
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "neoan3-apps/template",
"description": "neoan3 minimal template engine",
"version": "1.1.3",
"version": "1.2.0",
"license": "MIT",
"autoload": {
"psr-4": {
Expand Down
Loading

0 comments on commit bfd1c04

Please sign in to comment.