Merge remote-tracking branch 'origin/support/2.7' into support/3.0

# Conflicts:
#	lib/composer/installed.php
#	setup/licenses/community-licenses.xml
#	setup/setuputils.class.inc.php
#	sources/application/TwigBase/Controller/Controller.php
This commit is contained in:
Pierre Goiffon
2022-02-14 08:41:33 +01:00
416 changed files with 6638 additions and 2444 deletions

View File

@@ -36,18 +36,24 @@ clearstatcache();
$oiTopComposer = new iTopComposer(); $oiTopComposer = new iTopComposer();
$aDeniedButStillPresent = $oiTopComposer->ListDeniedButStillPresent(); $aDeniedButStillPresent = $oiTopComposer->ListDeniedButStillPresent();
echo "\n";
foreach ($aDeniedButStillPresent as $sDir) foreach ($aDeniedButStillPresent as $sDir)
{ {
if (! preg_match('#[tT]ests?/?$#', $sDir)) if (false === iTopComposer::IsTestDir($sDir))
{ {
echo "\nfound INVALID denied test dir: '$sDir'\n"; echo "ERROR found INVALID denied test dir: '$sDir'\n";
throw new \Exception("$sDir must end with /Test/ or /test/"); throw new \Exception("$sDir must end with /Test/ or /test/");
} }
if (false === file_exists($sDir)) {
echo "INFO $sDir is in denied list, but not existing on disk => skipping !\n";
continue;
}
try try
{ {
SetupUtils::rrmdir($sDir); SetupUtils::rrmdir($sDir);
echo "Remove denied test dir: '$sDir'\n"; echo "OK Remove denied test dir: '$sDir'\n";
} }
catch (\Exception $e) catch (\Exception $e)
{ {

View File

@@ -1740,6 +1740,9 @@ HTML
* @param array $aParams * @param array $aParams
* *
* @throws \Exception * @throws \Exception
* only used in old and deprecated export.php
*
* @internal Only to be used by `/webservices/export.php` : this is a legacy method that produces wrong HTML (no TR on table body rows)
*/ */
public static function DisplaySetAsHTMLSpreadsheet(WebPage $oPage, CMDBObjectSet $oSet, $aParams = array()) public static function DisplaySetAsHTMLSpreadsheet(WebPage $oPage, CMDBObjectSet $oSet, $aParams = array())
{ {
@@ -1760,6 +1763,8 @@ HTML
* @throws \MySQLException * @throws \MySQLException
* @throws \MySQLHasGoneAwayException * @throws \MySQLHasGoneAwayException
* @throws \Exception * @throws \Exception
*
* @internal Only to be used by `/webservices/export.php` : this is a legacy method that produces wrong HTML (no TR on table body rows)
*/ */
public static function GetSetAsHTMLSpreadsheet(DBObjectSet $oSet, $aParams = array()) public static function GetSetAsHTMLSpreadsheet(DBObjectSet $oSet, $aParams = array())
{ {

View File

@@ -2408,7 +2408,7 @@ class utils
* @throws \ApplicationException if constant value is invalid * @throws \ApplicationException if constant value is invalid
* @uses ITOP_CORE_VERSION * @uses ITOP_CORE_VERSION
*/ */
public static function GetCoreVersionWikiSyntax($sItopVersion = ITOP_CORE_VERSION) public static function GetItopVersionWikiSyntax($sItopVersion = ITOP_CORE_VERSION)
{ {
$aExplodedVersion = explode('.', $sItopVersion); $aExplodedVersion = explode('.', $sItopVersion);

View File

@@ -20,7 +20,7 @@ define('ITOP_DESIGN_LATEST_VERSION', '3.0');
* When releasing, both constants should be updated : see `.make/release/update-versions.php` for that ! * When releasing, both constants should be updated : see `.make/release/update-versions.php` for that !
* *
* @since 2.7.7 3.0.1 3.1.0 N°4714 constant creation * @since 2.7.7 3.0.1 3.1.0 N°4714 constant creation
* @used-by utils::GetCoreVersionWikiSyntax() * @used-by utils::GetItopVersionWikiSyntax()
* @used-by iTopModulesPhpVersionIntegrationTest * @used-by iTopModulesPhpVersionIntegrationTest
*/ */
define('ITOP_CORE_VERSION', '3.0.1'); define('ITOP_CORE_VERSION', '3.0.1');

View File

@@ -16,16 +16,16 @@
"pelago/emogrifier": "3.1.0", "pelago/emogrifier": "3.1.0",
"scssphp/scssphp": "1.0.6", "scssphp/scssphp": "1.0.6",
"swiftmailer/swiftmailer": "5.4.12", "swiftmailer/swiftmailer": "5.4.12",
"symfony/console": "3.4.*", "symfony/console": "~3.4.47",
"symfony/dotenv": "3.4.*", "symfony/dotenv": "~3.4.47",
"symfony/framework-bundle": "3.4.*", "symfony/framework-bundle": "~3.4.47",
"symfony/polyfill-php70": "1.*", "symfony/polyfill-php70": "1.*",
"symfony/twig-bundle": "3.4.*", "symfony/twig-bundle": "~3.4.47",
"symfony/yaml": "3.4.*" "symfony/yaml": "~3.4.47"
}, },
"require-dev": { "require-dev": {
"symfony/stopwatch": "3.4.*", "symfony/stopwatch": "~3.4.47",
"symfony/web-profiler-bundle": "3.4.*" "symfony/web-profiler-bundle": "~3.4.47"
}, },
"suggest": { "suggest": {
"ext-libsodium": "Required to use the AttributeEncryptedString.", "ext-libsodium": "Required to use the AttributeEncryptedString.",

873
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -390,14 +390,18 @@ class ObjectController extends BrickController
} }
// Checking security layers // Checking security layers
if (!$oSecurityHelper->IsActionAllowed(UR_ACTION_MODIFY, $sObjectClass, $sObjectId))
{
IssueLog::Warning(__METHOD__.' at line '.__LINE__.' : User #'.UserRights::GetUserId().' not allowed to modify '.$sObjectClass.'::'.$sObjectId.' object.');
throw new HttpException(Response::HTTP_NOT_FOUND, Dict::S('UI:ObjectDoesNotExist'));
}
if (!$oSecurityHelper->IsStimulusAllowed($sStimulusCode, $sObjectClass)) if (!$oSecurityHelper->IsStimulusAllowed($sStimulusCode, $sObjectClass))
{ {
throw new HttpException(Response::HTTP_NOT_FOUND, Dict::S('UI:ObjectDoesNotExist')); throw new HttpException(Response::HTTP_NOT_FOUND, Dict::S('UI:ObjectDoesNotExist'));
} }
// Retrieving object // Retrieving object
$oObject = MetaModel::GetObject($sObjectClass, $sObjectId, false /* MustBeFound */, $oObject = MetaModel::GetObject($sObjectClass, $sObjectId, false /* MustBeFound */, $oScopeValidator->IsAllDataAllowedForScope(UserRights::ListProfiles(), $sObjectClass));
$oScopeValidator->IsAllDataAllowedForScope(UserRights::ListProfiles(), $sObjectClass));
if ($oObject === null) if ($oObject === null)
{ {
// We should never be there as the secuirty helper makes sure that the object exists, but just in case. // We should never be there as the secuirty helper makes sure that the object exists, but just in case.

3
lib/.gitignore vendored
View File

@@ -13,9 +13,7 @@
# ArchiveTar # ArchiveTar
/pear/archive_tar/docs /pear/archive_tar/docs
/pear/archive_tar/scripts /pear/archive_tar/scripts
/pear/archive_tar/tests
/pear/archive_tar/sync-php4 /pear/archive_tar/sync-php4
/pear/console_getopt/tests
# Emogrifier # Emogrifier
/pelago/emogrifier/.github /pelago/emogrifier/.github
@@ -33,4 +31,3 @@
/twig/twig/doc /twig/twig/doc
/twig/twig/test /twig/twig/test
/twig/twig/drupal_test.sh /twig/twig/drupal_test.sh
/symfony/twig-bundle/Tests

View File

@@ -1048,6 +1048,7 @@ return array(
'Symfony\\Bundle\\FrameworkBundle\\DependencyInjection\\Compiler\\PropertyInfoPass' => $vendorDir . '/symfony/framework-bundle/DependencyInjection/Compiler/PropertyInfoPass.php', 'Symfony\\Bundle\\FrameworkBundle\\DependencyInjection\\Compiler\\PropertyInfoPass' => $vendorDir . '/symfony/framework-bundle/DependencyInjection/Compiler/PropertyInfoPass.php',
'Symfony\\Bundle\\FrameworkBundle\\DependencyInjection\\Compiler\\RoutingResolverPass' => $vendorDir . '/symfony/framework-bundle/DependencyInjection/Compiler/RoutingResolverPass.php', 'Symfony\\Bundle\\FrameworkBundle\\DependencyInjection\\Compiler\\RoutingResolverPass' => $vendorDir . '/symfony/framework-bundle/DependencyInjection/Compiler/RoutingResolverPass.php',
'Symfony\\Bundle\\FrameworkBundle\\DependencyInjection\\Compiler\\SerializerPass' => $vendorDir . '/symfony/framework-bundle/DependencyInjection/Compiler/SerializerPass.php', 'Symfony\\Bundle\\FrameworkBundle\\DependencyInjection\\Compiler\\SerializerPass' => $vendorDir . '/symfony/framework-bundle/DependencyInjection/Compiler/SerializerPass.php',
'Symfony\\Bundle\\FrameworkBundle\\DependencyInjection\\Compiler\\SessionPass' => $vendorDir . '/symfony/framework-bundle/DependencyInjection/Compiler/SessionPass.php',
'Symfony\\Bundle\\FrameworkBundle\\DependencyInjection\\Compiler\\TemplatingPass' => $vendorDir . '/symfony/framework-bundle/DependencyInjection/Compiler/TemplatingPass.php', 'Symfony\\Bundle\\FrameworkBundle\\DependencyInjection\\Compiler\\TemplatingPass' => $vendorDir . '/symfony/framework-bundle/DependencyInjection/Compiler/TemplatingPass.php',
'Symfony\\Bundle\\FrameworkBundle\\DependencyInjection\\Compiler\\TranslationDumperPass' => $vendorDir . '/symfony/framework-bundle/DependencyInjection/Compiler/TranslationDumperPass.php', 'Symfony\\Bundle\\FrameworkBundle\\DependencyInjection\\Compiler\\TranslationDumperPass' => $vendorDir . '/symfony/framework-bundle/DependencyInjection/Compiler/TranslationDumperPass.php',
'Symfony\\Bundle\\FrameworkBundle\\DependencyInjection\\Compiler\\TranslationExtractorPass' => $vendorDir . '/symfony/framework-bundle/DependencyInjection/Compiler/TranslationExtractorPass.php', 'Symfony\\Bundle\\FrameworkBundle\\DependencyInjection\\Compiler\\TranslationExtractorPass' => $vendorDir . '/symfony/framework-bundle/DependencyInjection/Compiler/TranslationExtractorPass.php',
@@ -1086,6 +1087,9 @@ return array(
'Symfony\\Bundle\\FrameworkBundle\\Templating\\TemplateNameParser' => $vendorDir . '/symfony/framework-bundle/Templating/TemplateNameParser.php', 'Symfony\\Bundle\\FrameworkBundle\\Templating\\TemplateNameParser' => $vendorDir . '/symfony/framework-bundle/Templating/TemplateNameParser.php',
'Symfony\\Bundle\\FrameworkBundle\\Templating\\TemplateReference' => $vendorDir . '/symfony/framework-bundle/Templating/TemplateReference.php', 'Symfony\\Bundle\\FrameworkBundle\\Templating\\TemplateReference' => $vendorDir . '/symfony/framework-bundle/Templating/TemplateReference.php',
'Symfony\\Bundle\\FrameworkBundle\\Templating\\TimedPhpEngine' => $vendorDir . '/symfony/framework-bundle/Templating/TimedPhpEngine.php', 'Symfony\\Bundle\\FrameworkBundle\\Templating\\TimedPhpEngine' => $vendorDir . '/symfony/framework-bundle/Templating/TimedPhpEngine.php',
'Symfony\\Bundle\\FrameworkBundle\\Test\\ForwardCompatTestTrait' => $vendorDir . '/symfony/framework-bundle/Test/ForwardCompatTestTrait.php',
'Symfony\\Bundle\\FrameworkBundle\\Test\\KernelTestCase' => $vendorDir . '/symfony/framework-bundle/Test/KernelTestCase.php',
'Symfony\\Bundle\\FrameworkBundle\\Test\\WebTestCase' => $vendorDir . '/symfony/framework-bundle/Test/WebTestCase.php',
'Symfony\\Bundle\\FrameworkBundle\\Translation\\PhpExtractor' => $vendorDir . '/symfony/framework-bundle/Translation/PhpExtractor.php', 'Symfony\\Bundle\\FrameworkBundle\\Translation\\PhpExtractor' => $vendorDir . '/symfony/framework-bundle/Translation/PhpExtractor.php',
'Symfony\\Bundle\\FrameworkBundle\\Translation\\PhpStringTokenParser' => $vendorDir . '/symfony/framework-bundle/Translation/PhpStringTokenParser.php', 'Symfony\\Bundle\\FrameworkBundle\\Translation\\PhpStringTokenParser' => $vendorDir . '/symfony/framework-bundle/Translation/PhpStringTokenParser.php',
'Symfony\\Bundle\\FrameworkBundle\\Translation\\TranslationLoader' => $vendorDir . '/symfony/framework-bundle/Translation/TranslationLoader.php', 'Symfony\\Bundle\\FrameworkBundle\\Translation\\TranslationLoader' => $vendorDir . '/symfony/framework-bundle/Translation/TranslationLoader.php',
@@ -1638,6 +1642,7 @@ return array(
'Symfony\\Component\\HttpFoundation\\Session\\SessionBagInterface' => $vendorDir . '/symfony/http-foundation/Session/SessionBagInterface.php', 'Symfony\\Component\\HttpFoundation\\Session\\SessionBagInterface' => $vendorDir . '/symfony/http-foundation/Session/SessionBagInterface.php',
'Symfony\\Component\\HttpFoundation\\Session\\SessionBagProxy' => $vendorDir . '/symfony/http-foundation/Session/SessionBagProxy.php', 'Symfony\\Component\\HttpFoundation\\Session\\SessionBagProxy' => $vendorDir . '/symfony/http-foundation/Session/SessionBagProxy.php',
'Symfony\\Component\\HttpFoundation\\Session\\SessionInterface' => $vendorDir . '/symfony/http-foundation/Session/SessionInterface.php', 'Symfony\\Component\\HttpFoundation\\Session\\SessionInterface' => $vendorDir . '/symfony/http-foundation/Session/SessionInterface.php',
'Symfony\\Component\\HttpFoundation\\Session\\SessionUtils' => $vendorDir . '/symfony/http-foundation/Session/SessionUtils.php',
'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\AbstractSessionHandler' => $vendorDir . '/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\AbstractSessionHandler' => $vendorDir . '/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php',
'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MemcacheSessionHandler' => $vendorDir . '/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MemcacheSessionHandler' => $vendorDir . '/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php',
'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MemcachedSessionHandler' => $vendorDir . '/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MemcachedSessionHandler' => $vendorDir . '/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php',
@@ -1889,6 +1894,7 @@ return array(
'Symfony\\Component\\VarDumper\\Dumper\\DataDumperInterface' => $vendorDir . '/symfony/var-dumper/Dumper/DataDumperInterface.php', 'Symfony\\Component\\VarDumper\\Dumper\\DataDumperInterface' => $vendorDir . '/symfony/var-dumper/Dumper/DataDumperInterface.php',
'Symfony\\Component\\VarDumper\\Dumper\\HtmlDumper' => $vendorDir . '/symfony/var-dumper/Dumper/HtmlDumper.php', 'Symfony\\Component\\VarDumper\\Dumper\\HtmlDumper' => $vendorDir . '/symfony/var-dumper/Dumper/HtmlDumper.php',
'Symfony\\Component\\VarDumper\\Exception\\ThrowingCasterException' => $vendorDir . '/symfony/var-dumper/Exception/ThrowingCasterException.php', 'Symfony\\Component\\VarDumper\\Exception\\ThrowingCasterException' => $vendorDir . '/symfony/var-dumper/Exception/ThrowingCasterException.php',
'Symfony\\Component\\VarDumper\\Test\\VarDumperTestTrait' => $vendorDir . '/symfony/var-dumper/Test/VarDumperTestTrait.php',
'Symfony\\Component\\VarDumper\\VarDumper' => $vendorDir . '/symfony/var-dumper/VarDumper.php', 'Symfony\\Component\\VarDumper\\VarDumper' => $vendorDir . '/symfony/var-dumper/VarDumper.php',
'Symfony\\Component\\Yaml\\Command\\LintCommand' => $vendorDir . '/symfony/yaml/Command/LintCommand.php', 'Symfony\\Component\\Yaml\\Command\\LintCommand' => $vendorDir . '/symfony/yaml/Command/LintCommand.php',
'Symfony\\Component\\Yaml\\Dumper' => $vendorDir . '/symfony/yaml/Dumper.php', 'Symfony\\Component\\Yaml\\Dumper' => $vendorDir . '/symfony/yaml/Dumper.php',

View File

@@ -6,8 +6,8 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir); $baseDir = dirname($vendorDir);
return array( return array(
'320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
'320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
'5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php', '5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php',
'023d27dca8066ef29e6739335ea73bad' => $vendorDir . '/symfony/polyfill-php70/bootstrap.php', '023d27dca8066ef29e6739335ea73bad' => $vendorDir . '/symfony/polyfill-php70/bootstrap.php',
'32dcc8afd4335739640db7d200c1971d' => $vendorDir . '/symfony/polyfill-apcu/bootstrap.php', '32dcc8afd4335739640db7d200c1971d' => $vendorDir . '/symfony/polyfill-apcu/bootstrap.php',

View File

@@ -7,8 +7,8 @@ namespace Composer\Autoload;
class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b
{ {
public static $files = array ( public static $files = array (
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
'5255c38a0faeba867671b61dfda6d864' => __DIR__ . '/..' . '/paragonie/random_compat/lib/random.php', '5255c38a0faeba867671b61dfda6d864' => __DIR__ . '/..' . '/paragonie/random_compat/lib/random.php',
'023d27dca8066ef29e6739335ea73bad' => __DIR__ . '/..' . '/symfony/polyfill-php70/bootstrap.php', '023d27dca8066ef29e6739335ea73bad' => __DIR__ . '/..' . '/symfony/polyfill-php70/bootstrap.php',
'32dcc8afd4335739640db7d200c1971d' => __DIR__ . '/..' . '/symfony/polyfill-apcu/bootstrap.php', '32dcc8afd4335739640db7d200c1971d' => __DIR__ . '/..' . '/symfony/polyfill-apcu/bootstrap.php',
@@ -1278,6 +1278,7 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b
'Symfony\\Bundle\\FrameworkBundle\\DependencyInjection\\Compiler\\PropertyInfoPass' => __DIR__ . '/..' . '/symfony/framework-bundle/DependencyInjection/Compiler/PropertyInfoPass.php', 'Symfony\\Bundle\\FrameworkBundle\\DependencyInjection\\Compiler\\PropertyInfoPass' => __DIR__ . '/..' . '/symfony/framework-bundle/DependencyInjection/Compiler/PropertyInfoPass.php',
'Symfony\\Bundle\\FrameworkBundle\\DependencyInjection\\Compiler\\RoutingResolverPass' => __DIR__ . '/..' . '/symfony/framework-bundle/DependencyInjection/Compiler/RoutingResolverPass.php', 'Symfony\\Bundle\\FrameworkBundle\\DependencyInjection\\Compiler\\RoutingResolverPass' => __DIR__ . '/..' . '/symfony/framework-bundle/DependencyInjection/Compiler/RoutingResolverPass.php',
'Symfony\\Bundle\\FrameworkBundle\\DependencyInjection\\Compiler\\SerializerPass' => __DIR__ . '/..' . '/symfony/framework-bundle/DependencyInjection/Compiler/SerializerPass.php', 'Symfony\\Bundle\\FrameworkBundle\\DependencyInjection\\Compiler\\SerializerPass' => __DIR__ . '/..' . '/symfony/framework-bundle/DependencyInjection/Compiler/SerializerPass.php',
'Symfony\\Bundle\\FrameworkBundle\\DependencyInjection\\Compiler\\SessionPass' => __DIR__ . '/..' . '/symfony/framework-bundle/DependencyInjection/Compiler/SessionPass.php',
'Symfony\\Bundle\\FrameworkBundle\\DependencyInjection\\Compiler\\TemplatingPass' => __DIR__ . '/..' . '/symfony/framework-bundle/DependencyInjection/Compiler/TemplatingPass.php', 'Symfony\\Bundle\\FrameworkBundle\\DependencyInjection\\Compiler\\TemplatingPass' => __DIR__ . '/..' . '/symfony/framework-bundle/DependencyInjection/Compiler/TemplatingPass.php',
'Symfony\\Bundle\\FrameworkBundle\\DependencyInjection\\Compiler\\TranslationDumperPass' => __DIR__ . '/..' . '/symfony/framework-bundle/DependencyInjection/Compiler/TranslationDumperPass.php', 'Symfony\\Bundle\\FrameworkBundle\\DependencyInjection\\Compiler\\TranslationDumperPass' => __DIR__ . '/..' . '/symfony/framework-bundle/DependencyInjection/Compiler/TranslationDumperPass.php',
'Symfony\\Bundle\\FrameworkBundle\\DependencyInjection\\Compiler\\TranslationExtractorPass' => __DIR__ . '/..' . '/symfony/framework-bundle/DependencyInjection/Compiler/TranslationExtractorPass.php', 'Symfony\\Bundle\\FrameworkBundle\\DependencyInjection\\Compiler\\TranslationExtractorPass' => __DIR__ . '/..' . '/symfony/framework-bundle/DependencyInjection/Compiler/TranslationExtractorPass.php',
@@ -1316,6 +1317,9 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b
'Symfony\\Bundle\\FrameworkBundle\\Templating\\TemplateNameParser' => __DIR__ . '/..' . '/symfony/framework-bundle/Templating/TemplateNameParser.php', 'Symfony\\Bundle\\FrameworkBundle\\Templating\\TemplateNameParser' => __DIR__ . '/..' . '/symfony/framework-bundle/Templating/TemplateNameParser.php',
'Symfony\\Bundle\\FrameworkBundle\\Templating\\TemplateReference' => __DIR__ . '/..' . '/symfony/framework-bundle/Templating/TemplateReference.php', 'Symfony\\Bundle\\FrameworkBundle\\Templating\\TemplateReference' => __DIR__ . '/..' . '/symfony/framework-bundle/Templating/TemplateReference.php',
'Symfony\\Bundle\\FrameworkBundle\\Templating\\TimedPhpEngine' => __DIR__ . '/..' . '/symfony/framework-bundle/Templating/TimedPhpEngine.php', 'Symfony\\Bundle\\FrameworkBundle\\Templating\\TimedPhpEngine' => __DIR__ . '/..' . '/symfony/framework-bundle/Templating/TimedPhpEngine.php',
'Symfony\\Bundle\\FrameworkBundle\\Test\\ForwardCompatTestTrait' => __DIR__ . '/..' . '/symfony/framework-bundle/Test/ForwardCompatTestTrait.php',
'Symfony\\Bundle\\FrameworkBundle\\Test\\KernelTestCase' => __DIR__ . '/..' . '/symfony/framework-bundle/Test/KernelTestCase.php',
'Symfony\\Bundle\\FrameworkBundle\\Test\\WebTestCase' => __DIR__ . '/..' . '/symfony/framework-bundle/Test/WebTestCase.php',
'Symfony\\Bundle\\FrameworkBundle\\Translation\\PhpExtractor' => __DIR__ . '/..' . '/symfony/framework-bundle/Translation/PhpExtractor.php', 'Symfony\\Bundle\\FrameworkBundle\\Translation\\PhpExtractor' => __DIR__ . '/..' . '/symfony/framework-bundle/Translation/PhpExtractor.php',
'Symfony\\Bundle\\FrameworkBundle\\Translation\\PhpStringTokenParser' => __DIR__ . '/..' . '/symfony/framework-bundle/Translation/PhpStringTokenParser.php', 'Symfony\\Bundle\\FrameworkBundle\\Translation\\PhpStringTokenParser' => __DIR__ . '/..' . '/symfony/framework-bundle/Translation/PhpStringTokenParser.php',
'Symfony\\Bundle\\FrameworkBundle\\Translation\\TranslationLoader' => __DIR__ . '/..' . '/symfony/framework-bundle/Translation/TranslationLoader.php', 'Symfony\\Bundle\\FrameworkBundle\\Translation\\TranslationLoader' => __DIR__ . '/..' . '/symfony/framework-bundle/Translation/TranslationLoader.php',
@@ -1868,6 +1872,7 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b
'Symfony\\Component\\HttpFoundation\\Session\\SessionBagInterface' => __DIR__ . '/..' . '/symfony/http-foundation/Session/SessionBagInterface.php', 'Symfony\\Component\\HttpFoundation\\Session\\SessionBagInterface' => __DIR__ . '/..' . '/symfony/http-foundation/Session/SessionBagInterface.php',
'Symfony\\Component\\HttpFoundation\\Session\\SessionBagProxy' => __DIR__ . '/..' . '/symfony/http-foundation/Session/SessionBagProxy.php', 'Symfony\\Component\\HttpFoundation\\Session\\SessionBagProxy' => __DIR__ . '/..' . '/symfony/http-foundation/Session/SessionBagProxy.php',
'Symfony\\Component\\HttpFoundation\\Session\\SessionInterface' => __DIR__ . '/..' . '/symfony/http-foundation/Session/SessionInterface.php', 'Symfony\\Component\\HttpFoundation\\Session\\SessionInterface' => __DIR__ . '/..' . '/symfony/http-foundation/Session/SessionInterface.php',
'Symfony\\Component\\HttpFoundation\\Session\\SessionUtils' => __DIR__ . '/..' . '/symfony/http-foundation/Session/SessionUtils.php',
'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\AbstractSessionHandler' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\AbstractSessionHandler' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php',
'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MemcacheSessionHandler' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MemcacheSessionHandler' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php',
'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MemcachedSessionHandler' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MemcachedSessionHandler' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php',
@@ -2119,6 +2124,7 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b
'Symfony\\Component\\VarDumper\\Dumper\\DataDumperInterface' => __DIR__ . '/..' . '/symfony/var-dumper/Dumper/DataDumperInterface.php', 'Symfony\\Component\\VarDumper\\Dumper\\DataDumperInterface' => __DIR__ . '/..' . '/symfony/var-dumper/Dumper/DataDumperInterface.php',
'Symfony\\Component\\VarDumper\\Dumper\\HtmlDumper' => __DIR__ . '/..' . '/symfony/var-dumper/Dumper/HtmlDumper.php', 'Symfony\\Component\\VarDumper\\Dumper\\HtmlDumper' => __DIR__ . '/..' . '/symfony/var-dumper/Dumper/HtmlDumper.php',
'Symfony\\Component\\VarDumper\\Exception\\ThrowingCasterException' => __DIR__ . '/..' . '/symfony/var-dumper/Exception/ThrowingCasterException.php', 'Symfony\\Component\\VarDumper\\Exception\\ThrowingCasterException' => __DIR__ . '/..' . '/symfony/var-dumper/Exception/ThrowingCasterException.php',
'Symfony\\Component\\VarDumper\\Test\\VarDumperTestTrait' => __DIR__ . '/..' . '/symfony/var-dumper/Test/VarDumperTestTrait.php',
'Symfony\\Component\\VarDumper\\VarDumper' => __DIR__ . '/..' . '/symfony/var-dumper/VarDumper.php', 'Symfony\\Component\\VarDumper\\VarDumper' => __DIR__ . '/..' . '/symfony/var-dumper/VarDumper.php',
'Symfony\\Component\\Yaml\\Command\\LintCommand' => __DIR__ . '/..' . '/symfony/yaml/Command/LintCommand.php', 'Symfony\\Component\\Yaml\\Command\\LintCommand' => __DIR__ . '/..' . '/symfony/yaml/Command/LintCommand.php',
'Symfony\\Component\\Yaml\\Dumper' => __DIR__ . '/..' . '/symfony/yaml/Dumper.php', 'Symfony\\Component\\Yaml\\Dumper' => __DIR__ . '/..' . '/symfony/yaml/Dumper.php',

File diff suppressed because it is too large Load Diff

View File

@@ -5,7 +5,7 @@
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
'reference' => '47feb7f4259aebc4e9b27cfc8a6eafbbbf0b3686', 'reference' => '9ad341f73a2aa0bd50515d88e1daac99b124238f',
'name' => '__root__', 'name' => '__root__',
'dev' => true, 'dev' => true,
), ),
@@ -16,7 +16,7 @@
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
'reference' => '47feb7f4259aebc4e9b27cfc8a6eafbbbf0b3686', 'reference' => '9ad341f73a2aa0bd50515d88e1daac99b124238f',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'combodo/tcpdf' => array( 'combodo/tcpdf' => array(
@@ -176,210 +176,210 @@
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/cache' => array( 'symfony/cache' => array(
'pretty_version' => 'v3.4.36', 'pretty_version' => 'v3.4.47',
'version' => '3.4.36.0', 'version' => '3.4.47.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/cache', 'install_path' => __DIR__ . '/../symfony/cache',
'aliases' => array(), 'aliases' => array(),
'reference' => '3d9f46a6960fd5cd7f030f86adc5b4b63bcfa4e3', 'reference' => 'a7a14c4832760bd1fbd31be2859ffedc9b6ff813',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/class-loader' => array( 'symfony/class-loader' => array(
'pretty_version' => 'v3.4.36', 'pretty_version' => 'v3.4.47',
'version' => '3.4.36.0', 'version' => '3.4.47.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/class-loader', 'install_path' => __DIR__ . '/../symfony/class-loader',
'aliases' => array(), 'aliases' => array(),
'reference' => 'e212b06996819a2bce026a63da03b7182d05a690', 'reference' => 'a22265a9f3511c0212bf79f54910ca5a77c0e92c',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/config' => array( 'symfony/config' => array(
'pretty_version' => 'v3.4.36', 'pretty_version' => 'v3.4.47',
'version' => '3.4.36.0', 'version' => '3.4.47.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/config', 'install_path' => __DIR__ . '/../symfony/config',
'aliases' => array(), 'aliases' => array(),
'reference' => 'a599a867d0e4a07c342b5f1e656b3915a540ddbe', 'reference' => 'bc6b3fd3930d4b53a60b42fe2ed6fc466b75f03f',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/console' => array( 'symfony/console' => array(
'pretty_version' => 'v3.4.36', 'pretty_version' => 'v3.4.47',
'version' => '3.4.36.0', 'version' => '3.4.47.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/console', 'install_path' => __DIR__ . '/../symfony/console',
'aliases' => array(), 'aliases' => array(),
'reference' => '1ee23b3b659b06c622f2bd2492a229e416eb4586', 'reference' => 'a10b1da6fc93080c180bba7219b5ff5b7518fe81',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/css-selector' => array( 'symfony/css-selector' => array(
'pretty_version' => 'v3.4.36', 'pretty_version' => 'v3.4.47',
'version' => '3.4.36.0', 'version' => '3.4.47.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/css-selector', 'install_path' => __DIR__ . '/../symfony/css-selector',
'aliases' => array(), 'aliases' => array(),
'reference' => 'f819f71ae3ba6f396b4c015bd5895de7d2f1f85f', 'reference' => 'da3d9da2ce0026771f5fe64cb332158f1bd2bc33',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/debug' => array( 'symfony/debug' => array(
'pretty_version' => 'v3.4.36', 'pretty_version' => 'v3.4.47',
'version' => '3.4.36.0', 'version' => '3.4.47.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/debug', 'install_path' => __DIR__ . '/../symfony/debug',
'aliases' => array(), 'aliases' => array(),
'reference' => 'f72e33fdb1170b326e72c3157f0cd456351dd086', 'reference' => 'ab42889de57fdfcfcc0759ab102e2fd4ea72dcae',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/dependency-injection' => array( 'symfony/dependency-injection' => array(
'pretty_version' => 'v3.4.36', 'pretty_version' => 'v3.4.47',
'version' => '3.4.36.0', 'version' => '3.4.47.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/dependency-injection', 'install_path' => __DIR__ . '/../symfony/dependency-injection',
'aliases' => array(), 'aliases' => array(),
'reference' => '0d201916bfb3af939fec3c0c8815ea16c60ac1a2', 'reference' => '51d2a2708c6ceadad84393f8581df1dcf9e5e84b',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/dotenv' => array( 'symfony/dotenv' => array(
'pretty_version' => 'v3.4.36', 'pretty_version' => 'v3.4.47',
'version' => '3.4.36.0', 'version' => '3.4.47.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/dotenv', 'install_path' => __DIR__ . '/../symfony/dotenv',
'aliases' => array(), 'aliases' => array(),
'reference' => 'c7e8e471fea74e868ae797970b383dea89ae548a', 'reference' => '1022723ac4f56b001d99691d96c6025dbf1404f1',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/event-dispatcher' => array( 'symfony/event-dispatcher' => array(
'pretty_version' => 'v3.4.36', 'pretty_version' => 'v3.4.47',
'version' => '3.4.36.0', 'version' => '3.4.47.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/event-dispatcher', 'install_path' => __DIR__ . '/../symfony/event-dispatcher',
'aliases' => array(), 'aliases' => array(),
'reference' => 'f9031c22ec127d4a2450760f81a8677fe8a10177', 'reference' => '31fde73757b6bad247c54597beef974919ec6860',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/filesystem' => array( 'symfony/filesystem' => array(
'pretty_version' => 'v3.4.36', 'pretty_version' => 'v3.4.47',
'version' => '3.4.36.0', 'version' => '3.4.47.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/filesystem', 'install_path' => __DIR__ . '/../symfony/filesystem',
'aliases' => array(), 'aliases' => array(),
'reference' => '00cdad0936d06fab136944bc2342b762b1c3a4a2', 'reference' => 'e58d7841cddfed6e846829040dca2cca0ebbbbb3',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/finder' => array( 'symfony/finder' => array(
'pretty_version' => 'v3.4.36', 'pretty_version' => 'v3.4.47',
'version' => '3.4.36.0', 'version' => '3.4.47.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/finder', 'install_path' => __DIR__ . '/../symfony/finder',
'aliases' => array(), 'aliases' => array(),
'reference' => '290ae21279b37bfd287cdcce640d51204e84afdf', 'reference' => 'b6b6ad3db3edb1b4b1c1896b1975fb684994de6e',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/framework-bundle' => array( 'symfony/framework-bundle' => array(
'pretty_version' => 'v3.4.36', 'pretty_version' => 'v3.4.47',
'version' => '3.4.36.0', 'version' => '3.4.47.0',
'type' => 'symfony-bundle', 'type' => 'symfony-bundle',
'install_path' => __DIR__ . '/../symfony/framework-bundle', 'install_path' => __DIR__ . '/../symfony/framework-bundle',
'aliases' => array(), 'aliases' => array(),
'reference' => '0d61117c7a770da0bd8bbe7ccfa34d8063f272ea', 'reference' => '6c95e747b75ddd2af61152ce93bf87299d15710e',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/http-foundation' => array( 'symfony/http-foundation' => array(
'pretty_version' => 'v3.4.36', 'pretty_version' => 'v3.4.47',
'version' => '3.4.36.0', 'version' => '3.4.47.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/http-foundation', 'install_path' => __DIR__ . '/../symfony/http-foundation',
'aliases' => array(), 'aliases' => array(),
'reference' => 'd2d0cfe8e319d9df44c4cca570710fcf221d4593', 'reference' => 'b9885fcce6fe494201da4f70a9309770e9d13dc8',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/http-kernel' => array( 'symfony/http-kernel' => array(
'pretty_version' => 'v3.4.36', 'pretty_version' => 'v3.4.49',
'version' => '3.4.36.0', 'version' => '3.4.49.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/http-kernel', 'install_path' => __DIR__ . '/../symfony/http-kernel',
'aliases' => array(), 'aliases' => array(),
'reference' => 'c42c8339acb28cfff0fb1786948db4d23d609ff7', 'reference' => '5aa72405f5bd5583c36ed6e756acb17d3f98ac40',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/polyfill-apcu' => array( 'symfony/polyfill-apcu' => array(
'pretty_version' => 'v1.13.1', 'pretty_version' => 'v1.19.0',
'version' => '1.13.1.0', 'version' => '1.19.0.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-apcu', 'install_path' => __DIR__ . '/../symfony/polyfill-apcu',
'aliases' => array(), 'aliases' => array(),
'reference' => 'a8e961c841b9ec52927a87914f8820a1ad8f8116', 'reference' => 'b44b51e7814c23bfbd793a16ead5d7ce43ed23c5',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/polyfill-ctype' => array( 'symfony/polyfill-ctype' => array(
'pretty_version' => 'v1.13.1', 'pretty_version' => 'v1.19.0',
'version' => '1.13.1.0', 'version' => '1.19.0.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-ctype', 'install_path' => __DIR__ . '/../symfony/polyfill-ctype',
'aliases' => array(), 'aliases' => array(),
'reference' => 'f8f0b461be3385e56d6de3dbb5a0df24c0c275e3', 'reference' => 'aed596913b70fae57be53d86faa2e9ef85a2297b',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/polyfill-mbstring' => array( 'symfony/polyfill-mbstring' => array(
'pretty_version' => 'v1.13.1', 'pretty_version' => 'v1.19.0',
'version' => '1.13.1.0', 'version' => '1.19.0.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-mbstring', 'install_path' => __DIR__ . '/../symfony/polyfill-mbstring',
'aliases' => array(), 'aliases' => array(),
'reference' => '7b4aab9743c30be783b73de055d24a39cf4b954f', 'reference' => 'b5f7b932ee6fa802fc792eabd77c4c88084517ce',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/polyfill-php56' => array( 'symfony/polyfill-php56' => array(
'pretty_version' => 'v1.13.1', 'pretty_version' => 'v1.19.0',
'version' => '1.13.1.0', 'version' => '1.19.0.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-php56', 'install_path' => __DIR__ . '/../symfony/polyfill-php56',
'aliases' => array(), 'aliases' => array(),
'reference' => '53dd1cdf3cb986893ccf2b96665b25b3abb384f4', 'reference' => 'ea19621731cbd973a6702cfedef3419768bf3372',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/polyfill-php70' => array( 'symfony/polyfill-php70' => array(
'pretty_version' => 'v1.13.1', 'pretty_version' => 'v1.19.0',
'version' => '1.13.1.0', 'version' => '1.19.0.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-php70', 'install_path' => __DIR__ . '/../symfony/polyfill-php70',
'aliases' => array(), 'aliases' => array(),
'reference' => 'af23c7bb26a73b850840823662dda371484926c4', 'reference' => '3fe414077251a81a1b15b1c709faf5c2fbae3d4e',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/polyfill-util' => array( 'symfony/polyfill-util' => array(
'pretty_version' => 'v1.13.1', 'pretty_version' => 'v1.19.0',
'version' => '1.13.1.0', 'version' => '1.19.0.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-util', 'install_path' => __DIR__ . '/../symfony/polyfill-util',
'aliases' => array(), 'aliases' => array(),
'reference' => '964a67f293b66b95883a5ed918a65354fcd2258f', 'reference' => '8df0c3e6a4b85df9a5c6f3f2f46fba5c5c47058a',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/routing' => array( 'symfony/routing' => array(
'pretty_version' => 'v3.4.36', 'pretty_version' => 'v3.4.47',
'version' => '3.4.36.0', 'version' => '3.4.47.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/routing', 'install_path' => __DIR__ . '/../symfony/routing',
'aliases' => array(), 'aliases' => array(),
'reference' => 'b689ccd48e234ea404806d94b07eeb45f9f6f06a', 'reference' => '3e522ac69cadffd8131cc2b22157fa7662331a6c',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/stopwatch' => array( 'symfony/stopwatch' => array(
'pretty_version' => 'v3.4.36', 'pretty_version' => 'v3.4.47',
'version' => '3.4.36.0', 'version' => '3.4.47.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/stopwatch', 'install_path' => __DIR__ . '/../symfony/stopwatch',
'aliases' => array(), 'aliases' => array(),
'reference' => 'efe0af281ad336bc3b10375c88b117499f1d8494', 'reference' => '298b81faad4ce60e94466226b2abbb8c9bca7462',
'dev_requirement' => true, 'dev_requirement' => true,
), ),
'symfony/twig-bridge' => array( 'symfony/twig-bridge' => array(
'pretty_version' => 'v3.4.36', 'pretty_version' => 'v3.4.47',
'version' => '3.4.36.0', 'version' => '3.4.47.0',
'type' => 'symfony-bridge', 'type' => 'symfony-bridge',
'install_path' => __DIR__ . '/../symfony/twig-bridge', 'install_path' => __DIR__ . '/../symfony/twig-bridge',
'aliases' => array(), 'aliases' => array(),
'reference' => '49b824ddc7f2d250a1f172349cd9a111d63287c0', 'reference' => '090d19d6f1ea5b9e1d79f372785aa5e5c9cd4042',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/twig-bundle' => array( 'symfony/twig-bundle' => array(
@@ -392,30 +392,30 @@
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/var-dumper' => array( 'symfony/var-dumper' => array(
'pretty_version' => 'v3.4.36', 'pretty_version' => 'v3.4.47',
'version' => '3.4.36.0', 'version' => '3.4.47.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/var-dumper', 'install_path' => __DIR__ . '/../symfony/var-dumper',
'aliases' => array(), 'aliases' => array(),
'reference' => '569e261461600810845a8305ca3f64abd3e712c0', 'reference' => '0719f6cf4633a38b2c1585140998579ce23b4b7d',
'dev_requirement' => true, 'dev_requirement' => true,
), ),
'symfony/web-profiler-bundle' => array( 'symfony/web-profiler-bundle' => array(
'pretty_version' => 'v3.4.36', 'pretty_version' => 'v3.4.47',
'version' => '3.4.36.0', 'version' => '3.4.47.0',
'type' => 'symfony-bundle', 'type' => 'symfony-bundle',
'install_path' => __DIR__ . '/../symfony/web-profiler-bundle', 'install_path' => __DIR__ . '/../symfony/web-profiler-bundle',
'aliases' => array(), 'aliases' => array(),
'reference' => '3ae27cf1b2776cd68aa15fdb57089970f78bcf11', 'reference' => 'ccb83b3a508f4a683e44f571f127beebdc315ff9',
'dev_requirement' => true, 'dev_requirement' => true,
), ),
'symfony/yaml' => array( 'symfony/yaml' => array(
'pretty_version' => 'v3.4.36', 'pretty_version' => 'v3.4.47',
'version' => '3.4.36.0', 'version' => '3.4.47.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/yaml', 'install_path' => __DIR__ . '/../symfony/yaml',
'aliases' => array(), 'aliases' => array(),
'reference' => 'dab657db15207879217fc81df4f875947bf68804', 'reference' => '88289caa3c166321883f67fe5130188ebbb47094',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'tecnickcom/tcpdf' => array( 'tecnickcom/tcpdf' => array(

View File

@@ -14,7 +14,6 @@ namespace Symfony\Component\Cache\Adapter;
use Psr\Cache\CacheItemInterface; use Psr\Cache\CacheItemInterface;
use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
use Symfony\Component\Cache\CacheItem; use Symfony\Component\Cache\CacheItem;
use Symfony\Component\Cache\Exception\InvalidArgumentException; use Symfony\Component\Cache\Exception\InvalidArgumentException;
use Symfony\Component\Cache\ResettableInterface; use Symfony\Component\Cache\ResettableInterface;
@@ -46,15 +45,14 @@ abstract class AbstractAdapter implements AdapterInterface, LoggerAwareInterface
{ {
$this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace).static::NS_SEPARATOR; $this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace).static::NS_SEPARATOR;
if (null !== $this->maxIdLength && \strlen($namespace) > $this->maxIdLength - 24) { if (null !== $this->maxIdLength && \strlen($namespace) > $this->maxIdLength - 24) {
throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s")', $this->maxIdLength - 24, \strlen($namespace), $namespace)); throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s").', $this->maxIdLength - 24, \strlen($namespace), $namespace));
} }
$this->createCacheItem = \Closure::bind( $this->createCacheItem = \Closure::bind(
static function ($key, $value, $isHit) use ($defaultLifetime) { static function ($key, $value, $isHit) {
$item = new CacheItem(); $item = new CacheItem();
$item->key = $key; $item->key = $key;
$item->value = $value; $item->value = $value;
$item->isHit = $isHit; $item->isHit = $isHit;
$item->defaultLifetime = $defaultLifetime;
return $item; return $item;
}, },
@@ -63,14 +61,16 @@ abstract class AbstractAdapter implements AdapterInterface, LoggerAwareInterface
); );
$getId = function ($key) { return $this->getId((string) $key); }; $getId = function ($key) { return $this->getId((string) $key); };
$this->mergeByLifetime = \Closure::bind( $this->mergeByLifetime = \Closure::bind(
static function ($deferred, $namespace, &$expiredIds) use ($getId) { static function ($deferred, $namespace, &$expiredIds) use ($getId, $defaultLifetime) {
$byLifetime = []; $byLifetime = [];
$now = time(); $now = time();
$expiredIds = []; $expiredIds = [];
foreach ($deferred as $key => $item) { foreach ($deferred as $key => $item) {
if (null === $item->expiry) { if (null === $item->expiry) {
$byLifetime[0 < $item->defaultLifetime ? $item->defaultLifetime : 0][$getId($key)] = $item->value; $byLifetime[0 < $defaultLifetime ? $defaultLifetime : 0][$getId($key)] = $item->value;
} elseif (0 === $item->expiry) {
$byLifetime[0][$getId($key)] = $item->value;
} elseif ($item->expiry > $now) { } elseif ($item->expiry > $now) {
$byLifetime[$item->expiry - $now][$getId($key)] = $item->value; $byLifetime[$item->expiry - $now][$getId($key)] = $item->value;
} else { } else {
@@ -116,14 +116,12 @@ abstract class AbstractAdapter implements AdapterInterface, LoggerAwareInterface
if (null !== $logger) { if (null !== $logger) {
$fs->setLogger($logger); $fs->setLogger($logger);
} }
if (!self::$apcuSupported) { if (!self::$apcuSupported || (\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) && !filter_var(ini_get('apc.enable_cli'), \FILTER_VALIDATE_BOOLEAN))) {
return $fs; return $fs;
} }
$apcu = new ApcuAdapter($namespace, (int) $defaultLifetime / 5, $version); $apcu = new ApcuAdapter($namespace, (int) $defaultLifetime / 5, $version);
if ('cli' === \PHP_SAPI && !filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) { if (null !== $logger) {
$apcu->setLogger(new NullLogger());
} elseif (null !== $logger) {
$apcu->setLogger($logger); $apcu->setLogger($logger);
} }
@@ -133,7 +131,7 @@ abstract class AbstractAdapter implements AdapterInterface, LoggerAwareInterface
public static function createConnection($dsn, array $options = []) public static function createConnection($dsn, array $options = [])
{ {
if (!\is_string($dsn)) { if (!\is_string($dsn)) {
throw new InvalidArgumentException(sprintf('The %s() method expect argument #1 to be string, %s given.', __METHOD__, \gettype($dsn))); throw new InvalidArgumentException(sprintf('The "%s()" method expect argument #1 to be string, "%s" given.', __METHOD__, \gettype($dsn)));
} }
if (0 === strpos($dsn, 'redis://')) { if (0 === strpos($dsn, 'redis://')) {
return RedisAdapter::createConnection($dsn, $options); return RedisAdapter::createConnection($dsn, $options);
@@ -142,7 +140,7 @@ abstract class AbstractAdapter implements AdapterInterface, LoggerAwareInterface
return MemcachedAdapter::createConnection($dsn, $options); return MemcachedAdapter::createConnection($dsn, $options);
} }
throw new InvalidArgumentException(sprintf('Unsupported DSN: %s.', $dsn)); throw new InvalidArgumentException(sprintf('Unsupported DSN: "%s".', $dsn));
} }
/** /**

View File

@@ -25,6 +25,7 @@ class ArrayAdapter implements AdapterInterface, LoggerAwareInterface, Resettable
use ArrayTrait; use ArrayTrait;
private $createCacheItem; private $createCacheItem;
private $defaultLifetime;
/** /**
* @param int $defaultLifetime * @param int $defaultLifetime
@@ -32,14 +33,14 @@ class ArrayAdapter implements AdapterInterface, LoggerAwareInterface, Resettable
*/ */
public function __construct($defaultLifetime = 0, $storeSerialized = true) public function __construct($defaultLifetime = 0, $storeSerialized = true)
{ {
$this->defaultLifetime = $defaultLifetime;
$this->storeSerialized = $storeSerialized; $this->storeSerialized = $storeSerialized;
$this->createCacheItem = \Closure::bind( $this->createCacheItem = \Closure::bind(
static function ($key, $value, $isHit) use ($defaultLifetime) { static function ($key, $value, $isHit) {
$item = new CacheItem(); $item = new CacheItem();
$item->key = $key; $item->key = $key;
$item->value = $value; $item->value = $value;
$item->isHit = $isHit; $item->isHit = $isHit;
$item->defaultLifetime = $defaultLifetime;
return $item; return $item;
}, },
@@ -112,6 +113,10 @@ class ArrayAdapter implements AdapterInterface, LoggerAwareInterface, Resettable
$value = $item["\0*\0value"]; $value = $item["\0*\0value"];
$expiry = $item["\0*\0expiry"]; $expiry = $item["\0*\0expiry"];
if (0 === $expiry) {
$expiry = \PHP_INT_MAX;
}
if (null !== $expiry && $expiry <= time()) { if (null !== $expiry && $expiry <= time()) {
$this->deleteItem($key); $this->deleteItem($key);
@@ -127,12 +132,12 @@ class ArrayAdapter implements AdapterInterface, LoggerAwareInterface, Resettable
return false; return false;
} }
} }
if (null === $expiry && 0 < $item["\0*\0defaultLifetime"]) { if (null === $expiry && 0 < $this->defaultLifetime) {
$expiry = time() + $item["\0*\0defaultLifetime"]; $expiry = time() + $this->defaultLifetime;
} }
$this->values[$key] = $value; $this->values[$key] = $value;
$this->expiries[$key] = null !== $expiry ? $expiry : PHP_INT_MAX; $this->expiries[$key] = null !== $expiry ? $expiry : \PHP_INT_MAX;
return true; return true;
} }

View File

@@ -46,6 +46,9 @@ class ChainAdapter implements AdapterInterface, PruneableInterface, ResettableIn
if (!$adapter instanceof CacheItemPoolInterface) { if (!$adapter instanceof CacheItemPoolInterface) {
throw new InvalidArgumentException(sprintf('The class "%s" does not implement the "%s" interface.', \get_class($adapter), CacheItemPoolInterface::class)); throw new InvalidArgumentException(sprintf('The class "%s" does not implement the "%s" interface.', \get_class($adapter), CacheItemPoolInterface::class));
} }
if (\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) && $adapter instanceof ApcuAdapter && !filter_var(ini_get('apc.enable_cli'), \FILTER_VALIDATE_BOOLEAN)) {
continue; // skip putting APCu in the chain when the backend is disabled
}
if ($adapter instanceof AdapterInterface) { if ($adapter instanceof AdapterInterface) {
$this->adapters[] = $adapter; $this->adapters[] = $adapter;
@@ -58,14 +61,10 @@ class ChainAdapter implements AdapterInterface, PruneableInterface, ResettableIn
$this->syncItem = \Closure::bind( $this->syncItem = \Closure::bind(
static function ($sourceItem, $item) use ($defaultLifetime) { static function ($sourceItem, $item) use ($defaultLifetime) {
$item->value = $sourceItem->value; $item->value = $sourceItem->value;
$item->expiry = $sourceItem->expiry;
$item->isHit = $sourceItem->isHit; $item->isHit = $sourceItem->isHit;
if (0 < $sourceItem->defaultLifetime && $sourceItem->defaultLifetime < $defaultLifetime) { if (0 < $defaultLifetime) {
$defaultLifetime = $sourceItem->defaultLifetime; $item->expiresAfter($defaultLifetime);
}
if (0 < $defaultLifetime && ($item->defaultLifetime <= 0 || $defaultLifetime < $item->defaultLifetime)) {
$item->defaultLifetime = $defaultLifetime;
} }
return $item; return $item;

View File

@@ -40,7 +40,7 @@ class PhpArrayAdapter implements AdapterInterface, PruneableInterface, Resettabl
{ {
$this->file = $file; $this->file = $file;
$this->pool = $fallbackPool; $this->pool = $fallbackPool;
$this->zendDetectUnicode = filter_var(ini_get('zend.detect_unicode'), FILTER_VALIDATE_BOOLEAN); $this->zendDetectUnicode = filter_var(ini_get('zend.detect_unicode'), \FILTER_VALIDATE_BOOLEAN);
$this->createCacheItem = \Closure::bind( $this->createCacheItem = \Closure::bind(
static function ($key, $value, $isHit) { static function ($key, $value, $isHit) {
$item = new CacheItem(); $item = new CacheItem();
@@ -61,14 +61,13 @@ class PhpArrayAdapter implements AdapterInterface, PruneableInterface, Resettabl
* fallback pool with this adapter only if the current PHP version is supported. * fallback pool with this adapter only if the current PHP version is supported.
* *
* @param string $file The PHP file were values are cached * @param string $file The PHP file were values are cached
* @param CacheItemPoolInterface $fallbackPool Fallback for old PHP versions or opcache disabled * @param CacheItemPoolInterface $fallbackPool A pool to fallback on when an item is not hit
* *
* @return CacheItemPoolInterface * @return CacheItemPoolInterface
*/ */
public static function create($file, CacheItemPoolInterface $fallbackPool) public static function create($file, CacheItemPoolInterface $fallbackPool)
{ {
// Shared memory is available in PHP 7.0+ with OPCache enabled and in HHVM if (\PHP_VERSION_ID >= 70000) {
if ((\PHP_VERSION_ID >= 70000 && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN)) || \defined('HHVM_VERSION')) {
if (!$fallbackPool instanceof AdapterInterface) { if (!$fallbackPool instanceof AdapterInterface) {
$fallbackPool = new ProxyAdapter($fallbackPool); $fallbackPool = new ProxyAdapter($fallbackPool);
} }
@@ -276,10 +275,17 @@ class PhpArrayAdapter implements AdapterInterface, PruneableInterface, Resettabl
'function' => 'spl_autoload_call', 'function' => 'spl_autoload_call',
'args' => [$class], 'args' => [$class],
]; ];
$i = 1 + array_search($autoloadFrame, $trace, true);
if (isset($trace[$i]['function']) && !isset($trace[$i]['class'])) { if (\PHP_VERSION_ID >= 80000 && isset($trace[1])) {
switch ($trace[$i]['function']) { $callerFrame = $trace[1];
} elseif (false !== $i = array_search($autoloadFrame, $trace, true)) {
$callerFrame = $trace[++$i];
} else {
throw $e;
}
if (isset($callerFrame['function']) && !isset($callerFrame['class'])) {
switch ($callerFrame['function']) {
case 'get_class_methods': case 'get_class_methods':
case 'get_class_vars': case 'get_class_vars':
case 'get_parent_class': case 'get_parent_class':

View File

@@ -29,13 +29,13 @@ class PhpFilesAdapter extends AbstractAdapter implements PruneableInterface
public function __construct($namespace = '', $defaultLifetime = 0, $directory = null) public function __construct($namespace = '', $defaultLifetime = 0, $directory = null)
{ {
if (!static::isSupported()) { if (!static::isSupported()) {
throw new CacheException('OPcache is not enabled'); throw new CacheException('OPcache is not enabled.');
} }
parent::__construct('', $defaultLifetime); parent::__construct('', $defaultLifetime);
$this->init($namespace, $directory); $this->init($namespace, $directory);
$e = new \Exception(); $e = new \Exception();
$this->includeHandler = function () use ($e) { throw $e; }; $this->includeHandler = function () use ($e) { throw $e; };
$this->zendDetectUnicode = filter_var(ini_get('zend.detect_unicode'), FILTER_VALIDATE_BOOLEAN); $this->zendDetectUnicode = filter_var(ini_get('zend.detect_unicode'), \FILTER_VALIDATE_BOOLEAN);
} }
} }

View File

@@ -29,6 +29,7 @@ class ProxyAdapter implements AdapterInterface, PruneableInterface, ResettableIn
private $namespaceLen; private $namespaceLen;
private $createCacheItem; private $createCacheItem;
private $poolHash; private $poolHash;
private $defaultLifetime;
/** /**
* @param string $namespace * @param string $namespace
@@ -40,11 +41,11 @@ class ProxyAdapter implements AdapterInterface, PruneableInterface, ResettableIn
$this->poolHash = $poolHash = spl_object_hash($pool); $this->poolHash = $poolHash = spl_object_hash($pool);
$this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace); $this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace);
$this->namespaceLen = \strlen($namespace); $this->namespaceLen = \strlen($namespace);
$this->defaultLifetime = $defaultLifetime;
$this->createCacheItem = \Closure::bind( $this->createCacheItem = \Closure::bind(
static function ($key, $innerItem) use ($defaultLifetime, $poolHash) { static function ($key, $innerItem) use ($poolHash) {
$item = new CacheItem(); $item = new CacheItem();
$item->key = $key; $item->key = $key;
$item->defaultLifetime = $defaultLifetime;
$item->poolHash = $poolHash; $item->poolHash = $poolHash;
if (null !== $innerItem) { if (null !== $innerItem) {
@@ -155,8 +156,8 @@ class ProxyAdapter implements AdapterInterface, PruneableInterface, ResettableIn
} }
$item = (array) $item; $item = (array) $item;
$expiry = $item["\0*\0expiry"]; $expiry = $item["\0*\0expiry"];
if (null === $expiry && 0 < $item["\0*\0defaultLifetime"]) { if (null === $expiry && 0 < $this->defaultLifetime) {
$expiry = time() + $item["\0*\0defaultLifetime"]; $expiry = time() + $this->defaultLifetime;
} }
if ($item["\0*\0poolHash"] === $this->poolHash && $item["\0*\0innerItem"]) { if ($item["\0*\0poolHash"] === $this->poolHash && $item["\0*\0innerItem"]) {

View File

@@ -46,7 +46,6 @@ class TagAwareAdapter implements TagAwareAdapterInterface, PruneableInterface, R
$item = new CacheItem(); $item = new CacheItem();
$item->key = $key; $item->key = $key;
$item->value = $value; $item->value = $value;
$item->defaultLifetime = $protoItem->defaultLifetime;
$item->expiry = $protoItem->expiry; $item->expiry = $protoItem->expiry;
$item->poolHash = $protoItem->poolHash; $item->poolHash = $protoItem->poolHash;
@@ -90,8 +89,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, PruneableInterface, R
$this->invalidateTags = \Closure::bind( $this->invalidateTags = \Closure::bind(
static function (AdapterInterface $tagsAdapter, array $tags) { static function (AdapterInterface $tagsAdapter, array $tags) {
foreach ($tags as $v) { foreach ($tags as $v) {
$v->defaultLifetime = 0; $v->expiry = 0;
$v->expiry = null;
$tagsAdapter->saveDeferred($v); $tagsAdapter->saveDeferred($v);
} }

View File

@@ -191,15 +191,11 @@ class TraceableAdapter implements AdapterInterface, PruneableInterface, Resettab
*/ */
public function reset() public function reset()
{ {
if (!$this->pool instanceof ResettableInterface) { if ($this->pool instanceof ResettableInterface) {
return;
}
$event = $this->start(__FUNCTION__);
try {
$this->pool->reset(); $this->pool->reset();
} finally {
$event->end = microtime(true);
} }
$this->clearCalls();
} }
public function getCalls() public function getCalls()

View File

@@ -24,7 +24,6 @@ final class CacheItem implements CacheItemInterface
protected $value; protected $value;
protected $isHit = false; protected $isHit = false;
protected $expiry; protected $expiry;
protected $defaultLifetime;
protected $tags = []; protected $tags = [];
protected $prevTags = []; protected $prevTags = [];
protected $innerItem; protected $innerItem;
@@ -74,11 +73,11 @@ final class CacheItem implements CacheItemInterface
public function expiresAt($expiration) public function expiresAt($expiration)
{ {
if (null === $expiration) { if (null === $expiration) {
$this->expiry = $this->defaultLifetime > 0 ? time() + $this->defaultLifetime : null; $this->expiry = null;
} elseif ($expiration instanceof \DateTimeInterface) { } elseif ($expiration instanceof \DateTimeInterface) {
$this->expiry = (int) $expiration->format('U'); $this->expiry = (int) $expiration->format('U');
} else { } else {
throw new InvalidArgumentException(sprintf('Expiration date must implement DateTimeInterface or be null, "%s" given', \is_object($expiration) ? \get_class($expiration) : \gettype($expiration))); throw new InvalidArgumentException(sprintf('Expiration date must implement DateTimeInterface or be null, "%s" given.', \is_object($expiration) ? \get_class($expiration) : \gettype($expiration)));
} }
return $this; return $this;
@@ -92,13 +91,13 @@ final class CacheItem implements CacheItemInterface
public function expiresAfter($time) public function expiresAfter($time)
{ {
if (null === $time) { if (null === $time) {
$this->expiry = $this->defaultLifetime > 0 ? time() + $this->defaultLifetime : null; $this->expiry = null;
} elseif ($time instanceof \DateInterval) { } elseif ($time instanceof \DateInterval) {
$this->expiry = (int) \DateTime::createFromFormat('U', time())->add($time)->format('U'); $this->expiry = (int) \DateTime::createFromFormat('U', time())->add($time)->format('U');
} elseif (\is_int($time)) { } elseif (\is_int($time)) {
$this->expiry = $time + time(); $this->expiry = $time + time();
} else { } else {
throw new InvalidArgumentException(sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given', \is_object($time) ? \get_class($time) : \gettype($time))); throw new InvalidArgumentException(sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given.', \is_object($time) ? \get_class($time) : \gettype($time)));
} }
return $this; return $this;
@@ -120,16 +119,16 @@ final class CacheItem implements CacheItemInterface
} }
foreach ($tags as $tag) { foreach ($tags as $tag) {
if (!\is_string($tag)) { if (!\is_string($tag)) {
throw new InvalidArgumentException(sprintf('Cache tag must be string, "%s" given', \is_object($tag) ? \get_class($tag) : \gettype($tag))); throw new InvalidArgumentException(sprintf('Cache tag must be string, "%s" given.', \is_object($tag) ? \get_class($tag) : \gettype($tag)));
} }
if (isset($this->tags[$tag])) { if (isset($this->tags[$tag])) {
continue; continue;
} }
if ('' === $tag) { if ('' === $tag) {
throw new InvalidArgumentException('Cache tag length must be greater than zero'); throw new InvalidArgumentException('Cache tag length must be greater than zero.');
} }
if (false !== strpbrk($tag, '{}()/\@:')) { if (false !== strpbrk($tag, '{}()/\@:')) {
throw new InvalidArgumentException(sprintf('Cache tag "%s" contains reserved characters {}()/\@:', $tag)); throw new InvalidArgumentException(sprintf('Cache tag "%s" contains reserved characters {}()/\@:.', $tag));
} }
$this->tags[$tag] = $tag; $this->tags[$tag] = $tag;
} }
@@ -159,13 +158,13 @@ final class CacheItem implements CacheItemInterface
public static function validateKey($key) public static function validateKey($key)
{ {
if (!\is_string($key)) { if (!\is_string($key)) {
throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given', \is_object($key) ? \get_class($key) : \gettype($key))); throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', \is_object($key) ? \get_class($key) : \gettype($key)));
} }
if ('' === $key) { if ('' === $key) {
throw new InvalidArgumentException('Cache key length must be greater than zero'); throw new InvalidArgumentException('Cache key length must be greater than zero.');
} }
if (false !== strpbrk($key, '{}()/\@:')) { if (false !== strpbrk($key, '{}()/\@:')) {
throw new InvalidArgumentException(sprintf('Cache key "%s" contains reserved characters {}()/\@:', $key)); throw new InvalidArgumentException(sprintf('Cache key "%s" contains reserved characters {}()/\@:.', $key));
} }
return $key; return $key;
@@ -187,7 +186,7 @@ final class CacheItem implements CacheItemInterface
$replace['{'.$k.'}'] = $v; $replace['{'.$k.'}'] = $v;
} }
} }
@trigger_error(strtr($message, $replace), E_USER_WARNING); @trigger_error(strtr($message, $replace), \E_USER_WARNING);
} }
} }
} }

View File

@@ -1,4 +1,4 @@
Copyright (c) 2016-2019 Fabien Potencier Copyright (c) 2016-2020 Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@@ -45,7 +45,7 @@ abstract class AbstractCache implements CacheInterface, LoggerAwareInterface, Re
$this->defaultLifetime = max(0, (int) $defaultLifetime); $this->defaultLifetime = max(0, (int) $defaultLifetime);
$this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace).':'; $this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace).':';
if (null !== $this->maxIdLength && \strlen($namespace) > $this->maxIdLength - 24) { if (null !== $this->maxIdLength && \strlen($namespace) > $this->maxIdLength - 24) {
throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s")', $this->maxIdLength - 24, \strlen($namespace), $namespace)); throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s").', $this->maxIdLength - 24, \strlen($namespace), $namespace));
} }
} }
@@ -85,7 +85,7 @@ abstract class AbstractCache implements CacheInterface, LoggerAwareInterface, Re
if ($keys instanceof \Traversable) { if ($keys instanceof \Traversable) {
$keys = iterator_to_array($keys, false); $keys = iterator_to_array($keys, false);
} elseif (!\is_array($keys)) { } elseif (!\is_array($keys)) {
throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys))); throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys)));
} }
$ids = []; $ids = [];
@@ -109,7 +109,7 @@ abstract class AbstractCache implements CacheInterface, LoggerAwareInterface, Re
public function setMultiple($values, $ttl = null) public function setMultiple($values, $ttl = null)
{ {
if (!\is_array($values) && !$values instanceof \Traversable) { if (!\is_array($values) && !$values instanceof \Traversable) {
throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given', \is_object($values) ? \get_class($values) : \gettype($values))); throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given.', \is_object($values) ? \get_class($values) : \gettype($values)));
} }
$valuesById = []; $valuesById = [];
@@ -147,7 +147,7 @@ abstract class AbstractCache implements CacheInterface, LoggerAwareInterface, Re
if ($keys instanceof \Traversable) { if ($keys instanceof \Traversable) {
$keys = iterator_to_array($keys, false); $keys = iterator_to_array($keys, false);
} elseif (!\is_array($keys)) { } elseif (!\is_array($keys)) {
throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys))); throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys)));
} }
return $this->deleteItems($keys); return $this->deleteItems($keys);
@@ -165,7 +165,7 @@ abstract class AbstractCache implements CacheInterface, LoggerAwareInterface, Re
return 0 < $ttl ? $ttl : false; return 0 < $ttl ? $ttl : false;
} }
throw new InvalidArgumentException(sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given', \is_object($ttl) ? \get_class($ttl) : \gettype($ttl))); throw new InvalidArgumentException(sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given.', \is_object($ttl) ? \get_class($ttl) : \gettype($ttl)));
} }
private function generateValues($values, &$keys, $default) private function generateValues($values, &$keys, $default)

View File

@@ -58,7 +58,7 @@ class ArrayCache implements CacheInterface, LoggerAwareInterface, ResettableInte
if ($keys instanceof \Traversable) { if ($keys instanceof \Traversable) {
$keys = iterator_to_array($keys, false); $keys = iterator_to_array($keys, false);
} elseif (!\is_array($keys)) { } elseif (!\is_array($keys)) {
throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys))); throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys)));
} }
foreach ($keys as $key) { foreach ($keys as $key) {
CacheItem::validateKey($key); CacheItem::validateKey($key);
@@ -73,7 +73,7 @@ class ArrayCache implements CacheInterface, LoggerAwareInterface, ResettableInte
public function deleteMultiple($keys) public function deleteMultiple($keys)
{ {
if (!\is_array($keys) && !$keys instanceof \Traversable) { if (!\is_array($keys) && !$keys instanceof \Traversable) {
throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys))); throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys)));
} }
foreach ($keys as $key) { foreach ($keys as $key) {
$this->delete($key); $this->delete($key);
@@ -98,7 +98,7 @@ class ArrayCache implements CacheInterface, LoggerAwareInterface, ResettableInte
public function setMultiple($values, $ttl = null) public function setMultiple($values, $ttl = null)
{ {
if (!\is_array($values) && !$values instanceof \Traversable) { if (!\is_array($values) && !$values instanceof \Traversable) {
throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given', \is_object($values) ? \get_class($values) : \gettype($values))); throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given.', \is_object($values) ? \get_class($values) : \gettype($values)));
} }
$valuesArray = []; $valuesArray = [];
@@ -121,7 +121,7 @@ class ArrayCache implements CacheInterface, LoggerAwareInterface, ResettableInte
} }
} }
} }
$expiry = 0 < $ttl ? time() + $ttl : PHP_INT_MAX; $expiry = 0 < $ttl ? time() + $ttl : \PHP_INT_MAX;
foreach ($valuesArray as $key => $value) { foreach ($valuesArray as $key => $value) {
$this->values[$key] = $value; $this->values[$key] = $value;
@@ -143,6 +143,6 @@ class ArrayCache implements CacheInterface, LoggerAwareInterface, ResettableInte
return 0 < $ttl ? $ttl : false; return 0 < $ttl ? $ttl : false;
} }
throw new InvalidArgumentException(sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given', \is_object($ttl) ? \get_class($ttl) : \gettype($ttl))); throw new InvalidArgumentException(sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given.', \is_object($ttl) ? \get_class($ttl) : \gettype($ttl)));
} }
} }

