diff --git a/.appveyor.yml b/.appveyor.yml
index 8993433c553cc..fa64309c54c95 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -9,8 +9,7 @@ cache:
init:
- SET PATH=c:\php;%PATH%
- SET COMPOSER_NO_INTERACTION=1
- - SET SYMFONY_DEPRECATIONS_HELPER=max[indirect]=7
- - SET "SYMFONY_REQUIRE=>=4.2"
+ - SET SYMFONY_DEPRECATIONS_HELPER=strict
- SET ANSICON=121x90 (121x90)
- SET SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE=1
- REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Command Processor" /v DelayedExpansion /t REG_DWORD /d 1 /f
@@ -43,22 +42,24 @@ install:
- echo extension=php_curl.dll >> php.ini-max
- copy /Y php.ini-max php.ini
- cd c:\projects\symfony
- - IF NOT EXIST composer.phar (appveyor DownloadFile https://github.com/composer/composer/releases/download/1.9.0/composer.phar)
- - php composer.phar self-update
+ - IF NOT EXIST composer.phar (appveyor DownloadFile https://github.com/composer/composer/releases/download/2.0.0/composer.phar)
+ - php composer.phar self-update --2
- copy /Y .github\composer-config.json %APPDATA%\Composer\config.json
- - php composer.phar global require --no-progress --no-scripts --no-plugins symfony/flex dev-master
+ - php composer.phar global require --no-progress --no-scripts --no-plugins symfony/flex
- git config --global user.email ""
- git config --global user.name "Symfony"
- - php .github/build-packages.php "HEAD^" src\Symfony\Bridge\PhpUnit src\Symfony\Contracts
- - IF %APPVEYOR_REPO_BRANCH%==master (SET COMPOSER_ROOT_VERSION=dev-master) ELSE (SET COMPOSER_ROOT_VERSION=%APPVEYOR_REPO_BRANCH%.x-dev)
- - php composer.phar update --no-progress --no-suggest --ansi
+ - FOR /F "tokens=* USEBACKQ" %%F IN (`bash -c "grep branch-version composer.json | grep -o '[0-9.]*'"`) DO (SET SYMFONY_VERSION=%%F)
+ - php .github/build-packages.php "HEAD^" %SYMFONY_VERSION% src\Symfony\Bridge\PhpUnit src\Symfony\Contracts
+ - SET "SYMFONY_REQUIRE=>=%SYMFONY_VERSION%"
+ - SET COMPOSER_ROOT_VERSION=%SYMFONY_VERSION%.x-dev
+ - php composer.phar update --no-progress --ansi
- php phpunit install
test_script:
- SET X=0
- SET SYMFONY_PHPUNIT_SKIPPED_TESTS=phpunit.skipped
- copy /Y c:\php\php.ini-min c:\php\php.ini
- - IF %APPVEYOR_REPO_BRANCH% neq master (rm -Rf src\Symfony\Bridge\PhpUnit)
+ - IF %APPVEYOR_REPO_BRANCH:~-2% neq .x (rm -Rf src\Symfony\Bridge\PhpUnit)
- php phpunit src\Symfony --exclude-group tty,benchmark,intl-data || SET X=!errorlevel!
- copy /Y c:\php\php.ini-max c:\php\php.ini
- php phpunit src\Symfony --exclude-group tty,benchmark,intl-data || SET X=!errorlevel!
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 6a9ac46efac81..0870dcfdd5cc4 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -1,9 +1,10 @@
# Console
+/src/Symfony/Component/Console/ @chalasr
/src/Symfony/Component/Console/Logger/ConsoleLogger.php @dunglas
# DependencyInjection
/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php @dunglas
-# ErrorRenderer
-/src/Symfony/Component/ErrorRenderer/* @yceruto
+# ErrorHandler
+/src/Symfony/Component/ErrorHandler/ @yceruto
# Form
/src/Symfony/Bridge/Twig/Extension/FormExtension.php @xabbuh
/src/Symfony/Bridge/Twig/Form/ @xabbuh
@@ -20,7 +21,7 @@
/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php @xabbuh
/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php @xabbuh
/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php @xabbuh
-/src/Symfony/Component/Form/ @xabbuh
+/src/Symfony/Component/Form/ @xabbuh @yceruto
# HttpKernel
/src/Symfony/Component/HttpKernel/Log/Logger.php @dunglas
# LDAP
@@ -30,13 +31,20 @@
# Messenger
/src/Symfony/Bridge/Doctrine/Messenger/ @sroze
/src/Symfony/Component/Messenger/ @sroze
+# OptionsResolver
+/src/Symfony/Component/OptionsResolver/ @yceruto
# PropertyInfo
/src/Symfony/Component/PropertyInfo/ @dunglas
/src/Symfony/Bridge/Doctrine/PropertyInfo/ @dunglas
# Serializer
/src/Symfony/Component/Serializer/ @dunglas
+# Security
+/src/Symfony/Bridge/Doctrine/Security/ @wouterj @chalasr
+/src/Symfony/Bundle/SecurityBundle/ @wouterj @chalasr
+/src/Symfony/Component/Security/ @wouterj @chalasr
+/src/Symfony/Component/Ldap/Security/ @wouterj @chalasr
# TwigBundle
-/src/Symfony/Bundle/TwigBundle/ErrorRenderer/TwigHtmlErrorRenderer.php @yceruto
+/src/Symfony/Bundle/TwigBundle/ @yceruto
# WebLink
/src/Symfony/Component/WebLink/ @dunglas
# Workflow
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 7b86916e7bc14..df9db03fa8bca 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,6 +1,6 @@
| Q | A
| ------------- | ---
-| Branch? | master for features / 3.4, 4.4 or 5.1 for bug fixes
+| Branch? | 5.x for features / 3.4, 4.4 or 5.1 for bug fixes
| Bug fix? | yes/no
| New feature? | yes/no
| Deprecations? | yes/no
@@ -16,5 +16,5 @@ Additionally (see https://symfony.com/releases):
- Never break backward compatibility (see https://symfony.com/bc).
- Bug fixes must be submitted against the lowest maintained branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too.)
- - Features and deprecations must be submitted against branch master.
+ - Features and deprecations must be submitted against branch 5.x.
-->
diff --git a/.github/build-packages.php b/.github/build-packages.php
index 81a309911135c..13978ab4e6d93 100644
--- a/.github/build-packages.php
+++ b/.github/build-packages.php
@@ -1,7 +1,7 @@
$_SERVER['argc']) {
- echo "Usage: branch dir1 dir2 ... dirN\n";
+ echo "Usage: branch version dir1 dir2 ... dirN\n";
exit(1);
}
chdir(dirname(__DIR__));
@@ -14,6 +14,7 @@
$dirs = $_SERVER['argv'];
array_shift($dirs);
$mergeBase = trim(shell_exec(sprintf('git merge-base "%s" HEAD', array_shift($dirs))));
+$version = array_shift($dirs);
$packages = array();
$flags = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
@@ -50,23 +51,15 @@
passthru("cd $dir && git init && git add . && git commit -q -m - && git archive -o package.tar HEAD && rm .git/ -Rf");
}
- if (!isset($package->extra->{'branch-alias'}->{'dev-master'})) {
- echo "Missing \"dev-master\" branch-alias in composer.json extra.\n";
- exit(1);
- }
- $package->version = str_replace('-dev', '.x-dev', $package->extra->{'branch-alias'}->{'dev-master'});
+ $package->version = (isset($package->extra->{'branch-version'}) ? $package->extra->{'branch-version'} : $version).'.x-dev';
$package->dist['type'] = 'tar';
$package->dist['url'] = 'file://'.str_replace(DIRECTORY_SEPARATOR, '/', dirname(__DIR__))."/$dir/package.tar";
$packages[$package->name][$package->version] = $package;
- $versions = @file_get_contents('https://repo.packagist.org/p/'.$package->name.'.json') ?: sprintf('{"packages":{"%s":{"dev-master":%s}}}', $package->name, file_get_contents($dir.'/composer.json'));
+ $versions = @file_get_contents('https://repo.packagist.org/p/'.$package->name.'.json') ?: sprintf('{"packages":{"%s":{"%s":%s}}}', $package->name, $package->version, file_get_contents($dir.'/composer.json'));
$versions = json_decode($versions)->packages->{$package->name};
- if (isset($versions->{'dev-master'}) && $package->version === str_replace('-dev', '.x-dev', $versions->{'dev-master'}->extra->{'branch-alias'}->{'dev-master'})) {
- unset($versions->{'dev-master'});
- }
-
foreach ($versions as $v => $package) {
$packages[$package->name] += array($v => $package);
}
diff --git a/.github/composer-config.json b/.github/composer-config.json
index 185292ab21cea..752047dbb681d 100644
--- a/.github/composer-config.json
+++ b/.github/composer-config.json
@@ -1,5 +1,6 @@
{
"config": {
+ "platform-check": false,
"preferred-install": {
"symfony/form": "source",
"symfony/http-kernel": "source",
diff --git a/.github/patch-types.php b/.github/patch-types.php
index 5c68a66c89c79..311e9e7ee40b4 100644
--- a/.github/patch-types.php
+++ b/.github/patch-types.php
@@ -5,7 +5,7 @@
exit(1);
}
-require __DIR__.'/../.phpunit/phpunit-8.3-0/vendor/autoload.php';
+require __DIR__.'/../.phpunit/phpunit/vendor/autoload.php';
file_put_contents(__DIR__.'/../vendor/autoload.php', preg_replace('/^return (Composer.*);/m', <<<'EOTXT'
$loader = \1;
@@ -33,6 +33,7 @@
case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/autowiring_classes.php'):
case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/uniontype_classes.php'):
case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Fixtures/ParentNotExists.php'):
+ case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Preload/'):
case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Prototype/BadClasses/MissingParent.php'):
case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/'):
case false !== strpos($file, '/src/Symfony/Component/ErrorHandler/Tests/Fixtures/'):
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 66b035855531d..1df99b47a887c 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -52,14 +52,12 @@ jobs:
extensions: "memcached,redis,xsl"
ini-values: "memory_limit=-1"
php-version: "${{ matrix.php }}"
- tools: flex
- name: Configure composer
run: |
- ([ -d ~/.composer ] || mkdir ~/.composer) && cp .github/composer-config.json ~/.composer/config.json
- SYMFONY_VERSION=$(cat composer.json | grep '^ *\"dev-master\". *\"[1-9]' | grep -o '[0-9.]*')
- echo "::set-env name=SYMFONY_VERSION::$SYMFONY_VERSION"
- echo "::set-env name=COMPOSER_ROOT_VERSION::$SYMFONY_VERSION.x-dev"
+ COMPOSER_HOME="$(composer config home)"
+ ([ -d "$COMPOSER_HOME" ] || mkdir "$COMPOSER_HOME") && cp .github/composer-config.json "$COMPOSER_HOME/config.json"
+ echo "COMPOSER_ROOT_VERSION=$(grep branch-version composer.json | grep -o '[0-9.]*').x-dev" >> $GITHUB_ENV
- name: Determine composer cache directory
id: composer-cache
@@ -95,6 +93,6 @@ jobs:
run: |
[ -d .phpunit ] && mv .phpunit .phpunit.bak
wget -q https://github.com/symfony/binary-utils/releases/download/v0.1/vulcain_0.1.3_Linux_x86_64.tar.gz -O - | tar xz && mv vulcain /usr/local/bin
- docker run --rm -e COMPOSER_ROOT_VERSION -e SYMFONY_VERSION -v $(pwd):/app -v $(which composer):/usr/local/bin/composer -v /usr/local/bin/vulcain:/usr/local/bin/vulcain -w /app php:7.4-alpine ./phpunit src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php --filter testHttp2Push
+ docker run --rm -e COMPOSER_ROOT_VERSION -v $(pwd):/app -v $(which composer):/usr/local/bin/composer -v /usr/local/bin/vulcain:/usr/local/bin/vulcain -w /app php:7.4-alpine ./phpunit src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php --filter testHttp2Push
sudo rm -rf .phpunit
[ -d .phpunit.bak ] && mv .phpunit.bak .phpunit
diff --git a/.travis.yml b/.travis.yml
index c8314d567f654..b21d6ba81ae00 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -60,11 +60,10 @@ before_install:
[ -d /usr/lib/openldap ] && ln -s /usr/lib/openldap /tmp/slapd-modules || ln -s /usr/lib/ldap /tmp/slapd-modules
fi
slapd -f src/Symfony/Component/Ldap/Tests/Fixtures/conf/slapd.conf -h ldap://localhost:3389 &
- [ -d ~/.composer ] || mkdir ~/.composer
- cp .github/composer-config.json ~/.composer/config.json
+ cp .github/composer-config.json "$(composer config home)/config.json"
export PHPUNIT=$(readlink -f ./phpunit)
export PHPUNIT_X="$PHPUNIT --exclude-group tty,benchmark,intl-data"
- export COMPOSER_UP='composer update --no-progress --no-suggest --ansi'
+ export COMPOSER_UP='composer update --no-progress --ansi'
export COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
find ~/.phpenv -name xdebug.ini -delete
@@ -123,23 +122,6 @@ before_install:
}
export -f tpecl
- install_apcu_dev () {
- local ref=$1
- local INI=$2
-
- wget https://github.com/krakjoe/apcu/archive/${ref}.zip
- unzip ${ref}.zip
- cd apcu-${ref}
- phpize
- ./configure
- make
- mv modules/apcu.so $(php -r "echo ini_get('extension_dir');")
- echo 'extension = apcu.so' >> $INI
- cd ..
- rm -rf apcu-${ref} ${ref}.zip
- }
- export -f install_apcu_dev
-
- |
# Install sigchild-enabled PHP to test the Process component on the lowest PHP matrix line
if [[ ! $deps && $TRAVIS_PHP_VERSION = ${MIN_PHP%.*} && ! -d php-$MIN_PHP/sapi ]]; then
@@ -168,26 +150,24 @@ before_install:
for PHP in $TRAVIS_PHP_VERSION $php_extra; do
export PHP=$PHP
phpenv global $PHP
+ composer self-update
+ composer self-update --2
INI=~/.phpenv/versions/$PHP/etc/conf.d/travis.ini
if ! php --ri sodium > /dev/null; then
tfold ext.libsodium tpecl libsodium sodium.so $INI
fi
if [[ $PHP = nightly ]]; then
tfold ext.memcached tpecl memcached-3.1.5 memcached.so $INI
- tfold ext.apcu install_apcu_dev 9c36db45100d4d27ec33072f4be90f1f5a0108b7 $INI
else
- tfold ext.apcu tpecl apcu-5.1.18 apcu.so $INI
tfold ext.mongodb tpecl mongodb-1.6.16 mongodb.so $INI
tfold ext.zookeeper tpecl zookeeper-0.7.2 zookeeper.so $INI
tfold ext.amqp tpecl amqp-1.10.2 amqp.so $INI
tfold ext.redis tpecl redis-5.2.2 redis.so $INI "no"
fi
- tfold ext.igbinary tpecl igbinary-3.1.5 igbinary.so $INI
+ tfold ext.apcu tpecl apcu-5.1.19 apcu.so $INI
+ tfold ext.igbinary tpecl igbinary-3.1.6 igbinary.so $INI
done
- - |
- # List all php extensions with versions
- php -r 'foreach (get_loaded_extensions() as $extension) echo $extension . " " . phpversion($extension) . PHP_EOL;'
- |
# Load fixtures
@@ -209,7 +189,7 @@ install:
git fetch --depth=2 origin refs/pull/$SYMFONY_PHPUNIT_BRIDGE_PR/head
git rm -rq src/Symfony/Bridge/PhpUnit
git checkout -q FETCH_HEAD -- src/Symfony/Bridge/PhpUnit
- export SYMFONY_VERSION=$(cat src/Symfony/Bridge/PhpUnit/composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*')
+ export SYMFONY_VERSION=$(curl -s https://api.github.com/repos/symfony/symfony/pulls/$SYMFONY_PHPUNIT_BRIDGE_PR | jq -r .base.ref)
sed -i 's/"symfony\/phpunit-bridge": ".*"/"symfony\/phpunit-bridge": "'$SYMFONY_VERSION'.x@dev"/' composer.json
rm -rf .phpunit
fi
@@ -219,14 +199,15 @@ install:
git config --global user.email ""
git config --global user.name "Symfony"
+ export SYMFONY_VERSION=$(grep branch-version composer.json | grep -o '[0-9.]*')
+
if [[ ! $deps ]]; then
- php .github/build-packages.php HEAD^ src/Symfony/Bridge/PhpUnit src/Symfony/Contracts
- composer remove --dev --no-update paragonie/sodium_compat
+ php .github/build-packages.php HEAD^ $SYMFONY_VERSION src/Symfony/Bridge/PhpUnit src/Symfony/Contracts
else
export SYMFONY_DEPRECATIONS_HELPER=weak &&
cp composer.json composer.json.orig &&
echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json &&
- php .github/build-packages.php HEAD^ $(find src/Symfony -mindepth 3 -type f -name composer.json -printf '%h\n' | sort) &&
+ php .github/build-packages.php HEAD^ $SYMFONY_VERSION $(find src/Symfony -mindepth 2 -type f -name composer.json -printf '%h\n' | sort) &&
mv composer.json composer.json.phpunit &&
mv composer.json.orig composer.json
fi
@@ -236,21 +217,19 @@ install:
fi
- |
- # For the master branch, when deps=high, the version before master is checked out and tested with the locally patched components
- if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then
+ # For the feature-branch, when deps=high, the version before it is checked out and tested with the locally patched components
+ if [[ $deps = high && $TRAVIS_BRANCH = *.x ]]; then
export FLIP='🙃'
- export SYMFONY_VERSION=$(git ls-remote --heads | grep -o '/[1-9].*' | tail -n 1 | sed s/.//) &&
+ export SYMFONY_VERSION=$(git ls-remote -q --heads | grep -o '/[1-9]\.[0-9].*' | tail -n 1 | sed s/.//) &&
git fetch --depth=2 origin $SYMFONY_VERSION &&
git checkout -m FETCH_HEAD &&
export COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
- else
- export SYMFONY_VERSION=$(cat composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*')
fi
- |
- # Skip the phpunit-bridge on not-master branches when $deps is empty
- if [[ ! $deps && $TRAVIS_BRANCH != master ]]; then
- export COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -not -wholename '*/Bridge/PhpUnit/*' -printf '%h\n' | sort)
+ # Skip the phpunit-bridge on bugfix-branches when $deps is empty
+ if [[ ! $deps && ! $TRAVIS_BRANCH = *.x ]]; then
+ export COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -not -wholename '*/Bridge/PhpUnit/*' -printf '%h\n' | sort)
fi
- |
@@ -267,16 +246,27 @@ install:
else
export SYMFONY_REQUIRE=">=$SYMFONY_VERSION"
fi
- composer global require --no-progress --no-scripts --no-plugins symfony/flex dev-master
+ composer global require --no-progress --no-scripts --no-plugins symfony/flex
- |
# Legacy tests are skipped when deps=high and when the current branch version has not the same major version number as the next one
- [[ $deps = high && ${SYMFONY_VERSION%.*} != $(git show $(git ls-remote --heads | grep -FA1 /$SYMFONY_VERSION | tail -n 1):composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9]*' | head -n 1) ]] && export LEGACY=,legacy
+ [[ $deps = high && ${SYMFONY_VERSION%.*} != $(git ls-remote -q --heads | cut -f2 | grep -FA1 /$SYMFONY_VERSION | tail -n 1 | grep -o '[0-9]*') ]] && export LEGACY=,legacy
export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev
if [[ $deps ]]; then mv composer.json.phpunit composer.json; fi
- - php -i
+ - |
+ # phpinfo
+ phpinfo() {
+ phpenv global $1
+ php -r 'foreach (get_loaded_extensions() as $extension) echo $extension . " " . phpversion($extension) . PHP_EOL;'
+ php -i
+ }
+ export -f phpinfo
+
+ for PHP in $TRAVIS_PHP_VERSION $php_extra; do
+ tfold phpinfo phpinfo $PHP
+ done
- |
run_tests () {
@@ -288,6 +278,7 @@ install:
return
fi
phpenv global $PHP
+ rm vendor/composer/package-versions-deprecated -Rf
([[ $deps ]] && cd src/Symfony/Component/HttpFoundation; cp composer.json composer.bak; composer config platform.ext-mongodb 1.6.99; composer require --dev --no-update mongodb/mongodb ~1.5.0)
tfold 'composer update' $COMPOSER_UP
tfold 'phpunit install' ./phpunit install
@@ -296,7 +287,7 @@ install:
(cd src/Symfony/Component/HttpFoundation; mv composer.bak composer.json)
COMPONENTS=$(git diff --name-only src/ | grep composer.json || true)
- if [[ $COMPONENTS && $LEGACY && $TRAVIS_BRANCH != master && $TRAVIS_PULL_REQUEST != false ]]; then
+ if [[ $COMPONENTS && $LEGACY && ! $TRAVIS_BRANCH = *.x && $TRAVIS_PULL_REQUEST != false ]]; then
export FLIP='🙃'
SYMFONY_VERSION=$(echo $SYMFONY_VERSION | awk '{print $1 - 1}')
echo -e "\\n\\e[33;1mChecking out Symfony $SYMFONY_VERSION and running tests with patched components as deps\\e[0m"
diff --git a/CHANGELOG-4.4.md b/CHANGELOG-4.4.md
index 9b3ef80dc1c16..eb669f2baca7b 100644
--- a/CHANGELOG-4.4.md
+++ b/CHANGELOG-4.4.md
@@ -7,6 +7,35 @@ in 4.4 minor versions.
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v4.4.0...v4.4.1
+* 4.4.16 (2020-10-28)
+
+ * bug #38713 [DI] Fix Preloader exception when preloading a class with an unknown parent/interface (rgeraads)
+ * bug #38647 [HttpClient] relax auth bearer format requirements (xabbuh)
+ * bug #38699 [DependencyInjection] Preload classes with union types correctly (derrabus)
+ * bug #38669 [Serializer] fix decoding float XML attributes starting with 0 (Marcin Kruk)
+ * bug #38680 [PhpUnitBridge] Support new expect methods in test case polyfill (alcaeus)
+ * bug #38681 [PHPUnitBridge] Support PHPUnit 8 and PHPUnit 9 in constraint compatibility trait (alcaeus)
+ * bug #38679 [PhpUnitBridge] Add missing exporter function for PHPUnit 7 (alcaeus)
+ * bug #38595 [TwigBridge] do not translate null placeholders or titles (xabbuh)
+ * bug #38635 [Cache] Use correct expiry in ChainAdapter (Nyholm)
+ * bug #38652 [Filesystem] Check if failed unlink was caused by permission denied (Nyholm)
+ * bug #38645 [PropertyAccess] forward the caught exception (xabbuh)
+ * bug #38604 [DoctrineBridge] indexBy does not refer to attributes, but to column names (xabbuh)
+ * bug #38606 [WebProfilerBundle] Hide debug toolbar in print view (jt2k)
+ * bug #38582 [DI] Fix Reflection file name with eval()\'d code (maxime-aknin)
+ * bug #38516 [HttpFoundation] Fix Range Requests (BattleRattle)
+ * bug #38553 [Lock] Reset Key lifetime time before we acquire it (Nyholm)
+ * bug #38551 Remove content-type check on toArray methods (jderusse)
+ * bug #38544 [DI] fix dumping env vars (nicolas-grekas)
+ * bug #38530 [HttpClient] fix reading the body after a ClientException (nicolas-grekas)
+ * bug #38510 [PropertyInfo] Support for the mixed type (derrabus)
+ * bug #38493 [HttpClient] Fix CurlHttpClient memory leak (HypeMC)
+ * bug #38456 [Cache] skip igbinary < 3.1.6 (nicolas-grekas)
+ * bug #38392 [Ldap] Bypass the use of `ldap_control_paged_result` on PHP >= 7.3 (lucasaba)
+ * bug #38444 [PhpUnitBridge] fix running parallel tests with phpunit 9 (nicolas-grekas)
+ * bug #38442 [VarDumper] fix truncating big arrays (nicolas-grekas)
+ * bug #38433 [Mime] Fix serialization of RawMessage (gilbertsoft)
+
* 4.4.15 (2020-10-04)
* bug #36291 [Lock] Fix StoreFactory to accept same DSN syntax as AbstractAdapter (Jontsa)
diff --git a/UPGRADE-4.4.md b/UPGRADE-4.4.md
index bcdee9ca1311f..2e81075a42180 100644
--- a/UPGRADE-4.4.md
+++ b/UPGRADE-4.4.md
@@ -64,7 +64,7 @@ DoctrineBridge
injected instead.
* Deprecated passing an `IdReader` to the `DoctrineChoiceLoader` when the query cannot be optimized with single id field.
* Deprecated not passing an `IdReader` to the `DoctrineChoiceLoader` when the query can be optimized with single id field.
- * Deprecated `RegistryInterface`, use `Doctrine\Common\Persistence\ManagerRegistry`.
+ * Deprecated `RegistryInterface`, use `Doctrine\Persistence\ManagerRegistry`.
* Added a new `getMetadataDriverClass` method to replace class parameters in `AbstractDoctrineExtension`. This method
will be abstract in Symfony 5 and must be declared in extending classes.
diff --git a/composer.json b/composer.json
index b2f9c50293ddc..4ae6826ce77ef 100644
--- a/composer.json
+++ b/composer.json
@@ -162,8 +162,6 @@
],
"minimum-stability": "dev",
"extra": {
- "branch-alias": {
- "dev-master": "4.4-dev"
- }
+ "branch-version": "4.4"
}
}
diff --git a/phpunit b/phpunit
index e1b1aea0e46c5..71915eecb2b34 100755
--- a/phpunit
+++ b/phpunit
@@ -15,7 +15,7 @@ if (!getenv('SYMFONY_PHPUNIT_VERSION')) {
if (\PHP_VERSION_ID < 70300) {
putenv('SYMFONY_PHPUNIT_VERSION=8.5');
} else {
- putenv('SYMFONY_PHPUNIT_VERSION=9.3');
+ putenv('SYMFONY_PHPUNIT_VERSION=9.4');
}
} elseif (\PHP_VERSION_ID >= 70000) {
putenv('SYMFONY_PHPUNIT_VERSION=6.5');
@@ -24,5 +24,8 @@ if (!getenv('SYMFONY_PHPUNIT_VERSION')) {
if (!getenv('SYMFONY_PATCH_TYPE_DECLARATIONS')) {
putenv('SYMFONY_PATCH_TYPE_DECLARATIONS=deprecations=1');
}
+if (getcwd() === realpath(__DIR__.'/src/Symfony/Bridge/PhpUnit')) {
+ putenv('SYMFONY_DEPRECATIONS_HELPER=disabled');
+}
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');
require __DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit';
diff --git a/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php b/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php
index c3a9c867c5e5e..8a250dcef01e0 100644
--- a/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php
+++ b/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php
@@ -107,19 +107,10 @@ public function getTypes($class, $property, array $context = [])
$associationMapping = $metadata->getAssociationMapping($property);
if (isset($associationMapping['indexBy'])) {
- $indexProperty = $associationMapping['indexBy'];
+ $indexColumn = $associationMapping['indexBy'];
/** @var ClassMetadataInfo $subMetadata */
$subMetadata = $this->entityManager ? $this->entityManager->getClassMetadata($associationMapping['targetEntity']) : $this->classMetadataFactory->getMetadataFor($associationMapping['targetEntity']);
- $typeOfField = $subMetadata->getTypeOfField($indexProperty);
-
- if (null === $typeOfField) {
- $associationMapping = $subMetadata->getAssociationMapping($indexProperty);
-
- /** @var ClassMetadataInfo $subMetadata */
- $indexProperty = $subMetadata->getSingleAssociationReferencedJoinColumnName($indexProperty);
- $subMetadata = $this->entityManager ? $this->entityManager->getClassMetadata($associationMapping['targetEntity']) : $this->classMetadataFactory->getMetadataFor($associationMapping['targetEntity']);
- $typeOfField = $subMetadata->getTypeOfField($indexProperty);
- }
+ $typeOfField = $subMetadata->getTypeOfField($subMetadata->getFieldForColumn($indexColumn));
if (!$collectionKeyType = $this->getPhpType($typeOfField)) {
return null;
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
index 05ccfe8328253..6f4cdb4346125 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
@@ -60,13 +60,6 @@ class EntityTypeTest extends BaseTypeTest
protected static $supportedFeatureSetVersion = 404;
- public static function setUpBeforeClass(): void
- {
- if (\PHP_VERSION_ID >= 80000) {
- self::markTestSkipped('Doctrine DBAL 2.x is incompatible with PHP 8.');
- }
- }
-
protected function setUp(): void
{
$this->em = DoctrineTestHelper::createTestEntityManager();
diff --git a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineDummy.php b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineDummy.php
index 81264fad27c5f..568efce33d382 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineDummy.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineDummy.php
@@ -42,7 +42,7 @@ class DoctrineDummy
public $bar;
/**
- * @ManyToMany(targetEntity="DoctrineRelation", indexBy="rguid")
+ * @ManyToMany(targetEntity="DoctrineRelation", indexBy="rguid_column")
*/
protected $indexedBar;
diff --git a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineRelation.php b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineRelation.php
index 5730cf81dd493..e480ca9d777ba 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineRelation.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineRelation.php
@@ -30,7 +30,7 @@ class DoctrineRelation
public $id;
/**
- * @Column(type="guid")
+ * @Column(type="guid", name="rguid_column")
*/
protected $rguid;
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Security/RememberMe/DoctrineTokenProviderTest.php b/src/Symfony/Bridge/Doctrine/Tests/Security/RememberMe/DoctrineTokenProviderTest.php
index 75faf9012a56c..6e406b06b76af 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Security/RememberMe/DoctrineTokenProviderTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Security/RememberMe/DoctrineTokenProviderTest.php
@@ -13,13 +13,6 @@
*/
class DoctrineTokenProviderTest extends TestCase
{
- public static function setUpBeforeClass(): void
- {
- if (\PHP_VERSION_ID >= 80000) {
- self::markTestSkipped('Doctrine DBAL 2.x is incompatible with PHP 8.');
- }
- }
-
public function testCreateNewToken()
{
$provider = $this->bootstrapProvider();
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php b/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php
index 257c6f7a93fbb..59793406b5d5a 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php
@@ -24,13 +24,6 @@
class EntityUserProviderTest extends TestCase
{
- public static function setUpBeforeClass(): void
- {
- if (\PHP_VERSION_ID >= 80000) {
- self::markTestSkipped('Doctrine DBAL 2.x is incompatible with PHP 8.');
- }
- }
-
public function testRefreshUserGetsUserByPrimaryKey()
{
$em = DoctrineTestHelper::createTestEntityManager();
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php
index 985d4601bf4d5..e9e905c89c3a4 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php
@@ -59,13 +59,6 @@ class UniqueEntityValidatorTest extends ConstraintValidatorTestCase
protected $repositoryFactory;
- public static function setUpBeforeClass(): void
- {
- if (\PHP_VERSION_ID >= 80000) {
- self::markTestSkipped('Doctrine DBAL 2.x is incompatible with PHP 8.');
- }
- }
-
protected function setUp(): void
{
$this->repositoryFactory = new TestRepositoryFactory();
diff --git a/src/Symfony/Bridge/Doctrine/composer.json b/src/Symfony/Bridge/Doctrine/composer.json
index caa8844657aa4..b792582d59502 100644
--- a/src/Symfony/Bridge/Doctrine/composer.json
+++ b/src/Symfony/Bridge/Doctrine/composer.json
@@ -70,10 +70,5 @@
"/Tests/"
]
},
- "minimum-stability": "dev",
- "extra": {
- "branch-alias": {
- "dev-master": "4.4-dev"
- }
- }
+ "minimum-stability": "dev"
}
diff --git a/src/Symfony/Bridge/Monolog/composer.json b/src/Symfony/Bridge/Monolog/composer.json
index 82e44060701e2..97dd19e7c30fc 100644
--- a/src/Symfony/Bridge/Monolog/composer.json
+++ b/src/Symfony/Bridge/Monolog/composer.json
@@ -42,10 +42,5 @@
"/Tests/"
]
},
- "minimum-stability": "dev",
- "extra": {
- "branch-alias": {
- "dev-master": "4.4-dev"
- }
- }
+ "minimum-stability": "dev"
}
diff --git a/src/Symfony/Bridge/PhpUnit/ConstraintTrait.php b/src/Symfony/Bridge/PhpUnit/ConstraintTrait.php
index 64b24ee166858..446dbf2f4fe03 100644
--- a/src/Symfony/Bridge/PhpUnit/ConstraintTrait.php
+++ b/src/Symfony/Bridge/PhpUnit/ConstraintTrait.php
@@ -20,9 +20,19 @@ trait ConstraintTrait
{
use Legacy\ConstraintTraitForV6;
}
-} else {
+} elseif ($r->getProperty('exporter')->isProtected()) {
trait ConstraintTrait
{
use Legacy\ConstraintTraitForV7;
}
+} elseif (\PHP_VERSION < 70100 || !$r->getMethod('evaluate')->hasReturnType()) {
+ trait ConstraintTrait
+ {
+ use Legacy\ConstraintTraitForV8;
+ }
+} else {
+ trait ConstraintTrait
+ {
+ use Legacy\ConstraintTraitForV9;
+ }
}
diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/ConstraintLogicTrait.php b/src/Symfony/Bridge/PhpUnit/Legacy/ConstraintLogicTrait.php
new file mode 100644
index 0000000000000..e124358c4f724
--- /dev/null
+++ b/src/Symfony/Bridge/PhpUnit/Legacy/ConstraintLogicTrait.php
@@ -0,0 +1,62 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Bridge\PhpUnit\Legacy;
+
+/**
+ * @internal
+ */
+trait ConstraintLogicTrait
+{
+ private function doEvaluate($other, $description, $returnResult)
+ {
+ $success = false;
+
+ if ($this->matches($other)) {
+ $success = true;
+ }
+
+ if ($returnResult) {
+ return $success;
+ }
+
+ if (!$success) {
+ $this->fail($other, $description);
+ }
+
+ return null;
+ }
+
+ private function doAdditionalFailureDescription($other): string
+ {
+ return '';
+ }
+
+ private function doCount(): int
+ {
+ return 1;
+ }
+
+ private function doFailureDescription($other): string
+ {
+ return $this->exporter()->export($other).' '.$this->toString();
+ }
+
+ private function doMatches($other): bool
+ {
+ return false;
+ }
+
+ private function doToString(): string
+ {
+ return '';
+ }
+}
diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/ConstraintTraitForV6.php b/src/Symfony/Bridge/PhpUnit/Legacy/ConstraintTraitForV6.php
index 71b7c3c39d738..53819e4b3c4d7 100644
--- a/src/Symfony/Bridge/PhpUnit/Legacy/ConstraintTraitForV6.php
+++ b/src/Symfony/Bridge/PhpUnit/Legacy/ConstraintTraitForV6.php
@@ -18,6 +18,14 @@
*/
trait ConstraintTraitForV6
{
+ /**
+ * @return bool|null
+ */
+ public function evaluate($other, $description = '', $returnResult = false)
+ {
+ return $this->doEvaluate($other, $description, $returnResult);
+ }
+
/**
* @return int
*/
@@ -86,6 +94,25 @@ private function doCount()
return 1;
}
+ private function doEvaluate($other, $description, $returnResult)
+ {
+ $success = false;
+
+ if ($this->matches($other)) {
+ $success = true;
+ }
+
+ if ($returnResult) {
+ return $success;
+ }
+
+ if (!$success) {
+ $this->fail($other, $description);
+ }
+
+ return null;
+ }
+
private function doFailureDescription($other)
{
return $this->exporter()->export($other).' '.$this->toString();
diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/ConstraintTraitForV7.php b/src/Symfony/Bridge/PhpUnit/Legacy/ConstraintTraitForV7.php
index 48c79a76dd0cf..1e625e463a1e8 100644
--- a/src/Symfony/Bridge/PhpUnit/Legacy/ConstraintTraitForV7.php
+++ b/src/Symfony/Bridge/PhpUnit/Legacy/ConstraintTraitForV7.php
@@ -11,11 +11,23 @@
namespace Symfony\Bridge\PhpUnit\Legacy;
+use SebastianBergmann\Exporter\Exporter;
+
/**
* @internal
*/
trait ConstraintTraitForV7
{
+ use ConstraintLogicTrait;
+
+ /**
+ * @return bool|null
+ */
+ public function evaluate($other, $description = '', $returnResult = false)
+ {
+ return $this->doEvaluate($other, $description, $returnResult);
+ }
+
public function count(): int
{
return $this->doCount();
@@ -31,38 +43,22 @@ protected function additionalFailureDescription($other): string
return $this->doAdditionalFailureDescription($other);
}
- protected function failureDescription($other): string
- {
- return $this->doFailureDescription($other);
- }
-
- protected function matches($other): bool
- {
- return $this->doMatches($other);
- }
-
- private function doAdditionalFailureDescription($other): string
- {
- return '';
- }
-
- private function doCount(): int
+ protected function exporter(): Exporter
{
- return 1;
- }
+ if (null !== $this->exporter) {
+ $this->exporter = new Exporter();
+ }
- private function doFailureDescription($other): string
- {
- return $this->exporter()->export($other).' '.$this->toString();
+ return $this->exporter;
}
- private function doMatches($other): bool
+ protected function failureDescription($other): string
{
- return false;
+ return $this->doFailureDescription($other);
}
- private function doToString(): string
+ protected function matches($other): bool
{
- return '';
+ return $this->doMatches($other);
}
}
diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/ConstraintTraitForV8.php b/src/Symfony/Bridge/PhpUnit/Legacy/ConstraintTraitForV8.php
new file mode 100644
index 0000000000000..d31cc1215877b
--- /dev/null
+++ b/src/Symfony/Bridge/PhpUnit/Legacy/ConstraintTraitForV8.php
@@ -0,0 +1,53 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Bridge\PhpUnit\Legacy;
+
+/**
+ * @internal
+ */
+trait ConstraintTraitForV8
+{
+ use ConstraintLogicTrait;
+
+ /**
+ * @return bool|null
+ */
+ public function evaluate($other, $description = '', $returnResult = false)
+ {
+ return $this->doEvaluate($other, $description, $returnResult);
+ }
+
+ public function count(): int
+ {
+ return $this->doCount();
+ }
+
+ public function toString(): string
+ {
+ return $this->doToString();
+ }
+
+ protected function additionalFailureDescription($other): string
+ {
+ return $this->doAdditionalFailureDescription($other);
+ }
+
+ protected function failureDescription($other): string
+ {
+ return $this->doFailureDescription($other);
+ }
+
+ protected function matches($other): bool
+ {
+ return $this->doMatches($other);
+ }
+}
diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/ConstraintTraitForV9.php b/src/Symfony/Bridge/PhpUnit/Legacy/ConstraintTraitForV9.php
new file mode 100644
index 0000000000000..66da873e4243e
--- /dev/null
+++ b/src/Symfony/Bridge/PhpUnit/Legacy/ConstraintTraitForV9.php
@@ -0,0 +1,50 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Bridge\PhpUnit\Legacy;
+
+/**
+ * @internal
+ */
+trait ConstraintTraitForV9
+{
+ use ConstraintLogicTrait;
+
+ public function evaluate($other, string $description = '', bool $returnResult = false): ?bool
+ {
+ return $this->doEvaluate($other, $description, $returnResult);
+ }
+
+ public function count(): int
+ {
+ return $this->doCount();
+ }
+
+ public function toString(): string
+ {
+ return $this->doToString();
+ }
+
+ protected function additionalFailureDescription($other): string
+ {
+ return $this->doAdditionalFailureDescription($other);
+ }
+
+ protected function failureDescription($other): string
+ {
+ return $this->doFailureDescription($other);
+ }
+
+ protected function matches($other): bool
+ {
+ return $this->doMatches($other);
+ }
+}
diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/PolyfillTestCaseTrait.php b/src/Symfony/Bridge/PhpUnit/Legacy/PolyfillTestCaseTrait.php
index cb3fbf44903bd..ad2150436833d 100644
--- a/src/Symfony/Bridge/PhpUnit/Legacy/PolyfillTestCaseTrait.php
+++ b/src/Symfony/Bridge/PhpUnit/Legacy/PolyfillTestCaseTrait.php
@@ -11,6 +11,9 @@
namespace Symfony\Bridge\PhpUnit\Legacy;
+use PHPUnit\Framework\Error\Error;
+use PHPUnit\Framework\Error\Notice;
+use PHPUnit\Framework\Error\Warning;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
@@ -66,9 +69,7 @@ protected function createPartialMock($originalClassName, array $methods)
*/
public function expectException($exception)
{
- $property = new \ReflectionProperty(TestCase::class, 'expectedException');
- $property->setAccessible(true);
- $property->setValue($this, $exception);
+ $this->doExpectException($exception);
}
/**
@@ -116,4 +117,95 @@ public function expectExceptionMessageRegExp($messageRegExp)
$property->setAccessible(true);
$property->setValue($this, $messageRegExp);
}
+
+ /**
+ * @return void
+ */
+ public function expectNotice()
+ {
+ $this->doExpectException(Notice::class);
+ }
+
+ /**
+ * @param string $message
+ *
+ * @return void
+ */
+ public function expectNoticeMessage($message)
+ {
+ $this->expectExceptionMessage($message);
+ }
+
+ /**
+ * @param string $regularExpression
+ *
+ * @return void
+ */
+ public function expectNoticeMessageMatches($regularExpression)
+ {
+ $this->expectExceptionMessageMatches($regularExpression);
+ }
+
+ /**
+ * @return void
+ */
+ public function expectWarning()
+ {
+ $this->doExpectException(Warning::class);
+ }
+
+ /**
+ * @param string $message
+ *
+ * @return void
+ */
+ public function expectWarningMessage($message)
+ {
+ $this->expectExceptionMessage($message);
+ }
+
+ /**
+ * @param string $regularExpression
+ *
+ * @return void
+ */
+ public function expectWarningMessageMatches($regularExpression)
+ {
+ $this->expectExceptionMessageMatches($regularExpression);
+ }
+
+ /**
+ * @return void
+ */
+ public function expectError()
+ {
+ $this->doExpectException(Error::class);
+ }
+
+ /**
+ * @param string $message
+ *
+ * @return void
+ */
+ public function expectErrorMessage($message)
+ {
+ $this->expectExceptionMessage($message);
+ }
+
+ /**
+ * @param string $regularExpression
+ *
+ * @return void
+ */
+ public function expectErrorMessageMatches($regularExpression)
+ {
+ $this->expectExceptionMessageMatches($regularExpression);
+ }
+
+ private function doExpectException($exception)
+ {
+ $property = new \ReflectionProperty(TestCase::class, 'expectedException');
+ $property->setAccessible(true);
+ $property->setValue($this, $exception);
+ }
}
diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php
index 403d23cdd5505..5c2f28264037b 100644
--- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php
+++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php
@@ -41,7 +41,7 @@ private static function getVendorDir()
}
self::$vendorDir = $vendorDir;
- mkdir($vendorDir.'/myfakevendor/myfakepackage2');
+ @mkdir($vendorDir.'/myfakevendor/myfakepackage2');
touch($vendorDir.'/myfakevendor/myfakepackage1/MyFakeFile1.php');
touch($vendorDir.'/myfakevendor/myfakepackage1/MyFakeFile2.php');
touch($vendorDir.'/myfakevendor/myfakepackage2/MyFakeFile.php');
diff --git a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php
index 3261a333c628f..08be74fc721a8 100644
--- a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php
+++ b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php
@@ -95,7 +95,7 @@
if (\PHP_VERSION_ID >= 80000) {
// PHP 8 requires PHPUnit 9.3+
- $PHPUNIT_VERSION = $getEnvVar('SYMFONY_PHPUNIT_VERSION', '9.3');
+ $PHPUNIT_VERSION = $getEnvVar('SYMFONY_PHPUNIT_VERSION', '9.4');
} elseif (\PHP_VERSION_ID >= 70200) {
// PHPUnit 8 requires PHP 7.2+
$PHPUNIT_VERSION = $getEnvVar('SYMFONY_PHPUNIT_VERSION', '8.3');
@@ -196,7 +196,7 @@
'requires' => ['php' => '*'],
];
- $stableVersions = array_filter($info['versions'], function($v) {
+ $stableVersions = array_filter($info['versions'], function ($v) {
return !preg_match('/-dev$|^dev-/', $v);
});
@@ -264,11 +264,11 @@ class SymfonyExcludeListPhpunit {}
if (method_exists('PHPUnit\Util\ExcludeList', 'addDirectory')) {
(new PHPUnit\Util\Excludelist())->getExcludedDirectories();
PHPUnit\Util\ExcludeList::addDirectory(\dirname((new \ReflectionClass('SymfonyExcludeListPhpunit'))->getFileName()));
- PHPUnit\Util\ExcludeList::addDirectory(\dirname((new \ReflectionClass('SymfonyExcludeListSimplePhpunit'))->getFileName()));
+ class_exists('SymfonyExcludeListSimplePhpunit', false) && PHPUnit\Util\ExcludeList::addDirectory(\dirname((new \ReflectionClass('SymfonyExcludeListSimplePhpunit'))->getFileName()));
} elseif (method_exists('PHPUnit\Util\Blacklist', 'addDirectory')) {
(new PHPUnit\Util\BlackList())->getBlacklistedDirectories();
PHPUnit\Util\Blacklist::addDirectory(\dirname((new \ReflectionClass('SymfonyExcludeListPhpunit'))->getFileName()));
- PHPUnit\Util\Blacklist::addDirectory(\dirname((new \ReflectionClass('SymfonyExcludeListSimplePhpunit'))->getFileName()));
+ class_exists('SymfonyExcludeListSimplePhpunit', false) && PHPUnit\Util\Blacklist::addDirectory(\dirname((new \ReflectionClass('SymfonyExcludeListSimplePhpunit'))->getFileName()));
} else {
PHPUnit\Util\Blacklist::$blacklistedClassNames['SymfonyExcludeListPhpunit'] = 1;
PHPUnit\Util\Blacklist::$blacklistedClassNames['SymfonyExcludeListSimplePhpunit'] = 1;
diff --git a/src/Symfony/Bridge/PhpUnit/composer.json b/src/Symfony/Bridge/PhpUnit/composer.json
index 9bcabc69dc44f..85318fe178e58 100644
--- a/src/Symfony/Bridge/PhpUnit/composer.json
+++ b/src/Symfony/Bridge/PhpUnit/composer.json
@@ -38,9 +38,6 @@
],
"minimum-stability": "dev",
"extra": {
- "branch-alias": {
- "dev-master": "4.4-dev"
- },
"thanks": {
"name": "phpunit/phpunit",
"url": "https://github.com/sebastianbergmann/phpunit"
diff --git a/src/Symfony/Bridge/ProxyManager/composer.json b/src/Symfony/Bridge/ProxyManager/composer.json
index 43664d6c51518..b34def8465dd2 100644
--- a/src/Symfony/Bridge/ProxyManager/composer.json
+++ b/src/Symfony/Bridge/ProxyManager/composer.json
@@ -17,6 +17,7 @@
],
"require": {
"php": ">=7.1.3",
+ "composer/package-versions-deprecated": "^1.8",
"symfony/dependency-injection": "^4.0|^5.0",
"ocramius/proxy-manager": "~2.1"
},
@@ -32,10 +33,5 @@
"/Tests/"
]
},
- "minimum-stability": "dev",
- "extra": {
- "branch-alias": {
- "dev-master": "4.4-dev"
- }
- }
+ "minimum-stability": "dev"
}
diff --git a/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php b/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php
index 0204df05be7fa..96df106307da7 100644
--- a/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php
+++ b/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php
@@ -26,6 +26,7 @@
// Help opcache.preload discover always-needed symbols
class_exists(TranslatorInterface::class);
+class_exists(TranslatorTrait::class);
/**
* Provides integration of the Translation component with Twig.
diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
index 45843e713fd3d..066ed89c6372b 100644
--- a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
+++ b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
@@ -444,7 +444,7 @@
{%- for attrname, attrvalue in attr -%}
{{- " " -}}
{%- if attrname in ['placeholder', 'title'] -%}
- {{- attrname }}="{{ translation_domain is same as(false) ? attrvalue : attrvalue|trans(attr_translation_parameters, translation_domain) }}"
+ {{- attrname }}="{{ translation_domain is same as(false) or attrvalue is null ? attrvalue : attrvalue|trans(attr_translation_parameters, translation_domain) }}"
{%- elseif attrvalue is same as(true) -%}
{{- attrname }}="{{ attrname }}"
{%- elseif attrvalue is not same as(false) -%}
diff --git a/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php b/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php
index f2789542ff551..09e8352faeccf 100644
--- a/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php
@@ -142,7 +142,7 @@ protected function tearDown(): void
{
foreach ($this->files as $file) {
if (file_exists($file)) {
- unlink($file);
+ @unlink($file);
}
}
}
diff --git a/src/Symfony/Bridge/Twig/composer.json b/src/Symfony/Bridge/Twig/composer.json
index 94574bf7b344e..75860d1ed465b 100644
--- a/src/Symfony/Bridge/Twig/composer.json
+++ b/src/Symfony/Bridge/Twig/composer.json
@@ -78,10 +78,5 @@
"/Tests/"
]
},
- "minimum-stability": "dev",
- "extra": {
- "branch-alias": {
- "dev-master": "4.4-dev"
- }
- }
+ "minimum-stability": "dev"
}
diff --git a/src/Symfony/Bundle/DebugBundle/composer.json b/src/Symfony/Bundle/DebugBundle/composer.json
index 1336046bc6646..a4f0f030d5078 100644
--- a/src/Symfony/Bundle/DebugBundle/composer.json
+++ b/src/Symfony/Bundle/DebugBundle/composer.json
@@ -41,10 +41,5 @@
"/Tests/"
]
},
- "minimum-stability": "dev",
- "extra": {
- "branch-alias": {
- "dev-master": "4.4-dev"
- }
- }
+ "minimum-stability": "dev"
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php
index af81f335e3cdb..29947983f42af 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php
@@ -168,9 +168,9 @@ protected function tearDown(): void
{
foreach ($this->files as $file) {
if (file_exists($file)) {
- unlink($file);
+ @unlink($file);
}
}
- rmdir(sys_get_temp_dir().'/yml-lint-test');
+ @rmdir(sys_get_temp_dir().'/yml-lint-test');
}
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json
index c4f90e086a7f5..7929ccb59b517 100644
--- a/src/Symfony/Bundle/FrameworkBundle/composer.json
+++ b/src/Symfony/Bundle/FrameworkBundle/composer.json
@@ -106,10 +106,5 @@
"/Tests/"
]
},
- "minimum-stability": "dev",
- "extra": {
- "branch-alias": {
- "dev-master": "4.4-dev"
- }
- }
+ "minimum-stability": "dev"
}
diff --git a/src/Symfony/Bundle/SecurityBundle/composer.json b/src/Symfony/Bundle/SecurityBundle/composer.json
index 715425cd25f55..0c2987e4dc82f 100644
--- a/src/Symfony/Bundle/SecurityBundle/composer.json
+++ b/src/Symfony/Bundle/SecurityBundle/composer.json
@@ -58,10 +58,5 @@
"/Tests/"
]
},
- "minimum-stability": "dev",
- "extra": {
- "branch-alias": {
- "dev-master": "4.4-dev"
- }
- }
+ "minimum-stability": "dev"
}
diff --git a/src/Symfony/Bundle/TwigBundle/composer.json b/src/Symfony/Bundle/TwigBundle/composer.json
index 7fa8215626900..31fdda17c4d25 100644
--- a/src/Symfony/Bundle/TwigBundle/composer.json
+++ b/src/Symfony/Bundle/TwigBundle/composer.json
@@ -50,10 +50,5 @@
"/Tests/"
]
},
- "minimum-stability": "dev",
- "extra": {
- "branch-alias": {
- "dev-master": "4.4-dev"
- }
- }
+ "minimum-stability": "dev"
}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig
index 6669cd721fe73..d7508ec1448de 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig
@@ -541,6 +541,6 @@ div.sf-toolbar .sf-toolbar-block a:hover {
/***** Media query print: Do not print the Toolbar. *****/
@media print {
.sf-toolbar {
- display: none;
+ display: none !important;
}
}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/composer.json b/src/Symfony/Bundle/WebProfilerBundle/composer.json
index 2ad3b227ce349..13fe207a9bb0f 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/composer.json
+++ b/src/Symfony/Bundle/WebProfilerBundle/composer.json
@@ -41,10 +41,5 @@
"/Tests/"
]
},
- "minimum-stability": "dev",
- "extra": {
- "branch-alias": {
- "dev-master": "4.4-dev"
- }
- }
+ "minimum-stability": "dev"
}
diff --git a/src/Symfony/Bundle/WebServerBundle/composer.json b/src/Symfony/Bundle/WebServerBundle/composer.json
index 28a022f2eb10d..b376b071b9835 100644
--- a/src/Symfony/Bundle/WebServerBundle/composer.json
+++ b/src/Symfony/Bundle/WebServerBundle/composer.json
@@ -34,10 +34,5 @@
"symfony/monolog-bridge": "For using the log server.",
"symfony/expression-language": "For using the filter option of the log server."
},
- "minimum-stability": "dev",
- "extra": {
- "branch-alias": {
- "dev-master": "4.4-dev"
- }
- }
+ "minimum-stability": "dev"
}
diff --git a/src/Symfony/Component/Asset/composer.json b/src/Symfony/Component/Asset/composer.json
index 04f26f61788ab..2642935808105 100644
--- a/src/Symfony/Component/Asset/composer.json
+++ b/src/Symfony/Component/Asset/composer.json
@@ -31,10 +31,5 @@
"/Tests/"
]
},
- "minimum-stability": "dev",
- "extra": {
- "branch-alias": {
- "dev-master": "4.4-dev"
- }
- }
+ "minimum-stability": "dev"
}
diff --git a/src/Symfony/Component/BrowserKit/Tests/AbstractBrowserTest.php b/src/Symfony/Component/BrowserKit/Tests/AbstractBrowserTest.php
index 25e76cb80168f..ca3d18a9536b5 100644
--- a/src/Symfony/Component/BrowserKit/Tests/AbstractBrowserTest.php
+++ b/src/Symfony/Component/BrowserKit/Tests/AbstractBrowserTest.php
@@ -68,7 +68,7 @@ public function testXmlHttpRequest()
{
$client = $this->getBrowser();
$client->xmlHttpRequest('GET', 'http://example.com/', [], [], [], null, true);
- $this->assertEquals($client->getRequest()->getServer()['HTTP_X_REQUESTED_WITH'], 'XMLHttpRequest');
+ $this->assertSame('XMLHttpRequest', $client->getRequest()->getServer()['HTTP_X_REQUESTED_WITH']);
$this->assertFalse($client->getServerParameter('HTTP_X_REQUESTED_WITH', false));
}
@@ -77,9 +77,9 @@ public function testGetRequestWithIpAsHttpHost()
$client = $this->getBrowser();
$client->request('GET', 'https://example.com/foo', [], [], ['HTTP_HOST' => '127.0.0.1']);
- $this->assertEquals('https://example.com/foo', $client->getRequest()->getUri());
+ $this->assertSame('https://example.com/foo', $client->getRequest()->getUri());
$headers = $client->getRequest()->getServer();
- $this->assertEquals('127.0.0.1', $headers['HTTP_HOST']);
+ $this->assertSame('127.0.0.1', $headers['HTTP_HOST']);
}
public function testGetResponse()
@@ -88,7 +88,7 @@ public function testGetResponse()
$client->setNextResponse(new Response('foo'));
$client->request('GET', 'http://example.com/');
- $this->assertEquals('foo', $client->getResponse()->getContent(), '->getCrawler() returns the Response of the last request');
+ $this->assertSame('foo', $client->getResponse()->getContent(), '->getCrawler() returns the Response of the last request');
$this->assertInstanceOf('Symfony\Component\BrowserKit\Response', $client->getResponse(), '->getCrawler() returns the Response of the last request');
}
@@ -118,7 +118,7 @@ public function testGetContent()
$client = $this->getBrowser();
$client->request('POST', 'http://example.com/jsonrpc', [], [], [], $json);
- $this->assertEquals($json, $client->getRequest()->getContent());
+ $this->assertSame($json, $client->getRequest()->getContent());
}
public function testGetCrawler()
@@ -145,12 +145,12 @@ public function testRequestHttpHeaders()
$client = $this->getBrowser();
$client->request('GET', '/');
$headers = $client->getRequest()->getServer();
- $this->assertEquals('localhost', $headers['HTTP_HOST'], '->request() sets the HTTP_HOST header');
+ $this->assertSame('localhost', $headers['HTTP_HOST'], '->request() sets the HTTP_HOST header');
$client = $this->getBrowser();
$client->request('GET', 'http://www.example.com');
$headers = $client->getRequest()->getServer();
- $this->assertEquals('www.example.com', $headers['HTTP_HOST'], '->request() sets the HTTP_HOST header');
+ $this->assertSame('www.example.com', $headers['HTTP_HOST'], '->request() sets the HTTP_HOST header');
$client->request('GET', 'https://www.example.com');
$headers = $client->getRequest()->getServer();
@@ -159,66 +159,66 @@ public function testRequestHttpHeaders()
$client = $this->getBrowser();
$client->request('GET', 'http://www.example.com:8080');
$headers = $client->getRequest()->getServer();
- $this->assertEquals('www.example.com:8080', $headers['HTTP_HOST'], '->request() sets the HTTP_HOST header with port');
+ $this->assertSame('www.example.com:8080', $headers['HTTP_HOST'], '->request() sets the HTTP_HOST header with port');
}
public function testRequestURIConversion()
{
$client = $this->getBrowser();
$client->request('GET', '/foo');
- $this->assertEquals('http://localhost/foo', $client->getRequest()->getUri(), '->request() converts the URI to an absolute one');
+ $this->assertSame('http://localhost/foo', $client->getRequest()->getUri(), '->request() converts the URI to an absolute one');
$client = $this->getBrowser();
$client->request('GET', 'http://www.example.com');
- $this->assertEquals('http://www.example.com', $client->getRequest()->getUri(), '->request() does not change absolute URIs');
+ $this->assertSame('http://www.example.com', $client->getRequest()->getUri(), '->request() does not change absolute URIs');
$client = $this->getBrowser();
$client->request('GET', 'http://www.example.com/');
$client->request('GET', '/foo');
- $this->assertEquals('http://www.example.com/foo', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
+ $this->assertSame('http://www.example.com/foo', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
$client = $this->getBrowser();
$client->request('GET', 'http://www.example.com/foo');
$client->request('GET', '#');
- $this->assertEquals('http://www.example.com/foo#', $client->getRequest()->getUri(), '->request() uses the previous request for #');
+ $this->assertSame('http://www.example.com/foo#', $client->getRequest()->getUri(), '->request() uses the previous request for #');
$client->request('GET', '#');
- $this->assertEquals('http://www.example.com/foo#', $client->getRequest()->getUri(), '->request() uses the previous request for #');
+ $this->assertSame('http://www.example.com/foo#', $client->getRequest()->getUri(), '->request() uses the previous request for #');
$client->request('GET', '#foo');
- $this->assertEquals('http://www.example.com/foo#foo', $client->getRequest()->getUri(), '->request() uses the previous request for #');
+ $this->assertSame('http://www.example.com/foo#foo', $client->getRequest()->getUri(), '->request() uses the previous request for #');
$client = $this->getBrowser();
$client->request('GET', 'http://www.example.com/foo/');
$client->request('GET', 'bar');
- $this->assertEquals('http://www.example.com/foo/bar', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
+ $this->assertSame('http://www.example.com/foo/bar', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
$client = $this->getBrowser();
$client->request('GET', 'http://www.example.com/foo/foobar');
$client->request('GET', 'bar');
- $this->assertEquals('http://www.example.com/foo/bar', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
+ $this->assertSame('http://www.example.com/foo/bar', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
$client = $this->getBrowser();
$client->request('GET', 'http://www.example.com/foo/');
$client->request('GET', 'http');
- $this->assertEquals('http://www.example.com/foo/http', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
+ $this->assertSame('http://www.example.com/foo/http', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
$client = $this->getBrowser();
$client->request('GET', 'http://www.example.com/foo');
$client->request('GET', 'http/bar');
- $this->assertEquals('http://www.example.com/http/bar', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
+ $this->assertSame('http://www.example.com/http/bar', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
$client = $this->getBrowser();
$client->request('GET', 'http://www.example.com/');
$client->request('GET', 'http');
- $this->assertEquals('http://www.example.com/http', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
+ $this->assertSame('http://www.example.com/http', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
$client = $this->getBrowser();
$client->request('GET', 'http://www.example.com/foo');
$client->request('GET', '?');
- $this->assertEquals('http://www.example.com/foo?', $client->getRequest()->getUri(), '->request() uses the previous request for ?');
+ $this->assertSame('http://www.example.com/foo?', $client->getRequest()->getUri(), '->request() uses the previous request for ?');
$client->request('GET', '?');
- $this->assertEquals('http://www.example.com/foo?', $client->getRequest()->getUri(), '->request() uses the previous request for ?');
+ $this->assertSame('http://www.example.com/foo?', $client->getRequest()->getUri(), '->request() uses the previous request for ?');
$client->request('GET', '?foo=bar');
- $this->assertEquals('http://www.example.com/foo?foo=bar', $client->getRequest()->getUri(), '->request() uses the previous request for ?');
+ $this->assertSame('http://www.example.com/foo?foo=bar', $client->getRequest()->getUri(), '->request() uses the previous request for ?');
}
public function testRequestReferer()
@@ -227,7 +227,7 @@ public function testRequestReferer()
$client->request('GET', 'http://www.example.com/foo/foobar');
$client->request('GET', 'bar');
$server = $client->getRequest()->getServer();
- $this->assertEquals('http://www.example.com/foo/foobar', $server['HTTP_REFERER'], '->request() sets the referer');
+ $this->assertSame('http://www.example.com/foo/foobar', $server['HTTP_REFERER'], '->request() sets the referer');
}
public function testRequestRefererCanBeOverridden()
@@ -236,7 +236,7 @@ public function testRequestRefererCanBeOverridden()
$client->request('GET', 'http://www.example.com/foo/foobar');
$client->request('GET', 'bar', [], [], ['HTTP_REFERER' => 'xyz']);
$server = $client->getRequest()->getServer();
- $this->assertEquals('xyz', $server['HTTP_REFERER'], '->request() allows referer to be overridden');
+ $this->assertSame('xyz', $server['HTTP_REFERER'], '->request() allows referer to be overridden');
}
public function testRequestHistory()
@@ -245,8 +245,8 @@ public function testRequestHistory()
$client->request('GET', 'http://www.example.com/foo/foobar');
$client->request('GET', 'bar');
- $this->assertEquals('http://www.example.com/foo/bar', $client->getHistory()->current()->getUri(), '->request() updates the History');
- $this->assertEquals('http://www.example.com/foo/foobar', $client->getHistory()->back()->getUri(), '->request() updates the History');
+ $this->assertSame('http://www.example.com/foo/bar', $client->getHistory()->current()->getUri(), '->request() updates the History');
+ $this->assertSame('http://www.example.com/foo/foobar', $client->getHistory()->back()->getUri(), '->request() updates the History');
}
public function testRequestCookies()
@@ -254,10 +254,10 @@ public function testRequestCookies()
$client = $this->getBrowser();
$client->setNextResponse(new Response('foo', 200, ['Set-Cookie' => 'foo=bar']));
$client->request('GET', 'http://www.example.com/foo/foobar');
- $this->assertEquals(['foo' => 'bar'], $client->getCookieJar()->allValues('http://www.example.com/foo/foobar'), '->request() updates the CookieJar');
+ $this->assertSame(['foo' => 'bar'], $client->getCookieJar()->allValues('http://www.example.com/foo/foobar'), '->request() updates the CookieJar');
$client->request('GET', 'bar');
- $this->assertEquals(['foo' => 'bar'], $client->getCookieJar()->allValues('http://www.example.com/foo/foobar'), '->request() updates the CookieJar');
+ $this->assertSame(['foo' => 'bar'], $client->getCookieJar()->allValues('http://www.example.com/foo/foobar'), '->request() updates the CookieJar');
}
public function testRequestSecureCookies()
@@ -277,7 +277,7 @@ public function testClick()
$client->click($crawler->filter('a')->link());
- $this->assertEquals('http://www.example.com/foo', $client->getRequest()->getUri(), '->click() clicks on links');
+ $this->assertSame('http://www.example.com/foo', $client->getRequest()->getUri(), '->click() clicks on links');
}
public function testClickLink()
@@ -287,7 +287,7 @@ public function testClickLink()
$client->request('GET', 'http://www.example.com/foo/foobar');
$client->clickLink('foo');
- $this->assertEquals('http://www.example.com/foo', $client->getRequest()->getUri(), '->click() clicks on links');
+ $this->assertSame('http://www.example.com/foo', $client->getRequest()->getUri(), '->click() clicks on links');
}
public function testClickLinkNotFound()
@@ -312,7 +312,7 @@ public function testClickForm()
$client->click($crawler->filter('input')->form());
- $this->assertEquals('http://www.example.com/foo', $client->getRequest()->getUri(), '->click() Form submit forms');
+ $this->assertSame('http://www.example.com/foo', $client->getRequest()->getUri(), '->click() Form submit forms');
}
public function testSubmit()
@@ -323,7 +323,7 @@ public function testSubmit()
$client->submit($crawler->filter('input')->form());
- $this->assertEquals('http://www.example.com/foo', $client->getRequest()->getUri(), '->submit() submit forms');
+ $this->assertSame('http://www.example.com/foo', $client->getRequest()->getUri(), '->submit() submit forms');
}
public function testSubmitForm()
@@ -339,11 +339,11 @@ public function testSubmitForm()
'HTTP_USER_AGENT' => 'Symfony User Agent',
]);
- $this->assertEquals('http://www.example.com/foo', $client->getRequest()->getUri(), '->submitForm() submit forms');
- $this->assertEquals('PUT', $client->getRequest()->getMethod(), '->submitForm() allows to change the method');
- $this->assertEquals('new username', $client->getRequest()->getParameters()['username'], '->submitForm() allows to override the form values');
- $this->assertEquals('new password', $client->getRequest()->getParameters()['password'], '->submitForm() allows to override the form values');
- $this->assertEquals('Symfony User Agent', $client->getRequest()->getServer()['HTTP_USER_AGENT'], '->submitForm() allows to change the $_SERVER parameters');
+ $this->assertSame('http://www.example.com/foo', $client->getRequest()->getUri(), '->submitForm() submit forms');
+ $this->assertSame('PUT', $client->getRequest()->getMethod(), '->submitForm() allows to change the method');
+ $this->assertSame('new username', $client->getRequest()->getParameters()['username'], '->submitForm() allows to override the form values');
+ $this->assertSame('new password', $client->getRequest()->getParameters()['password'], '->submitForm() allows to override the form values');
+ $this->assertSame('Symfony User Agent', $client->getRequest()->getServer()['HTTP_USER_AGENT'], '->submitForm() allows to change the $_SERVER parameters');
}
public function testSubmitFormNotFound()
@@ -371,19 +371,19 @@ public function testSubmitPreserveAuth()
$server = $client->getRequest()->getServer();
$this->assertArrayHasKey('PHP_AUTH_USER', $server);
- $this->assertEquals('foo', $server['PHP_AUTH_USER']);
+ $this->assertSame('foo', $server['PHP_AUTH_USER']);
$this->assertArrayHasKey('PHP_AUTH_PW', $server);
- $this->assertEquals('bar', $server['PHP_AUTH_PW']);
+ $this->assertSame('bar', $server['PHP_AUTH_PW']);
$client->submit($crawler->filter('input')->form());
- $this->assertEquals('http://www.example.com/foo', $client->getRequest()->getUri(), '->submit() submit forms');
+ $this->assertSame('http://www.example.com/foo', $client->getRequest()->getUri(), '->submit() submit forms');
$server = $client->getRequest()->getServer();
$this->assertArrayHasKey('PHP_AUTH_USER', $server);
- $this->assertEquals('foo', $server['PHP_AUTH_USER']);
+ $this->assertSame('foo', $server['PHP_AUTH_USER']);
$this->assertArrayHasKey('PHP_AUTH_PW', $server);
- $this->assertEquals('bar', $server['PHP_AUTH_PW']);
+ $this->assertSame('bar', $server['PHP_AUTH_PW']);
}
public function testSubmitPassthrewHeaders()
@@ -397,7 +397,7 @@ public function testSubmitPassthrewHeaders()
$server = $client->getRequest()->getServer();
$this->assertArrayHasKey('Accept-Language', $server);
- $this->assertEquals('de', $server['Accept-Language']);
+ $this->assertSame('de', $server['Accept-Language']);
}
public function testFollowRedirect()
@@ -417,19 +417,19 @@ public function testFollowRedirect()
$client->request('GET', 'http://www.example.com/foo/foobar');
$client->followRedirect();
- $this->assertEquals('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows a redirect if any');
+ $this->assertSame('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows a redirect if any');
$client = $this->getBrowser();
$client->setNextResponse(new Response('', 302, ['Location' => 'http://www.example.com/redirected']));
$client->request('GET', 'http://www.example.com/foo/foobar');
- $this->assertEquals('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() automatically follows redirects if followRedirects is true');
+ $this->assertSame('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() automatically follows redirects if followRedirects is true');
$client = $this->getBrowser();
$client->setNextResponse(new Response('', 201, ['Location' => 'http://www.example.com/redirected']));
$client->request('GET', 'http://www.example.com/foo/foobar');
- $this->assertEquals('http://www.example.com/foo/foobar', $client->getRequest()->getUri(), '->followRedirect() does not follow redirect if HTTP Code is not 30x');
+ $this->assertSame('http://www.example.com/foo/foobar', $client->getRequest()->getUri(), '->followRedirect() does not follow redirect if HTTP Code is not 30x');
$client = $this->getBrowser();
$client->setNextResponse(new Response('', 201, ['Location' => 'http://www.example.com/redirected']));
@@ -449,12 +449,12 @@ public function testFollowRelativeRedirect()
$client = $this->getBrowser();
$client->setNextResponse(new Response('', 302, ['Location' => '/redirected']));
$client->request('GET', 'http://www.example.com/foo/foobar');
- $this->assertEquals('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows a redirect if any');
+ $this->assertSame('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows a redirect if any');
$client = $this->getBrowser();
$client->setNextResponse(new Response('', 302, ['Location' => '/redirected:1234']));
$client->request('GET', 'http://www.example.com/foo/foobar');
- $this->assertEquals('http://www.example.com/redirected:1234', $client->getRequest()->getUri(), '->followRedirect() follows relative urls');
+ $this->assertSame('http://www.example.com/redirected:1234', $client->getRequest()->getUri(), '->followRedirect() follows relative urls');
}
public function testFollowRedirectWithMaxRedirects()
@@ -463,7 +463,7 @@ public function testFollowRedirectWithMaxRedirects()
$client->setMaxRedirects(1);
$client->setNextResponse(new Response('', 302, ['Location' => 'http://www.example.com/redirected']));
$client->request('GET', 'http://www.example.com/foo/foobar');
- $this->assertEquals('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows a redirect if any');
+ $this->assertSame('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows a redirect if any');
$client->setNextResponse(new Response('', 302, ['Location' => 'http://www.example.com/redirected2']));
try {
@@ -475,25 +475,25 @@ public function testFollowRedirectWithMaxRedirects()
$client->setNextResponse(new Response('', 302, ['Location' => 'http://www.example.com/redirected']));
$client->request('GET', 'http://www.example.com/foo/foobar');
- $this->assertEquals('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows a redirect if any');
+ $this->assertSame('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows a redirect if any');
$client->setNextResponse(new Response('', 302, ['Location' => '/redirected']));
$client->request('GET', 'http://www.example.com/foo/foobar');
- $this->assertEquals('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows relative URLs');
+ $this->assertSame('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows relative URLs');
$client = $this->getBrowser();
$client->setNextResponse(new Response('', 302, ['Location' => '//www.example.org/']));
$client->request('GET', 'https://www.example.com/');
- $this->assertEquals('https://www.example.org/', $client->getRequest()->getUri(), '->followRedirect() follows protocol-relative URLs');
+ $this->assertSame('https://www.example.org/', $client->getRequest()->getUri(), '->followRedirect() follows protocol-relative URLs');
$client = $this->getBrowser();
$client->setNextResponse(new Response('', 302, ['Location' => 'http://www.example.com/redirected']));
$client->request('POST', 'http://www.example.com/foo/foobar', ['name' => 'bar']);
- $this->assertEquals('GET', $client->getRequest()->getMethod(), '->followRedirect() uses a GET for 302');
- $this->assertEquals([], $client->getRequest()->getParameters(), '->followRedirect() does not submit parameters when changing the method');
+ $this->assertSame('GET', $client->getRequest()->getMethod(), '->followRedirect() uses a GET for 302');
+ $this->assertSame([], $client->getRequest()->getParameters(), '->followRedirect() does not submit parameters when changing the method');
}
public function testFollowRedirectWithCookies()
@@ -505,9 +505,9 @@ public function testFollowRedirectWithCookies()
'Set-Cookie' => 'foo=bar',
]));
$client->request('GET', 'http://www.example.com/');
- $this->assertEquals([], $client->getRequest()->getCookies());
+ $this->assertSame([], $client->getRequest()->getCookies());
$client->followRedirect();
- $this->assertEquals(['foo' => 'bar'], $client->getRequest()->getCookies());
+ $this->assertSame(['foo' => 'bar'], $client->getRequest()->getCookies());
}
public function testFollowRedirectWithHeaders()
@@ -566,9 +566,9 @@ public function testIsFollowingRedirects()
public function testGetMaxRedirects()
{
$client = $this->getBrowser();
- $this->assertEquals(-1, $client->getMaxRedirects(), '->getMaxRedirects() returns default value');
+ $this->assertSame(-1, $client->getMaxRedirects(), '->getMaxRedirects() returns default value');
$client->setMaxRedirects(3);
- $this->assertEquals(3, $client->getMaxRedirects(), '->getMaxRedirects() returns assigned value');
+ $this->assertSame(3, $client->getMaxRedirects(), '->getMaxRedirects() returns assigned value');
}
public function testFollowRedirectWithPostMethod()
@@ -583,12 +583,12 @@ public function testFollowRedirectWithPostMethod()
$client->setNextResponse(new Response('', 307, ['Location' => 'http://www.example.com/redirected']));
$client->request('POST', 'http://www.example.com/foo/foobar', $parameters, $files, $server, $content);
- $this->assertEquals('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows a redirect with POST method');
+ $this->assertSame('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows a redirect with POST method');
$this->assertArrayHasKey('foo', $client->getRequest()->getParameters(), '->followRedirect() keeps parameters with POST method');
$this->assertArrayHasKey('myfile.foo', $client->getRequest()->getFiles(), '->followRedirect() keeps files with POST method');
$this->assertArrayHasKey('X_TEST_FOO', $client->getRequest()->getServer(), '->followRedirect() keeps $_SERVER with POST method');
- $this->assertEquals($content, $client->getRequest()->getContent(), '->followRedirect() keeps content with POST method');
- $this->assertEquals('POST', $client->getRequest()->getMethod(), '->followRedirect() keeps request method');
+ $this->assertSame($content, $client->getRequest()->getContent(), '->followRedirect() keeps content with POST method');
+ $this->assertSame('POST', $client->getRequest()->getMethod(), '->followRedirect() keeps request method');
}
public function testFollowRedirectDropPostMethod()
@@ -604,12 +604,12 @@ public function testFollowRedirectDropPostMethod()
$client->setNextResponse(new Response('', $code, ['Location' => 'http://www.example.com/redirected']));
$client->request('POST', 'http://www.example.com/foo/foobar', $parameters, $files, $server, $content);
- $this->assertEquals('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows a redirect with POST method on response code: '.$code.'.');
+ $this->assertSame('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows a redirect with POST method on response code: '.$code.'.');
$this->assertEmpty($client->getRequest()->getParameters(), '->followRedirect() drops parameters with POST method on response code: '.$code.'.');
$this->assertEmpty($client->getRequest()->getFiles(), '->followRedirect() drops files with POST method on response code: '.$code.'.');
$this->assertArrayHasKey('X_TEST_FOO', $client->getRequest()->getServer(), '->followRedirect() keeps $_SERVER with POST method on response code: '.$code.'.');
$this->assertEmpty($client->getRequest()->getContent(), '->followRedirect() drops content with POST method on response code: '.$code.'.');
- $this->assertEquals('GET', $client->getRequest()->getMethod(), '->followRedirect() drops request method to GET on response code: '.$code.'.');
+ $this->assertSame('GET', $client->getRequest()->getMethod(), '->followRedirect() drops request method to GET on response code: '.$code.'.');
}
}
@@ -622,7 +622,7 @@ public function testFollowMetaRefresh(string $content, string $expectedEndingUrl
$client->followMetaRefresh($followMetaRefresh);
$client->setNextResponse(new Response($content));
$client->request('GET', 'http://www.example.com/foo/foobar');
- $this->assertEquals($expectedEndingUrl, $client->getRequest()->getUri());
+ $this->assertSame($expectedEndingUrl, $client->getRequest()->getUri());
}
public function getTestsForMetaRefresh()
@@ -659,11 +659,11 @@ public function testBack()
$client->request('GET', 'http://www.example.com/foo');
$client->back();
- $this->assertEquals('http://www.example.com/foo/foobar', $client->getRequest()->getUri(), '->back() goes back in the history');
+ $this->assertSame('http://www.example.com/foo/foobar', $client->getRequest()->getUri(), '->back() goes back in the history');
$this->assertArrayHasKey('foo', $client->getRequest()->getParameters(), '->back() keeps parameters');
$this->assertArrayHasKey('myfile.foo', $client->getRequest()->getFiles(), '->back() keeps files');
$this->assertArrayHasKey('X_TEST_FOO', $client->getRequest()->getServer(), '->back() keeps $_SERVER');
- $this->assertEquals($content, $client->getRequest()->getContent(), '->back() keeps content');
+ $this->assertSame($content, $client->getRequest()->getContent(), '->back() keeps content');
}
public function testForward()
@@ -680,11 +680,11 @@ public function testForward()
$client->back();
$client->forward();
- $this->assertEquals('http://www.example.com/foo', $client->getRequest()->getUri(), '->forward() goes forward in the history');
+ $this->assertSame('http://www.example.com/foo', $client->getRequest()->getUri(), '->forward() goes forward in the history');
$this->assertArrayHasKey('foo', $client->getRequest()->getParameters(), '->forward() keeps parameters');
$this->assertArrayHasKey('myfile.foo', $client->getRequest()->getFiles(), '->forward() keeps files');
$this->assertArrayHasKey('X_TEST_FOO', $client->getRequest()->getServer(), '->forward() keeps $_SERVER');
- $this->assertEquals($content, $client->getRequest()->getContent(), '->forward() keeps content');
+ $this->assertSame($content, $client->getRequest()->getContent(), '->forward() keeps content');
}
public function testBackAndFrowardWithRedirects()
@@ -695,15 +695,15 @@ public function testBackAndFrowardWithRedirects()
$client->setNextResponse(new Response('', 301, ['Location' => 'http://www.example.com/redirected']));
$client->request('GET', 'http://www.example.com/bar');
- $this->assertEquals('http://www.example.com/redirected', $client->getRequest()->getUri(), 'client followed redirect');
+ $this->assertSame('http://www.example.com/redirected', $client->getRequest()->getUri(), 'client followed redirect');
$client->back();
- $this->assertEquals('http://www.example.com/foo', $client->getRequest()->getUri(), '->back() goes back in the history skipping redirects');
+ $this->assertSame('http://www.example.com/foo', $client->getRequest()->getUri(), '->back() goes back in the history skipping redirects');
$client->forward();
- $this->assertEquals('http://www.example.com/redirected', $client->getRequest()->getUri(), '->forward() goes forward in the history skipping redirects');
+ $this->assertSame('http://www.example.com/redirected', $client->getRequest()->getUri(), '->forward() goes forward in the history skipping redirects');
}
public function testReload()
@@ -718,11 +718,11 @@ public function testReload()
$client->request('GET', 'http://www.example.com/foo/foobar', $parameters, $files, $server, $content);
$client->reload();
- $this->assertEquals('http://www.example.com/foo/foobar', $client->getRequest()->getUri(), '->reload() reloads the current page');
+ $this->assertSame('http://www.example.com/foo/foobar', $client->getRequest()->getUri(), '->reload() reloads the current page');
$this->assertArrayHasKey('foo', $client->getRequest()->getParameters(), '->reload() keeps parameters');
$this->assertArrayHasKey('myfile.foo', $client->getRequest()->getFiles(), '->reload() keeps files');
$this->assertArrayHasKey('X_TEST_FOO', $client->getRequest()->getServer(), '->reload() keeps $_SERVER');
- $this->assertEquals($content, $client->getRequest()->getContent(), '->reload() keeps content');
+ $this->assertSame($content, $client->getRequest()->getContent(), '->reload() keeps content');
}
public function testRestart()
@@ -732,7 +732,7 @@ public function testRestart()
$client->restart();
$this->assertTrue($client->getHistory()->isEmpty(), '->restart() clears the history');
- $this->assertEquals([], $client->getCookieJar()->all(), '->restart() clears the cookies');
+ $this->assertSame([], $client->getCookieJar()->all(), '->restart() clears the cookies');
}
/**
@@ -745,7 +745,7 @@ public function testInsulatedRequests()
$client->setNextScript("new Symfony\Component\BrowserKit\Response('foobar')");
$client->request('GET', 'http://www.example.com/foo/foobar');
- $this->assertEquals('foobar', $client->getResponse()->getContent(), '->insulate() process the request in a forked process');
+ $this->assertSame('foobar', $client->getResponse()->getContent(), '->insulate() process the request in a forked process');
$client->setNextScript("new Symfony\Component\BrowserKit\Response('foobar)");
@@ -760,31 +760,31 @@ public function testInsulatedRequests()
public function testGetServerParameter()
{
$client = $this->getBrowser();
- $this->assertEquals('', $client->getServerParameter('HTTP_HOST'));
- $this->assertEquals('Symfony BrowserKit', $client->getServerParameter('HTTP_USER_AGENT'));
- $this->assertEquals('testvalue', $client->getServerParameter('testkey', 'testvalue'));
+ $this->assertSame('', $client->getServerParameter('HTTP_HOST'));
+ $this->assertSame('Symfony BrowserKit', $client->getServerParameter('HTTP_USER_AGENT'));
+ $this->assertSame('testvalue', $client->getServerParameter('testkey', 'testvalue'));
}
public function testSetServerParameter()
{
$client = $this->getBrowser();
- $this->assertEquals('', $client->getServerParameter('HTTP_HOST'));
- $this->assertEquals('Symfony BrowserKit', $client->getServerParameter('HTTP_USER_AGENT'));
+ $this->assertSame('', $client->getServerParameter('HTTP_HOST'));
+ $this->assertSame('Symfony BrowserKit', $client->getServerParameter('HTTP_USER_AGENT'));
$client->setServerParameter('HTTP_HOST', 'testhost');
- $this->assertEquals('testhost', $client->getServerParameter('HTTP_HOST'));
+ $this->assertSame('testhost', $client->getServerParameter('HTTP_HOST'));
$client->setServerParameter('HTTP_USER_AGENT', 'testua');
- $this->assertEquals('testua', $client->getServerParameter('HTTP_USER_AGENT'));
+ $this->assertSame('testua', $client->getServerParameter('HTTP_USER_AGENT'));
}
public function testSetServerParameterInRequest()
{
$client = $this->getBrowser();
- $this->assertEquals('', $client->getServerParameter('HTTP_HOST'));
- $this->assertEquals('Symfony BrowserKit', $client->getServerParameter('HTTP_USER_AGENT'));
+ $this->assertSame('', $client->getServerParameter('HTTP_HOST'));
+ $this->assertSame('Symfony BrowserKit', $client->getServerParameter('HTTP_USER_AGENT'));
$client->request('GET', 'https://www.example.com/https/www.example.com', [], [], [
'HTTP_HOST' => 'testhost',
@@ -793,21 +793,21 @@ public function testSetServerParameterInRequest()
'NEW_SERVER_KEY' => 'new-server-key-value',
]);
- $this->assertEquals('', $client->getServerParameter('HTTP_HOST'));
- $this->assertEquals('Symfony BrowserKit', $client->getServerParameter('HTTP_USER_AGENT'));
+ $this->assertSame('', $client->getServerParameter('HTTP_HOST'));
+ $this->assertSame('Symfony BrowserKit', $client->getServerParameter('HTTP_USER_AGENT'));
- $this->assertEquals('https://www.example.com/https/www.example.com', $client->getRequest()->getUri());
+ $this->assertSame('https://www.example.com/https/www.example.com', $client->getRequest()->getUri());
$server = $client->getRequest()->getServer();
$this->assertArrayHasKey('HTTP_USER_AGENT', $server);
- $this->assertEquals('testua', $server['HTTP_USER_AGENT']);
+ $this->assertSame('testua', $server['HTTP_USER_AGENT']);
$this->assertArrayHasKey('HTTP_HOST', $server);
- $this->assertEquals('testhost', $server['HTTP_HOST']);
+ $this->assertSame('testhost', $server['HTTP_HOST']);
$this->assertArrayHasKey('NEW_SERVER_KEY', $server);
- $this->assertEquals('new-server-key-value', $server['NEW_SERVER_KEY']);
+ $this->assertSame('new-server-key-value', $server['NEW_SERVER_KEY']);
$this->assertArrayHasKey('HTTPS', $server);
$this->assertTrue($server['HTTPS']);
@@ -821,13 +821,13 @@ public function testRequestWithRelativeUri()
'HTTP_HOST' => 'testhost',
'HTTPS' => true,
]);
- $this->assertEquals('https://testhost/', $client->getRequest()->getUri());
+ $this->assertSame('https://testhost/', $client->getRequest()->getUri());
$client->request('GET', 'https://www.example.com/', [], [], [
'HTTP_HOST' => 'testhost',
'HTTPS' => false,
]);
- $this->assertEquals('https://www.example.com/', $client->getRequest()->getUri());
+ $this->assertSame('https://www.example.com/', $client->getRequest()->getUri());
}
public function testInternalRequest()
diff --git a/src/Symfony/Component/BrowserKit/composer.json b/src/Symfony/Component/BrowserKit/composer.json
index 6aa3f4006b012..ca81670e3d577 100644
--- a/src/Symfony/Component/BrowserKit/composer.json
+++ b/src/Symfony/Component/BrowserKit/composer.json
@@ -34,10 +34,5 @@
"/Tests/"
]
},
- "minimum-stability": "dev",
- "extra": {
- "branch-alias": {
- "dev-master": "4.4-dev"
- }
- }
+ "minimum-stability": "dev"
}
diff --git a/src/Symfony/Component/Cache/Adapter/ChainAdapter.php b/src/Symfony/Component/Cache/Adapter/ChainAdapter.php
index 5973b3d562602..4c086c3d55c74 100644
--- a/src/Symfony/Component/Cache/Adapter/ChainAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/ChainAdapter.php
@@ -73,7 +73,9 @@ static function ($sourceItem, $item, $sourceMetadata = null) use ($defaultLifeti
$item->isHit = $sourceItem->isHit;
$item->metadata = $item->newMetadata = $sourceItem->metadata = $sourceMetadata;
- if (0 < $defaultLifetime) {
+ if (isset($item->metadata[CacheItem::METADATA_EXPIRY])) {
+ $item->expiresAt(\DateTime::createFromFormat('U.u', $item->metadata[CacheItem::METADATA_EXPIRY]));
+ } elseif (0 < $defaultLifetime) {
$item->expiresAfter($defaultLifetime);
}
diff --git a/src/Symfony/Component/Cache/Marshaller/DefaultMarshaller.php b/src/Symfony/Component/Cache/Marshaller/DefaultMarshaller.php
index 0dbc4f89c2014..7493a2efa6aa1 100644
--- a/src/Symfony/Component/Cache/Marshaller/DefaultMarshaller.php
+++ b/src/Symfony/Component/Cache/Marshaller/DefaultMarshaller.php
@@ -25,9 +25,9 @@ class DefaultMarshaller implements MarshallerInterface
public function __construct(bool $useIgbinarySerialize = null)
{
if (null === $useIgbinarySerialize) {
- $useIgbinarySerialize = \extension_loaded('igbinary') && (\PHP_VERSION_ID < 70400 || version_compare('3.1.0', phpversion('igbinary'), '<='));
- } elseif ($useIgbinarySerialize && (!\extension_loaded('igbinary') || (\PHP_VERSION_ID >= 70400 && version_compare('3.1.0', phpversion('igbinary'), '>')))) {
- throw new CacheException(\extension_loaded('igbinary') && \PHP_VERSION_ID >= 70400 ? 'Please upgrade the "igbinary" PHP extension to v3.1 or higher.' : 'The "igbinary" PHP extension is not loaded.');
+ $useIgbinarySerialize = \extension_loaded('igbinary') && (\PHP_VERSION_ID < 70400 || version_compare('3.1.6', phpversion('igbinary'), '<='));
+ } elseif ($useIgbinarySerialize && (!\extension_loaded('igbinary') || (\PHP_VERSION_ID >= 70400 && version_compare('3.1.6', phpversion('igbinary'), '>')))) {
+ throw new CacheException(\extension_loaded('igbinary') && \PHP_VERSION_ID >= 70400 ? 'Please upgrade the "igbinary" PHP extension to v3.1.6 or higher.' : 'The "igbinary" PHP extension is not loaded.');
}
$this->useIgbinarySerialize = $useIgbinarySerialize;
}
@@ -66,7 +66,7 @@ public function unmarshall(string $value)
return null;
}
static $igbinaryNull;
- if ($value === ($igbinaryNull ?? $igbinaryNull = \extension_loaded('igbinary') && (\PHP_VERSION_ID < 70400 || version_compare('3.1.0', phpversion('igbinary'), '<=')) ? igbinary_serialize(null) : false)) {
+ if ($value === ($igbinaryNull ?? $igbinaryNull = \extension_loaded('igbinary') ? igbinary_serialize(null) : false)) {
return null;
}
$unserializeCallbackHandler = ini_set('unserialize_callback_func', __CLASS__.'::handleUnserializeCallback');
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php b/src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php
index 05b863d1ac110..57c355eaa43a6 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php
@@ -116,11 +116,11 @@ public function testGetMetadata()
$item = $cache->getItem('foo');
- $expected = [
- CacheItem::METADATA_EXPIRY => 9.5 + time(),
- CacheItem::METADATA_CTIME => 1000,
- ];
- $this->assertEqualsWithDelta($expected, $item->getMetadata(), .6, 'Item metadata should embed expiry and ctime.');
+ $metadata = $item->getMetadata();
+ $this->assertArrayHasKey(CacheItem::METADATA_CTIME, $metadata);
+ $this->assertEqualsWithDelta(1000, $metadata[CacheItem::METADATA_CTIME], 6);
+ $this->assertArrayHasKey(CacheItem::METADATA_EXPIRY, $metadata);
+ $this->assertEqualsWithDelta(9.5 + time(), $metadata[CacheItem::METADATA_EXPIRY], 0.6);
}
public function testDefaultLifeTime()
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php
index 53295a1eef0e5..909b5f87ceabd 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php
@@ -16,8 +16,11 @@
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Cache\Adapter\ChainAdapter;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
+use Symfony\Component\Cache\CacheItem;
use Symfony\Component\Cache\Tests\Fixtures\ExternalAdapter;
use Symfony\Component\Cache\Tests\Fixtures\PrunableAdapter;
+use Symfony\Component\Filesystem\Filesystem;
+use Symfony\Contracts\Cache\ItemInterface;
/**
* @author Kévin Dunglas