Update Twig to 3.4.3

This commit is contained in:
FreddleSpl0it 2022-09-30 11:03:05 +02:00
parent 8e0b1d8aee
commit 27e7407407
27 changed files with 222 additions and 217 deletions

View File

@ -128,10 +128,10 @@ table.footable > tbody > tr.footable-empty > th {
content: "\f130"; content: "\f130";
} }
.fooicon-plus:before { .fooicon-plus:before {
content: "\f4fc"; content: "\f4fd";
} }
.fooicon-minus:before { .fooicon-minus:before {
content: "\f2e8"; content: "\f2e9";
} }
.fooicon-search:before { .fooicon-search:before {
content: "\f52a"; content: "\f52a";

View File

@ -1604,16 +1604,16 @@
}, },
{ {
"name": "twig/twig", "name": "twig/twig",
"version": "v3.3.8", "version": "v3.4.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/twigphp/Twig.git", "url": "https://github.com/twigphp/Twig.git",
"reference": "972d8604a92b7054828b539f2febb0211dd5945c" "reference": "c38fd6b0b7f370c198db91ffd02e23b517426b58"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/972d8604a92b7054828b539f2febb0211dd5945c", "url": "https://api.github.com/repos/twigphp/Twig/zipball/c38fd6b0b7f370c198db91ffd02e23b517426b58",
"reference": "972d8604a92b7054828b539f2febb0211dd5945c", "reference": "c38fd6b0b7f370c198db91ffd02e23b517426b58",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1628,7 +1628,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.3-dev" "dev-master": "3.4-dev"
} }
}, },
"autoload": { "autoload": {
@ -1664,7 +1664,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/twigphp/Twig/issues", "issues": "https://github.com/twigphp/Twig/issues",
"source": "https://github.com/twigphp/Twig/tree/v3.3.8" "source": "https://github.com/twigphp/Twig/tree/v3.4.3"
}, },
"funding": [ "funding": [
{ {
@ -1676,7 +1676,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-02-04T06:59:48+00:00" "time": "2022-09-28T08:42:51+00:00"
}, },
{ {
"name": "yubico/u2flib-server", "name": "yubico/u2flib-server",
@ -1728,5 +1728,5 @@
"prefer-lowest": false, "prefer-lowest": false,
"platform": [], "platform": [],
"platform-dev": [], "platform-dev": [],
"plugin-api-version": "2.2.0" "plugin-api-version": "2.3.0"
} }

View File

@ -2,6 +2,11 @@
// autoload.php @generated by Composer // autoload.php @generated by Composer
if (PHP_VERSION_ID < 50600) {
echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
exit(1);
}
require_once __DIR__ . '/composer/autoload_real.php'; require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit873464e4bd965a3168f133248b1b218b::getLoader(); return ComposerAutoloaderInit873464e4bd965a3168f133248b1b218b::getLoader();

View File

@ -21,12 +21,14 @@ use Composer\Semver\VersionParser;
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions * See also https://getcomposer.org/doc/07-runtime.md#installed-versions
* *
* To require its presence, you can require `composer-runtime-api ^2.0` * To require its presence, you can require `composer-runtime-api ^2.0`
*
* @final
*/ */
class InstalledVersions class InstalledVersions
{ {
/** /**
* @var mixed[]|null * @var mixed[]|null
* @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
*/ */
private static $installed; private static $installed;
@ -37,7 +39,7 @@ class InstalledVersions
/** /**
* @var array[] * @var array[]
* @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}> * @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/ */
private static $installedByVendor = array(); private static $installedByVendor = array();
@ -241,7 +243,7 @@ class InstalledVersions
/** /**
* @return array * @return array
* @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string} * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
*/ */
public static function getRootPackage() public static function getRootPackage()
{ {
@ -255,7 +257,7 @@ class InstalledVersions
* *
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
* @return array[] * @return array[]
* @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
*/ */
public static function getRawData() public static function getRawData()
{ {
@ -278,7 +280,7 @@ class InstalledVersions
* Returns the raw data of all installed.php which are currently loaded for custom implementations * Returns the raw data of all installed.php which are currently loaded for custom implementations
* *
* @return array[] * @return array[]
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}> * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/ */
public static function getAllRawData() public static function getAllRawData()
{ {
@ -301,7 +303,7 @@ class InstalledVersions
* @param array[] $data A vendor/composer/installed.php data set * @param array[] $data A vendor/composer/installed.php data set
* @return void * @return void
* *
* @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
*/ */
public static function reload($data) public static function reload($data)
{ {
@ -311,7 +313,7 @@ class InstalledVersions
/** /**
* @return array[] * @return array[]
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}> * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/ */
private static function getInstalled() private static function getInstalled()
{ {

View File

@ -2,7 +2,7 @@
// autoload_classmap.php @generated by Composer // autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__)); $vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir); $baseDir = dirname($vendorDir);
return array( return array(

View File

@ -2,15 +2,15 @@
// autoload_files.php @generated by Composer // autoload_files.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__)); $vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir); $baseDir = dirname($vendorDir);
return array( return array(
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
'320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php', 'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
'a1105708a18b76903365ca1c4aa61b02' => $vendorDir . '/symfony/translation/Resources/functions.php', 'a1105708a18b76903365ca1c4aa61b02' => $vendorDir . '/symfony/translation/Resources/functions.php',
'667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php', '667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php',
'320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
'fe62ba7e10580d903cc46d808b5961a4' => $vendorDir . '/tightenco/collect/src/Collect/Support/helpers.php', 'fe62ba7e10580d903cc46d808b5961a4' => $vendorDir . '/tightenco/collect/src/Collect/Support/helpers.php',
'caf31cc6ec7cf2241cb6f12c226c3846' => $vendorDir . '/tightenco/collect/src/Collect/Support/alias.php', 'caf31cc6ec7cf2241cb6f12c226c3846' => $vendorDir . '/tightenco/collect/src/Collect/Support/alias.php',
'04c6c5c2f7095ccf6c481d3e53e1776f' => $vendorDir . '/mustangostang/spyc/Spyc.php', '04c6c5c2f7095ccf6c481d3e53e1776f' => $vendorDir . '/mustangostang/spyc/Spyc.php',

View File

@ -2,7 +2,7 @@
// autoload_namespaces.php @generated by Composer // autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__)); $vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir); $baseDir = dirname($vendorDir);
return array( return array(

View File

@ -2,7 +2,7 @@
// autoload_psr4.php @generated by Composer // autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__)); $vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir); $baseDir = dirname($vendorDir);
return array( return array(

View File

@ -25,38 +25,15 @@ class ComposerAutoloaderInit873464e4bd965a3168f133248b1b218b
require __DIR__ . '/platform_check.php'; require __DIR__ . '/platform_check.php';
spl_autoload_register(array('ComposerAutoloaderInit873464e4bd965a3168f133248b1b218b', 'loadClassLoader'), true, true); spl_autoload_register(array('ComposerAutoloaderInit873464e4bd965a3168f133248b1b218b', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit873464e4bd965a3168f133248b1b218b', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInit873464e4bd965a3168f133248b1b218b', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); require __DIR__ . '/autoload_static.php';
if ($useStaticLoader) { call_user_func(\Composer\Autoload\ComposerStaticInit873464e4bd965a3168f133248b1b218b::getInitializer($loader));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit873464e4bd965a3168f133248b1b218b::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}
$loader->register(true); $loader->register(true);
if ($useStaticLoader) { $includeFiles = \Composer\Autoload\ComposerStaticInit873464e4bd965a3168f133248b1b218b::$files;
$includeFiles = Composer\Autoload\ComposerStaticInit873464e4bd965a3168f133248b1b218b::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) { foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire873464e4bd965a3168f133248b1b218b($fileIdentifier, $file); composerRequire873464e4bd965a3168f133248b1b218b($fileIdentifier, $file);
} }

View File

@ -8,10 +8,10 @@ class ComposerStaticInit873464e4bd965a3168f133248b1b218b
{ {
public static $files = array ( public static $files = array (
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
'a1105708a18b76903365ca1c4aa61b02' => __DIR__ . '/..' . '/symfony/translation/Resources/functions.php', 'a1105708a18b76903365ca1c4aa61b02' => __DIR__ . '/..' . '/symfony/translation/Resources/functions.php',
'667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php', '667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php',
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
'fe62ba7e10580d903cc46d808b5961a4' => __DIR__ . '/..' . '/tightenco/collect/src/Collect/Support/helpers.php', 'fe62ba7e10580d903cc46d808b5961a4' => __DIR__ . '/..' . '/tightenco/collect/src/Collect/Support/helpers.php',
'caf31cc6ec7cf2241cb6f12c226c3846' => __DIR__ . '/..' . '/tightenco/collect/src/Collect/Support/alias.php', 'caf31cc6ec7cf2241cb6f12c226c3846' => __DIR__ . '/..' . '/tightenco/collect/src/Collect/Support/alias.php',
'04c6c5c2f7095ccf6c481d3e53e1776f' => __DIR__ . '/..' . '/mustangostang/spyc/Spyc.php', '04c6c5c2f7095ccf6c481d3e53e1776f' => __DIR__ . '/..' . '/mustangostang/spyc/Spyc.php',

View File

@ -1654,17 +1654,17 @@
}, },
{ {
"name": "twig/twig", "name": "twig/twig",
"version": "v3.3.8", "version": "v3.4.3",
"version_normalized": "3.3.8.0", "version_normalized": "3.4.3.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/twigphp/Twig.git", "url": "https://github.com/twigphp/Twig.git",
"reference": "972d8604a92b7054828b539f2febb0211dd5945c" "reference": "c38fd6b0b7f370c198db91ffd02e23b517426b58"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/972d8604a92b7054828b539f2febb0211dd5945c", "url": "https://api.github.com/repos/twigphp/Twig/zipball/c38fd6b0b7f370c198db91ffd02e23b517426b58",
"reference": "972d8604a92b7054828b539f2febb0211dd5945c", "reference": "c38fd6b0b7f370c198db91ffd02e23b517426b58",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1676,11 +1676,11 @@
"psr/container": "^1.0", "psr/container": "^1.0",
"symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0" "symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0"
}, },
"time": "2022-02-04T06:59:48+00:00", "time": "2022-09-28T08:42:51+00:00",
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.3-dev" "dev-master": "3.4-dev"
} }
}, },
"installation-source": "dist", "installation-source": "dist",
@ -1717,7 +1717,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/twigphp/Twig/issues", "issues": "https://github.com/twigphp/Twig/issues",
"source": "https://github.com/twigphp/Twig/tree/v3.3.8" "source": "https://github.com/twigphp/Twig/tree/v3.4.3"
}, },
"funding": [ "funding": [
{ {

View File

@ -1,49 +1,49 @@
<?php return array( <?php return array(
'root' => array( 'root' => array(
'pretty_version' => '1.0.0+no-version-set', 'name' => '__root__',
'version' => '1.0.0.0', 'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '8e0b1d8aee4af02311692cb031695cc2ac3850fd',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
'reference' => NULL,
'name' => '__root__',
'dev' => true, 'dev' => true,
), ),
'versions' => array( 'versions' => array(
'__root__' => array( '__root__' => array(
'pretty_version' => '1.0.0+no-version-set', 'pretty_version' => 'dev-master',
'version' => '1.0.0.0', 'version' => 'dev-master',
'reference' => '8e0b1d8aee4af02311692cb031695cc2ac3850fd',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
'reference' => NULL,
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'bshaffer/oauth2-server-php' => array( 'bshaffer/oauth2-server-php' => array(
'pretty_version' => 'v1.11.1', 'pretty_version' => 'v1.11.1',
'version' => '1.11.1.0', 'version' => '1.11.1.0',
'reference' => '5a0c8000d4763b276919e2106f54eddda6bc50fa',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../bshaffer/oauth2-server-php', 'install_path' => __DIR__ . '/../bshaffer/oauth2-server-php',
'aliases' => array(), 'aliases' => array(),
'reference' => '5a0c8000d4763b276919e2106f54eddda6bc50fa',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'ddeboer/imap' => array( 'ddeboer/imap' => array(
'pretty_version' => '1.13.1', 'pretty_version' => '1.13.1',
'version' => '1.13.1.0', 'version' => '1.13.1.0',
'reference' => '8b772d04b1deadb5df13782fb78c4b648f77496e',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../ddeboer/imap', 'install_path' => __DIR__ . '/../ddeboer/imap',
'aliases' => array(), 'aliases' => array(),
'reference' => '8b772d04b1deadb5df13782fb78c4b648f77496e',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'directorytree/ldaprecord' => array( 'directorytree/ldaprecord' => array(
'pretty_version' => 'v2.10.1', 'pretty_version' => 'v2.10.1',
'version' => '2.10.1.0', 'version' => '2.10.1.0',
'reference' => 'bf512d9af7a7b0e2ed7a666ab29cefdd027bee88',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../directorytree/ldaprecord', 'install_path' => __DIR__ . '/../directorytree/ldaprecord',
'aliases' => array(), 'aliases' => array(),
'reference' => 'bf512d9af7a7b0e2ed7a666ab29cefdd027bee88',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'exorus/php-mime-mail-parser' => array( 'exorus/php-mime-mail-parser' => array(
@ -55,28 +55,28 @@
'illuminate/contracts' => array( 'illuminate/contracts' => array(
'pretty_version' => 'v9.3.0', 'pretty_version' => 'v9.3.0',
'version' => '9.3.0.0', 'version' => '9.3.0.0',
'reference' => 'bf4b3c254c49d28157645d01e4883b5951b1e1d0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../illuminate/contracts', 'install_path' => __DIR__ . '/../illuminate/contracts',
'aliases' => array(), 'aliases' => array(),
'reference' => 'bf4b3c254c49d28157645d01e4883b5951b1e1d0',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'matthiasmullie/minify' => array( 'matthiasmullie/minify' => array(
'pretty_version' => '1.3.66', 'pretty_version' => '1.3.66',
'version' => '1.3.66.0', 'version' => '1.3.66.0',
'reference' => '45fd3b0f1dfa2c965857c6d4a470bea52adc31a6',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../matthiasmullie/minify', 'install_path' => __DIR__ . '/../matthiasmullie/minify',
'aliases' => array(), 'aliases' => array(),
'reference' => '45fd3b0f1dfa2c965857c6d4a470bea52adc31a6',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'matthiasmullie/path-converter' => array( 'matthiasmullie/path-converter' => array(
'pretty_version' => '1.1.3', 'pretty_version' => '1.1.3',
'version' => '1.1.3.0', 'version' => '1.1.3.0',
'reference' => 'e7d13b2c7e2f2268e1424aaed02085518afa02d9',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../matthiasmullie/path-converter', 'install_path' => __DIR__ . '/../matthiasmullie/path-converter',
'aliases' => array(), 'aliases' => array(),
'reference' => 'e7d13b2c7e2f2268e1424aaed02085518afa02d9',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'messaged/php-mime-mail-parser' => array( 'messaged/php-mime-mail-parser' => array(
@ -88,136 +88,136 @@
'mustangostang/spyc' => array( 'mustangostang/spyc' => array(
'pretty_version' => '0.6.3', 'pretty_version' => '0.6.3',
'version' => '0.6.3.0', 'version' => '0.6.3.0',
'reference' => '4627c838b16550b666d15aeae1e5289dd5b77da0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../mustangostang/spyc', 'install_path' => __DIR__ . '/../mustangostang/spyc',
'aliases' => array(), 'aliases' => array(),
'reference' => '4627c838b16550b666d15aeae1e5289dd5b77da0',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'nesbot/carbon' => array( 'nesbot/carbon' => array(
'pretty_version' => '2.57.0', 'pretty_version' => '2.57.0',
'version' => '2.57.0.0', 'version' => '2.57.0.0',
'reference' => '4a54375c21eea4811dbd1149fe6b246517554e78',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../nesbot/carbon', 'install_path' => __DIR__ . '/../nesbot/carbon',
'aliases' => array(), 'aliases' => array(),
'reference' => '4a54375c21eea4811dbd1149fe6b246517554e78',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'paragonie/random_compat' => array( 'paragonie/random_compat' => array(
'pretty_version' => 'v9.99.100', 'pretty_version' => 'v9.99.100',
'version' => '9.99.100.0', 'version' => '9.99.100.0',
'reference' => '996434e5492cb4c3edcb9168db6fbb1359ef965a',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../paragonie/random_compat', 'install_path' => __DIR__ . '/../paragonie/random_compat',
'aliases' => array(), 'aliases' => array(),
'reference' => '996434e5492cb4c3edcb9168db6fbb1359ef965a',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'php-mime-mail-parser/php-mime-mail-parser' => array( 'php-mime-mail-parser/php-mime-mail-parser' => array(
'pretty_version' => '7.0.0', 'pretty_version' => '7.0.0',
'version' => '7.0.0.0', 'version' => '7.0.0.0',
'reference' => '9d09a017f3f103fec8456211a4a538b80e0eca0d',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../php-mime-mail-parser/php-mime-mail-parser', 'install_path' => __DIR__ . '/../php-mime-mail-parser/php-mime-mail-parser',
'aliases' => array(), 'aliases' => array(),
'reference' => '9d09a017f3f103fec8456211a4a538b80e0eca0d',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'phpmailer/phpmailer' => array( 'phpmailer/phpmailer' => array(
'pretty_version' => 'v6.6.0', 'pretty_version' => 'v6.6.0',
'version' => '6.6.0.0', 'version' => '6.6.0.0',
'reference' => 'e43bac82edc26ca04b36143a48bde1c051cfd5b1',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../phpmailer/phpmailer', 'install_path' => __DIR__ . '/../phpmailer/phpmailer',
'aliases' => array(), 'aliases' => array(),
'reference' => 'e43bac82edc26ca04b36143a48bde1c051cfd5b1',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'psr/container' => array( 'psr/container' => array(
'pretty_version' => '2.0.2', 'pretty_version' => '2.0.2',
'version' => '2.0.2.0', 'version' => '2.0.2.0',
'reference' => 'c71ecc56dfe541dbd90c5360474fbc405f8d5963',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../psr/container', 'install_path' => __DIR__ . '/../psr/container',
'aliases' => array(), 'aliases' => array(),
'reference' => 'c71ecc56dfe541dbd90c5360474fbc405f8d5963',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'psr/log' => array( 'psr/log' => array(
'pretty_version' => '3.0.0', 'pretty_version' => '3.0.0',
'version' => '3.0.0.0', 'version' => '3.0.0.0',
'reference' => 'fe5ea303b0887d5caefd3d431c3e61ad47037001',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../psr/log', 'install_path' => __DIR__ . '/../psr/log',
'aliases' => array(), 'aliases' => array(),
'reference' => 'fe5ea303b0887d5caefd3d431c3e61ad47037001',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'psr/simple-cache' => array( 'psr/simple-cache' => array(
'pretty_version' => '2.0.0', 'pretty_version' => '2.0.0',
'version' => '2.0.0.0', 'version' => '2.0.0.0',
'reference' => '8707bf3cea6f710bf6ef05491234e3ab06f6432a',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../psr/simple-cache', 'install_path' => __DIR__ . '/../psr/simple-cache',
'aliases' => array(), 'aliases' => array(),
'reference' => '8707bf3cea6f710bf6ef05491234e3ab06f6432a',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'robthree/twofactorauth' => array( 'robthree/twofactorauth' => array(
'pretty_version' => '1.8.1', 'pretty_version' => '1.8.1',
'version' => '1.8.1.0', 'version' => '1.8.1.0',
'reference' => '5afcb45282f1c75562a48d479ecd1732c9bdb11b',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../robthree/twofactorauth', 'install_path' => __DIR__ . '/../robthree/twofactorauth',
'aliases' => array(), 'aliases' => array(),
'reference' => '5afcb45282f1c75562a48d479ecd1732c9bdb11b',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'soundasleep/html2text' => array( 'soundasleep/html2text' => array(
'pretty_version' => '0.5.0', 'pretty_version' => '0.5.0',
'version' => '0.5.0.0', 'version' => '0.5.0.0',
'reference' => 'cdb89f6ffa2c4cc78f8ed9ea6ee0594a9133ccad',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../soundasleep/html2text', 'install_path' => __DIR__ . '/../soundasleep/html2text',
'aliases' => array(), 'aliases' => array(),
'reference' => 'cdb89f6ffa2c4cc78f8ed9ea6ee0594a9133ccad',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/polyfill-ctype' => array( 'symfony/polyfill-ctype' => array(
'pretty_version' => 'v1.24.0', 'pretty_version' => 'v1.24.0',
'version' => '1.24.0.0', 'version' => '1.24.0.0',
'reference' => '30885182c981ab175d4d034db0f6f469898070ab',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-ctype', 'install_path' => __DIR__ . '/../symfony/polyfill-ctype',
'aliases' => array(), 'aliases' => array(),
'reference' => '30885182c981ab175d4d034db0f6f469898070ab',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/polyfill-mbstring' => array( 'symfony/polyfill-mbstring' => array(
'pretty_version' => 'v1.24.0', 'pretty_version' => 'v1.24.0',
'version' => '1.24.0.0', 'version' => '1.24.0.0',
'reference' => '0abb51d2f102e00a4eefcf46ba7fec406d245825',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-mbstring', 'install_path' => __DIR__ . '/../symfony/polyfill-mbstring',
'aliases' => array(), 'aliases' => array(),
'reference' => '0abb51d2f102e00a4eefcf46ba7fec406d245825',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/polyfill-php80' => array( 'symfony/polyfill-php80' => array(
'pretty_version' => 'v1.24.0', 'pretty_version' => 'v1.24.0',
'version' => '1.24.0.0', 'version' => '1.24.0.0',
'reference' => '57b712b08eddb97c762a8caa32c84e037892d2e9',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-php80', 'install_path' => __DIR__ . '/../symfony/polyfill-php80',
'aliases' => array(), 'aliases' => array(),
'reference' => '57b712b08eddb97c762a8caa32c84e037892d2e9',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/translation' => array( 'symfony/translation' => array(
'pretty_version' => 'v6.0.5', 'pretty_version' => 'v6.0.5',
'version' => '6.0.5.0', 'version' => '6.0.5.0',
'reference' => 'e69501c71107cc3146b32aaa45f4edd0c3427875',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/translation', 'install_path' => __DIR__ . '/../symfony/translation',
'aliases' => array(), 'aliases' => array(),
'reference' => 'e69501c71107cc3146b32aaa45f4edd0c3427875',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/translation-contracts' => array( 'symfony/translation-contracts' => array(
'pretty_version' => 'v3.0.0', 'pretty_version' => 'v3.0.0',
'version' => '3.0.0.0', 'version' => '3.0.0.0',
'reference' => '1b6ea5a7442af5a12dba3dbd6d71034b5b234e77',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/translation-contracts', 'install_path' => __DIR__ . '/../symfony/translation-contracts',
'aliases' => array(), 'aliases' => array(),
'reference' => '1b6ea5a7442af5a12dba3dbd6d71034b5b234e77',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/translation-implementation' => array( 'symfony/translation-implementation' => array(
@ -229,37 +229,37 @@
'symfony/var-dumper' => array( 'symfony/var-dumper' => array(
'pretty_version' => 'v6.0.5', 'pretty_version' => 'v6.0.5',
'version' => '6.0.5.0', 'version' => '6.0.5.0',
'reference' => '60d6a756d5f485df5e6e40b337334848f79f61ce',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/var-dumper', 'install_path' => __DIR__ . '/../symfony/var-dumper',
'aliases' => array(), 'aliases' => array(),
'reference' => '60d6a756d5f485df5e6e40b337334848f79f61ce',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'tightenco/collect' => array( 'tightenco/collect' => array(
'pretty_version' => 'v8.83.2', 'pretty_version' => 'v8.83.2',
'version' => '8.83.2.0', 'version' => '8.83.2.0',
'reference' => 'd9c66d586ec2d216d8a31283d73f8df1400cc722',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../tightenco/collect', 'install_path' => __DIR__ . '/../tightenco/collect',
'aliases' => array(), 'aliases' => array(),
'reference' => 'd9c66d586ec2d216d8a31283d73f8df1400cc722',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'twig/twig' => array( 'twig/twig' => array(
'pretty_version' => 'v3.3.8', 'pretty_version' => 'v3.4.3',
'version' => '3.3.8.0', 'version' => '3.4.3.0',
'reference' => 'c38fd6b0b7f370c198db91ffd02e23b517426b58',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../twig/twig', 'install_path' => __DIR__ . '/../twig/twig',
'aliases' => array(), 'aliases' => array(),
'reference' => '972d8604a92b7054828b539f2febb0211dd5945c',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'yubico/u2flib-server' => array( 'yubico/u2flib-server' => array(
'pretty_version' => '1.0.2', 'pretty_version' => '1.0.2',
'version' => '1.0.2.0', 'version' => '1.0.2.0',
'reference' => '55d813acf68212ad2cadecde07551600d6971939',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../yubico/u2flib-server', 'install_path' => __DIR__ . '/../yubico/u2flib-server',
'aliases' => array(), 'aliases' => array(),
'reference' => '55d813acf68212ad2cadecde07551600d6971939',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
), ),

View File

@ -1,4 +1,4 @@
/doc/** export-ignore /doc/ export-ignore
/extra/** export-ignore /extra/ export-ignore
/tests export-ignore /tests/ export-ignore
/phpunit.xml.dist export-ignore /phpunit.xml.dist export-ignore

View File

@ -9,6 +9,9 @@ on:
env: env:
SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE: 1 SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE: 1
permissions:
contents: read
jobs: jobs:
tests: tests:
name: "PHP ${{ matrix.php-version }}" name: "PHP ${{ matrix.php-version }}"
@ -25,36 +28,23 @@ jobs:
- '7.4' - '7.4'
- '8.0' - '8.0'
- '8.1' - '8.1'
composer-options: ['']
experimental: [false] experimental: [false]
steps: steps:
- name: "Checkout code" - name: "Checkout code"
uses: actions/checkout@v2.3.3 uses: actions/checkout@v2
- name: "Install PHP with extensions" - name: "Install PHP with extensions"
uses: shivammathur/setup-php@2.7.0 uses: shivammathur/setup-php@v2
with: with:
coverage: "none" coverage: "none"
php-version: ${{ matrix.php-version }} php-version: ${{ matrix.php-version }}
ini-values: memory_limit=-1 ini-values: memory_limit=-1
tools: composer:v2
- name: "Add PHPUnit matcher" - name: "Add PHPUnit matcher"
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: "Set composer cache directory" - run: composer install
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: "Cache composer"
uses: actions/cache@v2.1.2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.php-version }}-composer-${{ hashFiles('composer.json') }}
restore-keys: ${{ runner.os }}-${{ matrix.php-version }}-composer-
- run: composer install ${{ matrix.composer-options }}
- name: "Install PHPUnit" - name: "Install PHPUnit"
run: vendor/bin/simple-phpunit install run: vendor/bin/simple-phpunit install
@ -92,35 +82,22 @@ jobs:
- 'extra/markdown-extra' - 'extra/markdown-extra'
- 'extra/string-extra' - 'extra/string-extra'
- 'extra/twig-extra-bundle' - 'extra/twig-extra-bundle'
composer-options: ['']
experimental: [false] experimental: [false]
steps: steps:
- name: "Checkout code" - name: "Checkout code"
uses: actions/checkout@v2.3.3 uses: actions/checkout@v2
- name: "Install PHP with extensions" - name: "Install PHP with extensions"
uses: shivammathur/setup-php@2.7.0 uses: shivammathur/setup-php@v2
with: with:
coverage: "none" coverage: "none"
php-version: ${{ matrix.php-version }} php-version: ${{ matrix.php-version }}
ini-values: memory_limit=-1 ini-values: memory_limit=-1
tools: composer:v2
- name: "Add PHPUnit matcher" - name: "Add PHPUnit matcher"
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: "Set composer cache directory"
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: "Cache composer"
uses: actions/cache@v2.1.2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.php-version }}-${{ matrix.extension }}-${{ hashFiles('composer.json') }}
restore-keys: ${{ runner.os }}-${{ matrix.php-version }}-${{ matrix.extension }}-
- run: composer install - run: composer install
- name: "Install PHPUnit" - name: "Install PHPUnit"
@ -129,10 +106,6 @@ jobs:
- name: "PHPUnit version" - name: "PHPUnit version"
run: vendor/bin/simple-phpunit --version run: vendor/bin/simple-phpunit --version
- if: matrix.extension == 'extra/markdown-extra' && matrix.php-version == '8.0'
working-directory: ${{ matrix.extension}}
run: composer config platform.php 7.4.99
- name: "Composer install" - name: "Composer install"
working-directory: ${{ matrix.extension}} working-directory: ${{ matrix.extension}}
run: composer install run: composer install
@ -140,6 +113,7 @@ jobs:
- name: "Run tests" - name: "Run tests"
working-directory: ${{ matrix.extension}} working-directory: ${{ matrix.extension}}
run: ../../vendor/bin/simple-phpunit run: ../../vendor/bin/simple-phpunit
# #
# Drupal does not support Twig 3 now! # Drupal does not support Twig 3 now!
# #
@ -160,10 +134,10 @@ jobs:
# #
# steps: # steps:
# - name: "Checkout code" # - name: "Checkout code"
# uses: actions/checkout@v2.3.3 # uses: actions/checkout@v2
# #
# - name: "Install PHP with extensions" # - name: "Install PHP with extensions"
# uses: shivammathur/setup-php@2.7.0 # uses: shivammathur/setup-php@2
# with: # with:
# coverage: "none" # coverage: "none"
# extensions: "gd, pdo_sqlite" # extensions: "gd, pdo_sqlite"

View File

@ -4,8 +4,12 @@ on:
pull_request: pull_request:
push: push:
branches: branches:
- '2.x'
- '3.x' - '3.x'
permissions:
contents: read
jobs: jobs:
build: build:
name: "Build" name: "Build"
@ -16,32 +20,32 @@ jobs:
- name: "Checkout code" - name: "Checkout code"
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: "Set up Python 3.7" - name: "Set-up PHP"
uses: actions/setup-python@v1 uses: shivammathur/setup-php@v2
with: with:
python-version: '3.7' # Semantic version range syntax or exact version of a Python version php-version: 8.1
coverage: none
tools: "composer:v2"
- name: "Display Python version" - name: Get composer cache directory
run: python -c "import sys; print(sys.version)" id: composercache
working-directory: doc/_build
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: "Install Sphinx dependencies" - name: Cache dependencies
run: sudo apt-get install python-dev build-essential
- name: "Cache pip"
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: ~/.cache/pip path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('_build/.requirements.txt') }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: | restore-keys: ${{ runner.os }}-composer-
${{ runner.os }}-pip-
- name: "Install Sphinx + requirements via pip" - name: "Install dependencies"
working-directory: "doc" working-directory: doc/_build
run: pip install -r _build/.requirements.txt run: composer install --prefer-dist --no-progress
- name: "Build documentation" - name: "Build the docs"
working-directory: "doc" working-directory: doc/_build
run: make -C _build SPHINXOPTS="-nqW -j auto" html run: php build.php --disable-cache
doctor-rst: doctor-rst:
name: "DOCtor-RST" name: "DOCtor-RST"

View File

@ -1,3 +1,5 @@
/doc/_build/vendor
/doc/_build/output
/composer.lock /composer.lock
/phpunit.xml /phpunit.xml
/vendor /vendor

View File

@ -1,6 +1,36 @@
# 3.4.3 (2022-09-28)
* Fix a security issue on filesystem loader (possibility to load a template outside a configured directory)
# 3.4.2 (2022-08-12)
* Allow inherited magic method to still run with calling class
* Fix CallExpression::reflectCallable() throwing TypeError
* Fix typo in naming (currency_code)
# 3.4.1 (2022-05-17)
* Fix optimizing non-public named closures
# 3.4.0 (2022-05-22)
* Add support for named closures
# 3.3.10 (2022-04-06)
* Enable bytecode invalidation when auto_reload is enabled
# 3.3.9 (2022-03-25)
* Fix custom escapers when using multiple Twig environments
* Add support for "constant('class', object)"
* Do not reuse internally generated variable names during parsing
# 3.3.8 (2022-02-04) # 3.3.8 (2022-02-04)
* Fix a security issue when in a sandbox: the `sort` filter must require a Closure for the `arrow` parameter * Fix a security issue when in a sandbox: the `sort` filter must require a Closure for the `arrow` parameter
* Fix deprecation notice on `round`
* Fix call to deprecated `convertToHtml` method
# 3.3.7 (2022-01-03) # 3.3.7 (2022-01-03)

View File

@ -44,7 +44,7 @@
}, },
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.3-dev" "dev-master": "3.4-dev"
} }
} }
} }

View File

@ -38,11 +38,11 @@ use Twig\TokenParser\TokenParserInterface;
*/ */
class Environment class Environment
{ {
public const VERSION = '3.3.8'; public const VERSION = '3.4.3';
public const VERSION_ID = 30308; public const VERSION_ID = 30403;
public const MAJOR_VERSION = 3; public const MAJOR_VERSION = 3;
public const MINOR_VERSION = 3; public const MINOR_VERSION = 4;
public const RELEASE_VERSION = 8; public const RELEASE_VERSION = 3;
public const EXTRA_VERSION = ''; public const EXTRA_VERSION = '';
private $charset; private $charset;
@ -228,7 +228,7 @@ class Environment
{ {
if (\is_string($cache)) { if (\is_string($cache)) {
$this->originalCache = $cache; $this->originalCache = $cache;
$this->cache = new FilesystemCache($cache); $this->cache = new FilesystemCache($cache, $this->autoReload ? FilesystemCache::FORCE_BYTECODE_INVALIDATION : 0);
} elseif (false === $cache) { } elseif (false === $cache) {
$this->originalCache = $cache; $this->originalCache = $cache;
$this->cache = new NullCache(); $this->cache = new NullCache();

View File

@ -485,7 +485,7 @@ class ExpressionParser
} }
} }
} else { } else {
throw new SyntaxError('Expected name or number.', $lineno, $stream->getSourceContext()); throw new SyntaxError(sprintf('Expected name or number, got value "%s" of type %s.', $token->getValue(), Token::typeToEnglish($token->getType())), $lineno, $stream->getSourceContext());
} }
if ($node instanceof NameExpression && null !== $this->parser->getImportedSymbol('template', $node->getAttribute('name'))) { if ($node instanceof NameExpression && null !== $this->parser->getImportedSymbol('template', $node->getAttribute('name'))) {

View File

@ -1359,6 +1359,10 @@ function twig_source(Environment $env, $name, $ignoreMissing = false)
function twig_constant($constant, $object = null) function twig_constant($constant, $object = null)
{ {
if (null !== $object) { if (null !== $object) {
if ('class' === $constant) {
return \get_class($object);
}
$constant = \get_class($object).'::'.$constant; $constant = \get_class($object).'::'.$constant;
} }
@ -1376,6 +1380,10 @@ function twig_constant($constant, $object = null)
function twig_constant_is_defined($constant, $object = null) function twig_constant_is_defined($constant, $object = null)
{ {
if (null !== $object) { if (null !== $object) {
if ('class' === $constant) {
return true;
}
$constant = \get_class($object).'::'.$constant; $constant = \get_class($object).'::'.$constant;
} }

View File

@ -387,13 +387,8 @@ function twig_escape_filter(Environment $env, $string, $strategy = 'html', $char
return rawurlencode($string); return rawurlencode($string);
default: default:
static $escapers; $escapers = $env->getExtension(EscaperExtension::class)->getEscapers();
if (array_key_exists($strategy, $escapers)) {
if (null === $escapers) {
$escapers = $env->getExtension(EscaperExtension::class)->getEscapers();
}
if (isset($escapers[$strategy])) {
return $escapers[$strategy]($env, $string, $charset); return $escapers[$strategy]($env, $string, $charset);
} }

View File

@ -91,11 +91,11 @@ final class SandboxExtension extends AbstractExtension
} }
} }
public function checkPropertyAllowed($obj, $method, int $lineno = -1, Source $source = null): void public function checkPropertyAllowed($obj, $property, int $lineno = -1, Source $source = null): void
{ {
if ($this->isSandboxed()) { if ($this->isSandboxed()) {
try { try {
$this->policy->checkPropertyAllowed($obj, $method); $this->policy->checkPropertyAllowed($obj, $property);
} catch (SecurityNotAllowedPropertyError $e) { } catch (SecurityNotAllowedPropertyError $e) {
$e->setSourceContext($source); $e->setSourceContext($source);
$e->setTemplateLine($lineno); $e->setTemplateLine($lineno);

View File

@ -183,9 +183,9 @@ class FilesystemLoader implements LoaderInterface
} }
try { try {
$this->validateName($name);
list($namespace, $shortname) = $this->parseName($name); list($namespace, $shortname) = $this->parseName($name);
$this->validateName($shortname);
} catch (LoaderError $e) { } catch (LoaderError $e) {
if (!$throw) { if (!$throw) {
return null; return null;

View File

@ -24,19 +24,20 @@ abstract class CallExpression extends AbstractExpression
{ {
$callable = $this->getAttribute('callable'); $callable = $this->getAttribute('callable');
$closingParenthesis = false;
$isArray = false;
if (\is_string($callable) && false === strpos($callable, '::')) { if (\is_string($callable) && false === strpos($callable, '::')) {
$compiler->raw($callable); $compiler->raw($callable);
} else { } else {
list($r, $callable) = $this->reflectCallable($callable); [$r, $callable] = $this->reflectCallable($callable);
if ($r instanceof \ReflectionMethod && \is_string($callable[0])) {
if ($r->isStatic()) { if (\is_string($callable)) {
$compiler->raw($callable);
} elseif (\is_array($callable) && \is_string($callable[0])) {
if (!$r instanceof \ReflectionMethod || $r->isStatic()) {
$compiler->raw(sprintf('%s::%s', $callable[0], $callable[1])); $compiler->raw(sprintf('%s::%s', $callable[0], $callable[1]));
} else { } else {
$compiler->raw(sprintf('$this->env->getRuntime(\'%s\')->%s', $callable[0], $callable[1])); $compiler->raw(sprintf('$this->env->getRuntime(\'%s\')->%s', $callable[0], $callable[1]));
} }
} elseif ($r instanceof \ReflectionMethod && $callable[0] instanceof ExtensionInterface) { } elseif (\is_array($callable) && $callable[0] instanceof ExtensionInterface) {
$class = \get_class($callable[0]); $class = \get_class($callable[0]);
if (!$compiler->getEnvironment()->hasExtension($class)) { if (!$compiler->getEnvironment()->hasExtension($class)) {
// Compile a non-optimized call to trigger a \Twig\Error\RuntimeError, which cannot be a compile-time error // Compile a non-optimized call to trigger a \Twig\Error\RuntimeError, which cannot be a compile-time error
@ -47,17 +48,11 @@ abstract class CallExpression extends AbstractExpression
$compiler->raw(sprintf('->%s', $callable[1])); $compiler->raw(sprintf('->%s', $callable[1]));
} else { } else {
$closingParenthesis = true; $compiler->raw(sprintf('$this->env->get%s(\'%s\')->getCallable()', ucfirst($this->getAttribute('type')), $this->getAttribute('name')));
$isArray = true;
$compiler->raw(sprintf('call_user_func_array($this->env->get%s(\'%s\')->getCallable(), ', ucfirst($this->getAttribute('type')), $this->getAttribute('name')));
} }
} }
$this->compileArguments($compiler, $isArray); $this->compileArguments($compiler);
if ($closingParenthesis) {
$compiler->raw(')');
}
} }
protected function compileArguments(Compiler $compiler, $isArray = false): void protected function compileArguments(Compiler $compiler, $isArray = false): void
@ -244,10 +239,7 @@ abstract class CallExpression extends AbstractExpression
private function getCallableParameters($callable, bool $isVariadic): array private function getCallableParameters($callable, bool $isVariadic): array
{ {
list($r) = $this->reflectCallable($callable); [$r, , $callableName] = $this->reflectCallable($callable);
if (null === $r) {
return [[], false];
}
$parameters = $r->getParameters(); $parameters = $r->getParameters();
if ($this->hasNode('node')) { if ($this->hasNode('node')) {
@ -274,11 +266,6 @@ abstract class CallExpression extends AbstractExpression
array_pop($parameters); array_pop($parameters);
$isPhpVariadic = true; $isPhpVariadic = true;
} else { } else {
$callableName = $r->name;
if ($r instanceof \ReflectionMethod) {
$callableName = $r->getDeclaringClass()->name.'::'.$callableName;
}
throw new \LogicException(sprintf('The last parameter of "%s" for %s "%s" must be an array with default value, eg. "array $arg = []".', $callableName, $this->getAttribute('type'), $this->getAttribute('name'))); throw new \LogicException(sprintf('The last parameter of "%s" for %s "%s" must be an array with default value, eg. "array $arg = []".', $callableName, $this->getAttribute('type'), $this->getAttribute('name')));
} }
} }
@ -292,29 +279,41 @@ abstract class CallExpression extends AbstractExpression
return $this->reflector; return $this->reflector;
} }
if (\is_array($callable)) { if (\is_string($callable) && false !== $pos = strpos($callable, '::')) {
if (!method_exists($callable[0], $callable[1])) { $callable = [substr($callable, 0, $pos), substr($callable, 2 + $pos)];
// __call()
return [null, []];
}
$r = new \ReflectionMethod($callable[0], $callable[1]);
} elseif (\is_object($callable) && !$callable instanceof \Closure) {
$r = new \ReflectionObject($callable);
$r = $r->getMethod('__invoke');
$callable = [$callable, '__invoke'];
} elseif (\is_string($callable) && false !== $pos = strpos($callable, '::')) {
$class = substr($callable, 0, $pos);
$method = substr($callable, $pos + 2);
if (!method_exists($class, $method)) {
// __staticCall()
return [null, []];
}
$r = new \ReflectionMethod($callable);
$callable = [$class, $method];
} else {
$r = new \ReflectionFunction($callable);
} }
return $this->reflector = [$r, $callable]; if (\is_array($callable) && method_exists($callable[0], $callable[1])) {
$r = new \ReflectionMethod($callable[0], $callable[1]);
return $this->reflector = [$r, $callable, $r->class.'::'.$r->name];
}
$checkVisibility = $callable instanceof \Closure;
try {
$closure = \Closure::fromCallable($callable);
} catch (\TypeError $e) {
throw new \LogicException(sprintf('Callback for %s "%s" is not callable in the current scope.', $this->getAttribute('type'), $this->getAttribute('name')), 0, $e);
}
$r = new \ReflectionFunction($closure);
if (false !== strpos($r->name, '{closure}')) {
return $this->reflector = [$r, $callable, 'Closure'];
}
if ($object = $r->getClosureThis()) {
$callable = [$object, $r->name];
$callableName = (\function_exists('get_debug_type') ? get_debug_type($object) : \get_class($object)).'::'.$r->name;
} elseif ($class = $r->getClosureScopeClass()) {
$callableName = (\is_array($callable) ? $callable[0] : $class->name).'::'.$r->name;
} else {
$callable = $callableName = $r->name;
}
if ($checkVisibility && \is_array($callable) && method_exists(...$callable) && !(new \ReflectionMethod(...$callable))->isPublic()) {
$callable = $r->getClosure();
}
return $this->reflector = [$r, $callable, $callableName];
} }
} }

View File

@ -58,7 +58,7 @@ class Parser
public function parse(TokenStream $stream, $test = null, bool $dropNeedle = false): ModuleNode public function parse(TokenStream $stream, $test = null, bool $dropNeedle = false): ModuleNode
{ {
$vars = get_object_vars($this); $vars = get_object_vars($this);
unset($vars['stack'], $vars['env'], $vars['handlers'], $vars['visitors'], $vars['expressionParser'], $vars['reservedMacroNames']); unset($vars['stack'], $vars['env'], $vars['handlers'], $vars['visitors'], $vars['expressionParser'], $vars['reservedMacroNames'], $vars['varNameSalt']);
$this->stack[] = $vars; $this->stack[] = $vars;
// node visitors // node visitors
@ -78,7 +78,6 @@ class Parser
$this->blockStack = []; $this->blockStack = [];
$this->importedSymbols = [[]]; $this->importedSymbols = [[]];
$this->embeddedTemplates = []; $this->embeddedTemplates = [];
$this->varNameSalt = 0;
try { try {
$body = $this->subparse($test, $dropNeedle); $body = $this->subparse($test, $dropNeedle);

View File

@ -19,17 +19,27 @@ namespace Twig\Sandbox;
interface SecurityPolicyInterface interface SecurityPolicyInterface
{ {
/** /**
* @param string[] $tags
* @param string[] $filters
* @param string[] $functions
*
* @throws SecurityError * @throws SecurityError
*/ */
public function checkSecurity($tags, $filters, $functions): void; public function checkSecurity($tags, $filters, $functions): void;
/** /**
* @param object $obj
* @param string $method
*
* @throws SecurityNotAllowedMethodError * @throws SecurityNotAllowedMethodError
*/ */
public function checkMethodAllowed($obj, $method): void; public function checkMethodAllowed($obj, $method): void;
/** /**
* @param object $obj
* @param string $property
*
* @throws SecurityNotAllowedPropertyError * @throws SecurityNotAllowedPropertyError
*/ */
public function checkPropertyAllowed($obj, $method): void; public function checkPropertyAllowed($obj, $property): void;
} }