View File

@@ -36,7 +36,7 @@ class PhpArrayCache implements CacheInterface, PruneableInterface, ResettableInt
{ {
$this->file = $file; $this->file = $file;
$this->pool = $fallbackPool; $this->pool = $fallbackPool;
$this->zendDetectUnicode = filter_var(ini_get('zend.detect_unicode'), FILTER_VALIDATE_BOOLEAN); $this->zendDetectUnicode = filter_var(ini_get('zend.detect_unicode'), \FILTER_VALIDATE_BOOLEAN);
} }
/** /**
@@ -44,14 +44,14 @@ class PhpArrayCache implements CacheInterface, PruneableInterface, ResettableInt
* stores arrays in its latest versions. This factory method decorates the given * stores arrays in its latest versions. This factory method decorates the given
* fallback pool with this adapter only if the current PHP version is supported. * fallback pool with this adapter only if the current PHP version is supported.
* *
* @param string $file The PHP file were values are cached * @param string $file The PHP file were values are cached
* @param CacheInterface $fallbackPool A pool to fallback on when an item is not hit
* *
* @return CacheInterface * @return CacheInterface
*/ */
public static function create($file, CacheInterface $fallbackPool) public static function create($file, CacheInterface $fallbackPool)
{ {
// Shared memory is available in PHP 7.0+ with OPCache enabled and in HHVM if (\PHP_VERSION_ID >= 70000) {
if ((\PHP_VERSION_ID >= 70000 && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN)) || \defined('HHVM_VERSION')) {
return new static($file, $fallbackPool); return new static($file, $fallbackPool);
} }
@@ -100,7 +100,7 @@ class PhpArrayCache implements CacheInterface, PruneableInterface, ResettableInt
if ($keys instanceof \Traversable) { if ($keys instanceof \Traversable) {
$keys = iterator_to_array($keys, false); $keys = iterator_to_array($keys, false);
} elseif (!\is_array($keys)) { } elseif (!\is_array($keys)) {
throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys))); throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys)));
} }
foreach ($keys as $key) { foreach ($keys as $key) {
if (!\is_string($key)) { if (!\is_string($key)) {
@@ -150,7 +150,7 @@ class PhpArrayCache implements CacheInterface, PruneableInterface, ResettableInt
public function deleteMultiple($keys) public function deleteMultiple($keys)
{ {
if (!\is_array($keys) && !$keys instanceof \Traversable) { if (!\is_array($keys) && !$keys instanceof \Traversable) {
throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys))); throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys)));
} }
$deleted = true; $deleted = true;
@@ -199,7 +199,7 @@ class PhpArrayCache implements CacheInterface, PruneableInterface, ResettableInt
public function setMultiple($values, $ttl = null) public function setMultiple($values, $ttl = null)
{ {
if (!\is_array($values) && !$values instanceof \Traversable) { if (!\is_array($values) && !$values instanceof \Traversable) {
throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given', \is_object($values) ? \get_class($values) : \gettype($values))); throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given.', \is_object($values) ? \get_class($values) : \gettype($values)));
} }
$saved = true; $saved = true;

