Skip to content

Commit

Permalink
bug #3495 added PHP 8.1 as experimental (oleg-andreyev)
Browse files Browse the repository at this point in the history
This PR was squashed before being merged into the 1.x branch.

Discussion
----------

added PHP 8.1 as experimental

fixes #3494

Commits
-------

bef89dc added PHP 8.1 as experimental
  • Loading branch information
fabpot committed Mar 22, 2021
2 parents ad02eb9 + bef89dc commit 47201dc
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

runs-on: 'ubuntu-latest'

continue-on-error: true
continue-on-error: ${{ matrix.experimental }}

strategy:
matrix:
Expand All @@ -24,6 +24,10 @@ jobs:
- '7.3'
- '7.4'
- '8.0'
composer-options: ['']
experimental: [false]
include:
- { php-version: '8.1', experimental: true, composer-options: '--ignore-platform-req=php' }

steps:
- name: "Checkout code"
Expand Down Expand Up @@ -51,7 +55,7 @@ jobs:
key: ${{ runner.os }}-${{ matrix.php-version }}-composer-${{ hashFiles('composer.json') }}
restore-keys: ${{ runner.os }}-${{ matrix.php-version }}-composer-

- run: composer install
- run: composer install ${{ matrix.composer-options }}

- name: "Install PHPUnit"
run: vendor/bin/simple-phpunit install
Expand Down
2 changes: 1 addition & 1 deletion src/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function __construct(LoaderInterface $loader = null, $options = [])
], $options);

$this->debug = (bool) $options['debug'];
$this->charset = strtoupper($options['charset']);
$this->charset = null === $options['charset'] ? null : strtoupper($options['charset']);
$this->baseTemplateClass = $options['base_template_class'];
$this->autoReload = null === $options['auto_reload'] ? $this->debug : (bool) $options['auto_reload'];
$this->strictVariables = (bool) $options['strict_variables'];
Expand Down
2 changes: 1 addition & 1 deletion src/Error/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ protected function guessTemplateInfo()
foreach ($backtrace as $trace) {
if (isset($trace['object']) && $trace['object'] instanceof Template && 'Twig_Template' !== \get_class($trace['object'])) {
$currentClass = \get_class($trace['object']);
$isEmbedContainer = 0 === strpos($templateClass, $currentClass);
$isEmbedContainer = null === $templateClass ? false : 0 === strpos($templateClass, $currentClass);
if (null === $this->filename || ($this->filename == $trace['object']->getTemplateName() && !$isEmbedContainer)) {
$template = $trace['object'];
$templateClass = \get_class($trace['object']);
Expand Down
3 changes: 3 additions & 0 deletions src/Extension/CoreExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,9 @@ function twig_date_converter(Environment $env, $date = null, $timezone = null)
}

if (null === $date || 'now' === $date) {
if ($date === null) {
$date = 'now';
}
return new \DateTime($date, false !== $timezone ? $timezone : $env->getExtension('\Twig\Extension\CoreExtension')->getTimezone());
}

Expand Down
2 changes: 1 addition & 1 deletion src/Loader/FilesystemLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class FilesystemLoader implements LoaderInterface, ExistsLoaderInterface, Source
public function __construct($paths = [], $rootPath = null)
{
$this->rootPath = (null === $rootPath ? getcwd() : $rootPath).\DIRECTORY_SEPARATOR;
if (false !== $realPath = realpath($rootPath)) {
if ($rootPath !== null && false !== ($realPath = realpath($rootPath))) {
$this->rootPath = $realPath.\DIRECTORY_SEPARATOR;
}

Expand Down

0 comments on commit 47201dc

Please sign in to comment.