mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-15 11:56:50 +00:00
Merge branch '1.x' into 2.x
* 1.x: added PHP 8.1 as experimental
This commit is contained in:
@@ -15,7 +15,7 @@ jobs:
|
||||
|
||||
runs-on: 'ubuntu-latest'
|
||||
|
||||
continue-on-error: true
|
||||
continue-on-error: ${{ matrix.experimental }}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
@@ -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"
|
||||
@@ -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
|
||||
|
||||
+1
-1
@@ -623,7 +623,7 @@ class Environment
|
||||
*/
|
||||
public function setCharset($charset)
|
||||
{
|
||||
if ('UTF8' === $charset = strtoupper($charset)) {
|
||||
if ('UTF8' === $charset = null === $charset ? null : strtoupper($charset)) {
|
||||
// iconv on Windows requires "UTF-8" instead of "UTF8"
|
||||
$charset = 'UTF-8';
|
||||
}
|
||||
|
||||
+1
-1
@@ -200,7 +200,7 @@ class Error extends \Exception
|
||||
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->name || ($this->name == $trace['object']->getTemplateName() && !$isEmbedContainer)) {
|
||||
$template = $trace['object'];
|
||||
$templateClass = \get_class($trace['object']);
|
||||
|
||||
@@ -519,6 +519,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(CoreExtension::class)->getTimezone());
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class FilesystemLoader implements LoaderInterface, ExistsLoaderInterface, Source
|
||||
public function __construct($paths = [], string $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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user