View File

@@ -29,13 +29,13 @@ class PhpFilesCache extends AbstractCache implements PruneableInterface
public function __construct($namespace = '', $defaultLifetime = 0, $directory = null) public function __construct($namespace = '', $defaultLifetime = 0, $directory = null)
{ {
if (!static::isSupported()) { if (!static::isSupported()) {
throw new CacheException('OPcache is not enabled'); throw new CacheException('OPcache is not enabled.');
} }
parent::__construct('', $defaultLifetime); parent::__construct('', $defaultLifetime);
$this->init($namespace, $directory); $this->init($namespace, $directory);
$e = new \Exception(); $e = new \Exception();
$this->includeHandler = function () use ($e) { throw $e; }; $this->includeHandler = function () use ($e) { throw $e; };
$this->zendDetectUnicode = filter_var(ini_get('zend.detect_unicode'), FILTER_VALIDATE_BOOLEAN); $this->zendDetectUnicode = filter_var(ini_get('zend.detect_unicode'), \FILTER_VALIDATE_BOOLEAN);
} }
} }

View File

@@ -135,7 +135,7 @@ class Psr6Cache implements CacheInterface, PruneableInterface, ResettableInterfa
if ($keys instanceof \Traversable) { if ($keys instanceof \Traversable) {
$keys = iterator_to_array($keys, false); $keys = iterator_to_array($keys, false);
} elseif (!\is_array($keys)) { } elseif (!\is_array($keys)) {
throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys))); throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys)));
} }
try { try {
@@ -161,7 +161,7 @@ class Psr6Cache implements CacheInterface, PruneableInterface, ResettableInterfa
{ {
$valuesIsArray = \is_array($values); $valuesIsArray = \is_array($values);
if (!$valuesIsArray && !$values instanceof \Traversable) { if (!$valuesIsArray && !$values instanceof \Traversable) {
throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given', \is_object($values) ? \get_class($values) : \gettype($values))); throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given.', \is_object($values) ? \get_class($values) : \gettype($values)));
} }
$items = []; $items = [];
@@ -213,7 +213,7 @@ class Psr6Cache implements CacheInterface, PruneableInterface, ResettableInterfa
if ($keys instanceof \Traversable) { if ($keys instanceof \Traversable) {
$keys = iterator_to_array($keys, false); $keys = iterator_to_array($keys, false);
} elseif (!\is_array($keys)) { } elseif (!\is_array($keys)) {
throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys))); throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys)));
} }
try { try {

View File

@@ -222,9 +222,9 @@ trait AbstractTrait
if (false !== $value = unserialize($value)) { if (false !== $value = unserialize($value)) {
return $value; return $value;
} }
throw new \DomainException('Failed to unserialize cached value'); throw new \DomainException('Failed to unserialize cached value.');
} catch (\Error $e) { } catch (\Error $e) {
throw new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine()); throw new \ErrorException($e->getMessage(), $e->getCode(), \E_ERROR, $e->getFile(), $e->getLine());
} finally { } finally {
ini_set('unserialize_callback_func', $unserializeCallbackHandler); ini_set('unserialize_callback_func', $unserializeCallbackHandler);
} }

View File

@@ -23,13 +23,13 @@ trait ApcuTrait
{ {
public static function isSupported() public static function isSupported()
{ {
return \function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN); return \function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), \FILTER_VALIDATE_BOOLEAN);
} }
private function init($namespace, $defaultLifetime, $version) private function init($namespace, $defaultLifetime, $version)
{ {
if (!static::isSupported()) { if (!static::isSupported()) {
throw new CacheException('APCu is not enabled'); throw new CacheException('APCu is not enabled.');
} }
if ('cli' === \PHP_SAPI) { if ('cli' === \PHP_SAPI) {
ini_set('apc.use_request_time', 0); ini_set('apc.use_request_time', 0);
@@ -58,7 +58,7 @@ trait ApcuTrait
} }
} }
} catch (\Error $e) { } catch (\Error $e) {
throw new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine()); throw new \ErrorException($e->getMessage(), $e->getCode(), \E_ERROR, $e->getFile(), $e->getLine());
} }
} }
@@ -75,8 +75,8 @@ trait ApcuTrait
*/ */
protected function doClear($namespace) protected function doClear($namespace)
{ {
return isset($namespace[0]) && class_exists('APCuIterator', false) && ('cli' !== \PHP_SAPI || filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) return isset($namespace[0]) && class_exists('APCuIterator', false) && ('cli' !== \PHP_SAPI || filter_var(ini_get('apc.enable_cli'), \FILTER_VALIDATE_BOOLEAN))
? apcu_delete(new \APCuIterator(sprintf('/^%s/', preg_quote($namespace, '/')), APC_ITER_KEY)) ? apcu_delete(new \APCuIterator(sprintf('/^%s/', preg_quote($namespace, '/')), \APC_ITER_KEY))
: apcu_clear_cache(); : apcu_clear_cache();
} }

View File

@@ -45,7 +45,7 @@ trait DoctrineTrait
case 'unserialize': case 'unserialize':
case 'apcu_fetch': case 'apcu_fetch':
case 'apc_fetch': case 'apc_fetch':
throw new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine()); throw new \ErrorException($e->getMessage(), $e->getCode(), \E_ERROR, $e->getFile(), $e->getLine());
} }
} }

View File

@@ -42,7 +42,7 @@ trait FilesystemCommonTrait
$directory .= \DIRECTORY_SEPARATOR; $directory .= \DIRECTORY_SEPARATOR;
// On Windows the whole path is limited to 258 chars // On Windows the whole path is limited to 258 chars
if ('\\' === \DIRECTORY_SEPARATOR && \strlen($directory) > 234) { if ('\\' === \DIRECTORY_SEPARATOR && \strlen($directory) > 234) {
throw new InvalidArgumentException(sprintf('Cache directory too long (%s)', $directory)); throw new InvalidArgumentException(sprintf('Cache directory too long (%s).', $directory));
} }
$this->directory = $directory; $this->directory = $directory;

View File

@@ -99,7 +99,7 @@ trait FilesystemTrait
} }
if (!$ok && !is_writable($this->directory)) { if (!$ok && !is_writable($this->directory)) {
throw new CacheException(sprintf('Cache directory is not writable (%s)', $this->directory)); throw new CacheException(sprintf('Cache directory is not writable (%s).', $this->directory));
} }
return $ok; return $ok;

View File

@@ -40,7 +40,7 @@ trait MemcachedTrait
private function init(\Memcached $client, $namespace, $defaultLifetime) private function init(\Memcached $client, $namespace, $defaultLifetime)
{ {
if (!static::isSupported()) { if (!static::isSupported()) {
throw new CacheException('Memcached >= 2.2.0 is required'); throw new CacheException('Memcached >= 2.2.0 is required.');
} }
if ('Memcached' === \get_class($client)) { if ('Memcached' === \get_class($client)) {
$opt = $client->getOption(\Memcached::OPT_SERIALIZER); $opt = $client->getOption(\Memcached::OPT_SERIALIZER);
@@ -78,10 +78,10 @@ trait MemcachedTrait
if (\is_string($servers)) { if (\is_string($servers)) {
$servers = [$servers]; $servers = [$servers];
} elseif (!\is_array($servers)) { } elseif (!\is_array($servers)) {
throw new InvalidArgumentException(sprintf('MemcachedAdapter::createClient() expects array or string as first argument, %s given.', \gettype($servers))); throw new InvalidArgumentException(sprintf('MemcachedAdapter::createClient() expects array or string as first argument, "%s" given.', \gettype($servers)));
} }
if (!static::isSupported()) { if (!static::isSupported()) {
throw new CacheException('Memcached >= 2.2.0 is required'); throw new CacheException('Memcached >= 2.2.0 is required.');
} }
set_error_handler(function ($type, $msg, $file, $line) { throw new \ErrorException($msg, 0, $type, $file, $line); }); set_error_handler(function ($type, $msg, $file, $line) { throw new \ErrorException($msg, 0, $type, $file, $line); });
try { try {
@@ -96,7 +96,7 @@ trait MemcachedTrait
continue; continue;
} }
if (0 !== strpos($dsn, 'memcached://')) { if (0 !== strpos($dsn, 'memcached://')) {
throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: %s does not start with "memcached://"', $dsn)); throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: "%s" does not start with "memcached://".', $dsn));
} }
$params = preg_replace_callback('#^memcached://(?:([^@]*+)@)?#', function ($m) use (&$username, &$password) { $params = preg_replace_callback('#^memcached://(?:([^@]*+)@)?#', function ($m) use (&$username, &$password) {
if (!empty($m[1])) { if (!empty($m[1])) {
@@ -106,10 +106,10 @@ trait MemcachedTrait
return 'file://'; return 'file://';
}, $dsn); }, $dsn);
if (false === $params = parse_url($params)) { if (false === $params = parse_url($params)) {
throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: %s', $dsn)); throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: "%s".', $dsn));
} }
if (!isset($params['host']) && !isset($params['path'])) { if (!isset($params['host']) && !isset($params['path'])) {
throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: %s', $dsn)); throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: "%s".', $dsn));
} }
if (isset($params['path']) && preg_match('#/(\d+)$#', $params['path'], $m)) { if (isset($params['path']) && preg_match('#/(\d+)$#', $params['path'], $m)) {
$params['weight'] = $m[1]; $params['weight'] = $m[1];
@@ -131,7 +131,7 @@ trait MemcachedTrait
// set client's options // set client's options
unset($options['persistent_id'], $options['username'], $options['password'], $options['weight'], $options['lazy']); unset($options['persistent_id'], $options['username'], $options['password'], $options['weight'], $options['lazy']);
$options = array_change_key_case($options, CASE_UPPER); $options = array_change_key_case($options, \CASE_UPPER);
$client->setOption(\Memcached::OPT_BINARY_PROTOCOL, true); $client->setOption(\Memcached::OPT_BINARY_PROTOCOL, true);
$client->setOption(\Memcached::OPT_NO_BLOCK, true); $client->setOption(\Memcached::OPT_NO_BLOCK, true);
$client->setOption(\Memcached::OPT_TCP_NODELAY, true); $client->setOption(\Memcached::OPT_TCP_NODELAY, true);
@@ -225,7 +225,7 @@ trait MemcachedTrait
return $result; return $result;
} catch (\Error $e) { } catch (\Error $e) {
throw new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine()); throw new \ErrorException($e->getMessage(), $e->getCode(), \E_ERROR, $e->getFile(), $e->getLine());
} finally { } finally {
ini_set('unserialize_callback_func', $unserializeCallbackHandler); ini_set('unserialize_callback_func', $unserializeCallbackHandler);
} }
@@ -272,7 +272,7 @@ trait MemcachedTrait
return $result; return $result;
} }
throw new CacheException(sprintf('MemcachedAdapter client error: %s.', strtolower($this->client->getResultMessage()))); throw new CacheException('MemcachedAdapter client error: '.strtolower($this->client->getResultMessage()));
} }
/** /**

View File

@@ -44,7 +44,7 @@ trait PdoTrait
if ($connOrDsn instanceof \PDO) { if ($connOrDsn instanceof \PDO) {
if (\PDO::ERRMODE_EXCEPTION !== $connOrDsn->getAttribute(\PDO::ATTR_ERRMODE)) { if (\PDO::ERRMODE_EXCEPTION !== $connOrDsn->getAttribute(\PDO::ATTR_ERRMODE)) {
throw new InvalidArgumentException(sprintf('"%s" requires PDO error mode attribute be set to throw Exceptions (i.e. $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION))', __CLASS__)); throw new InvalidArgumentException(sprintf('"%s" requires PDO error mode attribute be set to throw Exceptions (i.e. $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION)).', __CLASS__));
} }
$this->conn = $connOrDsn; $this->conn = $connOrDsn;
@@ -105,7 +105,11 @@ trait PdoTrait
$table->setPrimaryKey([$this->idCol]); $table->setPrimaryKey([$this->idCol]);
foreach ($schema->toSql($conn->getDatabasePlatform()) as $sql) { foreach ($schema->toSql($conn->getDatabasePlatform()) as $sql) {
$conn->exec($sql); if (method_exists($conn, 'executeStatement')) {
$conn->executeStatement($sql);
} else {
$conn->exec($sql);
}
} }
return; return;
@@ -136,7 +140,11 @@ trait PdoTrait
throw new \DomainException(sprintf('Creating the cache table is currently not implemented for PDO driver "%s".', $this->driver)); throw new \DomainException(sprintf('Creating the cache table is currently not implemented for PDO driver "%s".', $this->driver));
} }
$conn->exec($sql); if (method_exists($conn, 'executeStatement')) {
$conn->executeStatement($sql);
} else {
$conn->exec($sql);
}
} }
/** /**
@@ -175,9 +183,16 @@ trait PdoTrait
foreach ($ids as $id) { foreach ($ids as $id) {
$stmt->bindValue(++$i, $id); $stmt->bindValue(++$i, $id);
} }
$stmt->execute(); $result = $stmt->execute();
while ($row = $stmt->fetch(\PDO::FETCH_NUM)) { if (\is_object($result)) {
$result = $result->iterateNumeric();
} else {
$stmt->setFetchMode(\PDO::FETCH_NUM);
$result = $stmt;
}
foreach ($result as $row) {
if (null === $row[1]) { if (null === $row[1]) {
$expired[] = $row[0]; $expired[] = $row[0];
} else { } else {
@@ -207,9 +222,9 @@ trait PdoTrait
$stmt->bindValue(':id', $id); $stmt->bindValue(':id', $id);
$stmt->bindValue(':time', time(), \PDO::PARAM_INT); $stmt->bindValue(':time', time(), \PDO::PARAM_INT);
$stmt->execute(); $result = $stmt->execute();
return (bool) $stmt->fetchColumn(); return (bool) (\is_object($result) ? $result->fetchOne() : $stmt->fetchColumn());
} }
/** /**
@@ -229,7 +244,11 @@ trait PdoTrait
$sql = "DELETE FROM $this->table WHERE $this->idCol LIKE '$namespace%'"; $sql = "DELETE FROM $this->table WHERE $this->idCol LIKE '$namespace%'";
} }
$conn->exec($sql); if (method_exists($conn, 'executeStatement')) {
$conn->executeStatement($sql);
} else {
$conn->exec($sql);
}
return true; return true;
} }
@@ -329,9 +348,9 @@ trait PdoTrait
} }
foreach ($serialized as $id => $data) { foreach ($serialized as $id => $data) {
$stmt->execute(); $result = $stmt->execute();
if (null === $driver && !$stmt->rowCount()) { if (null === $driver && !(\is_object($result) ? $result->rowCount() : $stmt->rowCount())) {
try { try {
$insertStmt->execute(); $insertStmt->execute();
} catch (DBALException $e) { } catch (DBALException $e) {
@@ -357,25 +376,37 @@ trait PdoTrait
if ($this->conn instanceof \PDO) { if ($this->conn instanceof \PDO) {
$this->driver = $this->conn->getAttribute(\PDO::ATTR_DRIVER_NAME); $this->driver = $this->conn->getAttribute(\PDO::ATTR_DRIVER_NAME);
} else { } else {
switch ($this->driver = $this->conn->getDriver()->getName()) { $driver = $this->conn->getDriver();
case 'mysqli':
case 'pdo_mysql': switch (true) {
case 'drizzle_pdo_mysql': case $driver instanceof \Doctrine\DBAL\Driver\AbstractMySQLDriver:
case $driver instanceof \Doctrine\DBAL\Driver\DrizzlePDOMySql\Driver:
case $driver instanceof \Doctrine\DBAL\Driver\Mysqli\Driver:
case $driver instanceof \Doctrine\DBAL\Driver\PDOMySql\Driver:
case $driver instanceof \Doctrine\DBAL\Driver\PDO\MySQL\Driver:
$this->driver = 'mysql'; $this->driver = 'mysql';
break; break;
case 'pdo_sqlite': case $driver instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver:
case $driver instanceof \Doctrine\DBAL\Driver\PDO\SQLite\Driver:
$this->driver = 'sqlite'; $this->driver = 'sqlite';
break; break;
case 'pdo_pgsql': case $driver instanceof \Doctrine\DBAL\Driver\PDOPgSql\Driver:
case $driver instanceof \Doctrine\DBAL\Driver\PDO\PgSQL\Driver:
$this->driver = 'pgsql'; $this->driver = 'pgsql';
break; break;
case 'oci8': case $driver instanceof \Doctrine\DBAL\Driver\OCI8\Driver:
case 'pdo_oracle': case $driver instanceof \Doctrine\DBAL\Driver\PDOOracle\Driver:
case $driver instanceof \Doctrine\DBAL\Driver\PDO\OCI\Driver:
$this->driver = 'oci'; $this->driver = 'oci';
break; break;
case 'pdo_sqlsrv': case $driver instanceof \Doctrine\DBAL\Driver\SQLSrv\Driver:
case $driver instanceof \Doctrine\DBAL\Driver\PDOSqlsrv\Driver:
case $driver instanceof \Doctrine\DBAL\Driver\PDO\SQLSrv\Driver:
$this->driver = 'sqlsrv'; $this->driver = 'sqlsrv';
break; break;
default:
$this->driver = \get_class($driver);
break;
} }
} }
} }

View File

@@ -28,6 +28,8 @@ trait PhpArrayTrait
private $values; private $values;
private $zendDetectUnicode; private $zendDetectUnicode;
private static $valuesCache = [];
/** /**
* Store an array of cached values. * Store an array of cached values.
* *
@@ -37,21 +39,21 @@ trait PhpArrayTrait
{ {
if (file_exists($this->file)) { if (file_exists($this->file)) {
if (!is_file($this->file)) { if (!is_file($this->file)) {
throw new InvalidArgumentException(sprintf('Cache path exists and is not a file: %s.', $this->file)); throw new InvalidArgumentException(sprintf('Cache path exists and is not a file: "%s".', $this->file));
} }
if (!is_writable($this->file)) { if (!is_writable($this->file)) {
throw new InvalidArgumentException(sprintf('Cache file is not writable: %s.', $this->file)); throw new InvalidArgumentException(sprintf('Cache file is not writable: "%s".', $this->file));
} }
} else { } else {
$directory = \dirname($this->file); $directory = \dirname($this->file);
if (!is_dir($directory) && !@mkdir($directory, 0777, true)) { if (!is_dir($directory) && !@mkdir($directory, 0777, true)) {
throw new InvalidArgumentException(sprintf('Cache directory does not exist and cannot be created: %s.', $directory)); throw new InvalidArgumentException(sprintf('Cache directory does not exist and cannot be created: "%s".', $directory));
} }
if (!is_writable($directory)) { if (!is_writable($directory)) {
throw new InvalidArgumentException(sprintf('Cache directory is not writable: %s.', $directory)); throw new InvalidArgumentException(sprintf('Cache directory is not writable: "%s".', $directory));
} }
} }
@@ -72,7 +74,7 @@ EOF;
try { try {
$value = serialize($value); $value = serialize($value);
} catch (\Exception $e) { } catch (\Exception $e) {
throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable %s value.', $key, \get_class($value)), 0, $e); throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable "%s" value.', $key, \get_class($value)), 0, $e);
} }
} elseif (\is_array($value)) { } elseif (\is_array($value)) {
try { try {
@@ -91,7 +93,7 @@ EOF;
$value = serialize($value); $value = serialize($value);
} }
} elseif (!is_scalar($value)) { } elseif (!is_scalar($value)) {
throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable %s value.', $key, \gettype($value))); throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable "%s" value.', $key, \gettype($value)));
} }
$dump .= var_export($key, true).' => '.var_export($value, true).",\n"; $dump .= var_export($key, true).' => '.var_export($value, true).",\n";
@@ -107,6 +109,7 @@ EOF;
unset($serialized, $unserialized, $value, $dump); unset($serialized, $unserialized, $value, $dump);
@rename($tmpFile, $this->file); @rename($tmpFile, $this->file);
unset(self::$valuesCache[$this->file]);
$this->initialize(); $this->initialize();
} }
@@ -119,6 +122,7 @@ EOF;
$this->values = []; $this->values = [];
$cleared = @unlink($this->file) || !file_exists($this->file); $cleared = @unlink($this->file) || !file_exists($this->file);
unset(self::$valuesCache[$this->file]);
return $this->pool->clear() && $cleared; return $this->pool->clear() && $cleared;
} }
@@ -128,11 +132,17 @@ EOF;
*/ */
private function initialize() private function initialize()
{ {
if (isset(self::$valuesCache[$this->file])) {
$this->values = self::$valuesCache[$this->file];
return;
}
if ($this->zendDetectUnicode) { if ($this->zendDetectUnicode) {
$zmb = ini_set('zend.detect_unicode', 0); $zmb = ini_set('zend.detect_unicode', 0);
} }
try { try {
$this->values = file_exists($this->file) ? (include $this->file ?: []) : []; $this->values = self::$valuesCache[$this->file] = file_exists($this->file) ? (include $this->file ?: []) : [];
} finally { } finally {
if ($this->zendDetectUnicode) { if ($this->zendDetectUnicode) {
ini_set('zend.detect_unicode', $zmb); ini_set('zend.detect_unicode', $zmb);

View File

@@ -30,7 +30,7 @@ trait PhpFilesTrait
public static function isSupported() public static function isSupported()
{ {
return \function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN); return \function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN);
} }
/** /**
@@ -40,7 +40,7 @@ trait PhpFilesTrait
{ {
$time = time(); $time = time();
$pruned = true; $pruned = true;
$allowCompile = 'cli' !== \PHP_SAPI || filter_var(ini_get('opcache.enable_cli'), FILTER_VALIDATE_BOOLEAN); $allowCompile = 'cli' !== \PHP_SAPI || filter_var(ini_get('opcache.enable_cli'), \FILTER_VALIDATE_BOOLEAN);
set_error_handler($this->includeHandler); set_error_handler($this->includeHandler);
try { try {
@@ -118,8 +118,8 @@ trait PhpFilesTrait
protected function doSave(array $values, $lifetime) protected function doSave(array $values, $lifetime)
{ {
$ok = true; $ok = true;
$data = [$lifetime ? time() + $lifetime : PHP_INT_MAX, '']; $data = [$lifetime ? time() + $lifetime : \PHP_INT_MAX, ''];
$allowCompile = 'cli' !== \PHP_SAPI || filter_var(ini_get('opcache.enable_cli'), FILTER_VALIDATE_BOOLEAN); $allowCompile = 'cli' !== \PHP_SAPI || filter_var(ini_get('opcache.enable_cli'), \FILTER_VALIDATE_BOOLEAN);
foreach ($values as $key => $value) { foreach ($values as $key => $value) {
if (null === $value || \is_object($value)) { if (null === $value || \is_object($value)) {
@@ -137,7 +137,7 @@ trait PhpFilesTrait
$value = serialize($value); $value = serialize($value);
} }
} elseif (!is_scalar($value)) { } elseif (!is_scalar($value)) {
throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable %s value.', $key, \gettype($value))); throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable "%s" value.', $key, \gettype($value)));
} }
$data[1] = $value; $data[1] = $value;
@@ -150,7 +150,7 @@ trait PhpFilesTrait
} }
if (!$ok && !is_writable($this->directory)) { if (!$ok && !is_writable($this->directory)) {
throw new CacheException(sprintf('Cache directory is not writable (%s)', $this->directory)); throw new CacheException(sprintf('Cache directory is not writable (%s).', $this->directory));
} }
return $ok; return $ok;

View File

@@ -48,7 +48,7 @@ trait RedisTrait
throw new InvalidArgumentException(sprintf('RedisAdapter namespace contains "%s" but only characters in [-+_.A-Za-z0-9] are allowed.', $match[0])); throw new InvalidArgumentException(sprintf('RedisAdapter namespace contains "%s" but only characters in [-+_.A-Za-z0-9] are allowed.', $match[0]));
} }
if (!$redisClient instanceof \Redis && !$redisClient instanceof \RedisArray && !$redisClient instanceof \RedisCluster && !$redisClient instanceof \Predis\Client && !$redisClient instanceof RedisProxy) { if (!$redisClient instanceof \Redis && !$redisClient instanceof \RedisArray && !$redisClient instanceof \RedisCluster && !$redisClient instanceof \Predis\Client && !$redisClient instanceof RedisProxy) {
throw new InvalidArgumentException(sprintf('%s() expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\Client, %s given', __METHOD__, \is_object($redisClient) ? \get_class($redisClient) : \gettype($redisClient))); throw new InvalidArgumentException(sprintf('"%s()" expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\Client, "%s" given.', __METHOD__, \is_object($redisClient) ? \get_class($redisClient) : \gettype($redisClient)));
} }
$this->redis = $redisClient; $this->redis = $redisClient;
} }
@@ -73,7 +73,7 @@ trait RedisTrait
public static function createConnection($dsn, array $options = []) public static function createConnection($dsn, array $options = [])
{ {
if (0 !== strpos($dsn, 'redis://')) { if (0 !== strpos($dsn, 'redis://')) {
throw new InvalidArgumentException(sprintf('Invalid Redis DSN: %s does not start with "redis://"', $dsn)); throw new InvalidArgumentException(sprintf('Invalid Redis DSN: "%s" does not start with "redis://".', $dsn));
} }
$params = preg_replace_callback('#^redis://(?:(?:[^:@]*+:)?([^@]*+)@)?#', function ($m) use (&$auth) { $params = preg_replace_callback('#^redis://(?:(?:[^:@]*+:)?([^@]*+)@)?#', function ($m) use (&$auth) {
if (isset($m[1])) { if (isset($m[1])) {
@@ -83,10 +83,10 @@ trait RedisTrait
return 'file://'; return 'file://';
}, $dsn); }, $dsn);
if (false === $params = parse_url($params)) { if (false === $params = parse_url($params)) {
throw new InvalidArgumentException(sprintf('Invalid Redis DSN: %s', $dsn)); throw new InvalidArgumentException(sprintf('Invalid Redis DSN: "%s".', $dsn));
} }
if (!isset($params['host']) && !isset($params['path'])) { if (!isset($params['host']) && !isset($params['path'])) {
throw new InvalidArgumentException(sprintf('Invalid Redis DSN: %s', $dsn)); throw new InvalidArgumentException(sprintf('Invalid Redis DSN: "%s".', $dsn));
} }
if (isset($params['path']) && preg_match('#/(\d+)$#', $params['path'], $m)) { if (isset($params['path']) && preg_match('#/(\d+)$#', $params['path'], $m)) {
$params['dbindex'] = $m[1]; $params['dbindex'] = $m[1];
@@ -108,7 +108,7 @@ trait RedisTrait
} }
$params += $options + self::$defaultConnectionOptions; $params += $options + self::$defaultConnectionOptions;
if (null === $params['class'] && !\extension_loaded('redis') && !class_exists(\Predis\Client::class)) { if (null === $params['class'] && !\extension_loaded('redis') && !class_exists(\Predis\Client::class)) {
throw new CacheException(sprintf('Cannot find the "redis" extension, and "predis/predis" is not installed: %s', $dsn)); throw new CacheException(sprintf('Cannot find the "redis" extension, and "predis/predis" is not installed: "%s".', $dsn));
} }
$class = null === $params['class'] ? (\extension_loaded('redis') ? \Redis::class : \Predis\Client::class) : $params['class']; $class = null === $params['class'] ? (\extension_loaded('redis') ? \Redis::class : \Predis\Client::class) : $params['class'];
@@ -119,24 +119,24 @@ trait RedisTrait
$initializer = function ($redis) use ($connect, $params, $dsn, $auth) { $initializer = function ($redis) use ($connect, $params, $dsn, $auth) {
try { try {
@$redis->{$connect}($params['host'], $params['port'], $params['timeout'], $params['persistent_id'], $params['retry_interval']); @$redis->{$connect}($params['host'], $params['port'], $params['timeout'], $params['persistent_id'], $params['retry_interval']);
set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
$isConnected = $redis->isConnected();
restore_error_handler();
if (!$isConnected) {
$error = preg_match('/^Redis::p?connect\(\): (.*)/', $error, $error) ? sprintf(' (%s)', $error[1]) : '';
throw new InvalidArgumentException(sprintf('Redis connection "%s" failed: ', $dsn).$error.'.');
}
if ((null !== $auth && !$redis->auth($auth))
|| ($params['dbindex'] && !$redis->select($params['dbindex']))
|| ($params['read_timeout'] && !$redis->setOption(\Redis::OPT_READ_TIMEOUT, $params['read_timeout']))
) {
$e = preg_replace('/^ERR /', '', $redis->getLastError());
throw new InvalidArgumentException(sprintf('Redis connection "%s" failed: ', $dsn).$e.'.');
}
} catch (\RedisException $e) { } catch (\RedisException $e) {
throw new InvalidArgumentException(sprintf('Redis connection failed (%s): %s', $e->getMessage(), $dsn)); throw new InvalidArgumentException(sprintf('Redis connection "%s" failed: ', $dsn).$e->getMessage());
}
set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
$isConnected = $redis->isConnected();
restore_error_handler();
if (!$isConnected) {
$error = preg_match('/^Redis::p?connect\(\): (.*)/', $error, $error) ? sprintf(' (%s)', $error[1]) : '';
throw new InvalidArgumentException(sprintf('Redis connection failed%s: %s', $error, $dsn));
}
if ((null !== $auth && !$redis->auth($auth))
|| ($params['dbindex'] && !$redis->select($params['dbindex']))
|| ($params['read_timeout'] && !$redis->setOption(\Redis::OPT_READ_TIMEOUT, $params['read_timeout']))
) {
$e = preg_replace('/^ERR /', '', $redis->getLastError());
throw new InvalidArgumentException(sprintf('Redis connection failed (%s): %s', $e, $dsn));
} }
return true; return true;
@@ -153,9 +153,9 @@ trait RedisTrait
$params['password'] = $auth; $params['password'] = $auth;
$redis = new $class((new Factory())->create($params)); $redis = new $class((new Factory())->create($params));
} elseif (class_exists($class, false)) { } elseif (class_exists($class, false)) {
throw new InvalidArgumentException(sprintf('"%s" is not a subclass of "Redis" or "Predis\Client"', $class)); throw new InvalidArgumentException(sprintf('"%s" is not a subclass of "Redis" or "Predis\Client".', $class));
} else { } else {
throw new InvalidArgumentException(sprintf('Class "%s" does not exist', $class)); throw new InvalidArgumentException(sprintf('Class "%s" does not exist.', $class));
} }
return $redis; return $redis;

View File

@@ -28,9 +28,9 @@
}, },
"require-dev": { "require-dev": {
"cache/integration-tests": "dev-master", "cache/integration-tests": "dev-master",
"doctrine/cache": "~1.6", "doctrine/cache": "^1.6",
"doctrine/dbal": "~2.4", "doctrine/dbal": "^2.4|^3.0",
"predis/predis": "~1.0" "predis/predis": "^1.0"
}, },
"conflict": { "conflict": {
"symfony/var-dumper": "<3.3" "symfony/var-dumper": "<3.3"
@@ -41,10 +41,5 @@
"/Tests/" "/Tests/"
] ]
}, },
"minimum-stability": "dev", "minimum-stability": "dev"
"extra": {
"branch-alias": {
"dev-master": "3.4-dev"
}
}
} }

View File

@@ -11,7 +11,7 @@
namespace Symfony\Component\ClassLoader; namespace Symfony\Component\ClassLoader;
@trigger_error('The '.__NAMESPACE__.'\ApcClassLoader class is deprecated since Symfony 3.3 and will be removed in 4.0. Use `composer install --apcu-autoloader` instead.', E_USER_DEPRECATED); @trigger_error('The '.__NAMESPACE__.'\ApcClassLoader class is deprecated since Symfony 3.3 and will be removed in 4.0. Use `composer install --apcu-autoloader` instead.', \E_USER_DEPRECATED);
/** /**
* ApcClassLoader implements a wrapping autoloader cached in APC for PHP 5.3. * ApcClassLoader implements a wrapping autoloader cached in APC for PHP 5.3.

View File

@@ -12,7 +12,7 @@
namespace Symfony\Component\ClassLoader; namespace Symfony\Component\ClassLoader;
if (\PHP_VERSION_ID >= 70000) { if (\PHP_VERSION_ID >= 70000) {
@trigger_error('The '.__NAMESPACE__.'\ClassCollectionLoader class is deprecated since Symfony 3.3 and will be removed in 4.0.', E_USER_DEPRECATED); @trigger_error('The '.__NAMESPACE__.'\ClassCollectionLoader class is deprecated since Symfony 3.3 and will be removed in 4.0.', \E_USER_DEPRECATED);
} }
/** /**
@@ -63,7 +63,7 @@ class ClassCollectionLoader
// cache the core classes // cache the core classes
if (!is_dir($cacheDir) && !@mkdir($cacheDir, 0777, true) && !is_dir($cacheDir)) { if (!is_dir($cacheDir) && !@mkdir($cacheDir, 0777, true) && !is_dir($cacheDir)) {
throw new \RuntimeException(sprintf('Class Collection Loader was not able to create directory "%s"', $cacheDir)); throw new \RuntimeException(sprintf('Class Collection Loader was not able to create directory "%s".', $cacheDir));
} }
$cacheDir = rtrim(realpath($cacheDir) ?: $cacheDir, '/'.\DIRECTORY_SEPARATOR); $cacheDir = rtrim(realpath($cacheDir) ?: $cacheDir, '/'.\DIRECTORY_SEPARATOR);
$cache = $cacheDir.'/'.$name.$extension; $cache = $cacheDir.'/'.$name.$extension;
@@ -133,7 +133,7 @@ class ClassCollectionLoader
// cache the core classes // cache the core classes
$cacheDir = \dirname($cache); $cacheDir = \dirname($cache);
if (!is_dir($cacheDir) && !@mkdir($cacheDir, 0777, true) && !is_dir($cacheDir)) { if (!is_dir($cacheDir) && !@mkdir($cacheDir, 0777, true) && !is_dir($cacheDir)) {
throw new \RuntimeException(sprintf('Class Collection Loader was not able to create directory "%s"', $cacheDir)); throw new \RuntimeException(sprintf('Class Collection Loader was not able to create directory "%s".', $cacheDir));
} }
$spacesRegex = '(?:\s*+(?:(?:\#|//)[^\n]*+\n|/\*(?:(?<!\*/).)++)?+)*+'; $spacesRegex = '(?:\s*+(?:(?:\#|//)[^\n]*+\n|/\*(?:(?<!\*/).)++)?+)*+';
@@ -216,21 +216,26 @@ REGEX;
$inNamespace = false; $inNamespace = false;
$tokens = token_get_all($source); $tokens = token_get_all($source);
$nsTokens = [\T_WHITESPACE => true, \T_NS_SEPARATOR => true, \T_STRING => true];
if (\defined('T_NAME_QUALIFIED')) {
$nsTokens[T_NAME_QUALIFIED] = true;
}
for ($i = 0; isset($tokens[$i]); ++$i) { for ($i = 0; isset($tokens[$i]); ++$i) {
$token = $tokens[$i]; $token = $tokens[$i];
if (!isset($token[1]) || 'b"' === $token) { if (!isset($token[1]) || 'b"' === $token) {
$rawChunk .= $token; $rawChunk .= $token;
} elseif (\in_array($token[0], [T_COMMENT, T_DOC_COMMENT])) { } elseif (\in_array($token[0], [\T_COMMENT, \T_DOC_COMMENT])) {
// strip comments // strip comments
continue; continue;
} elseif (T_NAMESPACE === $token[0]) { } elseif (\T_NAMESPACE === $token[0]) {
if ($inNamespace) { if ($inNamespace) {
$rawChunk .= "}\n"; $rawChunk .= "}\n";
} }
$rawChunk .= $token[1]; $rawChunk .= $token[1];
// namespace name and whitespaces // namespace name and whitespaces
while (isset($tokens[++$i][1]) && \in_array($tokens[$i][0], [T_WHITESPACE, T_NS_SEPARATOR, T_STRING])) { while (isset($tokens[++$i][1], $nsTokens[$tokens[$i][0]])) {
$rawChunk .= $tokens[$i][1]; $rawChunk .= $tokens[$i][1];
} }
if ('{' === $tokens[$i]) { if ('{' === $tokens[$i]) {
@@ -240,15 +245,15 @@ REGEX;
$rawChunk = rtrim($rawChunk)."\n{"; $rawChunk = rtrim($rawChunk)."\n{";
$inNamespace = true; $inNamespace = true;
} }
} elseif (T_START_HEREDOC === $token[0]) { } elseif (\T_START_HEREDOC === $token[0]) {
$output .= self::compressCode($rawChunk).$token[1]; $output .= self::compressCode($rawChunk).$token[1];
do { do {
$token = $tokens[++$i]; $token = $tokens[++$i];
$output .= isset($token[1]) && 'b"' !== $token ? $token[1] : $token; $output .= isset($token[1]) && 'b"' !== $token ? $token[1] : $token;
} while (T_END_HEREDOC !== $token[0]); } while (\T_END_HEREDOC !== $token[0]);
$output .= "\n"; $output .= "\n";
$rawChunk = ''; $rawChunk = '';
} elseif (T_CONSTANT_ENCAPSED_STRING === $token[0]) { } elseif (\T_CONSTANT_ENCAPSED_STRING === $token[0]) {
$output .= self::compressCode($rawChunk).$token[1]; $output .= self::compressCode($rawChunk).$token[1];
$rawChunk = ''; $rawChunk = '';
} else { } else {
@@ -336,7 +341,7 @@ REGEX;
try { try {
$reflectionClass = new \ReflectionClass($class); $reflectionClass = new \ReflectionClass($class);
} catch (\ReflectionException $e) { } catch (\ReflectionException $e) {
throw new \InvalidArgumentException(sprintf('Unable to load class "%s"', $class)); throw new \InvalidArgumentException(sprintf('Unable to load class "%s".', $class));
} }
$map = array_merge($map, self::getClassHierarchy($reflectionClass)); $map = array_merge($map, self::getClassHierarchy($reflectionClass));

View File

@@ -11,7 +11,7 @@
namespace Symfony\Component\ClassLoader; namespace Symfony\Component\ClassLoader;
@trigger_error('The '.__NAMESPACE__.'\ClassLoader class is deprecated since Symfony 3.3 and will be removed in 4.0. Use Composer instead.', E_USER_DEPRECATED); @trigger_error('The '.__NAMESPACE__.'\ClassLoader class is deprecated since Symfony 3.3 and will be removed in 4.0. Use Composer instead.', \E_USER_DEPRECATED);
/** /**
* ClassLoader implements an PSR-0 class loader. * ClassLoader implements an PSR-0 class loader.

View File

@@ -11,7 +11,7 @@
namespace Symfony\Component\ClassLoader; namespace Symfony\Component\ClassLoader;
@trigger_error('The '.__NAMESPACE__.'\ClassMapGenerator class is deprecated since Symfony 3.3 and will be removed in 4.0. Use Composer instead.', E_USER_DEPRECATED); @trigger_error('The '.__NAMESPACE__.'\ClassMapGenerator class is deprecated since Symfony 3.3 and will be removed in 4.0. Use Composer instead.', \E_USER_DEPRECATED);
/** /**
* ClassMapGenerator. * ClassMapGenerator.
@@ -62,7 +62,7 @@ class ClassMapGenerator
$path = $file->getRealPath() ?: $file->getPathname(); $path = $file->getRealPath() ?: $file->getPathname();
if ('php' !== pathinfo($path, PATHINFO_EXTENSION)) { if ('php' !== pathinfo($path, \PATHINFO_EXTENSION)) {
continue; continue;
} }
@@ -93,6 +93,11 @@ class ClassMapGenerator
$contents = file_get_contents($path); $contents = file_get_contents($path);
$tokens = token_get_all($contents); $tokens = token_get_all($contents);
$nsTokens = [\T_STRING => true, \T_NS_SEPARATOR => true];
if (\defined('T_NAME_QUALIFIED')) {
$nsTokens[T_NAME_QUALIFIED] = true;
}
$classes = []; $classes = [];
$namespace = ''; $namespace = '';
@@ -106,19 +111,19 @@ class ClassMapGenerator
$class = ''; $class = '';
switch ($token[0]) { switch ($token[0]) {
case T_NAMESPACE: case \T_NAMESPACE:
$namespace = ''; $namespace = '';
// If there is a namespace, extract it // If there is a namespace, extract it
while (isset($tokens[++$i][1])) { while (isset($tokens[++$i][1])) {
if (\in_array($tokens[$i][0], [T_STRING, T_NS_SEPARATOR])) { if (isset($nsTokens[$tokens[$i][0]])) {
$namespace .= $tokens[$i][1]; $namespace .= $tokens[$i][1];
} }
} }
$namespace .= '\\'; $namespace .= '\\';
break; break;
case T_CLASS: case \T_CLASS:
case T_INTERFACE: case \T_INTERFACE:
case T_TRAIT: case \T_TRAIT:
// Skip usage of ::class constant // Skip usage of ::class constant
$isClassConstant = false; $isClassConstant = false;
for ($j = $i - 1; $j > 0; --$j) { for ($j = $i - 1; $j > 0; --$j) {
@@ -126,10 +131,10 @@ class ClassMapGenerator
break; break;
} }
if (T_DOUBLE_COLON === $tokens[$j][0]) { if (\T_DOUBLE_COLON === $tokens[$j][0]) {
$isClassConstant = true; $isClassConstant = true;
break; break;
} elseif (!\in_array($tokens[$j][0], [T_WHITESPACE, T_DOC_COMMENT, T_COMMENT])) { } elseif (!\in_array($tokens[$j][0], [\T_WHITESPACE, \T_DOC_COMMENT, \T_COMMENT])) {
break; break;
} }
} }
@@ -141,9 +146,9 @@ class ClassMapGenerator
// Find the classname // Find the classname
while (isset($tokens[++$i][1])) { while (isset($tokens[++$i][1])) {
$t = $tokens[$i]; $t = $tokens[$i];
if (T_STRING === $t[0]) { if (\T_STRING === $t[0]) {
$class .= $t[1]; $class .= $t[1];
} elseif ('' !== $class && T_WHITESPACE === $t[0]) { } elseif ('' !== $class && \T_WHITESPACE === $t[0]) {
break; break;
} }
} }

View File

@@ -1,4 +1,4 @@
Copyright (c) 2004-2019 Fabien Potencier Copyright (c) 2004-2020 Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@@ -11,7 +11,7 @@
namespace Symfony\Component\ClassLoader; namespace Symfony\Component\ClassLoader;
@trigger_error('The '.__NAMESPACE__.'\MapClassLoader class is deprecated since Symfony 3.3 and will be removed in 4.0. Use Composer instead.', E_USER_DEPRECATED); @trigger_error('The '.__NAMESPACE__.'\MapClassLoader class is deprecated since Symfony 3.3 and will be removed in 4.0. Use Composer instead.', \E_USER_DEPRECATED);
/** /**
* A class loader that uses a mapping file to look up paths. * A class loader that uses a mapping file to look up paths.

View File

@@ -11,7 +11,7 @@
namespace Symfony\Component\ClassLoader; namespace Symfony\Component\ClassLoader;
@trigger_error('The '.__NAMESPACE__.'\Psr4ClassLoader class is deprecated since Symfony 3.3 and will be removed in 4.0. Use Composer instead.', E_USER_DEPRECATED); @trigger_error('The '.__NAMESPACE__.'\Psr4ClassLoader class is deprecated since Symfony 3.3 and will be removed in 4.0. Use Composer instead.', \E_USER_DEPRECATED);
/** /**
* A PSR-4 compatible class loader. * A PSR-4 compatible class loader.

View File

@@ -7,7 +7,7 @@ their locations for performance.
Resources Resources
--------- ---------
* [Documentation](https://symfony.com/doc/current/components/class_loader/index.html) * [Documentation](https://symfony.com/doc/current/components/class_loader.html)
* [Contributing](https://symfony.com/doc/current/contributing/index.html) * [Contributing](https://symfony.com/doc/current/contributing/index.html)
* [Report issues](https://github.com/symfony/symfony/issues) and * [Report issues](https://github.com/symfony/symfony/issues) and
[send Pull Requests](https://github.com/symfony/symfony/pulls) [send Pull Requests](https://github.com/symfony/symfony/pulls)

View File

@@ -11,7 +11,7 @@
namespace Symfony\Component\ClassLoader; namespace Symfony\Component\ClassLoader;
@trigger_error('The '.__NAMESPACE__.'\WinCacheClassLoader class is deprecated since Symfony 3.3 and will be removed in 4.0. Use `composer install --apcu-autoloader` instead.', E_USER_DEPRECATED); @trigger_error('The '.__NAMESPACE__.'\WinCacheClassLoader class is deprecated since Symfony 3.3 and will be removed in 4.0. Use `composer install --apcu-autoloader` instead.', \E_USER_DEPRECATED);
/** /**
* WinCacheClassLoader implements a wrapping autoloader cached in WinCache. * WinCacheClassLoader implements a wrapping autoloader cached in WinCache.

View File

@@ -11,7 +11,7 @@
namespace Symfony\Component\ClassLoader; namespace Symfony\Component\ClassLoader;
@trigger_error('The '.__NAMESPACE__.'\XcacheClassLoader class is deprecated since Symfony 3.3 and will be removed in 4.0. Use `composer install --apcu-autoloader` instead.', E_USER_DEPRECATED); @trigger_error('The '.__NAMESPACE__.'\XcacheClassLoader class is deprecated since Symfony 3.3 and will be removed in 4.0. Use `composer install --apcu-autoloader` instead.', \E_USER_DEPRECATED);
/** /**
* XcacheClassLoader implements a wrapping autoloader cached in XCache for PHP 5.3. * XcacheClassLoader implements a wrapping autoloader cached in XCache for PHP 5.3.

View File

@@ -31,10 +31,5 @@
"exclude-from-classmap": [ "exclude-from-classmap": [
"/Tests/" "/Tests/"
] ]
},
"extra": {
"branch-alias": {
"dev-master": "3.4-dev"
}
} }
} }

View File

@@ -215,7 +215,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
protected function finalizeValue($value) protected function finalizeValue($value)
{ {
if (false === $value) { if (false === $value) {
throw new UnsetKeyException(sprintf('Unsetting key for path "%s", value: %s', $this->getPath(), json_encode($value))); throw new UnsetKeyException(sprintf('Unsetting key for path "%s", value: "%s".', $this->getPath(), json_encode($value)));
} }
foreach ($this->children as $name => $child) { foreach ($this->children as $name => $child) {
@@ -235,7 +235,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
} }
if ($child->isDeprecated()) { if ($child->isDeprecated()) {
@trigger_error($child->getDeprecationMessage($name, $this->getPath()), E_USER_DEPRECATED); @trigger_error($child->getDeprecationMessage($name, $this->getPath()), \E_USER_DEPRECATED);
} }
try { try {

View File

@@ -335,7 +335,7 @@ abstract class BaseNode implements NodeInterface
} catch (Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} catch (\Exception $e) { } catch (\Exception $e) {
throw new InvalidConfigurationException(sprintf('Invalid configuration for path "%s": %s', $this->getPath(), $e->getMessage()), $e->getCode(), $e); throw new InvalidConfigurationException(sprintf('Invalid configuration for path "%s": ', $this->getPath()).$e->getMessage(), $e->getCode(), $e);
} }
} }

View File

@@ -413,7 +413,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
} }
if (false === $this->allowEmptyValue) { if (false === $this->allowEmptyValue) {
@trigger_error(sprintf('Using %s::cannotBeEmpty() at path "%s" has no effect, consider requiresAtLeastOneElement() instead. In 4.0 both methods will behave the same.', __CLASS__, $node->getPath()), E_USER_DEPRECATED); @trigger_error(sprintf('Using %s::cannotBeEmpty() at path "%s" has no effect, consider requiresAtLeastOneElement() instead. In 4.0 both methods will behave the same.', __CLASS__, $node->getPath()), \E_USER_DEPRECATED);
} }
if (true === $this->atLeastOne) { if (true === $this->atLeastOne) {
@@ -472,23 +472,23 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
$path = $node->getPath(); $path = $node->getPath();
if (null !== $this->key) { if (null !== $this->key) {
throw new InvalidDefinitionException(sprintf('->useAttributeAsKey() is not applicable to concrete nodes at path "%s"', $path)); throw new InvalidDefinitionException(sprintf('->useAttributeAsKey() is not applicable to concrete nodes at path "%s".', $path));
} }
if (false === $this->allowEmptyValue) { if (false === $this->allowEmptyValue) {
@trigger_error(sprintf('->cannotBeEmpty() is not applicable to concrete nodes at path "%s". In 4.0 it will throw an exception.', $path), E_USER_DEPRECATED); @trigger_error(sprintf('->cannotBeEmpty() is not applicable to concrete nodes at path "%s". In 4.0 it will throw an exception.', $path), \E_USER_DEPRECATED);
} }
if (true === $this->atLeastOne) { if (true === $this->atLeastOne) {
throw new InvalidDefinitionException(sprintf('->requiresAtLeastOneElement() is not applicable to concrete nodes at path "%s"', $path)); throw new InvalidDefinitionException(sprintf('->requiresAtLeastOneElement() is not applicable to concrete nodes at path "%s".', $path));
} }
if ($this->default) { if ($this->default) {
throw new InvalidDefinitionException(sprintf('->defaultValue() is not applicable to concrete nodes at path "%s"', $path)); throw new InvalidDefinitionException(sprintf('->defaultValue() is not applicable to concrete nodes at path "%s".', $path));
} }
if (false !== $this->addDefaultChildren) { if (false !== $this->addDefaultChildren) {
throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() is not applicable to concrete nodes at path "%s"', $path)); throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() is not applicable to concrete nodes at path "%s".', $path));
} }
} }
@@ -502,20 +502,20 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
$path = $node->getPath(); $path = $node->getPath();
if ($this->addDefaults) { if ($this->addDefaults) {
throw new InvalidDefinitionException(sprintf('->addDefaultsIfNotSet() is not applicable to prototype nodes at path "%s"', $path)); throw new InvalidDefinitionException(sprintf('->addDefaultsIfNotSet() is not applicable to prototype nodes at path "%s".', $path));
} }
if (false !== $this->addDefaultChildren) { if (false !== $this->addDefaultChildren) {
if ($this->default) { if ($this->default) {
throw new InvalidDefinitionException(sprintf('A default value and default children might not be used together at path "%s"', $path)); throw new InvalidDefinitionException(sprintf('A default value and default children might not be used together at path "%s".', $path));
} }
if (null !== $this->key && (null === $this->addDefaultChildren || \is_int($this->addDefaultChildren) && $this->addDefaultChildren > 0)) { if (null !== $this->key && (null === $this->addDefaultChildren || \is_int($this->addDefaultChildren) && $this->addDefaultChildren > 0)) {
throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() should set default children names as ->useAttributeAsKey() is used at path "%s"', $path)); throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() should set default children names as ->useAttributeAsKey() is used at path "%s".', $path));
} }
if (null === $this->key && (\is_string($this->addDefaultChildren) || \is_array($this->addDefaultChildren))) { if (null === $this->key && (\is_string($this->addDefaultChildren) || \is_array($this->addDefaultChildren))) {
throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() might not set default children names as ->useAttributeAsKey() is not used at path "%s"', $path)); throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() might not set default children names as ->useAttributeAsKey() is not used at path "%s".', $path));
} }
} }
} }

View File

@@ -200,7 +200,7 @@ class ExprBuilder
*/ */
public function thenUnset() public function thenUnset()
{ {
$this->thenPart = function ($v) { throw new UnsetKeyException('Unsetting key'); }; $this->thenPart = function ($v) { throw new UnsetKeyException('Unsetting key.'); };
return $this; return $this;
} }

View File

@@ -24,13 +24,13 @@ class NodeBuilder implements NodeParentInterface
public function __construct() public function __construct()
{ {
$this->nodeMapping = [ $this->nodeMapping = [
'variable' => __NAMESPACE__.'\\VariableNodeDefinition', 'variable' => VariableNodeDefinition::class,
'scalar' => __NAMESPACE__.'\\ScalarNodeDefinition', 'scalar' => ScalarNodeDefinition::class,
'boolean' => __NAMESPACE__.'\\BooleanNodeDefinition', 'boolean' => BooleanNodeDefinition::class,
'integer' => __NAMESPACE__.'\\IntegerNodeDefinition', 'integer' => IntegerNodeDefinition::class,
'float' => __NAMESPACE__.'\\FloatNodeDefinition', 'float' => FloatNodeDefinition::class,
'array' => __NAMESPACE__.'\\ArrayNodeDefinition', 'array' => ArrayNodeDefinition::class,
'enum' => __NAMESPACE__.'\\EnumNodeDefinition', 'enum' => EnumNodeDefinition::class,
]; ];
} }

View File

@@ -35,7 +35,7 @@ abstract class NumericNodeDefinition extends ScalarNodeDefinition
public function max($max) public function max($max)
{ {
if (isset($this->min) && $this->min > $max) { if (isset($this->min) && $this->min > $max) {
throw new \InvalidArgumentException(sprintf('You cannot define a max(%s) as you already have a min(%s)', $max, $this->min)); throw new \InvalidArgumentException(sprintf('You cannot define a max(%s) as you already have a min(%s).', $max, $this->min));
} }
$this->max = $max; $this->max = $max;
@@ -54,7 +54,7 @@ abstract class NumericNodeDefinition extends ScalarNodeDefinition
public function min($min) public function min($min)
{ {
if (isset($this->max) && $this->max < $min) { if (isset($this->max) && $this->max < $min) {
throw new \InvalidArgumentException(sprintf('You cannot define a min(%s) as you already have a max(%s)', $min, $this->max)); throw new \InvalidArgumentException(sprintf('You cannot define a min(%s) as you already have a max(%s).', $min, $this->max));
} }
$this->min = $min; $this->min = $min;

View File

@@ -193,7 +193,7 @@ class XmlReferenceDumper
$commentDepth = $depth + 4 + \strlen($attrName) + 2; $commentDepth = $depth + 4 + \strlen($attrName) + 2;
$commentLines = explode("\n", $comment); $commentLines = explode("\n", $comment);
$multiline = (\count($commentLines) > 1); $multiline = (\count($commentLines) > 1);
$comment = implode(PHP_EOL.str_repeat(' ', $commentDepth), $commentLines); $comment = implode(\PHP_EOL.str_repeat(' ', $commentDepth), $commentLines);
if ($multiline) { if ($multiline) {
$this->writeLine('<!--', $depth); $this->writeLine('<!--', $depth);
@@ -267,7 +267,7 @@ class XmlReferenceDumper
$indent = \strlen($text) + $indent; $indent = \strlen($text) + $indent;
$format = '%'.$indent.'s'; $format = '%'.$indent.'s';
$this->reference .= sprintf($format, $text).PHP_EOL; $this->reference .= sprintf($format, $text).\PHP_EOL;
} }
/** /**

View File

@@ -39,7 +39,7 @@ class YamlReferenceDumper
foreach (explode('.', $path) as $step) { foreach (explode('.', $path) as $step) {
if (!$node instanceof ArrayNode) { if (!$node instanceof ArrayNode) {
throw new \UnexpectedValueException(sprintf('Unable to find node at path "%s.%s"', $rootNode->getName(), $path)); throw new \UnexpectedValueException(sprintf('Unable to find node at path "%s.%s".', $rootNode->getName(), $path));
} }
/** @var NodeInterface[] $children */ /** @var NodeInterface[] $children */
@@ -53,7 +53,7 @@ class YamlReferenceDumper
} }
} }
throw new \UnexpectedValueException(sprintf('Unable to find node at path "%s.%s"', $rootNode->getName(), $path)); throw new \UnexpectedValueException(sprintf('Unable to find node at path "%s.%s".', $rootNode->getName(), $path));
} }
return $this->dumpNode($node); return $this->dumpNode($node);

View File

@@ -185,7 +185,7 @@ class PrototypedArrayNode extends ArrayNode
protected function finalizeValue($value) protected function finalizeValue($value)
{ {
if (false === $value) { if (false === $value) {
throw new UnsetKeyException(sprintf('Unsetting key for path "%s", value: %s', $this->getPath(), json_encode($value))); throw new UnsetKeyException(sprintf('Unsetting key for path "%s", value: "%s".', $this->getPath(), json_encode($value)));
} }
foreach ($value as $k => $v) { foreach ($value as $k => $v) {

View File

@@ -11,7 +11,7 @@
namespace Symfony\Component\Config\DependencyInjection; namespace Symfony\Component\Config\DependencyInjection;
@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use tagged iterator arguments instead.', ConfigCachePass::class), E_USER_DEPRECATED); @trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use tagged iterator arguments instead.', ConfigCachePass::class), \E_USER_DEPRECATED);
use Symfony\Component\DependencyInjection\Argument\IteratorArgument; use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;

View File

@@ -68,7 +68,7 @@ class FileLocator implements FileLocatorInterface
} }
if (!$filepaths) { if (!$filepaths) {
throw new FileLocatorFileNotFoundException(sprintf('The file "%s" does not exist (in: %s).', $name, implode(', ', $paths)), 0, null, $notfound); throw new FileLocatorFileNotFoundException(sprintf('The file "%s" does not exist (in: "%s").', $name, implode('", "', $paths)), 0, null, $notfound);
} }
return $filepaths; return $filepaths;
@@ -88,7 +88,7 @@ class FileLocator implements FileLocatorInterface
&& ':' === $file[1] && ':' === $file[1]
&& ('\\' === $file[2] || '/' === $file[2]) && ('\\' === $file[2] || '/' === $file[2])
) )
|| null !== parse_url($file, PHP_URL_SCHEME) || null !== parse_url($file, \PHP_URL_SCHEME)
) { ) {
return true; return true;
} }

View File

@@ -1,4 +1,4 @@
Copyright (c) 2004-2019 Fabien Potencier Copyright (c) 2004-2020 Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@@ -76,7 +76,7 @@ abstract class FileLoader extends Loader
$ret = []; $ret = [];
$isSubpath = 0 !== $i && false !== strpos(substr($resource, 0, $i), '/'); $isSubpath = 0 !== $i && false !== strpos(substr($resource, 0, $i), '/');
foreach ($this->glob($resource, false, $_, $ignoreErrors || !$isSubpath) as $path => $info) { foreach ($this->glob($resource, false, $_, $ignoreErrors || !$isSubpath) as $path => $info) {
if (null !== $res = $this->doImport($path, $type, $ignoreErrors, $sourceResource)) { if (null !== $res = $this->doImport($path, 'glob' === $type ? null : $type, $ignoreErrors, $sourceResource)) {
$ret[] = $res; $ret[] = $res;
} }
$isSubpath = true; $isSubpath = true;

View File

@@ -8,7 +8,7 @@ may be (YAML, XML, INI files, or for instance a database).
Resources Resources
--------- ---------
* [Documentation](https://symfony.com/doc/current/components/config/index.html) * [Documentation](https://symfony.com/doc/current/components/config.html)
* [Contributing](https://symfony.com/doc/current/contributing/index.html) * [Contributing](https://symfony.com/doc/current/contributing/index.html)
* [Report issues](https://github.com/symfony/symfony/issues) and * [Report issues](https://github.com/symfony/symfony/issues) and
[send Pull Requests](https://github.com/symfony/symfony/pulls) [send Pull Requests](https://github.com/symfony/symfony/pulls)

View File

@@ -36,7 +36,7 @@ class ClassExistenceResource implements SelfCheckingResourceInterface, \Serializ
{ {
$this->resource = $resource; $this->resource = $resource;
if (null !== $exists) { if (null !== $exists) {
$this->exists = (bool) $exists; $this->exists = [(bool) $exists, null];
} }
} }
@@ -65,9 +65,13 @@ class ClassExistenceResource implements SelfCheckingResourceInterface, \Serializ
{ {
$loaded = class_exists($this->resource, false) || interface_exists($this->resource, false) || trait_exists($this->resource, false); $loaded = class_exists($this->resource, false) || interface_exists($this->resource, false) || trait_exists($this->resource, false);
if (null !== $exists = &self::$existsCache[(int) (0 >= $timestamp)][$this->resource]) { if (null !== $exists = &self::$existsCache[$this->resource]) {
$exists = $exists || $loaded; if ($loaded) {
} elseif (!$exists = $loaded) { $exists = [true, null];
} elseif (0 >= $timestamp && !$exists[0] && null !== $exists[1]) {
throw new \ReflectionException($exists[1]);
}
} elseif ([false, null] === $exists = [$loaded, null]) {
if (!self::$autoloadLevel++) { if (!self::$autoloadLevel++) {
spl_autoload_register(__CLASS__.'::throwOnRequiredClass'); spl_autoload_register(__CLASS__.'::throwOnRequiredClass');
} }
@@ -75,16 +79,21 @@ class ClassExistenceResource implements SelfCheckingResourceInterface, \Serializ
self::$autoloadedClass = ltrim($this->resource, '\\'); self::$autoloadedClass = ltrim($this->resource, '\\');
try { try {
$exists = class_exists($this->resource) || interface_exists($this->resource, false) || trait_exists($this->resource, false); $exists[0] = class_exists($this->resource) || interface_exists($this->resource, false) || trait_exists($this->resource, false);
} catch (\Exception $e) { } catch (\Exception $e) {
$exists[1] = $e->getMessage();
try { try {
self::throwOnRequiredClass($this->resource, $e); self::throwOnRequiredClass($this->resource, $e);
} catch (\ReflectionException $e) { } catch (\ReflectionException $e) {
if (0 >= $timestamp) { if (0 >= $timestamp) {
unset(self::$existsCache[1][$this->resource]);
throw $e; throw $e;
} }
} }
} catch (\Throwable $e) {
$exists[1] = $e->getMessage();
throw $e;
} finally { } finally {
self::$autoloadedClass = $autoloadedClass; self::$autoloadedClass = $autoloadedClass;
if (!--self::$autoloadLevel) { if (!--self::$autoloadLevel) {
@@ -97,7 +106,7 @@ class ClassExistenceResource implements SelfCheckingResourceInterface, \Serializ
$this->exists = $exists; $this->exists = $exists;
} }
return $this->exists xor !$exists; return $this->exists[0] xor !$exists[0];
} }
/** /**
@@ -118,6 +127,10 @@ class ClassExistenceResource implements SelfCheckingResourceInterface, \Serializ
public function unserialize($serialized) public function unserialize($serialized)
{ {
list($this->resource, $this->exists) = unserialize($serialized); list($this->resource, $this->exists) = unserialize($serialized);
if (\is_bool($this->exists)) {
$this->exists = [$this->exists, null];
}
} }
/** /**
@@ -155,7 +168,17 @@ class ClassExistenceResource implements SelfCheckingResourceInterface, \Serializ
throw $previous; throw $previous;
} }
$e = new \ReflectionException(sprintf('Class "%s" not found while loading "%s".', $class, self::$autoloadedClass), 0, $previous); $message = sprintf('Class "%s" not found.', $class);
if (self::$autoloadedClass !== $class) {
$message = substr_replace($message, sprintf(' while loading "%s"', self::$autoloadedClass), -1, 0);
}
if (null !== $previous) {
$message = $previous->getMessage();
}
$e = new \ReflectionException($message, 0, $previous);
if (null !== $previous) { if (null !== $previous) {
throw $e; throw $e;
@@ -167,12 +190,17 @@ class ClassExistenceResource implements SelfCheckingResourceInterface, \Serializ
'args' => [$class], 'args' => [$class],
]; ];
if (false === $i = array_search($autoloadFrame, $trace, true)) { if (\PHP_VERSION_ID >= 80000 && isset($trace[1])) {
$callerFrame = $trace[1];
$i = 2;
} elseif (false !== $i = array_search($autoloadFrame, $trace, true)) {
$callerFrame = $trace[++$i];
} else {
throw $e; throw $e;
} }
if (isset($trace[++$i]['function']) && !isset($trace[$i]['class'])) { if (isset($callerFrame['function']) && !isset($callerFrame['class'])) {
switch ($trace[$i]['function']) { switch ($callerFrame['function']) {
case 'get_class_methods': case 'get_class_methods':
case 'get_class_vars': case 'get_class_vars':
case 'get_parent_class': case 'get_parent_class':
@@ -191,8 +219,8 @@ class ClassExistenceResource implements SelfCheckingResourceInterface, \Serializ
} }
$props = [ $props = [
'file' => isset($trace[$i]['file']) ? $trace[$i]['file'] : null, 'file' => isset($callerFrame['file']) ? $callerFrame['file'] : null,
'line' => isset($trace[$i]['line']) ? $trace[$i]['line'] : null, 'line' => isset($callerFrame['line']) ? $callerFrame['line'] : null,
'trace' => \array_slice($trace, 1 + $i), 'trace' => \array_slice($trace, 1 + $i),
]; ];

View File

@@ -100,7 +100,7 @@ class GlobResource implements \IteratorAggregate, SelfCheckingResourceInterface,
} }
if (0 !== strpos($this->prefix, 'phar://') && false === strpos($this->pattern, '/**/') && (\defined('GLOB_BRACE') || false === strpos($this->pattern, '{'))) { if (0 !== strpos($this->prefix, 'phar://') && false === strpos($this->pattern, '/**/') && (\defined('GLOB_BRACE') || false === strpos($this->pattern, '{'))) {
$paths = glob($this->prefix.$this->pattern, GLOB_NOSORT | (\defined('GLOB_BRACE') ? GLOB_BRACE : 0)); $paths = glob($this->prefix.$this->pattern, \GLOB_NOSORT | (\defined('GLOB_BRACE') ? \GLOB_BRACE : 0));
sort($paths); sort($paths);
foreach ($paths as $path) { foreach ($paths as $path) {
if ($this->recursive && is_dir($path)) { if ($this->recursive && is_dir($path)) {

View File

@@ -139,7 +139,11 @@ class ReflectionClassResource implements SelfCheckingResourceInterface, \Seriali
$defaults = $class->getDefaultProperties(); $defaults = $class->getDefaultProperties();
foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED) as $p) { foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED) as $p) {
yield $p->getDocComment().$p; yield $p->getDocComment();
yield $p->isDefault() ? '<default>' : '';
yield $p->isPublic() ? 'public' : 'protected';
yield $p->isStatic() ? 'static' : '';
yield '$'.$p->name;
yield print_r(isset($defaults[$p->name]) && !\is_object($defaults[$p->name]) ? $defaults[$p->name] : null, true); yield print_r(isset($defaults[$p->name]) && !\is_object($defaults[$p->name]) ? $defaults[$p->name] : null, true);
} }
} }
@@ -173,6 +177,7 @@ class ReflectionClassResource implements SelfCheckingResourceInterface, \Seriali
if (!$parametersWithUndefinedConstants) { if (!$parametersWithUndefinedConstants) {
yield preg_replace('/^ @@.*/m', '', $m); yield preg_replace('/^ @@.*/m', '', $m);
} else { } else {
$t = \PHP_VERSION_ID >= 70000 ? $m->getReturnType() : '';
$stack = [ $stack = [
$m->getDocComment(), $m->getDocComment(),
$m->getName(), $m->getName(),
@@ -183,15 +188,16 @@ class ReflectionClassResource implements SelfCheckingResourceInterface, \Seriali
$m->isPrivate(), $m->isPrivate(),
$m->isProtected(), $m->isProtected(),
$m->returnsReference(), $m->returnsReference(),
\PHP_VERSION_ID >= 70000 && $m->hasReturnType() ? (\PHP_VERSION_ID >= 70100 ? $m->getReturnType()->getName() : (string) $m->getReturnType()) : '', $t instanceof \ReflectionNamedType ? ((string) $t->allowsNull()).$t->getName() : (string) $t,
]; ];
foreach ($m->getParameters() as $p) { foreach ($m->getParameters() as $p) {
if (!isset($parametersWithUndefinedConstants[$p->name])) { if (!isset($parametersWithUndefinedConstants[$p->name])) {
$stack[] = (string) $p; $stack[] = (string) $p;
} else { } else {
$t = \PHP_VERSION_ID >= 70000 ? $p->getType() : '';
$stack[] = $p->isOptional(); $stack[] = $p->isOptional();
$stack[] = \PHP_VERSION_ID >= 70000 && $p->hasType() ? (\PHP_VERSION_ID >= 70100 ? $p->getType()->getName() : (string) $p->getType()) : ''; $stack[] = $t instanceof \ReflectionNamedType ? ((string) $t->allowsNull()).$t->getName() : (string) $t;
$stack[] = $p->isPassedByReference(); $stack[] = $p->isPassedByReference();
$stack[] = \PHP_VERSION_ID >= 50600 ? $p->isVariadic() : ''; $stack[] = \PHP_VERSION_ID >= 50600 ? $p->isVariadic() : '';
$stack[] = $p->getName(); $stack[] = $p->getName();

View File

@@ -137,7 +137,7 @@ class ResourceCheckerConfigCache implements ConfigCacheInterface
} }
} }
if (\function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN)) { if (\function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN)) {
@opcache_invalidate($this->file, true); @opcache_invalidate($this->file, true);
} }
} }

View File

@@ -51,13 +51,17 @@ class XmlUtils
} }
$internalErrors = libxml_use_internal_errors(true); $internalErrors = libxml_use_internal_errors(true);
$disableEntities = libxml_disable_entity_loader(true); if (\LIBXML_VERSION < 20900) {
$disableEntities = libxml_disable_entity_loader(true);
}
libxml_clear_errors(); libxml_clear_errors();
$dom = new \DOMDocument(); $dom = new \DOMDocument();
$dom->validateOnParse = true; $dom->validateOnParse = true;
if (!$dom->loadXML($content, LIBXML_NONET | (\defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0))) { if (!$dom->loadXML($content, \LIBXML_NONET | (\defined('LIBXML_COMPACT') ? \LIBXML_COMPACT : 0))) {
libxml_disable_entity_loader($disableEntities); if (\LIBXML_VERSION < 20900) {
libxml_disable_entity_loader($disableEntities);
}
throw new XmlParsingException(implode("\n", static::getXmlErrors($internalErrors))); throw new XmlParsingException(implode("\n", static::getXmlErrors($internalErrors)));
} }
@@ -65,10 +69,12 @@ class XmlUtils
$dom->normalizeDocument(); $dom->normalizeDocument();
libxml_use_internal_errors($internalErrors); libxml_use_internal_errors($internalErrors);
libxml_disable_entity_loader($disableEntities); if (\LIBXML_VERSION < 20900) {
libxml_disable_entity_loader($disableEntities);
}
foreach ($dom->childNodes as $child) { foreach ($dom->childNodes as $child) {
if (XML_DOCUMENT_TYPE_NODE === $child->nodeType) { if (\XML_DOCUMENT_TYPE_NODE === $child->nodeType) {
throw new XmlParsingException('Document types are not allowed.'); throw new XmlParsingException('Document types are not allowed.');
} }
} }
@@ -122,9 +128,18 @@ class XmlUtils
*/ */
public static function loadFile($file, $schemaOrCallable = null) public static function loadFile($file, $schemaOrCallable = null)
{ {
if (!is_file($file)) {
throw new \InvalidArgumentException(sprintf('Resource "%s" is not a file.', $file));
}
if (!is_readable($file)) {
throw new \InvalidArgumentException(sprintf('File "%s" is not readable.', $file));
}
$content = @file_get_contents($file); $content = @file_get_contents($file);
if ('' === trim($content)) { if ('' === trim($content)) {
throw new \InvalidArgumentException(sprintf('File %s does not contain valid XML, it is empty.', $file)); throw new \InvalidArgumentException(sprintf('File "%s" does not contain valid XML, it is empty.', $file));
} }
try { try {
@@ -252,7 +267,7 @@ class XmlUtils
$errors = []; $errors = [];
foreach (libxml_get_errors() as $error) { foreach (libxml_get_errors() as $error) {
$errors[] = sprintf('[%s %s] %s (in %s - line %d, column %d)', $errors[] = sprintf('[%s %s] %s (in %s - line %d, column %d)',
LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR', \LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR',
$error->code, $error->code,
trim($error->message), trim($error->message),
$error->file ?: 'n/a', $error->file ?: 'n/a',

View File

@@ -39,10 +39,5 @@
"/Tests/" "/Tests/"
] ]
}, },
"minimum-stability": "dev", "minimum-stability": "dev"
"extra": {
"branch-alias": {
"dev-master": "3.4-dev"
}
}
} }

View File

@@ -121,7 +121,7 @@ class Application
$renderException = function ($e) use ($output) { $renderException = function ($e) use ($output) {
if (!$e instanceof \Exception) { if (!$e instanceof \Exception) {
$e = class_exists(FatalThrowableError::class) ? new FatalThrowableError($e) : new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine()); $e = class_exists(FatalThrowableError::class) ? new FatalThrowableError($e) : new \ErrorException($e->getMessage(), $e->getCode(), \E_ERROR, $e->getFile(), $e->getLine());
} }
if ($output instanceof ConsoleOutputInterface) { if ($output instanceof ConsoleOutputInterface) {
$this->renderException($e, $output->getErrorOutput()); $this->renderException($e, $output->getErrorOutput());
@@ -139,7 +139,7 @@ class Application
} }
if (null !== $this->dispatcher && $this->dispatcher->hasListeners(ConsoleEvents::EXCEPTION)) { if (null !== $this->dispatcher && $this->dispatcher->hasListeners(ConsoleEvents::EXCEPTION)) {
@trigger_error(sprintf('The "ConsoleEvents::EXCEPTION" event is deprecated since Symfony 3.3 and will be removed in 4.0. Listen to the "ConsoleEvents::ERROR" event instead.'), E_USER_DEPRECATED); @trigger_error(sprintf('The "ConsoleEvents::EXCEPTION" event is deprecated since Symfony 3.3 and will be removed in 4.0. Listen to the "ConsoleEvents::ERROR" event instead.'), \E_USER_DEPRECATED);
} }
$this->configureIO($input, $output); $this->configureIO($input, $output);
@@ -490,6 +490,11 @@ class Application
throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name)); throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
} }
// When the command has a different name than the one used at the command loader level
if (!isset($this->commands[$name])) {
throw new CommandNotFoundException(sprintf('The "%s" command cannot be found because it is registered under multiple names. Make sure you don\'t set a different name via constructor or "setName()".', $name));
}
$command = $this->commands[$name]; $command = $this->commands[$name];
if ($this->wantHelps) { if ($this->wantHelps) {
@@ -576,7 +581,7 @@ class Application
$exact = \in_array($namespace, $namespaces, true); $exact = \in_array($namespace, $namespaces, true);
if (\count($namespaces) > 1 && !$exact) { if (\count($namespaces) > 1 && !$exact) {
throw new CommandNotFoundException(sprintf("The namespace \"%s\" is ambiguous.\nDid you mean one of these?\n%s", $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces)); throw new CommandNotFoundException(sprintf("The namespace \"%s\" is ambiguous.\nDid you mean one of these?\n%s.", $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
} }
return $exact ? $namespace : reset($namespaces); return $exact ? $namespace : reset($namespaces);
@@ -608,6 +613,10 @@ class Application
} }
} }
if ($this->has($name)) {
return $this->get($name);
}
$allCommands = $this->commandLoader ? array_merge($this->commandLoader->getNames(), array_keys($this->commands)) : array_keys($this->commands); $allCommands = $this->commandLoader ? array_merge($this->commandLoader->getNames(), array_keys($this->commands)) : array_keys($this->commands);
$expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name); $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name);
$commands = preg_grep('{^'.$expr.'}', $allCommands); $commands = preg_grep('{^'.$expr.'}', $allCommands);
@@ -645,8 +654,13 @@ class Application
// filter out aliases for commands which are already on the list // filter out aliases for commands which are already on the list
if (\count($commands) > 1) { if (\count($commands) > 1) {
$commandList = $this->commandLoader ? array_merge(array_flip($this->commandLoader->getNames()), $this->commands) : $this->commands; $commandList = $this->commandLoader ? array_merge(array_flip($this->commandLoader->getNames()), $this->commands) : $this->commands;
$commands = array_unique(array_filter($commands, function ($nameOrAlias) use ($commandList, $commands, &$aliases) { $commands = array_unique(array_filter($commands, function ($nameOrAlias) use (&$commandList, $commands, &$aliases) {
$commandName = $commandList[$nameOrAlias] instanceof Command ? $commandList[$nameOrAlias]->getName() : $nameOrAlias; if (!$commandList[$nameOrAlias] instanceof Command) {
$commandList[$nameOrAlias] = $this->commandLoader->get($nameOrAlias);
}
$commandName = $commandList[$nameOrAlias]->getName();
$aliases[$nameOrAlias] = $commandName; $aliases[$nameOrAlias] = $commandName;
return $commandName === $nameOrAlias || !\in_array($commandName, $commands); return $commandName === $nameOrAlias || !\in_array($commandName, $commands);
@@ -662,10 +676,6 @@ class Application
$maxLen = max(Helper::strlen($abbrev), $maxLen); $maxLen = max(Helper::strlen($abbrev), $maxLen);
} }
$abbrevs = array_map(function ($cmd) use ($commandList, $usableWidth, $maxLen) { $abbrevs = array_map(function ($cmd) use ($commandList, $usableWidth, $maxLen) {
if (!$commandList[$cmd] instanceof Command) {
$commandList[$cmd] = $this->commandLoader->get($cmd);
}
if ($commandList[$cmd]->isHidden()) { if ($commandList[$cmd]->isHidden()) {
return false; return false;
} }
@@ -676,7 +686,7 @@ class Application
}, array_values($commands)); }, array_values($commands));
$suggestions = $this->getAbbreviationSuggestions(array_filter($abbrevs)); $suggestions = $this->getAbbreviationSuggestions(array_filter($abbrevs));
throw new CommandNotFoundException(sprintf("Command \"%s\" is ambiguous.\nDid you mean one of these?\n%s", $name, $suggestions), array_values($commands)); throw new CommandNotFoundException(sprintf("Command \"%s\" is ambiguous.\nDid you mean one of these?\n%s.", $name, $suggestions), array_values($commands));
} }
return $this->get($exact ? $name : reset($commands)); return $this->get($exact ? $name : reset($commands));
@@ -774,7 +784,7 @@ class Application
$len = 0; $len = 0;
} }
$width = $this->terminal->getWidth() ? $this->terminal->getWidth() - 1 : PHP_INT_MAX; $width = $this->terminal->getWidth() ? $this->terminal->getWidth() - 1 : \PHP_INT_MAX;
// HHVM only accepts 32 bits integer in str_split, even when PHP_INT_MAX is a 64 bit integer: https://github.com/facebook/hhvm/issues/1327 // HHVM only accepts 32 bits integer in str_split, even when PHP_INT_MAX is a 64 bit integer: https://github.com/facebook/hhvm/issues/1327
if (\defined('HHVM_VERSION') && $width > 1 << 31) { if (\defined('HHVM_VERSION') && $width > 1 << 31) {
$width = 1 << 31; $width = 1 << 31;
@@ -843,7 +853,7 @@ class Application
*/ */
protected function getTerminalWidth() protected function getTerminalWidth()
{ {
@trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), E_USER_DEPRECATED); @trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), \E_USER_DEPRECATED);
return $this->terminal->getWidth(); return $this->terminal->getWidth();
} }
@@ -857,7 +867,7 @@ class Application
*/ */
protected function getTerminalHeight() protected function getTerminalHeight()
{ {
@trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), E_USER_DEPRECATED); @trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), \E_USER_DEPRECATED);
return $this->terminal->getHeight(); return $this->terminal->getHeight();
} }
@@ -871,7 +881,7 @@ class Application
*/ */
public function getTerminalDimensions() public function getTerminalDimensions()
{ {
@trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), E_USER_DEPRECATED); @trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), \E_USER_DEPRECATED);
return [$this->terminal->getWidth(), $this->terminal->getHeight()]; return [$this->terminal->getWidth(), $this->terminal->getHeight()];
} }
@@ -890,7 +900,7 @@ class Application
*/ */
public function setTerminalDimensions($width, $height) public function setTerminalDimensions($width, $height)
{ {
@trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Set the COLUMNS and LINES env vars instead.', __METHOD__), E_USER_DEPRECATED); @trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Set the COLUMNS and LINES env vars instead.', __METHOD__), \E_USER_DEPRECATED);
putenv('COLUMNS='.$width); putenv('COLUMNS='.$width);
putenv('LINES='.$height); putenv('LINES='.$height);
@@ -1163,7 +1173,7 @@ class Application
} }
$alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; }); $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
ksort($alternatives, SORT_NATURAL | SORT_FLAG_CASE); ksort($alternatives, \SORT_NATURAL | \SORT_FLAG_CASE);
return array_keys($alternatives); return array_keys($alternatives);
} }

View File

@@ -55,7 +55,7 @@ class Command
*/ */
public static function getDefaultName() public static function getDefaultName()
{ {
$class = \get_called_class(); $class = static::class;
$r = new \ReflectionProperty($class, 'defaultName'); $r = new \ReflectionProperty($class, 'defaultName');
return $class === $r->class ? static::$defaultName : null; return $class === $r->class ? static::$defaultName : null;
@@ -223,7 +223,7 @@ class Command
if (null !== $this->processTitle) { if (null !== $this->processTitle) {
if (\function_exists('cli_set_process_title')) { if (\function_exists('cli_set_process_title')) {
if (!@cli_set_process_title($this->processTitle)) { if (!@cli_set_process_title($this->processTitle)) {
if ('Darwin' === PHP_OS) { if ('Darwin' === \PHP_OS) {
$output->writeln('<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE); $output->writeln('<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
} else { } else {
cli_set_process_title($this->processTitle); cli_set_process_title($this->processTitle);
@@ -348,7 +348,7 @@ class Command
public function getDefinition() public function getDefinition()
{ {
if (null === $this->definition) { if (null === $this->definition) {
throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', \get_class($this))); throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', static::class));
} }
return $this->definition; return $this->definition;
@@ -437,8 +437,6 @@ class Command
* This feature should be used only when creating a long process command, * This feature should be used only when creating a long process command,
* like a daemon. * like a daemon.
* *
* PHP 5.5+ or the proctitle PECL library is required
*
* @param string $title The process title * @param string $title The process title
* *
* @return $this * @return $this
@@ -563,7 +561,7 @@ class Command
public function setAliases($aliases) public function setAliases($aliases)
{ {
if (!\is_array($aliases) && !$aliases instanceof \Traversable) { if (!\is_array($aliases) && !$aliases instanceof \Traversable) {
throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable'); throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable.');
} }
foreach ($aliases as $alias) { foreach ($aliases as $alias) {

View File

@@ -88,7 +88,7 @@ class ApplicationDescription
public function getCommand($name) public function getCommand($name)
{ {
if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) { if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) {
throw new CommandNotFoundException(sprintf('Command %s does not exist.', $name)); throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name));
} }
return isset($this->commands[$name]) ? $this->commands[$name] : $this->aliases[$name]; return isset($this->commands[$name]) ? $this->commands[$name] : $this->aliases[$name];

View File

@@ -110,7 +110,7 @@ class JsonDescriptor extends Descriptor
'is_required' => $argument->isRequired(), 'is_required' => $argument->isRequired(),
'is_array' => $argument->isArray(), 'is_array' => $argument->isArray(),
'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()), 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
'default' => INF === $argument->getDefault() ? 'INF' : $argument->getDefault(), 'default' => \INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
]; ];
} }
@@ -126,7 +126,7 @@ class JsonDescriptor extends Descriptor
'is_value_required' => $option->isValueRequired(), 'is_value_required' => $option->isValueRequired(),
'is_multiple' => $option->isArray(), 'is_multiple' => $option->isArray(),
'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()), 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
'default' => INF === $option->getDefault() ? 'INF' : $option->getDefault(), 'default' => \INF === $option->getDefault() ? 'INF' : $option->getDefault(),
]; ];
} }

View File

@@ -204,7 +204,7 @@ class TextDescriptor extends Descriptor
// calculate max. width based on available commands per namespace // calculate max. width based on available commands per namespace
$width = $this->getColumnWidth(\call_user_func_array('array_merge', array_map(function ($namespace) use ($commands) { $width = $this->getColumnWidth(\call_user_func_array('array_merge', array_map(function ($namespace) use ($commands) {
return array_intersect($namespace['commands'], array_keys($commands)); return array_intersect($namespace['commands'], array_keys($commands));
}, $namespaces))); }, array_values($namespaces))));
if ($describedNamespace) { if ($describedNamespace) {
$this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options); $this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
@@ -276,7 +276,7 @@ class TextDescriptor extends Descriptor
*/ */
private function formatDefaultValue($default) private function formatDefaultValue($default)
{ {
if (INF === $default) { if (\INF === $default) {
return 'INF'; return 'INF';
} }
@@ -290,7 +290,7 @@ class TextDescriptor extends Descriptor
} }
} }
return str_replace('\\\\', '\\', json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)); return str_replace('\\\\', '\\', json_encode($default, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE));
} }
/** /**

View File

@@ -11,7 +11,7 @@
namespace Symfony\Component\Console\Event; namespace Symfony\Component\Console\Event;
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 3.3 and will be removed in 4.0. Use the ConsoleErrorEvent instead.', ConsoleExceptionEvent::class), E_USER_DEPRECATED); @trigger_error(sprintf('The "%s" class is deprecated since Symfony 3.3 and will be removed in 4.0. Use the ConsoleErrorEvent instead.', ConsoleExceptionEvent::class), \E_USER_DEPRECATED);
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;

View File

@@ -119,7 +119,7 @@ class OutputFormatter implements OutputFormatterInterface
public function getStyle($name) public function getStyle($name)
{ {
if (!$this->hasStyle($name)) { if (!$this->hasStyle($name)) {
throw new InvalidArgumentException(sprintf('Undefined style: %s', $name)); throw new InvalidArgumentException(sprintf('Undefined style: "%s".', $name));
} }
return $this->styles[strtolower($name)]; return $this->styles[strtolower($name)];
@@ -134,7 +134,7 @@ class OutputFormatter implements OutputFormatterInterface
$offset = 0; $offset = 0;
$output = ''; $output = '';
$tagRegex = '[a-z][a-z0-9,_=;-]*+'; $tagRegex = '[a-z][a-z0-9,_=;-]*+';
preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#ix", $message, $matches, PREG_OFFSET_CAPTURE); preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#ix", $message, $matches, \PREG_OFFSET_CAPTURE);
foreach ($matches[0] as $i => $match) { foreach ($matches[0] as $i => $match) {
$pos = $match[1]; $pos = $match[1];
$text = $match[0]; $text = $match[0];
@@ -196,7 +196,7 @@ class OutputFormatter implements OutputFormatterInterface
return $this->styles[$string]; return $this->styles[$string];
} }
if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', $string, $matches, PREG_SET_ORDER)) { if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', $string, $matches, \PREG_SET_ORDER)) {
return false; return false;
} }
@@ -216,7 +216,7 @@ class OutputFormatter implements OutputFormatterInterface
try { try {
$style->setOption($option); $style->setOption($option);
} catch (\InvalidArgumentException $e) { } catch (\InvalidArgumentException $e) {
@trigger_error(sprintf('Unknown style options are deprecated since Symfony 3.2 and will be removed in 4.0. Exception "%s".', $e->getMessage()), E_USER_DEPRECATED); @trigger_error(sprintf('Unknown style options are deprecated since Symfony 3.2 and will be removed in 4.0. Exception "%s".', $e->getMessage()), \E_USER_DEPRECATED);
return false; return false;
} }

View File

@@ -86,7 +86,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
} }
if (!isset(static::$availableForegroundColors[$color])) { if (!isset(static::$availableForegroundColors[$color])) {
throw new InvalidArgumentException(sprintf('Invalid foreground color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableForegroundColors)))); throw new InvalidArgumentException(sprintf('Invalid foreground color specified: "%s". Expected one of (%s).', $color, implode(', ', array_keys(static::$availableForegroundColors))));
} }
$this->foreground = static::$availableForegroundColors[$color]; $this->foreground = static::$availableForegroundColors[$color];
@@ -104,7 +104,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
} }
if (!isset(static::$availableBackgroundColors[$color])) { if (!isset(static::$availableBackgroundColors[$color])) {
throw new InvalidArgumentException(sprintf('Invalid background color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableBackgroundColors)))); throw new InvalidArgumentException(sprintf('Invalid background color specified: "%s". Expected one of (%s).', $color, implode(', ', array_keys(static::$availableBackgroundColors))));
} }
$this->background = static::$availableBackgroundColors[$color]; $this->background = static::$availableBackgroundColors[$color];
@@ -116,7 +116,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
public function setOption($option) public function setOption($option)
{ {
if (!isset(static::$availableOptions[$option])) { if (!isset(static::$availableOptions[$option])) {
throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions)))); throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s).', $option, implode(', ', array_keys(static::$availableOptions))));
} }
if (!\in_array(static::$availableOptions[$option], $this->options)) { if (!\in_array(static::$availableOptions[$option], $this->options)) {
@@ -130,7 +130,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
public function unsetOption($option) public function unsetOption($option)
{ {
if (!isset(static::$availableOptions[$option])) { if (!isset(static::$availableOptions[$option])) {
throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions)))); throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s).', $option, implode(', ', array_keys(static::$availableOptions))));
} }
$pos = array_search(static::$availableOptions[$option], $this->options); $pos = array_search(static::$availableOptions[$option], $this->options);

View File

@@ -54,12 +54,12 @@ class FormatterHelper extends Helper
foreach ($messages as $message) { foreach ($messages as $message) {
$message = OutputFormatter::escape($message); $message = OutputFormatter::escape($message);
$lines[] = sprintf($large ? ' %s ' : ' %s ', $message); $lines[] = sprintf($large ? ' %s ' : ' %s ', $message);
$len = max($this->strlen($message) + ($large ? 4 : 2), $len); $len = max(self::strlen($message) + ($large ? 4 : 2), $len);
} }
$messages = $large ? [str_repeat(' ', $len)] : []; $messages = $large ? [str_repeat(' ', $len)] : [];
for ($i = 0; isset($lines[$i]); ++$i) { for ($i = 0; isset($lines[$i]); ++$i) {
$messages[] = $lines[$i].str_repeat(' ', $len - $this->strlen($lines[$i])); $messages[] = $lines[$i].str_repeat(' ', $len - self::strlen($lines[$i]));
} }
if ($large) { if ($large) {
$messages[] = str_repeat(' ', $len); $messages[] = str_repeat(' ', $len);
@@ -83,17 +83,13 @@ class FormatterHelper extends Helper
*/ */
public function truncate($message, $length, $suffix = '...') public function truncate($message, $length, $suffix = '...')
{ {
$computedLength = $length - $this->strlen($suffix); $computedLength = $length - self::strlen($suffix);
if ($computedLength > $this->strlen($message)) { if ($computedLength > self::strlen($message)) {
return $message; return $message;
} }
if (false === $encoding = mb_detect_encoding($message, null, true)) { return self::substr($message, 0, $length).$suffix;
return substr($message, 0, $length).$suffix;
}
return mb_substr($message, 0, $length, $encoding).$suffix;
} }
/** /**

View File

@@ -37,6 +37,10 @@ class ProcessHelper extends Helper
*/ */
public function run(OutputInterface $output, $cmd, $error = null, callable $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE) public function run(OutputInterface $output, $cmd, $error = null, callable $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE)
{ {
if (!class_exists(Process::class)) {
throw new \LogicException('The ProcessHelper cannot be run as the Process component is not installed. Try running "compose require symfony/process".');
}
if ($output instanceof ConsoleOutputInterface) { if ($output instanceof ConsoleOutputInterface) {
$output = $output->getErrorOutput(); $output = $output->getErrorOutput();
} }

View File

@@ -475,7 +475,7 @@ final class ProgressBar
$message = "\x0D\x1B[2K$message"; $message = "\x0D\x1B[2K$message";
} }
} elseif ($this->step > 0) { } elseif ($this->step > 0) {
$message = PHP_EOL.$message; $message = \PHP_EOL.$message;
} }
$this->firstRun = false; $this->firstRun = false;
@@ -544,7 +544,7 @@ final class ProgressBar
return Helper::formatMemory(memory_get_usage(true)); return Helper::formatMemory(memory_get_usage(true));
}, },
'current' => function (self $bar) { 'current' => function (self $bar) {
return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', STR_PAD_LEFT); return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', \STR_PAD_LEFT);
}, },
'max' => function (self $bar) { 'max' => function (self $bar) {
return $bar->getMaxSteps(); return $bar->getMaxSteps();

View File

@@ -32,7 +32,7 @@ class QuestionHelper extends Helper
{ {
private $inputStream; private $inputStream;
private static $shell; private static $shell;
private static $stty; private static $stty = true;
/** /**
* Asks a question to the user. * Asks a question to the user.
@@ -102,7 +102,7 @@ class QuestionHelper extends Helper
*/ */
public function setInputStream($stream) public function setInputStream($stream)
{ {
@trigger_error(sprintf('The %s() method is deprecated since Symfony 3.2 and will be removed in 4.0. Use %s::setStream() instead.', __METHOD__, StreamableInputInterface::class), E_USER_DEPRECATED); @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.2 and will be removed in 4.0. Use %s::setStream() instead.', __METHOD__, StreamableInputInterface::class), \E_USER_DEPRECATED);
if (!\is_resource($stream)) { if (!\is_resource($stream)) {
throw new InvalidArgumentException('Input stream must be a valid resource.'); throw new InvalidArgumentException('Input stream must be a valid resource.');
@@ -122,7 +122,7 @@ class QuestionHelper extends Helper
public function getInputStream() public function getInputStream()
{ {
if (0 === \func_num_args() || func_get_arg(0)) { if (0 === \func_num_args() || func_get_arg(0)) {
@trigger_error(sprintf('The %s() method is deprecated since Symfony 3.2 and will be removed in 4.0. Use %s::getStream() instead.', __METHOD__, StreamableInputInterface::class), E_USER_DEPRECATED); @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.2 and will be removed in 4.0. Use %s::getStream() instead.', __METHOD__, StreamableInputInterface::class), \E_USER_DEPRECATED);
} }
return $this->inputStream; return $this->inputStream;
@@ -155,10 +155,15 @@ class QuestionHelper extends Helper
{ {
$this->writePrompt($output, $question); $this->writePrompt($output, $question);
$inputStream = $this->inputStream ?: STDIN; $inputStream = $this->inputStream ?: \STDIN;
$autocomplete = $question->getAutocompleterValues(); $autocomplete = $question->getAutocompleterValues();
if (null === $autocomplete || !Terminal::hasSttyAvailable()) { if (\function_exists('sapi_windows_cp_set')) {
// Codepage used by cmd.exe on Windows to allow special characters (éàüñ).
@sapi_windows_cp_set(1252);
}
if (null === $autocomplete || !self::$stty || !Terminal::hasSttyAvailable()) {
$ret = false; $ret = false;
if ($question->isHidden()) { if ($question->isHidden()) {
try { try {
@@ -198,15 +203,9 @@ class QuestionHelper extends Helper
$message = $question->getQuestion(); $message = $question->getQuestion();
if ($question instanceof ChoiceQuestion) { if ($question instanceof ChoiceQuestion) {
$maxWidth = max(array_map([$this, 'strlen'], array_keys($question->getChoices()))); $output->writeln(array_merge([
$question->getQuestion(),
$messages = (array) $question->getQuestion(); ], $this->formatChoiceQuestionChoices($question, 'info')));
foreach ($question->getChoices() as $key => $value) {
$width = $maxWidth - $this->strlen($key);
$messages[] = ' [<info>'.$key.str_repeat(' ', $width).'</info>] '.$value;
}
$output->writeln($messages);
$message = $question->getPrompt(); $message = $question->getPrompt();
} }
@@ -214,6 +213,26 @@ class QuestionHelper extends Helper
$output->write($message); $output->write($message);
} }
/**
* @param string $tag
*
* @return string[]
*/
protected function formatChoiceQuestionChoices(ChoiceQuestion $question, $tag)
{
$messages = [];
$maxWidth = max(array_map('self::strlen', array_keys($choices = $question->getChoices())));
foreach ($choices as $key => $value) {
$padding = str_repeat(' ', $maxWidth - self::strlen($key));
$messages[] = sprintf(" [<$tag>%s$padding</$tag>] %s", $key, $value);
}
return $messages;
}
/** /**
* Outputs an error message. * Outputs an error message.
*/ */
@@ -410,7 +429,7 @@ class QuestionHelper extends Helper
return $value; return $value;
} }
if (Terminal::hasSttyAvailable()) { if (self::$stty && Terminal::hasSttyAvailable()) {
$sttyMode = shell_exec('stty -g'); $sttyMode = shell_exec('stty -g');
shell_exec('stty -echo'); shell_exec('stty -echo');

View File

@@ -41,7 +41,7 @@ class SymfonyQuestionHelper extends QuestionHelper
} else { } else {
// make required // make required
if (!\is_array($value) && !\is_bool($value) && 0 === \strlen($value)) { if (!\is_array($value) && !\is_bool($value) && 0 === \strlen($value)) {
@trigger_error('The default question validator is deprecated since Symfony 3.3 and will not be used anymore in version 4.0. Set a custom question validator if needed.', E_USER_DEPRECATED); @trigger_error('The default question validator is deprecated since Symfony 3.3 and will not be used anymore in version 4.0. Set a custom question validator if needed.', \E_USER_DEPRECATED);
throw new LogicException('A value is required.'); throw new LogicException('A value is required.');
} }
@@ -96,15 +96,15 @@ class SymfonyQuestionHelper extends QuestionHelper
$output->writeln($text); $output->writeln($text);
if ($question instanceof ChoiceQuestion) { $prompt = ' > ';
$width = max(array_map('strlen', array_keys($question->getChoices())));
foreach ($question->getChoices() as $key => $value) { if ($question instanceof ChoiceQuestion) {
$output->writeln(sprintf(" [<comment>%-${width}s</comment>] %s", $key, $value)); $output->writeln($this->formatChoiceQuestionChoices($question, 'comment'));
}
$prompt = $question->getPrompt();
} }
$output->write(' > '); $output->write($prompt);
} }
/** /**

View File

@@ -460,7 +460,7 @@ class Table
$unmergedRows = []; $unmergedRows = [];
foreach ($rows[$line] as $column => $cell) { foreach ($rows[$line] as $column => $cell) {
if (null !== $cell && !$cell instanceof TableCell && !is_scalar($cell) && !(\is_object($cell) && method_exists($cell, '__toString'))) { if (null !== $cell && !$cell instanceof TableCell && !is_scalar($cell) && !(\is_object($cell) && method_exists($cell, '__toString'))) {
throw new InvalidArgumentException(sprintf('A cell must be a TableCell, a scalar or an object implementing __toString, %s given.', \gettype($cell))); throw new InvalidArgumentException(sprintf('A cell must be a TableCell, a scalar or an object implementing "__toString()", "%s" given.', \gettype($cell)));
} }
if ($cell instanceof TableCell && $cell->getRowspan() > 1) { if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
$nbLines = $cell->getRowspan() - 1; $nbLines = $cell->getRowspan() - 1;

View File

@@ -30,7 +30,7 @@ class TableStyle
private $cellRowFormat = '%s'; private $cellRowFormat = '%s';
private $cellRowContentFormat = ' %s '; private $cellRowContentFormat = ' %s ';
private $borderFormat = '%s'; private $borderFormat = '%s';
private $padType = STR_PAD_RIGHT; private $padType = \STR_PAD_RIGHT;
/** /**
* Sets padding character, used for cell padding. * Sets padding character, used for cell padding.
@@ -42,7 +42,7 @@ class TableStyle
public function setPaddingChar($paddingChar) public function setPaddingChar($paddingChar)
{ {
if (!$paddingChar) { if (!$paddingChar) {
throw new LogicException('The padding char must not be empty'); throw new LogicException('The padding char must not be empty.');
} }
$this->paddingChar = $paddingChar; $this->paddingChar = $paddingChar;
@@ -237,7 +237,7 @@ class TableStyle
*/ */
public function setPadType($padType) public function setPadType($padType)
{ {
if (!\in_array($padType, [STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH], true)) { if (!\in_array($padType, [\STR_PAD_LEFT, \STR_PAD_RIGHT, \STR_PAD_BOTH], true)) {
throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).'); throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
} }

View File

@@ -49,9 +49,7 @@ class ArgvInput extends Input
*/ */
public function __construct(array $argv = null, InputDefinition $definition = null) public function __construct(array $argv = null, InputDefinition $definition = null)
{ {
if (null === $argv) { $argv = null !== $argv ? $argv : (isset($_SERVER['argv']) ? $_SERVER['argv'] : []);
$argv = $_SERVER['argv'];
}
// strip the application name // strip the application name
array_shift($argv); array_shift($argv);

View File

@@ -171,7 +171,7 @@ class InputDefinition
*/ */
public function getArgumentCount() public function getArgumentCount()
{ {
return $this->hasAnArrayArgument ? PHP_INT_MAX : \count($this->arguments); return $this->hasAnArrayArgument ? \PHP_INT_MAX : \count($this->arguments);
} }
/** /**

View File

@@ -61,7 +61,7 @@ class StringInput extends ArgvInput
$tokens[] = stripcslashes($match[1]); $tokens[] = stripcslashes($match[1]);
} else { } else {
// should never happen // should never happen
throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10))); throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ...".', substr($input, $cursor, 10)));
} }
$cursor += \strlen($match[0]); $cursor += \strlen($match[0]);

View File

@@ -1,4 +1,4 @@
Copyright (c) 2004-2019 Fabien Potencier Copyright (c) 2004-2020 Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@@ -39,7 +39,7 @@ class BufferedOutput extends Output
$this->buffer .= $message; $this->buffer .= $message;
if ($newline) { if ($newline) {
$this->buffer .= PHP_EOL; $this->buffer .= \PHP_EOL;
} }
} }
} }

View File

@@ -124,7 +124,7 @@ class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
$checks = [ $checks = [
\function_exists('php_uname') ? php_uname('s') : '', \function_exists('php_uname') ? php_uname('s') : '',
getenv('OSTYPE'), getenv('OSTYPE'),
PHP_OS, \PHP_OS,
]; ];
return false !== stripos(implode(';', $checks), 'OS400'); return false !== stripos(implode(';', $checks), 'OS400');

View File

@@ -12,7 +12,6 @@
namespace Symfony\Component\Console\Output; namespace Symfony\Component\Console\Output;
use Symfony\Component\Console\Exception\InvalidArgumentException; use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Formatter\OutputFormatterInterface; use Symfony\Component\Console\Formatter\OutputFormatterInterface;
/** /**
@@ -71,13 +70,10 @@ class StreamOutput extends Output
protected function doWrite($message, $newline) protected function doWrite($message, $newline)
{ {
if ($newline) { if ($newline) {
$message .= PHP_EOL; $message .= \PHP_EOL;
} }
if (false === @fwrite($this->stream, $message)) { @fwrite($this->stream, $message);
// should never happen
throw new RuntimeException('Unable to write output.');
}
fflush($this->stream); fflush($this->stream);
} }

View File

@@ -155,7 +155,7 @@ class ChoiceQuestion extends Question
} }
if (\count($results) > 1) { if (\count($results) > 1) {
throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of %s.', implode(' or ', $results))); throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of "%s".', implode('" or "', $results)));
} }
$result = array_search($value, $choices); $result = array_search($value, $choices);

View File

@@ -188,8 +188,11 @@ class Question
*/ */
public function setMaxAttempts($attempts) public function setMaxAttempts($attempts)
{ {
if (null !== $attempts && $attempts < 1) { if (null !== $attempts) {
throw new InvalidArgumentException('Maximum number of attempts must be a positive value.'); $attempts = (int) $attempts;
if ($attempts < 1) {
throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
}
} }
$this->attempts = $attempts; $this->attempts = $attempts;

View File

@@ -7,7 +7,7 @@ interfaces.
Resources Resources
--------- ---------
* [Documentation](https://symfony.com/doc/current/components/console/index.html) * [Documentation](https://symfony.com/doc/current/components/console.html)
* [Contributing](https://symfony.com/doc/current/contributing/index.html) * [Contributing](https://symfony.com/doc/current/contributing/index.html)
* [Report issues](https://github.com/symfony/symfony/issues) and * [Report issues](https://github.com/symfony/symfony/issues) and
[send Pull Requests](https://github.com/symfony/symfony/pulls) [send Pull Requests](https://github.com/symfony/symfony/pulls)

View File

@@ -35,7 +35,7 @@ abstract class OutputStyle implements OutputInterface, StyleInterface
*/ */
public function newLine($count = 1) public function newLine($count = 1)
{ {
$this->output->write(str_repeat(PHP_EOL, $count)); $this->output->write(str_repeat(\PHP_EOL, $count));
} }
/** /**

View File

@@ -229,7 +229,7 @@ class SymfonyStyle extends OutputStyle
{ {
if (null !== $default) { if (null !== $default) {
$values = array_flip($choices); $values = array_flip($choices);
$default = $values[$default]; $default = isset($values[$default]) ? $values[$default] : $default;
} }
return $this->askQuestion(new ChoiceQuestion($question, $choices, $default)); return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
@@ -352,7 +352,7 @@ class SymfonyStyle extends OutputStyle
private function autoPrependBlock() private function autoPrependBlock()
{ {
$chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2); $chars = substr(str_replace(\PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
if (!isset($chars[0])) { if (!isset($chars[0])) {
$this->newLine(); //empty history, so we should start with a new line. $this->newLine(); //empty history, so we should start with a new line.
@@ -399,7 +399,7 @@ class SymfonyStyle extends OutputStyle
$message = OutputFormatter::escape($message); $message = OutputFormatter::escape($message);
} }
$lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - $prefixLength - $indentLength, PHP_EOL, true))); $lines = array_merge($lines, explode(\PHP_EOL, wordwrap($message, $this->lineLength - $prefixLength - $indentLength, \PHP_EOL, true)));
if (\count($messages) > 1 && $key < \count($messages) - 1) { if (\count($messages) > 1 && $key < \count($messages) - 1) {
$lines[] = ''; $lines[] = '';

View File

@@ -66,6 +66,11 @@ class Terminal
return self::$stty; return self::$stty;
} }
// skip check if exec function is disabled
if (!\function_exists('exec')) {
return false;
}
exec('stty 2>&1', $output, $exitcode); exec('stty 2>&1', $output, $exitcode);
return self::$stty = 0 === $exitcode; return self::$stty = 0 === $exitcode;

View File

@@ -114,7 +114,7 @@ class ApplicationTester
$display = stream_get_contents($this->output->getStream()); $display = stream_get_contents($this->output->getStream());
if ($normalize) { if ($normalize) {
$display = str_replace(PHP_EOL, "\n", $display); $display = str_replace(\PHP_EOL, "\n", $display);
} }
return $display; return $display;
@@ -138,7 +138,7 @@ class ApplicationTester
$display = stream_get_contents($this->output->getErrorOutput()->getStream()); $display = stream_get_contents($this->output->getErrorOutput()->getStream());
if ($normalize) { if ($normalize) {
$display = str_replace(PHP_EOL, "\n", $display); $display = str_replace(\PHP_EOL, "\n", $display);
} }
return $display; return $display;

View File

@@ -96,7 +96,7 @@ class CommandTester
$display = stream_get_contents($this->output->getStream()); $display = stream_get_contents($this->output->getStream());
if ($normalize) { if ($normalize) {
$display = str_replace(PHP_EOL, "\n", $display); $display = str_replace(\PHP_EOL, "\n", $display);
} }
return $display; return $display;
@@ -152,7 +152,7 @@ class CommandTester
$stream = fopen('php://memory', 'r+', false); $stream = fopen('php://memory', 'r+', false);
foreach ($inputs as $input) { foreach ($inputs as $input) {
fwrite($stream, $input.PHP_EOL); fwrite($stream, $input.\PHP_EOL);
} }
rewind($stream); rewind($stream);

Some files were not shown because too many files have changed in this diff Show More