diff --git a/.appveyor.yml b/.appveyor.yml index a2f36f9d97414..5077eea33d60a 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -12,6 +12,7 @@ init: - SET SYMFONY_DEPRECATIONS_HELPER=strict - SET ANSICON=121x90 (121x90) - SET SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE=1 + - SET SYMFONY_DEPRECATIONS_HELPER=max[indirect]=170 - REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Command Processor" /v DelayedExpansion /t REG_DWORD /d 1 /f install: @@ -50,9 +51,10 @@ install: - php composer.phar global require --no-progress --no-scripts --no-plugins symfony/flex - git config --global user.email "" - git config --global user.name "Symfony" - - FOR /F "tokens=* USEBACKQ" %%F IN (`bash -c "grep branch-version composer.json | grep -o '[0-9.x]*'"`) DO (SET SYMFONY_VERSION=%%F) + - FOR /F "tokens=* USEBACKQ" %%F IN (`bash -c "grep -m1 SYMFONY_VERSION .travis.yml | grep -o '[0-9.x]*'"`) DO (SET SYMFONY_VERSION=%%F) - php .github/build-packages.php HEAD^ %SYMFONY_VERSION% src\Symfony\Bridge\PhpUnit - SET "SYMFONY_REQUIRE=>=%SYMFONY_VERSION%" + - SET COMPOSER_ROOT_VERSION=%SYMFONY_VERSION%.x-dev - php composer.phar update --no-progress --ansi - php phpunit install diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md deleted file mode 100644 index 16e2603b76a1d..0000000000000 --- a/.github/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,8 +0,0 @@ -# Code of Conduct - -This project follows a [Code of Conduct][code_of_conduct] in order to ensure an open and welcoming environment. -Please read the full text for understanding the accepted and unaccepted behavior. -Please read also the [reporting guidelines][guidelines], in case you encountered or witnessed any misbehavior. - -[code_of_conduct]: https://symfony.com/doc/current/contributing/code_of_conduct/index.html -[guidelines]: https://symfony.com/doc/current/contributing/code_of_conduct/reporting_guidelines.html diff --git a/.github/ISSUE_TEMPLATE/1_Bug_report.md b/.github/ISSUE_TEMPLATE/1_Bug_report.md deleted file mode 100644 index 4a64e16edf0a5..0000000000000 --- a/.github/ISSUE_TEMPLATE/1_Bug_report.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -name: 🐛 Bug Report -about: Report errors and problems - ---- - -**Symfony version(s) affected**: x.y.z - -**Description** - - -**How to reproduce** - - -**Possible Solution** - - -**Additional context** - diff --git a/.github/ISSUE_TEMPLATE/2_Feature_request.md b/.github/ISSUE_TEMPLATE/2_Feature_request.md deleted file mode 100644 index 335321e413607..0000000000000 --- a/.github/ISSUE_TEMPLATE/2_Feature_request.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -name: 🚀 Feature Request -about: RFC and ideas for new features and improvements - ---- - -**Description** - - -**Example** - diff --git a/.github/ISSUE_TEMPLATE/3_Support_question.md b/.github/ISSUE_TEMPLATE/3_Support_question.md deleted file mode 100644 index 9480710c15655..0000000000000 --- a/.github/ISSUE_TEMPLATE/3_Support_question.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: ⛔ Support Question -about: See https://symfony.com/support for questions about using Symfony and its components - ---- - -We use GitHub issues only to discuss about Symfony bugs and new features. For -this kind of questions about using Symfony or third-party bundles, please use -any of the support alternatives shown in https://symfony.com/support - -Thanks! diff --git a/.github/ISSUE_TEMPLATE/4_Documentation_issue.md b/.github/ISSUE_TEMPLATE/4_Documentation_issue.md deleted file mode 100644 index 0855c3c5f1e12..0000000000000 --- a/.github/ISSUE_TEMPLATE/4_Documentation_issue.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -name: ⛔ Documentation Issue -about: See https://github.com/symfony/symfony-docs/issues for documentation issues - ---- - -Symfony Documentation has its own dedicated repository. Please open your -documentation-related issue at https://github.com/symfony/symfony-docs/issues - -Thanks! diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 2b27d887c2f74..d4182db630352 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,6 @@ | Q | A | ------------- | --- -| Branch? | 5.x for features / 4.4, 5.1 or 5.2 for bug fixes +| Branch? | 5.x for features / 4.4 or 5.2 for bug fixes | Bug fix? | yes/no | New feature? | yes/no | Deprecations? | yes/no @@ -17,4 +17,5 @@ Additionally (see https://symfony.com/releases): - 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 5.x. + - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry --> diff --git a/.github/SECURITY.md b/.github/SECURITY.md deleted file mode 100644 index 60990950bf039..0000000000000 --- a/.github/SECURITY.md +++ /dev/null @@ -1,10 +0,0 @@ -Security Policy -=============== - -If you found any issues that might have security implications, -please send a report to security[at]symfony.com -DO NOT PUBLISH SECURITY REPORTS PUBLICLY. - -The full [Security Policy][1] is described in the official documentation. - - [1]: https://symfony.com/security diff --git a/.github/build-packages.php b/.github/build-packages.php index c8c802ad595b4..30dcf0c9adce8 100644 --- a/.github/build-packages.php +++ b/.github/build-packages.php @@ -46,7 +46,7 @@ passthru("cd $dir && git init && git add . && git commit -q -m - && git archive -o package.tar HEAD && rm .git/ -Rf"); } - $package->version = (isset($package->extra->{'branch-version'}) ? $package->extra->{'branch-version'} : $version).'.x-dev'; + $package->version = preg_replace('/(?:\.x)?-dev$/', '', $package->extra->{'branch-alias'}->{'dev-main'} ?? $version).'.x-dev'; $package->dist['type'] = 'tar'; $package->dist['url'] = 'file://'.str_replace(DIRECTORY_SEPARATOR, '/', dirname(__DIR__))."/$dir/package.tar"; diff --git a/.github/psalm/.gitignore b/.github/psalm/.gitignore new file mode 100644 index 0000000000000..d6b7ef32c8478 --- /dev/null +++ b/.github/psalm/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/.github/psalm/psalm.baseline.xml b/.github/psalm/psalm.baseline.xml new file mode 100644 index 0000000000000..f74693accd46f --- /dev/null +++ b/.github/psalm/psalm.baseline.xml @@ -0,0 +1,3 @@ + + + diff --git a/.github/workflows/intl-data-tests.yml b/.github/workflows/intl-data-tests.yml index 17e26dad0d1ec..0ca0322281448 100644 --- a/.github/workflows/intl-data-tests.yml +++ b/.github/workflows/intl-data-tests.yml @@ -1,47 +1,50 @@ name: Intl data tests on: - push: - paths: - - 'src/Symfony/Component/Intl/Resources/data/**' - pull_request: - paths: - - 'src/Symfony/Component/Intl/Resources/data/**' + push: + paths: + - 'src/Symfony/Component/Intl/Resources/data/**' + pull_request: + paths: + - 'src/Symfony/Component/Intl/Resources/data/**' -jobs: +defaults: + run: + shell: bash - tests: - name: Tests (intl-data) - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Define the ICU version - run: | - SYMFONY_ICU_VERSION=$(php -r 'require "src/Symfony/Component/Intl/Intl.php"; echo Symfony\Component\Intl\Intl::getIcuStubVersion();') - echo "SYMFONY_ICU_VERSION=$SYMFONY_ICU_VERSION" >> $GITHUB_ENV - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - coverage: "none" - extensions: "zip,intl-${{env.SYMFONY_ICU_VERSION}}" - ini-values: "memory_limit=-1" - php-version: "7.4" - - - name: Install dependencies - run: | - echo "::group::composer update" - composer update --no-progress --no-suggest --ansi - echo "::endgroup::" - echo "::group::install phpunit" - ./phpunit install - echo "::endgroup::" - - - name: Report the ICU version - run: icu-config --version && php -i | grep 'ICU version' - - - name: Run intl-data tests - run: ./phpunit --group intl-data -v +jobs: + tests: + name: Tests (intl-data) + runs-on: Ubuntu-20.04 + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Define the ICU version + run: | + SYMFONY_ICU_VERSION=$(php -r 'require "src/Symfony/Component/Intl/Intl.php"; echo Symfony\Component\Intl\Intl::getIcuStubVersion();') + echo "SYMFONY_ICU_VERSION=$SYMFONY_ICU_VERSION" >> $GITHUB_ENV + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + coverage: "none" + extensions: "zip,intl-${{env.SYMFONY_ICU_VERSION}}" + ini-values: "memory_limit=-1" + php-version: "7.4" + + - name: Install dependencies + run: | + echo "::group::composer update" + composer update --no-progress --no-suggest --ansi + echo "::endgroup::" + echo "::group::install phpunit" + ./phpunit install + echo "::endgroup::" + + - name: Report the ICU version + run: icu-config --version && php -i | grep 'ICU version' + + - name: Run intl-data tests + run: ./phpunit --group intl-data -v diff --git a/.github/workflows/phpunit-bridge.yml b/.github/workflows/phpunit-bridge.yml index bdda65de1b6f5..b503ce48d8a17 100644 --- a/.github/workflows/phpunit-bridge.yml +++ b/.github/workflows/phpunit-bridge.yml @@ -1,28 +1,31 @@ name: PhpUnitBridge on: - push: - paths: - - 'src/Symfony/Bridge/PhpUnit/**' - pull_request: - paths: - - 'src/Symfony/Bridge/PhpUnit/**' + push: + paths: + - 'src/Symfony/Bridge/PhpUnit/**' + pull_request: + paths: + - 'src/Symfony/Bridge/PhpUnit/**' -jobs: +defaults: + run: + shell: bash - lint: - name: Lint - runs-on: ubuntu-latest +jobs: + lint: + name: Lint + runs-on: Ubuntu-20.04 - steps: - - name: Checkout - uses: actions/checkout@v2 + steps: + - name: Checkout + uses: actions/checkout@v2 - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - coverage: "none" - php-version: "5.5" + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + coverage: "none" + php-version: "5.5" - - name: Lint - run: find ./src/Symfony/Bridge/PhpUnit -name '*.php' | grep -v -e /Tests/ -e ForV6 -e ForV7 -e ForV8 -e ForV9 -e ConstraintLogicTrait | parallel -j 4 php -l {} + - name: Lint + run: find ./src/Symfony/Bridge/PhpUnit -name '*.php' | grep -v -e /Tests/ -e ForV6 -e ForV7 -e ForV8 -e ForV9 -e ConstraintLogicTrait | parallel -j 4 php -l {} diff --git a/.github/workflows/psalm.yml b/.github/workflows/psalm.yml new file mode 100644 index 0000000000000..4c15203380059 --- /dev/null +++ b/.github/workflows/psalm.yml @@ -0,0 +1,58 @@ +name: Static analysis + +on: + pull_request: ~ + +defaults: + run: + shell: bash + +jobs: + psalm: + name: Psalm + runs-on: Ubuntu-20.04 + + steps: + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.0' + extensions: "json,memcached,mongodb,redis,xsl,ldap,dom" + ini-values: "memory_limit=-1" + coverage: none + + - name: Checkout target branch + uses: actions/checkout@v2 + with: + ref: ${{ github.base_ref }} + + - name: Checkout PR + uses: actions/checkout@v2 + + - name: Configure composer + run: | + 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 -m1 SYMFONY_VERSION .travis.yml | grep -o '[0-9.x]*').x-dev" >> $GITHUB_ENV + + - name: Install Psalm + run: | + echo "::group::modify composer.json" + composer remove --no-update --no-interaction symfony/phpunit-bridge + composer require --no-update psalm/phar phpunit/phpunit php-http/discovery psr/event-dispatcher + echo "::endgroup::" + echo "::group::composer update" + composer update --no-progress --ansi + git checkout composer.json + echo "::endgroup::" + ./vendor/bin/psalm.phar --version + + - name: Generate Psalm baseline + run: | + git checkout -m ${{ github.base_ref }} + ./vendor/bin/psalm.phar --set-baseline=.github/psalm/psalm.baseline.xml --no-progress + git checkout -m FETCH_HEAD + + - name: Psalm + run: | + ./vendor/bin/psalm.phar --output-format=github --no-progress diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0038195fcf9a8..603c05bff80d7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,126 +1,116 @@ name: Tests on: - push: - pull_request: + push: + pull_request: jobs: - integration: - name: Integration - runs-on: ubuntu-latest + integration: + name: Integration + runs-on: Ubuntu-20.04 - strategy: - matrix: - php: ['7.1', '7.4'] + strategy: + matrix: + php: ['7.1', '7.4'] - services: - ldap: - image: bitnami/openldap - ports: - - 3389:3389 - env: - LDAP_ADMIN_USERNAME: admin - LDAP_ADMIN_PASSWORD: symfony - LDAP_ROOT: dc=symfony,dc=com - LDAP_PORT_NUMBER: 3389 - LDAP_USERS: a - LDAP_PASSWORDS: a - redis: - image: redis:6.0.0 - ports: - - 6379:6379 - redis-cluster: - image: grokzen/redis-cluster:5.0.4 - ports: - - 7000:7000 - - 7001:7001 - - 7002:7002 - - 7003:7003 - - 7004:7004 - - 7005:7005 - - 7006:7006 - env: - STANDALONE: 1 - redis-sentinel: - image: bitnami/redis-sentinel:6.0 - ports: - - 26379:26379 - env: - REDIS_MASTER_HOST: redis - REDIS_MASTER_SET: redis_sentinel - REDIS_SENTINEL_QUORUM: 1 - memcached: - image: memcached:1.6.5 - ports: - - 11211:11211 - rabbitmq: - image: rabbitmq:3.8.3 - ports: - - 5672:5672 + services: + ldap: + image: bitnami/openldap + ports: + - 3389:3389 + env: + LDAP_ADMIN_USERNAME: admin + LDAP_ADMIN_PASSWORD: symfony + LDAP_ROOT: dc=symfony,dc=com + LDAP_PORT_NUMBER: 3389 + LDAP_USERS: a + LDAP_PASSWORDS: a + redis: + image: redis:6.0.0 + ports: + - 6379:6379 + redis-cluster: + image: grokzen/redis-cluster:5.0.4 + ports: + - 7000:7000 + - 7001:7001 + - 7002:7002 + - 7003:7003 + - 7004:7004 + - 7005:7005 + - 7006:7006 + env: + STANDALONE: 1 + redis-sentinel: + image: bitnami/redis-sentinel:6.0 + ports: + - 26379:26379 + env: + REDIS_MASTER_HOST: redis + REDIS_MASTER_SET: redis_sentinel + REDIS_SENTINEL_QUORUM: 1 + memcached: + image: memcached:1.6.5 + ports: + - 11211:11211 + rabbitmq: + image: rabbitmq:3.8.3 + ports: + - 5672:5672 - steps: - - name: Checkout - uses: actions/checkout@v2 + steps: + - name: Checkout + uses: actions/checkout@v2 - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - coverage: "none" - extensions: "memcached,redis,xsl,ldap" - ini-values: "memory_limit=-1" - php-version: "${{ matrix.php }}" + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + coverage: "none" + extensions: "memcached,redis,xsl,ldap" + ini-values: "memory_limit=-1" + php-version: "${{ matrix.php }}" - - name: Load fixtures - uses: docker://bitnami/openldap - with: - entrypoint: /bin/bash - args: -c "(/opt/bitnami/openldap/bin/ldapwhoami -h localhost:3389 -D cn=admin,dc=symfony,dc=com -w symfony||sleep 5) && /opt/bitnami/openldap/bin/ldapadd -h ldap:3389 -D cn=admin,dc=symfony,dc=com -w symfony -f src/Symfony/Component/Ldap/Tests/Fixtures/data/fixtures.ldif && /opt/bitnami/openldap/bin/ldapdelete -h ldap:3389 -D cn=admin,dc=symfony,dc=com -w symfony cn=a,ou=users,dc=symfony,dc=com" + - name: Load fixtures + uses: docker://bitnami/openldap + with: + entrypoint: /bin/bash + args: -c "(/opt/bitnami/openldap/bin/ldapwhoami -h localhost:3389 -D cn=admin,dc=symfony,dc=com -w symfony||sleep 5) && /opt/bitnami/openldap/bin/ldapadd -h ldap:3389 -D cn=admin,dc=symfony,dc=com -w symfony -f src/Symfony/Component/Ldap/Tests/Fixtures/data/fixtures.ldif && /opt/bitnami/openldap/bin/ldapdelete -h ldap:3389 -D cn=admin,dc=symfony,dc=com -w symfony cn=a,ou=users,dc=symfony,dc=com" - - name: Configure composer - run: | - 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]*').x-dev" >> $GITHUB_ENV + - name: Configure composer + run: | + COMPOSER_HOME="$(composer config home)" + composer self-update + ([ -d "$COMPOSER_HOME" ] || mkdir "$COMPOSER_HOME") && cp .github/composer-config.json "$COMPOSER_HOME/config.json" + echo "COMPOSER_ROOT_VERSION=$(grep -m1 SYMFONY_VERSION .travis.yml | grep -o '[0-9.x]*').x-dev" >> $GITHUB_ENV - - name: Determine composer cache directory - id: composer-cache - run: echo "::set-output name=directory::$(composer config cache-dir)" + - name: Install dependencies + run: | + echo "::group::composer update" + composer update --no-progress --ansi + echo "::endgroup::" + echo "::group::install phpunit" + ./phpunit install + echo "::endgroup::" - - name: Cache composer dependencies - uses: actions/cache@v1 - with: - path: ${{ steps.composer-cache.outputs.directory }} - key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ matrix.php }}-composer- + - name: Run tests + run: ./phpunit --group integration -v + env: + REDIS_HOST: localhost + REDIS_CLUSTER_HOSTS: 'localhost:7000 localhost:7001 localhost:7002 localhost:7003 localhost:7004 localhost:7005' + REDIS_SENTINEL_HOSTS: 'localhost:26379' + REDIS_SENTINEL_SERVICE: redis_sentinel + MESSENGER_REDIS_DSN: redis://127.0.0.1:7006/messages + MESSENGER_AMQP_DSN: amqp://localhost/%2f/messages + MEMCACHED_HOST: localhost + LDAP_HOST: localhost + LDAP_PORT: 3389 - - name: Install dependencies - run: | - echo "::group::composer update" - composer update --no-progress --ansi - echo "::endgroup::" - echo "::group::install phpunit" - ./phpunit install - echo "::endgroup::" - - - name: Run tests - run: ./phpunit --group integration -v - env: - REDIS_HOST: localhost - REDIS_CLUSTER_HOSTS: 'localhost:7000 localhost:7001 localhost:7002 localhost:7003 localhost:7004 localhost:7005' - REDIS_SENTINEL_HOSTS: 'localhost:26379' - REDIS_SENTINEL_SERVICE: redis_sentinel - MESSENGER_REDIS_DSN: redis://127.0.0.1:7006/messages - MESSENGER_AMQP_DSN: amqp://localhost/%2f/messages - MEMCACHED_HOST: localhost - LDAP_HOST: localhost - LDAP_PORT: 3389 - - - name: Run HTTP push tests - if: matrix.php == '7.4' - 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 -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 + - name: Run HTTP push tests + if: matrix.php == '7.4' + 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 -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 78e02c8c7af60..ee0c4c815974d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,7 @@ addons: env: global: + - SYMFONY_VERSION=4.4 - MIN_PHP=7.1.3 - SYMFONY_PROCESS_PHP_TEST_BINARY=~/.phpenv/shims/php - SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE=1 @@ -53,6 +54,7 @@ before_install: export PHPUNIT_X="$PHPUNIT --exclude-group tty,benchmark,intl-data" 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) + export SYMFONY_DEPRECATIONS_HELPER=max[indirect]=170 nanoseconds () { local cmd="date" @@ -170,8 +172,8 @@ 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=$(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 + SYMFONY_PHPUNIT_BRIDGE_REF=$(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_PHPUNIT_BRIDGE_REF'.x@dev"/' composer.json rm -rf .phpunit fi @@ -180,7 +182,6 @@ install: git config --global user.email "" git config --global user.name "Symfony" - export SYMFONY_VERSION=$(grep branch-version composer.json | grep -o '[0-9.x]*') SYMFONY_VERSIONS=$(git ls-remote -q --heads); if [[ ! $deps ]]; then @@ -227,6 +228,7 @@ install: # 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%.*} != $(echo "$SYMFONY_VERSIONS" | cut -f2 | grep -FA1 /$SYMFONY_VERSION | tail -n 1 | grep -o '[0-9]*' | head -n 1) ]] && export LEGACY=,legacy + export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev if [[ $deps ]]; then mv composer.json.phpunit composer.json; fi - | @@ -253,7 +255,7 @@ install: fi phpenv global $PHP rm vendor/composer/package-versions-deprecated -Rf - ([[ $deps ]] && cd src/Symfony/Component/HttpFoundation; cp composer.json composer.bak; composer require --dev --no-update mongodb/mongodb ^1.9.0) + ([[ $deps ]] && cd src/Symfony/Component/HttpFoundation; cp composer.json composer.bak; composer require --dev --no-update mongodb/mongodb) tfold 'composer update' $COMPOSER_UP tfold 'phpunit install' ./phpunit install if [[ $deps = high ]]; then @@ -265,6 +267,7 @@ install: 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" + export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev export SYMFONY_REQUIRE=">=$SYMFONY_VERSION" git fetch --depth=2 origin $SYMFONY_VERSION git checkout -m FETCH_HEAD diff --git a/CHANGELOG-4.4.md b/CHANGELOG-4.4.md index 78e12222ef3b8..3811db5442333 100644 --- a/CHANGELOG-4.4.md +++ b/CHANGELOG-4.4.md @@ -7,6 +7,50 @@ 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.20 (2021-03-04) + + * bug #40318 [Translation] deal with indented heredoc/nowdoc tokens (xabbuh) + * bug #40350 [DependencyInjection] fix parsing calls of methods named "method" (xabbuh) + * bug #40316 [Serializer] zero parts can be omitted in date interval input (xabbuh) + * bug #40239 MockResponse total_time should not be simulated when provided (Pierrick VIGNAND) + * bug #40299 [Cache] Add server-commands support for Predis Replication Environments (DemigodCode) + * bug #40231 [HttpKernel] Configure `session.cookie_secure` earlier (tamcy) + * bug #40283 [Translation] Make `name` attribute optional in xliff2 (MarieMinasyan) + * bug #39599 [Cache] Fix Redis TLS scheme `rediss` for Redis connection (misaert) + * bug #40244 [Routing] fix conflict with param named class in attribute (nlhommet) + * bug #40273 [Cache] fix setting items' metadata on commit() (nicolas-grekas) + * bug #40258 [Form] Ignoring invalid forms from delete_empty behavior in CollectionType (yceruto) + * bug #40162 [Intl] fix Locale::getFallback() throwing exception on long $locale (AmirHo3ein13) + * bug #40208 [PropertyInfo] fix resolving self to name of the analyzed class (xabbuh) + * bug #40209 [WebLink] Escape double quotes in attributes values (fancyweb) + * bug #40192 [Console] fix QuestionHelper::getHiddenResponse() not working with space in project directory name (Yendric) + * bug #40175 [PropertyInfo]  use the right context for properties defined in traits (xabbuh) + * bug #40172 [Translation] Allow using dashes in locale when linting Xliff files (localheinz) + * bug #40187 [Console] Fix PHP 8.1 null error for preg_match flag (kylekatarnls) + * bug #39659 [Form] keep valid submitted choices when additional choices are submitted (xabbuh) + * bug #40188 [HttpFoundation] Fix PHP 8.1 null values (kylekatarnls) + * bug #40167 [DependencyInjection] Definition::removeMethodCall should remove all matching calls (ruudk) + * bug #40160 [PropertyInfo] fix extracting mixed type-hinted property types (xabbuh) + * bug #40040 [Finder] Use a lazyIterator to close files descriptors when no longer used (jderusse) + * bug #40135 [FrameworkBundle] Fix freshness checks with boolean parameters on routes (HypeMC) + * bug #40138 [FrameworkBundle] fix registering "annotations.cache" on the "container.hot_path" (nicolas-grekas) + * bug #40116 [FrameworkBundle][Translator] scan directories for translations sequentially (xabbuh) + * bug #40104 [HttpKernel] [Kernel] Silence failed deprecations logs writes (fancyweb) + * bug #40098 [DependencyInjection] fix tracking of changes to vendor/ dirs (nicolas-grekas) + * bug #39980 [Mailer][Mime] Update inline part names with newly generated ContentId (ddegentesh) + * bug #40043 [HttpFoundation] Setting `REQUEST_TIME_FLOAT` when constructing a Request object (ctasada) + * bug #40050 [FrameworkBundle][Translator] Fixed updating catalogue metadata from Intl domain (yceruto) + * bug #40089 [SecurityBundle] role_names variable instead of roles (wickedOne) + * bug #40042 [Doctrine] Restore priority for EventSubscribers (jderusse) + * bug #40066 [ErrorHandler] fix parsing return types in DebugClassLoader (nicolas-grekas) + * bug #40065 [ErrorHandler] fix handling messages with null bytes from anonymous classes (nicolas-grekas) + * bug #40067 [PhpUnitBridge] fix reporting deprecations when they come from DebugClassLoader (nicolas-grekas) + * bug #40060 fix validator when we have false returned by the current element of the iterator (FabienSalles) + * bug #40062 [Mime] Fix case-sensitive handling of header names (piku235) + * bug #40023 [Finder]  use proper keys to not override appended files (xabbuh) + * bug #40019 [ErrorHandler] Fix strpos error when trying to call a method without a name (Deuchnord) + * bug #40004 [Serializer] Prevent access to private properties without getters (julienfalque) + * 4.4.19 (2021-01-27) * bug #38900 [Serializer] Exclude non-initialized properties accessed with getters (BoShurik) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 5b8efba4073b3..09e940bebd83c 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -1,17 +1,17 @@ CONTRIBUTORS ============ -Symfony is the result of the work of many people who made the code better -(see https://symfony.com/contributors for more information): +Symfony is the result of the work of many people who made the code better. +The Symfony Connect username in parenthesis allows to get more information - Fabien Potencier (fabpot) - Nicolas Grekas (nicolas-grekas) - Christian Flothmann (xabbuh) - Bernhard Schussek (bschussek) - Tobias Schultze (tobion) - Robin Chalas (chalas_r) - - Christophe Coevoet (stof) - Alexander M. Turek (derrabus) + - Christophe Coevoet (stof) - Kévin Dunglas (dunglas) - Maxime Steinhausser (ogizanagi) - Jordi Boggiano (seldaek) @@ -23,12 +23,12 @@ Symfony is the result of the work of many people who made the code better - Jakub Zalas (jakubzalas) - Johannes S (johannes) - Kris Wallsmith (kriswallsmith) - - Wouter de Jong (wouterj) + - Wouter De Jong (wouterj) - Jérémy DERUSSÉ (jderusse) - Thomas Calvet (fancyweb) - - Yonel Ceruto (yonelceruto) + - Yonel Ceruto González (yonelceruto) - Hugo Hamon (hhamon) - - Abdellatif Ait boudad (aitboudad) + - Ait Boudad Abdellatif (aitboudad) - Samuel ROZE (sroze) - Romain Neutron (romain) - Pascal Borreli (pborreli) @@ -36,20 +36,20 @@ Symfony is the result of the work of many people who made the code better - Karma Dordrak (drak) - Jules Pietri (heah) - Lukas Kahwe Smith (lsmith) - - Martin Hasoň (hason) - - Hamza Amrouche (simperfit) - Tobias Nyholm (tobias) + - Martin Hasoň (hason) + - Amrouche Hamza (simperfit) - Jeremy Mikola (jmikola) + - Oskar Stark (oskarstark) - Jean-François Simon (jfsimon) - Benjamin Eberlei (beberlei) - Igor Wiedler (igorw) - - Oskar Stark (oskarstark) - Eriksen Costa (eriksencosta) - - Guilhem Niot (energetick) + - Ener-Getick (energetick) - Sarah Khalil (saro0h) - Jan Schädlich (jschaedl) - Jonathan Wage (jwage) - - Lynn van der Berg (kjarli) + - Iltar van der Berg (kjarli) - Pierre du Plessis (pierredup) - Matthias Pigulla (mpdude) - Diego Saint Esteben (dosten) @@ -67,7 +67,7 @@ Symfony is the result of the work of many people who made the code better - Bulat Shakirzyanov (avalanche123) - Saša Stamenković (umpirsky) - Peter Rehm (rpet) - - Gabriel Ostrolucký (gadelat) + - gadelat (gadelat) - Titouan Galopin (tgalopin) - David Maicher (dmaicher) - Gábor Egyed (1ed) @@ -87,14 +87,14 @@ Symfony is the result of the work of many people who made the code better - Eric Clemmons (ericclemmons) - Charles Sarrazin (csarrazi) - Douglas Greenshields (shieldo) + - Jérôme Tamarelle (gromnan) - Laurent VOULLEMIER (lvo) - Arnout Boks (aboks) - Graham Campbell (graham) - - Jérôme Tamarelle (gromnan) + - David Buchmann (dbu) - Deni - Henrik Westphal (snc) - Dariusz Górecki (canni) - - David Buchmann (dbu) - Dariusz Ruminski - Fran Moreno (franmomu) - Lee McDermott @@ -127,6 +127,7 @@ Symfony is the result of the work of many people who made the code better - Massimiliano Arione (garak) - Włodzimierz Gajda (gajdaw) - Adrien Brault (adrienbrault) + - Antoine M (amakdessi) - Jacob Dreesen (jdreesen) - Florian Voutzinos (florianv) - Teoh Han Hui (teohhanhui) @@ -134,21 +135,21 @@ Symfony is the result of the work of many people who made the code better - Colin Frei - Javier Spagnoletti (phansys) - Joshua Thijssen - - Antoine Makdessi (amakdessi) - Daniel Wehner (dawehner) - Tugdual Saunier (tucksaun) + - Julien Falque (julienfalque) - excelwebzone - Gordon Franke (gimler) - Joel Wurtz (brouznouf) - Fabien Pennequin (fabienpennequin) - - Julien Falque (julienfalque) - Théo FIDRY (theofidry) - Eric GELOEN (gelo) - Jannik Zschiesche (apfelbox) - - jeremyFreeAgent (jeremyfreeagent) + - Jérémy Romey (jeremyfreeagent) - Robert Schönthal (digitalkaoz) - Gregor Harlan (gharlan) - Florian Lonqueu-Brochard (florianlb) + - Tigran Azatyan (tigranazatyan) - Gabriel Caruso (carusogabriel) - Stefano Sala (stefano.sala) - Yanick Witschi (toflar) @@ -156,7 +157,6 @@ Symfony is the result of the work of many people who made the code better - Vincent AUBERT (vincent) - Juti Noppornpitak (shiroyuki) - Anthony MARTIN (xurudragon) - - Tigran Azatyan (tigranazatyan) - Sebastian Hörl (blogsh) - Daniel Gomes (danielcsgomes) - Hidenori Goto (hidenorigoto) @@ -173,13 +173,14 @@ Symfony is the result of the work of many people who made the code better - François-Xavier de Guillebon (de-gui_f) - Oleg Voronkovich - Tomas Norkūnas (norkunas) - - Philipp Wahala (hifi) + - hacfi (hifi) - Rafael Dohms (rdohms) - jwdeitch - Ahmed TAILOULOUTE (ahmedtai) - Mathias Arlaud (mtarld) - Mikael Pajunen - Gary PEGEOT (gary-p) + - HypeMC (hypemc) - Arman Hosseini (arman) - Niels Keurentjes (curry684) - Vyacheslav Pavlov @@ -192,7 +193,6 @@ Symfony is the result of the work of many people who made the code better - Ben Davies (bendavies) - Andreas Schempp (aschempp) - Clemens Tolboom - - HypeMC (hypemc) - Helmer Aaviksoo - Hiromi Hishida (77web) - Matthieu Ouellette-Vachon (maoueh) @@ -200,6 +200,7 @@ Symfony is the result of the work of many people who made the code better - Dawid Nowak - Maxime Helias (maxhelias) - Amal Raghav (kertz) + - Albert Casademont (acasademont) - Jonathan Ingram (jonathaningram) - Artur Kotyrba - Tyson Andre @@ -207,7 +208,7 @@ Symfony is the result of the work of many people who made the code better - Samuel NELA (snela) - Olivier Dolbeau (odolbeau) - Fabien Bourigault (fbourigault) - - Saif (╯°□°)╯ (azjezz) + - Saif Eddin Gmati (azjezz) - James Halsall (jaitsu) - Florent Mata (fmata) - Warnar Boekkooi (boekkooi) @@ -221,7 +222,7 @@ Symfony is the result of the work of many people who made the code better - Michaël Perrin (michael.perrin) - Sergey Linnik (linniksa) - Richard Miller (mr_r_miller) - - Albert Casademont (acasademont) + - Ruud Kamphuis (ruudk) - Wouter J - Mario A. Alvarez Garcia (nomack84) - Dennis Benkert (denderello) @@ -235,7 +236,7 @@ Symfony is the result of the work of many people who made the code better - Benjamin Dulau (dbenjamin) - Jan Rosier (rosier) - Mathieu Lemoine (lemoinem) - - Rémon van de Kamp (rpkamp) + - Remon van de Kamp (rpkamp) - Christian Schmidt - Andreas Hucks (meandmymonkey) - Tom Van Looy (tvlooy) @@ -260,6 +261,7 @@ Symfony is the result of the work of many people who made the code better - Hidde Wieringa (hiddewie) - Jeremy Livingston (jeremylivingston) - Michael Lee (zerustech) + - Timo Bakx (timobakx) - Dmitrii Poddubnyi (karser) - Matthieu Auger (matthieuauger) - Leszek Prabucki (l3l0) @@ -276,6 +278,7 @@ Symfony is the result of the work of many people who made the code better - Maxime Veber (nek-) - Rui Marinho (ruimarinho) - Eugene Wissner + - Andreas Möller (localheinz) - Edi Modrić (emodric) - Pascal Montoya - Julien Brochet (mewt) @@ -284,7 +287,6 @@ Symfony is the result of the work of many people who made the code better - Victor Bocharsky (bocharsky_bw) - Marcel Beerta (mazen) - Christopher Hertel (chertel) - - Ruud Kamphuis (ruudk) - Chi-teck - Pavel Batanov (scaytrase) - Mantis Development @@ -297,7 +299,6 @@ Symfony is the result of the work of many people who made the code better - julien pauli (jpauli) - Lorenz Schori - Sébastien Lavoie (lavoiesl) - - Timo Bakx (timobakx) - Dariusz - Farhad Safarov (safarov) - Michael Babker (mbabker) @@ -345,7 +346,7 @@ Symfony is the result of the work of many people who made the code better - Joseph Rouff (rouffj) - Félix Labrecque (woodspire) - GordonsLondon - - Quynh Xuan Nguyen (xuanquynh) + - Nguyen Xuan Quynh (xuanquynh) - Jan Sorgalla (jsor) - Ray - Chekote @@ -359,10 +360,11 @@ Symfony is the result of the work of many people who made the code better - Nikita Konstantinov - Wodor Wodorski - Joe Bennett (kralos) + - Simon Berger - soyuka - Giorgio Premi - renanbr - - Alex Rock (pierstoval) + - Alex Rock Ancelet (pierstoval) - Beau Simensen (simensen) - Michael Hirschler (mvhirsch) - Robert Kiss (kepten) @@ -428,6 +430,7 @@ Symfony is the result of the work of many people who made the code better - Julien Galenski (ruian) - Thomas Landauer (thomas-landauer) - Bongiraud Dominique + - Kyle - janschoenherr - Emanuele Gaspari (inmarelibero) - Dariusz Rumiński @@ -439,7 +442,6 @@ Symfony is the result of the work of many people who made the code better - Mark Challoner (markchalloner) - ivan - Karoly Gossler (connorhu) - - Simon Berger - Ahmed Raafat - Philippe Segatori - Gennady Telegin (gtelegin) @@ -466,6 +468,7 @@ Symfony is the result of the work of many people who made the code better - Sylvain Fabre (sylfabre) - Artur Eshenbrener - Harm van Tilborg (hvt) + - Malte Schlüter (maltemaltesich) - Thomas Perez (scullwm) - Felix Labrecque - Yaroslav Kiliba @@ -491,7 +494,7 @@ Symfony is the result of the work of many people who made the code better - ShinDarth - Stéphane PY (steph_py) - Philipp Kräutli (pkraeutli) - - Grzegorz (Greg) Zdanowski (kiler129) + - Grzegorz Zdanowski (kiler129) - Dimitri Gritsajuk (ottaviano) - Kirill chEbba Chebunin (chebba) - @@ -573,6 +576,7 @@ Symfony is the result of the work of many people who made the code better - Mihai Stancu - Ivan Nikolaev (destillat) - Gildas Quéméner (gquemener) + - BoShurik - Laurent Masforné (heisenberg) - Claude Khedhiri (ck-developer) - Desjardins Jérôme (jewome62) @@ -590,7 +594,6 @@ Symfony is the result of the work of many people who made the code better - Asier Illarramendi (doup) - Martijn Cuppens - Vlad Gregurco (vgregurco) - - Malte Schlüter (maltemaltesich) - Boris Vujicic (boris.vujicic) - Artem Lopata - Judicaël RUFFIEUX (axanagor) @@ -621,6 +624,7 @@ Symfony is the result of the work of many people who made the code better - Tavo Nieves J - Luc Vieillescazes (iamluc) - Lukáš Holeczy (holicz) + - Erik Saunier (snickers) - franek (franek) - Raulnet - Christian Wahler @@ -655,6 +659,7 @@ Symfony is the result of the work of many people who made the code better - Nathan Dench (ndenc2) - Sebastian Bergmann - Miroslav Sustek + - Michał (bambucha15) - Pablo Díez (pablodip) - Kevin McBride - Sergio Santoro @@ -663,6 +668,7 @@ Symfony is the result of the work of many people who made the code better - Manuel de Ruiter (manuel) - Nathanael Noblet (gnat) - nikos.sotiropoulos + - BENOIT POLASZEK (bpolaszek) - Eduardo Oliveira (entering) - Oleksii Zhurbytskyi - Ilya Antipenko (aivus) @@ -749,7 +755,6 @@ Symfony is the result of the work of many people who made the code better - Michiel Boeckaert (milio) - Geoffrey Tran (geoff) - Pablo Lozano (arkadis) - - Kyle - Jan Behrens - Mantas Var (mvar) - Terje Bråten @@ -791,7 +796,6 @@ Symfony is the result of the work of many people who made the code better - James Johnston - Noémi Salaün (noemi-salaun) - Sinan Eldem - - BoShurik - Alexandre Dupuy (satchette) - Michel Hunziker - Malte Blättermann @@ -845,7 +849,7 @@ Symfony is the result of the work of many people who made the code better - adev - Stefan Warman - Tristan Maindron (tmaindron) - - Behnoush Norouzali (behnoush) + - Behnoush norouzali (behnoush) - Marko H. Tamminen (gzumba) - Wesley Lancel - Xavier Briand (xavierbriand) @@ -868,6 +872,7 @@ Symfony is the result of the work of many people who made the code better - Ivan Grigoriev - Johann Saunier (prophet777) - Sergey (upyx) + - Fabien Salles (blacked) - Andreas Erhard - Michael Devery (mickadoo) - Antoine Corcy @@ -926,7 +931,6 @@ Symfony is the result of the work of many people who made the code better - Michel Roca (mroca) - Reedy - Arturas Smorgun (asarturas) - - Michał (bambucha15) - Alexander Volochnev (exelenz) - Michael Piecko - Toni Peric (tperic) @@ -977,8 +981,10 @@ Symfony is the result of the work of many people who made the code better - Andrew Tchircoff (andrewtch) - michaelwilliams - Martin Kirilov + - Alexandre Parent - 1emming - Nykopol (nykopol) + - Piotr Kugla (piku235) - Jordan Deitch - Casper Valdemar Poulsen - Josiah (josiah) @@ -987,9 +993,9 @@ Symfony is the result of the work of many people who made the code better - John Bohn (jbohn) - Marc Morera (mmoreram) - Jason Tan - - BENOIT POLASZEK (bpolaszek) - Julien Pauli - Mathieu Rochette (mathroc) + - Jérôme Tanghe (deuchnord) - Andrew Hilobok (hilobok) - Noah Heck (myesain) - Christian Soronellas (theunic) @@ -1042,7 +1048,6 @@ Symfony is the result of the work of many people who made the code better - Rafał Wrzeszcz (rafalwrzeszcz) - Vincent CHALAMON (vincentchalamon) - Reen Lokum - - Andreas Möller (localheinz) - Dennis Langen (nijusan) - Martin Parsiegla (spea) - Manuel Alejandro Paz Cetina @@ -1171,7 +1176,6 @@ Symfony is the result of the work of many people who made the code better - Benoît Merlet (trompette) - Koen Kuipers - datibbaw - - Erik Saunier (snickers) - Thiago Cordeiro (thiagocordeiro) - Rootie - Bernd Stellwag @@ -1216,6 +1220,7 @@ Symfony is the result of the work of many people who made the code better - Christin Gruber (christingruber) - Phan Thanh Ha (haphan) - Chris Jones (leek) + - James Hemery - neghmurken - xaav - Mahmoud Mostafa (mahmoud) @@ -1544,6 +1549,7 @@ Symfony is the result of the work of many people who made the code better - Jorge Vahldick (jvahldick) - Frederic Godfrin - Paul Matthews + - Xesxen - Jakub Kisielewski - Vacheslav Silyutin - Aleksandr Dankovtsev @@ -1615,6 +1621,7 @@ Symfony is the result of the work of many people who made the code better - Lars Ambrosius Wallenborn (larsborn) - Oriol Mangas Abellan (oriolman) - Sebastian Göttschkes (sgoettschkes) + - Frankie Wittevrongel - Tatsuya Tsuruoka - Ross Tuck - Gerben Oolbekkink @@ -1646,7 +1653,6 @@ Symfony is the result of the work of many people who made the code better - Sebastian Utz - Adrien Gallou (agallou) - Andrea Sprega (asprega) - - Fabien Salles (blacked) - Maks Rafalko (bornfree) - Karol Sójko (karolsojko) - sl_toto (sl_toto) @@ -1667,7 +1673,6 @@ Symfony is the result of the work of many people who made the code better - Cédric Lahouste (rapotor) - Samuel Vogel (samuelvogel) - Osayawe Ogbemudia Terry (terdia) - - Alexandre Parent - Berat Doğan - Guillaume LECERF - Juanmi Rodriguez Cerón @@ -1698,6 +1703,7 @@ Symfony is the result of the work of many people who made the code better - Łukasz Makuch - George Giannoulopoulos - Alexander Pasichnick + - Ilya Ch. (ilya0) - Luis Ramirez (luisdeimos) - Daniel Richter (richtermeister) - ChrisC @@ -1732,6 +1738,7 @@ Symfony is the result of the work of many people who made the code better - Fabien S (bafs) - Daniel Rotter (danrot) - Frédéric Bouchery (fbouchery) + - kylekatarnls (kylekatarnls) - Patrick Daley (padrig) - Max Summe - WedgeSama @@ -1855,6 +1862,7 @@ Symfony is the result of the work of many people who made the code better - Dominik Piekarski (dompie) - Andrew (drew) - kor3k kor3k (kor3k) + - Rares Sebastian Moldovan (raresmldvn) - Stelian Mocanita (stelian) - Justin (wackymole) - Flavian (2much) @@ -1862,6 +1870,7 @@ Symfony is the result of the work of many people who made the code better - mike - Gilbertsoft - tadas + - Bastien Picharles - Kirk Madera - Keith Maika - Mephistofeles @@ -1898,10 +1907,10 @@ Symfony is the result of the work of many people who made the code better - wusuopu - povilas - Gavin Staniforth + - bahram - Alessandro Tagliapietra (alex88) - Andy Palmer (andyexeter) - Biji (biji) - - Jérôme Tanghe (deuchnord) - Alex Teterin (errogaht) - Gunnar Lium (gunnarlium) - Tiago Garcia (tiagojsag) @@ -2207,6 +2216,7 @@ Symfony is the result of the work of many people who made the code better - Ahmed Hannachi (tiecoders) - Vincent LEFORT (vlefort) - Walid BOUGHDIRI (walidboughdiri) + - wicliff wolda (wickedone) - Wim Molenberghs (wimm) - Darryl Hein (xmmedia) - Sadicov Vladimir (xtech) @@ -2249,10 +2259,12 @@ Symfony is the result of the work of many people who made the code better - Götz Gottwald - Veres Lajos - Ernest Hymel + - LoginovIlya - Nick Chiu - grifx - Robert Campbell - Matt Lehner + - carlos-ea - Helmut Januschka - Jérémy Benoist - Hein Zaw Htet™ @@ -2269,6 +2281,7 @@ Symfony is the result of the work of many people who made the code better - Marin Nicolae - Alessandro Loffredo - Ian Phillips + - Carlos Tasada - Haritz - Matthieu Prat - Grummfy @@ -2462,6 +2475,7 @@ Symfony is the result of the work of many people who made the code better - Matt Fields - Olatunbosun Egberinde - Andras Debreczeni + - Knallcharge - Vladimir Sazhin - Michel Bardelmeijer - Tomas Kmieliauskas @@ -2510,6 +2524,7 @@ Symfony is the result of the work of many people who made the code better - Alexis BOYER - Kaipi Yann - adam-mospan + - Steve Hyde - Sam Williams - Guillaume Aveline - Adrian Philipp @@ -2621,6 +2636,7 @@ Symfony is the result of the work of many people who made the code better - sualko - Molkobain - Bilge + - Yendric - ADmad - Nicolas Roudaire - Matthias Meyer @@ -2776,6 +2792,7 @@ Symfony is the result of the work of many people who made the code better - Michael - fh-github@fholzhauer.de - AbdElKader Bouadjadja + - ddegentesh - DSeemiller - Jan Emrich - Mark Topper diff --git a/composer.json b/composer.json index c228650326b27..63108b1e132e9 100644 --- a/composer.json +++ b/composer.json @@ -15,6 +15,22 @@ "homepage": "https://symfony.com/contributors" } ], + "provide": { + "php-http/async-client-implementation": "*", + "php-http/client-implementation": "*", + "psr/cache-implementation": "1.0|2.0", + "psr/container-implementation": "1.0", + "psr/event-dispatcher-implementation": "1.0", + "psr/http-client-implementation": "1.0", + "psr/link-implementation": "1.0", + "psr/log-implementation": "1.0", + "psr/simple-cache-implementation": "1.0", + "symfony/cache-implementation": "1.0|2.0", + "symfony/event-dispatcher-implementation": "1.1", + "symfony/http-client-implementation": "1.1|2.0", + "symfony/service-implementation": "1.0|2.0", + "symfony/translation-implementation": "1.0|2.0" + }, "require": { "php": ">=7.1.3", "ext-xml": "*", @@ -22,7 +38,7 @@ "doctrine/event-manager": "~1.0", "doctrine/persistence": "^1.3|^2", "twig/twig": "^1.43|^2.13|^3.0.4", - "psr/cache": "~1.0", + "psr/cache": "^1.0|^2.0", "psr/container": "^1.0", "psr/link": "^1.0", "psr/log": "~1.0", @@ -156,11 +172,13 @@ "repositories": [ { "type": "path", - "url": "src/Symfony/Contracts" + "url": "src/Symfony/Contracts", + "options": { + "versions": { + "symfony/contracts": "1.1.x-dev" + } + } } ], - "minimum-stability": "dev", - "extra": { - "branch-version": "4.4" - } + "minimum-stability": "dev" } diff --git a/phpunit b/phpunit index 9141d249d2695..3a18c4c782e1e 100755 --- a/phpunit +++ b/phpunit @@ -16,7 +16,7 @@ if (!getenv('SYMFONY_PHPUNIT_VERSION')) { putenv('SYMFONY_PHPUNIT_VERSION=9.5'); } } -if (!getenv('SYMFONY_PATCH_TYPE_DECLARATIONS')) { +if (!getenv('SYMFONY_PATCH_TYPE_DECLARATIONS') && \PHP_VERSION_ID >= 70300) { putenv('SYMFONY_PATCH_TYPE_DECLARATIONS=deprecations=1'); } if (getcwd() === realpath(__DIR__.'/src/Symfony/Bridge/PhpUnit')) { diff --git a/psalm.xml b/psalm.xml new file mode 100644 index 0000000000000..3f12f1331c272 --- /dev/null +++ b/psalm.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + diff --git a/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php b/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php index 8415ee14b63cb..9b3c1595a41f0 100644 --- a/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php +++ b/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php @@ -164,11 +164,22 @@ private function initializeListeners(string $eventName) private function initializeSubscribers() { $this->initializedSubscribers = true; + + $eventListeners = $this->listeners; + // reset eventListener to respect priority: EventSubscribers have a higher priority + $this->listeners = []; foreach ($this->subscribers as $id => $subscriber) { if (\is_string($subscriber)) { parent::addEventSubscriber($this->subscribers[$id] = $this->container->get($subscriber)); } } + foreach ($eventListeners as $event => $listeners) { + if (!isset($this->listeners[$event])) { + $this->listeners[$event] = []; + } + $this->listeners[$event] += $listeners; + } + $this->subscribers = []; } /** diff --git a/src/Symfony/Bridge/Doctrine/Test/DoctrineTestHelper.php b/src/Symfony/Bridge/Doctrine/Test/DoctrineTestHelper.php index 2ad16dcd4de24..d3d25c17b275d 100644 --- a/src/Symfony/Bridge/Doctrine/Test/DoctrineTestHelper.php +++ b/src/Symfony/Bridge/Doctrine/Test/DoctrineTestHelper.php @@ -12,7 +12,6 @@ namespace Symfony\Bridge\Doctrine\Test; use Doctrine\Common\Annotations\AnnotationReader; -use Doctrine\Common\Cache\ArrayCache; use Doctrine\ORM\Configuration; use Doctrine\ORM\EntityManager; use Doctrine\ORM\Mapping\Driver\AnnotationDriver; @@ -62,8 +61,6 @@ public static function createTestConfiguration() $config->setProxyDir(sys_get_temp_dir()); $config->setProxyNamespace('SymfonyTests\Doctrine'); $config->setMetadataDriverImpl(new AnnotationDriver(new AnnotationReader())); - $config->setQueryCacheImpl(new ArrayCache()); - $config->setMetadataCacheImpl(new ArrayCache()); return $config; } diff --git a/src/Symfony/Bridge/Doctrine/Tests/ContainerAwareEventManagerTest.php b/src/Symfony/Bridge/Doctrine/Tests/ContainerAwareEventManagerTest.php index 01baa46dc93dc..e9d260ec26608 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/ContainerAwareEventManagerTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/ContainerAwareEventManagerTest.php @@ -146,11 +146,14 @@ public function testAddEventListenerAndSubscriberAfterDispatchEvent() public function testGetListenersForEvent() { + $this->evm = new ContainerAwareEventManager($this->container, ['lazy2']); + $this->container->set('lazy', $listener1 = new MyListener()); + $this->container->set('lazy2', $subscriber1 = new MySubscriber(['foo'])); $this->evm->addEventListener('foo', 'lazy'); $this->evm->addEventListener('foo', $listener2 = new MyListener()); - $this->assertSame([$listener1, $listener2], array_values($this->evm->getListeners('foo'))); + $this->assertSame([$subscriber1, $listener1, $listener2], array_values($this->evm->getListeners('foo'))); } public function testGetListeners() diff --git a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php index d8b7abc8064bc..05faff5872dd8 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php @@ -793,4 +793,85 @@ public function testValidateUniquenessCause() ->setCode(UniqueEntity::NOT_UNIQUE_ERROR) ->assertRaised(); } + + /** + * @dataProvider resultWithEmptyIterator + */ + public function testValidateUniquenessWithEmptyIterator($entity, $result) + { + $constraint = new UniqueEntity([ + 'message' => 'myMessage', + 'fields' => ['name'], + 'em' => self::EM_NAME, + 'repositoryMethod' => 'findByCustom', + ]); + + $repository = $this->createRepositoryMock(); + $repository->expects($this->once()) + ->method('findByCustom') + ->willReturn($result) + ; + $this->em = $this->createEntityManagerMock($repository); + $this->registry = $this->createRegistryMock($this->em); + $this->validator = $this->createValidator(); + $this->validator->initialize($this->context); + + $this->validator->validate($entity, $constraint); + + $this->assertNoViolation(); + } + + public function resultWithEmptyIterator(): array + { + $entity = new SingleIntIdEntity(1, 'foo'); + + return [ + [$entity, new class() implements \Iterator { + public function current() + { + return null; + } + + public function valid(): bool + { + return false; + } + + public function next() + { + } + + public function key() + { + } + + public function rewind() + { + } + }], + [$entity, new class() implements \Iterator { + public function current() + { + return false; + } + + public function valid(): bool + { + return false; + } + + public function next() + { + } + + public function key() + { + } + + public function rewind() + { + } + }], + ]; + } } diff --git a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php index 4324dfde55436..399a18d90c7fe 100644 --- a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php +++ b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php @@ -147,8 +147,7 @@ public function validate($entity, Constraint $constraint) if ($result instanceof \Countable && 1 < \count($result)) { $result = [$result->current(), $result->current()]; } else { - $result = $result->current(); - $result = null === $result ? [] : [$result]; + $result = $result->valid() && null !== $result->current() ? [$result->current()] : []; } } elseif (\is_array($result)) { reset($result); diff --git a/src/Symfony/Bridge/PhpUnit/.gitignore b/src/Symfony/Bridge/PhpUnit/.gitignore index 9d8c4aadaf9f5..c49a5d8df5c65 100644 --- a/src/Symfony/Bridge/PhpUnit/.gitignore +++ b/src/Symfony/Bridge/PhpUnit/.gitignore @@ -1,4 +1,3 @@ vendor/ composer.lock phpunit.xml -Tests/DeprecationErrorHandler/fake_vendor/symfony/error-handler/DebugClassLoader.php diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php index f2f80453609f9..19c6691dbec3e 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php @@ -132,44 +132,48 @@ public function handleError($type, $msg, $file, $line, $context = []) return \call_user_func(self::getPhpUnitErrorHandler(), $type, $msg, $file, $line, $context); } - $deprecation = new Deprecation($msg, debug_backtrace(), $file); + $trace = debug_backtrace(); + + if (isset($trace[1]['function'], $trace[1]['args'][0]) && ('trigger_error' === $trace[1]['function'] || 'user_error' === $trace[1]['function'])) { + $msg = $trace[1]['args'][0]; + } + + $deprecation = new Deprecation($msg, $trace, $file); if ($deprecation->isMuted()) { return null; } - $group = 'other'; - if ($deprecation->originatesFromAnObject()) { - $class = $deprecation->originatingClass(); - $method = $deprecation->originatingMethod(); - $msg = $deprecation->getMessage(); + $msg = $deprecation->getMessage(); - if (error_reporting() & $type) { - $group = 'unsilenced'; - } elseif ($deprecation->isLegacy()) { - $group = 'legacy'; - } else { - $group = [ - Deprecation::TYPE_SELF => 'remaining self', - Deprecation::TYPE_DIRECT => 'remaining direct', - Deprecation::TYPE_INDIRECT => 'remaining indirect', - Deprecation::TYPE_UNDETERMINED => 'other', - ][$deprecation->getType()]; - } + if (error_reporting() & $type) { + $group = 'unsilenced'; + } elseif ($deprecation->isLegacy()) { + $group = 'legacy'; + } else { + $group = [ + Deprecation::TYPE_SELF => 'remaining self', + Deprecation::TYPE_DIRECT => 'remaining direct', + Deprecation::TYPE_INDIRECT => 'remaining indirect', + Deprecation::TYPE_UNDETERMINED => 'other', + ][$deprecation->getType()]; + } - if ($this->getConfiguration()->shouldDisplayStackTrace($msg)) { - echo "\n".ucfirst($group).' '.$deprecation->toString(); + if ($this->getConfiguration()->shouldDisplayStackTrace($msg)) { + echo "\n".ucfirst($group).' '.$deprecation->toString(); - exit(1); - } - if ('legacy' !== $group) { - $ref = &$this->deprecations[$group][$msg]['count']; - ++$ref; + exit(1); + } + + if ('legacy' !== $group) { + $ref = &$this->deprecations[$group][$msg]['count']; + ++$ref; + + if ($deprecation->originatesFromAnObject()) { + $class = $deprecation->originatingClass(); + $method = $deprecation->originatingMethod(); $ref = &$this->deprecations[$group][$msg][$class.'::'.$method]; ++$ref; } - } else { - $ref = &$this->deprecations[$group][$msg]['count']; - ++$ref; } ++$this->deprecations[$group.'Count']; diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php index 1ea274045cdb6..ac1a95ef41242 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php @@ -55,48 +55,64 @@ class Deprecation public function __construct($message, array $trace, $file) { $this->trace = $trace; - - if ('trigger_error' === (isset($trace[1]['function']) ? $trace[1]['function'] : null) - && (DebugClassLoader::class === ($class = (isset($trace[2]['class']) ? $trace[2]['class'] : null)) || LegacyDebugClassLoader::class === $class) - && 'checkClass' === (isset($trace[2]['function']) ? $trace[2]['function'] : null) - && null !== ($extraFile = (isset($trace[2]['args'][1]) ? $trace[2]['args'][1] : null)) - && '' !== $extraFile - && false !== $extraFile = realpath($extraFile) - ) { - $this->getOriginalFilesStack(); - array_splice($this->originalFilesStack, 2, 1, $extraFile); - } - $this->message = $message; + $i = \count($trace); while (1 < $i && $this->lineShouldBeSkipped($trace[--$i])) { // No-op } + $line = $trace[$i]; $this->triggeringFile = $file; - if (isset($line['object']) || isset($line['class'])) { - if (isset($line['class']) && 0 === strpos($line['class'], SymfonyTestsListenerFor::class)) { - set_error_handler(function () {}); - $parsedMsg = unserialize($this->message); - restore_error_handler(); - $this->message = $parsedMsg['deprecation']; - $this->originClass = $parsedMsg['class']; - $this->originMethod = $parsedMsg['method']; - if (isset($parsedMsg['files_stack'])) { - $this->originalFilesStack = $parsedMsg['files_stack']; - } - // If the deprecation has been triggered via - // \Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerTrait::endTest() - // then we need to use the serialized information to determine - // if the error has been triggered from vendor code. - if (isset($parsedMsg['triggering_file'])) { - $this->triggeringFile = $parsedMsg['triggering_file']; + + for ($j = 1; $j < $i; ++$j) { + if (!isset($trace[$j]['function'], $trace[1 + $j]['class'], $trace[1 + $j]['args'][0])) { + continue; + } + + if ('trigger_error' === $trace[$j]['function'] && !isset($trace[$j]['class'])) { + if (\in_array($trace[1 + $j]['class'], [DebugClassLoader::class, LegacyDebugClassLoader::class], true)) { + $class = $trace[1 + $j]['args'][0]; + $this->triggeringFile = isset($trace[1 + $j]['args'][1]) ? realpath($trace[1 + $j]['args'][1]) : (new \ReflectionClass($class))->getFileName(); + $this->getOriginalFilesStack(); + array_splice($this->originalFilesStack, 0, $j, [$this->triggeringFile]); } + break; + } + } + + if (isset($line['object']) || isset($line['class'])) { + if (!isset($line['class'], $trace[$i - 2]['function']) || 0 !== strpos($line['class'], SymfonyTestsListenerFor::class)) { + $this->originClass = isset($line['object']) ? \get_class($line['object']) : $line['class']; + $this->originMethod = $line['function']; + + return; + } + + if ('trigger_error' !== $trace[$i - 2]['function'] || isset($trace[$i - 2]['class'])) { + $this->originClass = \get_class($line['args'][0]); + $this->originMethod = $line['args'][0]->getName(); + return; } - $this->originClass = isset($line['object']) ? \get_class($line['object']) : $line['class']; - $this->originMethod = $line['function']; + + set_error_handler(function () {}); + $parsedMsg = unserialize($this->message); + restore_error_handler(); + $this->message = $parsedMsg['deprecation']; + $this->originClass = $parsedMsg['class']; + $this->originMethod = $parsedMsg['method']; + if (isset($parsedMsg['files_stack'])) { + $this->originalFilesStack = $parsedMsg['files_stack']; + } + // If the deprecation has been triggered via + // \Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerTrait::endTest() + // then we need to use the serialized information to determine + // if the error has been triggered from vendor code. + if (isset($parsedMsg['triggering_file'])) { + $this->triggeringFile = $parsedMsg['triggering_file']; + } } } @@ -130,7 +146,9 @@ public function originatingClass() throw new \LogicException('Check with originatesFromAnObject() before calling this method.'); } - return $this->originClass; + $class = $this->originClass; + + return false !== strpos($class, "@anonymous\0") ? (get_parent_class($class) ?: key(class_implements($class)) ?: 'class').'@anonymous' : $class; } /** @@ -158,8 +176,7 @@ public function getMessage() */ public function isLegacy() { - $class = $this->originatingClass(); - if ((new \ReflectionClass($class))->isInternal()) { + if (!$this->originClass || (new \ReflectionClass($this->originClass))->isInternal()) { return false; } @@ -168,8 +185,8 @@ public function isLegacy() return 0 === strpos($method, 'testLegacy') || 0 === strpos($method, 'provideLegacy') || 0 === strpos($method, 'getLegacy') - || strpos($class, '\Legacy') - || \in_array('legacy', Test::getGroups($class, $method), true); + || strpos($this->originClass, '\Legacy') + || \in_array('legacy', Test::getGroups($this->originClass, $method), true); } /** @@ -195,11 +212,10 @@ public function isMuted() */ public function getType() { - $triggeringFilePathType = $this->getPathType($this->triggeringFile); - if (self::PATH_TYPE_SELF === $triggeringFilePathType) { + if (self::PATH_TYPE_SELF === $pathType = $this->getPathType($this->triggeringFile)) { return self::TYPE_SELF; } - if (self::PATH_TYPE_UNDETERMINED === $triggeringFilePathType) { + if (self::PATH_TYPE_UNDETERMINED === $pathType) { return self::TYPE_UNDETERMINED; } $erroringFile = $erroringPackage = null; @@ -208,10 +224,10 @@ public function getType() if ('-' === $file || 'Standard input code' === $file || !realpath($file)) { continue; } - if (self::PATH_TYPE_SELF === $this->getPathType($file)) { + if (self::PATH_TYPE_SELF === $pathType = $this->getPathType($file)) { return self::TYPE_DIRECT; } - if (self::PATH_TYPE_UNDETERMINED === $this->getPathType($file)) { + if (self::PATH_TYPE_UNDETERMINED === $pathType) { return self::TYPE_UNDETERMINED; } if (null !== $erroringFile && null !== $erroringPackage) { @@ -233,7 +249,7 @@ private function getOriginalFilesStack() if (null === $this->originalFilesStack) { $this->originalFilesStack = []; foreach ($this->trace as $frame) { - if (!isset($frame['file']) || \in_array($frame['function'], ['require', 'require_once', 'include', 'include_once'], true)) { + if (!isset($frame['file'], $frame['function']) || (!isset($frame['class']) && \in_array($frame['function'], ['require', 'require_once', 'include', 'include_once'], true))) { continue; } @@ -259,13 +275,10 @@ private function getPackage($path) $relativePath = substr($path, \strlen($vendorRoot) + 1); $vendor = strstr($relativePath, \DIRECTORY_SEPARATOR, true); if (false === $vendor) { - throw new \RuntimeException(sprintf('Could not find directory separator "%s" in path "%s".', \DIRECTORY_SEPARATOR, $relativePath)); + return 'symfony'; } - return rtrim($vendor.'/'.strstr(substr( - $relativePath, - \strlen($vendor) + 1 - ), \DIRECTORY_SEPARATOR, true), '/'); + return rtrim($vendor.'/'.strstr(substr($relativePath, \strlen($vendor) + 1), \DIRECTORY_SEPARATOR, true), '/'); } } @@ -279,6 +292,13 @@ private static function getVendors() { if (null === self::$vendors) { self::$vendors = $paths = []; + self::$vendors[] = \dirname(__DIR__).\DIRECTORY_SEPARATOR.'Legacy'; + if (class_exists(DebugClassLoader::class, false)) { + self::$vendors[] = \dirname((new \ReflectionClass(DebugClassLoader::class))->getFileName()); + } + if (class_exists(LegacyDebugClassLoader::class, false)) { + self::$vendors[] = \dirname((new \ReflectionClass(LegacyDebugClassLoader::class))->getFileName()); + } foreach (get_declared_classes() as $class) { if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) { $r = new \ReflectionClass($class); @@ -354,10 +374,9 @@ public function toString() $reflection->setAccessible(true); $reflection->setValue($exception, $this->trace); - return 'deprecation triggered by '.$this->originatingClass().'::'.$this->originatingMethod().':'. - "\n".$this->message. - "\nStack trace:". - "\n".str_replace(' '.getcwd().\DIRECTORY_SEPARATOR, ' ', $exception->getTraceAsString()). - "\n"; + return ($this->originatesFromAnObject() ? 'deprecation triggered by '.$this->originatingClass().'::'.$this->originatingMethod().":\n" : '') + .$this->message."\n" + ."Stack trace:\n" + .str_replace(' '.getcwd().\DIRECTORY_SEPARATOR, ' ', $exception->getTraceAsString())."\n"; } } diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php index f36c689099ec8..9cb0a0e32ce3a 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php @@ -174,6 +174,8 @@ public function testGetTypeDetectsSelf(string $expectedType, string $message, st { $trace = [ ['class' => 'MyClass1', 'function' => 'myMethod'], + ['function' => 'trigger_error'], + ['class' => SymfonyTestsListenerTrait::class, 'function' => 'endTest'], ['class' => $traceClass, 'function' => 'myMethod'], ]; $deprecation = new Deprecation($message, $trace, $file); @@ -183,6 +185,11 @@ public function testGetTypeDetectsSelf(string $expectedType, string $message, st public function providerGetTypeUsesRightTrace() { $vendorDir = self::getVendorDir(); + $fakeTrace = [ + ['function' => 'trigger_error'], + ['class' => SymfonyTestsListenerTrait::class, 'function' => 'endTest'], + ['class' => SymfonyTestsListenerForV5::class, 'function' => 'endTest'], + ]; return [ 'no_file_in_stack' => [Deprecation::TYPE_DIRECT, '', [['function' => 'myfunc1'], ['function' => 'myfunc2']]], @@ -205,7 +212,7 @@ public function providerGetTypeUsesRightTrace() $vendorDir.'/myfakevendor/myfakepackage1/MyFakeFile2.php', ], ]), - [['function' => 'myfunc1'], ['class' => SymfonyTestsListenerForV5::class, 'method' => 'mymethod']], + $fakeTrace, ], 'serialized_stack_files_from_various_packages' => [ Deprecation::TYPE_INDIRECT, @@ -218,7 +225,7 @@ public function providerGetTypeUsesRightTrace() $vendorDir.'/myfakevendor/myfakepackage2/MyFakeFile.php', ], ]), - [['function' => 'myfunc1'], ['class' => SymfonyTestsListenerForV5::class, 'method' => 'mymethod']], + $fakeTrace, ], ]; } diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/debug_class_loader_autoload.phpt b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/debug_class_loader_autoload.phpt index 781027e84fe66..04e64d33e46b6 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/debug_class_loader_autoload.phpt +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/debug_class_loader_autoload.phpt @@ -30,16 +30,6 @@ EOPHP ); require __DIR__.'/fake_vendor/autoload.php'; -// We need the real DebugClassLoader FQCN but in a vendor path. -if (!file_exists($errorHandlerRootDir = __DIR__.'/../../../../Component/ErrorHandler')) { - if (!file_exists($errorHandlerRootDir = __DIR__.'/../../vendor/symfony/error-handler')) { - die('Could not find the ErrorHandler component root directory.'); - } -} - -file_put_contents($fakeDebugClassLoadPath = __DIR__.'/fake_vendor/symfony/error-handler/DebugClassLoader.php', file_get_contents($errorHandlerRootDir.'/DebugClassLoader.php')); -require $fakeDebugClassLoadPath; - \Symfony\Component\ErrorHandler\DebugClassLoader::enable(); new \App\Services\BarService(); diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_vendor.phpt b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_vendor.phpt index 174e2ba89b54e..c9b323f6d5ad1 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_vendor.phpt +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_vendor.phpt @@ -29,13 +29,11 @@ Unsilenced deprecation notices (3) 1x: unsilenced bar deprecation 1x in FooTestCase::testNonLegacyBar -Remaining direct deprecation notices (1) +Remaining direct deprecation notices (2) + + 1x: root deprecation 1x: silenced bar deprecation 1x in FooTestCase::testNonLegacyBar Legacy deprecation notices (2) - -Other deprecation notices (1) - - 1x: root deprecation diff --git a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php index 648c9523dcf39..cb1f36f9ce73c 100644 --- a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php +++ b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php @@ -10,7 +10,7 @@ */ // Please update when phpunit needs to be reinstalled with fresh deps: -// Cache-Id: 2020-01-31 10:00 UTC +// Cache-Id: 2021-02-04 11:00 UTC error_reporting(-1); diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/HttpFoundationExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/HttpFoundationExtensionTest.php index df9add8afb42b..cb6658e4bbd32 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/HttpFoundationExtensionTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/HttpFoundationExtensionTest.php @@ -23,7 +23,7 @@ class HttpFoundationExtensionTest extends TestCase { /** - * @dataProvider getGenerateAbsoluteUrlData() + * @dataProvider getGenerateAbsoluteUrlData */ public function testGenerateAbsoluteUrl($expected, $path, $pathinfo) { @@ -116,7 +116,7 @@ public function testGenerateAbsoluteUrlWithScriptFileName() } /** - * @dataProvider getGenerateRelativePathData() + * @dataProvider getGenerateRelativePathData */ public function testGenerateRelativePath($expected, $path, $pathinfo) { diff --git a/src/Symfony/Bridge/Twig/composer.json b/src/Symfony/Bridge/Twig/composer.json index 72ebca58f49c3..6878052543bac 100644 --- a/src/Symfony/Bridge/Twig/composer.json +++ b/src/Symfony/Bridge/Twig/composer.json @@ -29,6 +29,7 @@ "symfony/form": "^4.4.17", "symfony/http-foundation": "^4.3|^5.0", "symfony/http-kernel": "^4.4", + "symfony/intl": "^4.4|^5.0", "symfony/mime": "^4.3|^5.0", "symfony/polyfill-intl-icu": "~1.0", "symfony/routing": "^3.4|^4.0|^5.0", diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php index 138afc5e73db6..e922398b28cc0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php @@ -369,6 +369,11 @@ private function filterCatalogue(MessageCatalogue $catalogue, string $domain): M foreach ($catalogue->getResources() as $resource) { $filteredCatalogue->addResource($resource); } + if ($metadata = $catalogue->getMetadata('', $intlDomain)) { + foreach ($metadata as $k => $v) { + $filteredCatalogue->setMetadata($k, $v, $intlDomain); + } + } if ($metadata = $catalogue->getMetadata('', $domain)) { foreach ($metadata as $k => $v) { $filteredCatalogue->setMetadata($k, $v, $domain); diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 58148b18cad43..2ba05d6d4fae7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -1431,7 +1431,7 @@ private function addHttpClientSection(ArrayNodeDefinition $rootNode) ->info('A network interface name, IP address, a host name or a UNIX socket to bind to.') ->end() ->booleanNode('verify_peer') - ->info('Indicates if the peer should be verified in a SSL/TLS context.') + ->info('Indicates if the peer should be verified in an SSL/TLS context.') ->end() ->booleanNode('verify_host') ->info('Indicates if the host should exist as a certificate common name.') @@ -1570,7 +1570,7 @@ private function addHttpClientSection(ArrayNodeDefinition $rootNode) ->info('A network interface name, IP address, a host name or a UNIX socket to bind to.') ->end() ->booleanNode('verify_peer') - ->info('Indicates if the peer should be verified in a SSL/TLS context.') + ->info('Indicates if the peer should be verified in an SSL/TLS context.') ->end() ->booleanNode('verify_host') ->info('Indicates if the host should exist as a certificate common name.') diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 06069cae5b634..9d46e259fd263 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -1236,24 +1236,26 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder // Register translation resources if ($dirs) { $files = []; - $finder = Finder::create() - ->followLinks() - ->files() - ->filter(function (\SplFileInfo $file) { - return 2 <= substr_count($file->getBasename(), '.') && preg_match('/\.\w+$/', $file->getBasename()); - }) - ->in($dirs) - ->sortByName() - ; - foreach ($finder as $file) { - $fileNameParts = explode('.', basename($file)); - $locale = $fileNameParts[\count($fileNameParts) - 2]; - if (!isset($files[$locale])) { - $files[$locale] = []; - } + foreach ($dirs as $dir) { + $finder = Finder::create() + ->followLinks() + ->files() + ->filter(function (\SplFileInfo $file) { + return 2 <= substr_count($file->getBasename(), '.') && preg_match('/\.\w+$/', $file->getBasename()); + }) + ->in($dir) + ->sortByName() + ; + foreach ($finder as $file) { + $fileNameParts = explode('.', basename($file)); + $locale = $fileNameParts[\count($fileNameParts) - 2]; + if (!isset($files[$locale])) { + $files[$locale] = []; + } - $files[$locale][] = (string) $file; + $files[$locale][] = (string) $file; + } } $projectDir = $container->getParameter('kernel.project_dir'); @@ -1445,8 +1447,8 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde } $container - ->getDefinition('annotations.filesystem_cache') - ->replaceArgument(0, $cacheDir) + ->getDefinition('annotations.filesystem_cache_adapter') + ->replaceArgument(2, $cacheDir) ; $cacheService = 'annotations.filesystem_cache'; diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.xml index 0ce6bf6594e31..2e56f1deb62f3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.xml @@ -24,15 +24,25 @@ - + + + + + - + + + 0 + + + + %kernel.cache_dir%/annotations.php @@ -48,6 +58,7 @@ + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml index 17598fa95815c..05a58c4c4cd2c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml @@ -69,6 +69,7 @@ + diff --git a/src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php b/src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php index 5a2ba7dba1949..47ca299e54f4b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php +++ b/src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php @@ -77,7 +77,7 @@ public function load($resource, $type = null) // - this handles the case and prevents the second fatal error // by triggering an exception beforehand. - throw new LoaderLoadException($resource, null, null, null, $type); + throw new LoaderLoadException($resource, null, 0, null, $type); } $this->loading = true; diff --git a/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php b/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php index cf2eadbd51cbd..89e8f77aee640 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php +++ b/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php @@ -178,14 +178,16 @@ private function resolve($value) $resolved = ($this->paramFetcher)($match[1]); - if (\is_bool($resolved)) { - $resolved = (string) (int) $resolved; - } - - if (\is_string($resolved) || is_numeric($resolved)) { + if (is_scalar($resolved)) { $this->collectedParameters[$match[1]] = $resolved; - return (string) $this->resolve($resolved); + if (\is_string($resolved)) { + $resolved = $this->resolve($resolved); + } + + if (is_scalar($resolved)) { + return false === $resolved ? '0' : (string) $resolved; + } } throw new RuntimeException(sprintf('The container parameter "%s", used in the route configuration value "%s", must be a string or numeric, but it is of type "%s".', $match[1], $value, \gettype($resolved))); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php index 4b557011a9d26..27f2973d82c3d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php @@ -18,6 +18,7 @@ use Symfony\Component\Config\Resource\ResourceInterface; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Output\NullOutput; +use Symfony\Component\Filesystem\Exception\IOException; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Finder\Finder; @@ -37,7 +38,10 @@ protected function setUp(): void protected function tearDown(): void { - $this->fs->remove($this->kernel->getProjectDir()); + try { + $this->fs->remove($this->kernel->getProjectDir()); + } catch (IOException $e) { + } } public function testCacheIsFreshAfterCacheClearedWithWarmup() diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index de4875653340e..db26edcfedebf 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -877,6 +877,19 @@ public function testTranslator() $files, '->registerTranslatorConfiguration() finds translation resources with dots in domain' ); + $this->assertContains(strtr(__DIR__.'/translations/security.en.yaml', '/', \DIRECTORY_SEPARATOR), $files); + + $positionOverridingTranslationFile = array_search(strtr(realpath(__DIR__.'/translations/security.en.yaml'), '/', \DIRECTORY_SEPARATOR), $files); + + if (false !== $positionCoreTranslationFile = array_search(strtr(realpath(__DIR__.'/../../../../Component/Security/Core/Resources/translations/security.en.xlf'), '/', \DIRECTORY_SEPARATOR), $files)) { + $this->assertContains(strtr(realpath(__DIR__.'/../../../../Component/Security/Core/Resources/translations/security.en.xlf'), '/', \DIRECTORY_SEPARATOR), $files); + } else { + $this->assertContains(strtr(realpath(__DIR__.'/../../vendor/symfony/security-core/Resources/translations/security.en.xlf'), '/', \DIRECTORY_SEPARATOR), $files); + + $positionCoreTranslationFile = array_search(strtr(realpath(__DIR__.'/../../vendor/symfony/security-core/Resources/translations/security.en.xlf'), '/', \DIRECTORY_SEPARATOR), $files); + } + + $this->assertGreaterThan($positionCoreTranslationFile, $positionOverridingTranslationFile); $calls = $container->getDefinition('translator.default')->getMethodCalls(); $this->assertEquals(['fr'], $calls[1][1][0]); @@ -984,7 +997,7 @@ public function testAnnotations() $container->addCompilerPass(new TestAnnotationsPass()); $container->compile(); - $this->assertEquals($container->getParameter('kernel.cache_dir').'/annotations', $container->getDefinition('annotations.filesystem_cache')->getArgument(0)); + $this->assertEquals($container->getParameter('kernel.cache_dir').'/annotations', $container->getDefinition('annotations.filesystem_cache_adapter')->getArgument(2)); $this->assertSame('annotations.filesystem_cache', (string) $container->getDefinition('annotation_reader')->getArgument(1)); } diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor/symfony/error-handler/.gitkeep b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/translations/security.en.yaml similarity index 100% rename from src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor/symfony/error-handler/.gitkeep rename to src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/translations/security.en.yaml diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/Fixtures/with_condition.yaml b/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/Fixtures/with_condition.yaml new file mode 100644 index 0000000000000..c97edc1a42542 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/Fixtures/with_condition.yaml @@ -0,0 +1,3 @@ +foo: + path: /foo + condition: '%parameter.condition%' diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php index ca66001ed9fa1..3e6c5bf6c602e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php @@ -14,11 +14,16 @@ use PHPUnit\Framework\TestCase; use Psr\Container\ContainerInterface; use Symfony\Bundle\FrameworkBundle\Routing\Router; +use Symfony\Component\Config\FileLocator; use Symfony\Component\Config\Loader\LoaderInterface; +use Symfony\Component\Config\ResourceCheckerConfigCache; +use Symfony\Component\Config\ResourceCheckerConfigCacheFactory; use Symfony\Component\DependencyInjection\Config\ContainerParametersResource; +use Symfony\Component\DependencyInjection\Config\ContainerParametersResourceChecker; use Symfony\Component\DependencyInjection\Container; use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException; use Symfony\Component\DependencyInjection\Exception\RuntimeException; +use Symfony\Component\Routing\Loader\YamlFileLoader; use Symfony\Component\Routing\Route; use Symfony\Component\Routing\RouteCollection; @@ -503,6 +508,55 @@ public function getNonStringValues() return [[null], [false], [true], [new \stdClass()], [['foo', 'bar']], [[[]]]]; } + /** + * @dataProvider getContainerParameterForRoute + */ + public function testCacheValidityWithContainerParameters($parameter) + { + $cacheDir = sys_get_temp_dir().\DIRECTORY_SEPARATOR.uniqid('router_', true); + + try { + $container = new Container(); + $container->set('routing.loader', new YamlFileLoader(new FileLocator(__DIR__.'/Fixtures'))); + + $container->setParameter('parameter.condition', $parameter); + + $router = new Router($container, 'with_condition.yaml', [ + 'debug' => true, + 'cache_dir' => $cacheDir, + ]); + + $resourceCheckers = [ + new ContainerParametersResourceChecker($container), + ]; + + $router->setConfigCacheFactory(new ResourceCheckerConfigCacheFactory($resourceCheckers)); + + $router->getMatcher(); // trigger cache build + + $cache = new ResourceCheckerConfigCache($cacheDir.\DIRECTORY_SEPARATOR.'url_matching_routes.php', $resourceCheckers); + + if (!$cache->isFresh()) { + $cache = new ResourceCheckerConfigCache($cacheDir.\DIRECTORY_SEPARATOR.'UrlMatcher.php', $resourceCheckers); + } + + $this->assertTrue($cache->isFresh()); + } finally { + if (is_dir($cacheDir)) { + array_map('unlink', glob($cacheDir.\DIRECTORY_SEPARATOR.'*')); + rmdir($cacheDir); + } + } + } + + public function getContainerParameterForRoute() + { + yield 'String' => ['"foo"']; + yield 'Integer' => [0]; + yield 'Boolean true' => [true]; + yield 'Boolean false' => [false]; + } + private function getServiceContainer(RouteCollection $routes): Container { $loader = $this->createMock(LoaderInterface::class); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TimedPhpEngineTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TimedPhpEngineTest.php index 86c6d3940c713..72e3fb0f78920 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TimedPhpEngineTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TimedPhpEngineTest.php @@ -29,7 +29,7 @@ class TimedPhpEngineTest extends TestCase { public function testThatRenderLogsTime() { - $container = $this->getContainer(); + $container = $this->createMock(Container::class); $templateNameParser = $this->getTemplateNameParser(); $globalVariables = $this->getGlobalVariables(); $loader = $this->getLoader($this->getStorage()); @@ -48,11 +48,6 @@ public function testThatRenderLogsTime() $engine->render('index.php'); } - private function getContainer(): Container - { - return $this->createMock(Container::class); - } - private function getTemplateNameParser(): TemplateNameParserInterface { $templateReference = $this->createMock(TemplateReferenceInterface::class); diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json index 72baafd8fdfb8..f592065b28cd7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/composer.json +++ b/src/Symfony/Bundle/FrameworkBundle/composer.json @@ -49,6 +49,7 @@ "symfony/messenger": "^4.4|^5.0", "symfony/mime": "^4.4|^5.0", "symfony/process": "^3.4|^4.0|^5.0", + "symfony/security-core": "^3.4|^4.4|^5.2", "symfony/security-csrf": "^3.4|^4.0|^5.0", "symfony/security-http": "^3.4|^4.0|^5.0", "symfony/serializer": "^4.4|^5.0", diff --git a/src/Symfony/Bundle/SecurityBundle/CacheWarmer/ExpressionCacheWarmer.php b/src/Symfony/Bundle/SecurityBundle/CacheWarmer/ExpressionCacheWarmer.php index 938b28dcb637b..130cdfbb11e7f 100644 --- a/src/Symfony/Bundle/SecurityBundle/CacheWarmer/ExpressionCacheWarmer.php +++ b/src/Symfony/Bundle/SecurityBundle/CacheWarmer/ExpressionCacheWarmer.php @@ -37,7 +37,7 @@ public function isOptional() public function warmUp($cacheDir) { foreach ($this->expressions as $expression) { - $this->expressionLanguage->parse($expression, ['token', 'user', 'object', 'subject', 'roles', 'request', 'trust_resolver']); + $this->expressionLanguage->parse($expression, ['token', 'user', 'object', 'subject', 'roles', 'role_names', 'request', 'trust_resolver']); } } } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/CacheWarmer/ExpressionCacheWarmerTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/CacheWarmer/ExpressionCacheWarmerTest.php index d1299bffed611..9143db38edffd 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/CacheWarmer/ExpressionCacheWarmerTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/CacheWarmer/ExpressionCacheWarmerTest.php @@ -26,8 +26,8 @@ public function testWarmUp() $expressionLang->expects($this->exactly(2)) ->method('parse') ->withConsecutive( - [$expressions[0], ['token', 'user', 'object', 'subject', 'roles', 'request', 'trust_resolver']], - [$expressions[1], ['token', 'user', 'object', 'subject', 'roles', 'request', 'trust_resolver']] + [$expressions[0], ['token', 'user', 'object', 'subject', 'roles', 'role_names', 'request', 'trust_resolver']], + [$expressions[1], ['token', 'user', 'object', 'subject', 'roles', 'role_names', 'request', 'trust_resolver']] ); (new ExpressionCacheWarmer($expressions, $expressionLang))->warmUp(''); diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/EventListener/WebDebugToolbarListenerTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/EventListener/WebDebugToolbarListenerTest.php index 30b3edf164637..01d586346ad30 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Tests/EventListener/WebDebugToolbarListenerTest.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/EventListener/WebDebugToolbarListenerTest.php @@ -65,7 +65,7 @@ public function testHtmlRedirectionIsIntercepted($statusCode, $hasSession) { $response = new Response('Some content', $statusCode); $response->headers->set('X-Debug-Token', 'xxxxxxxx'); - $event = new ResponseEvent($this->getKernelMock(), $this->getRequestMock(false, 'html', $hasSession), HttpKernelInterface::MASTER_REQUEST, $response); + $event = new ResponseEvent($this->createMock(Kernel::class), $this->getRequestMock(false, 'html', $hasSession), HttpKernelInterface::MASTER_REQUEST, $response); $listener = new WebDebugToolbarListener($this->getTwigMock('Redirection'), true); $listener->onKernelResponse($event); @@ -78,7 +78,7 @@ public function testNonHtmlRedirectionIsNotIntercepted() { $response = new Response('Some content', '301'); $response->headers->set('X-Debug-Token', 'xxxxxxxx'); - $event = new ResponseEvent($this->getKernelMock(), $this->getRequestMock(false, 'json', true), HttpKernelInterface::MASTER_REQUEST, $response); + $event = new ResponseEvent($this->createMock(Kernel::class), $this->getRequestMock(false, 'json', true), HttpKernelInterface::MASTER_REQUEST, $response); $listener = new WebDebugToolbarListener($this->getTwigMock('Redirection'), true); $listener->onKernelResponse($event); @@ -92,7 +92,7 @@ public function testToolbarIsInjected() $response = new Response(''); $response->headers->set('X-Debug-Token', 'xxxxxxxx'); - $event = new ResponseEvent($this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response); + $event = new ResponseEvent($this->createMock(Kernel::class), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response); $listener = new WebDebugToolbarListener($this->getTwigMock()); $listener->onKernelResponse($event); @@ -108,7 +108,7 @@ public function testToolbarIsNotInjectedOnNonHtmlContentType() $response = new Response(''); $response->headers->set('X-Debug-Token', 'xxxxxxxx'); $response->headers->set('Content-Type', 'text/xml'); - $event = new ResponseEvent($this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response); + $event = new ResponseEvent($this->createMock(Kernel::class), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response); $listener = new WebDebugToolbarListener($this->getTwigMock()); $listener->onKernelResponse($event); @@ -124,7 +124,7 @@ public function testToolbarIsNotInjectedOnContentDispositionAttachment() $response = new Response(''); $response->headers->set('X-Debug-Token', 'xxxxxxxx'); $response->headers->set('Content-Disposition', 'attachment; filename=test.html'); - $event = new ResponseEvent($this->getKernelMock(), $this->getRequestMock(false, 'html'), HttpKernelInterface::MASTER_REQUEST, $response); + $event = new ResponseEvent($this->createMock(Kernel::class), $this->getRequestMock(false, 'html'), HttpKernelInterface::MASTER_REQUEST, $response); $listener = new WebDebugToolbarListener($this->getTwigMock()); $listener->onKernelResponse($event); @@ -140,7 +140,7 @@ public function testToolbarIsNotInjectedOnRedirection($statusCode, $hasSession) { $response = new Response('', $statusCode); $response->headers->set('X-Debug-Token', 'xxxxxxxx'); - $event = new ResponseEvent($this->getKernelMock(), $this->getRequestMock(false, 'html', $hasSession), HttpKernelInterface::MASTER_REQUEST, $response); + $event = new ResponseEvent($this->createMock(Kernel::class), $this->getRequestMock(false, 'html', $hasSession), HttpKernelInterface::MASTER_REQUEST, $response); $listener = new WebDebugToolbarListener($this->getTwigMock()); $listener->onKernelResponse($event); @@ -165,7 +165,7 @@ public function testToolbarIsNotInjectedWhenThereIsNoNoXDebugTokenResponseHeader { $response = new Response(''); - $event = new ResponseEvent($this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response); + $event = new ResponseEvent($this->createMock(Kernel::class), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response); $listener = new WebDebugToolbarListener($this->getTwigMock()); $listener->onKernelResponse($event); @@ -181,7 +181,7 @@ public function testToolbarIsNotInjectedWhenOnSubRequest() $response = new Response(''); $response->headers->set('X-Debug-Token', 'xxxxxxxx'); - $event = new ResponseEvent($this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::SUB_REQUEST, $response); + $event = new ResponseEvent($this->createMock(Kernel::class), $this->getRequestMock(), HttpKernelInterface::SUB_REQUEST, $response); $listener = new WebDebugToolbarListener($this->getTwigMock()); $listener->onKernelResponse($event); @@ -197,7 +197,7 @@ public function testToolbarIsNotInjectedOnIncompleteHtmlResponses() $response = new Response('
Some content
'); $response->headers->set('X-Debug-Token', 'xxxxxxxx'); - $event = new ResponseEvent($this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response); + $event = new ResponseEvent($this->createMock(Kernel::class), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response); $listener = new WebDebugToolbarListener($this->getTwigMock()); $listener->onKernelResponse($event); @@ -213,7 +213,7 @@ public function testToolbarIsNotInjectedOnXmlHttpRequests() $response = new Response(''); $response->headers->set('X-Debug-Token', 'xxxxxxxx'); - $event = new ResponseEvent($this->getKernelMock(), $this->getRequestMock(true), HttpKernelInterface::MASTER_REQUEST, $response); + $event = new ResponseEvent($this->createMock(Kernel::class), $this->getRequestMock(true), HttpKernelInterface::MASTER_REQUEST, $response); $listener = new WebDebugToolbarListener($this->getTwigMock()); $listener->onKernelResponse($event); @@ -229,7 +229,7 @@ public function testToolbarIsNotInjectedOnNonHtmlRequests() $response = new Response(''); $response->headers->set('X-Debug-Token', 'xxxxxxxx'); - $event = new ResponseEvent($this->getKernelMock(), $this->getRequestMock(false, 'json'), HttpKernelInterface::MASTER_REQUEST, $response); + $event = new ResponseEvent($this->createMock(Kernel::class), $this->getRequestMock(false, 'json'), HttpKernelInterface::MASTER_REQUEST, $response); $listener = new WebDebugToolbarListener($this->getTwigMock()); $listener->onKernelResponse($event); @@ -242,7 +242,7 @@ public function testXDebugUrlHeader() $response = new Response(); $response->headers->set('X-Debug-Token', 'xxxxxxxx'); - $urlGenerator = $this->getUrlGeneratorMock(); + $urlGenerator = $this->createMock(UrlGeneratorInterface::class); $urlGenerator ->expects($this->once()) ->method('generate') @@ -250,7 +250,7 @@ public function testXDebugUrlHeader() ->willReturn('http://mydomain.com/_profiler/xxxxxxxx') ; - $event = new ResponseEvent($this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response); + $event = new ResponseEvent($this->createMock(Kernel::class), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response); $listener = new WebDebugToolbarListener($this->getTwigMock(), false, WebDebugToolbarListener::ENABLED, $urlGenerator); $listener->onKernelResponse($event); @@ -263,7 +263,7 @@ public function testThrowingUrlGenerator() $response = new Response(); $response->headers->set('X-Debug-Token', 'xxxxxxxx'); - $urlGenerator = $this->getUrlGeneratorMock(); + $urlGenerator = $this->createMock(UrlGeneratorInterface::class); $urlGenerator ->expects($this->once()) ->method('generate') @@ -271,7 +271,7 @@ public function testThrowingUrlGenerator() ->willThrowException(new \Exception('foo')) ; - $event = new ResponseEvent($this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response); + $event = new ResponseEvent($this->createMock(Kernel::class), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response); $listener = new WebDebugToolbarListener($this->getTwigMock(), false, WebDebugToolbarListener::ENABLED, $urlGenerator); $listener->onKernelResponse($event); @@ -284,7 +284,7 @@ public function testThrowingErrorCleanup() $response = new Response(); $response->headers->set('X-Debug-Token', 'xxxxxxxx'); - $urlGenerator = $this->getUrlGeneratorMock(); + $urlGenerator = $this->createMock(UrlGeneratorInterface::class); $urlGenerator ->expects($this->once()) ->method('generate') @@ -292,7 +292,7 @@ public function testThrowingErrorCleanup() ->willThrowException(new \Exception("This\nmultiline\r\ntabbed text should\tcome out\r on\n \ta single plain\r\nline")) ; - $event = new ResponseEvent($this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response); + $event = new ResponseEvent($this->createMock(Kernel::class), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response); $listener = new WebDebugToolbarListener($this->getTwigMock(), false, WebDebugToolbarListener::ENABLED, $urlGenerator); $listener->onKernelResponse($event); @@ -331,14 +331,4 @@ protected function getTwigMock($render = 'WDT') return $templating; } - - protected function getUrlGeneratorMock() - { - return $this->createMock(UrlGeneratorInterface::class); - } - - protected function getKernelMock() - { - return $this->createMock(Kernel::class); - } } diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php index 9b43ab5350732..5e746c63bffe3 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php @@ -21,8 +21,6 @@ use Twig\Loader\SourceContextLoaderInterface; /** - * Test for TemplateManager class. - * * @author Artur Wielogórski */ class TemplateManagerTest extends TestCase @@ -38,7 +36,7 @@ class TemplateManagerTest extends TestCase protected $profiler; /** - * @var \Symfony\Bundle\WebProfilerBundle\Profiler\TemplateManager + * @var TemplateManager */ protected $templateManager; @@ -46,7 +44,7 @@ protected function setUp(): void { parent::setUp(); - $profiler = $this->mockProfiler(); + $this->profiler = $this->createMock(Profiler::class); $twigEnvironment = $this->mockTwigEnvironment(); $templates = [ 'data_collector.foo' => ['foo', 'FooBundle:Collector:foo'], @@ -54,7 +52,7 @@ protected function setUp(): void 'data_collector.baz' => ['baz', 'FooBundle:Collector:baz'], ]; - $this->templateManager = new TemplateManager($profiler, $twigEnvironment, $templates); + $this->templateManager = new TemplateManager($this->profiler, $twigEnvironment, $templates); } public function testGetNameOfInvalidTemplate() @@ -98,11 +96,6 @@ public function profileHasCollectorCallback($panel) } } - protected function mockProfile() - { - return $this->createMock(Profile::class); - } - protected function mockTwigEnvironment() { $this->twigEnvironment = $this->createMock(Environment::class); @@ -121,13 +114,6 @@ protected function mockTwigEnvironment() return $this->twigEnvironment; } - - protected function mockProfiler() - { - $this->profiler = $this->createMock(Profiler::class); - - return $this->profiler; - } } class ProfileDummy extends Profile diff --git a/src/Symfony/Component/BrowserKit/Client.php b/src/Symfony/Component/BrowserKit/Client.php index b20ccdc88c29b..e5bf8b757d5b3 100644 --- a/src/Symfony/Component/BrowserKit/Client.php +++ b/src/Symfony/Component/BrowserKit/Client.php @@ -331,7 +331,7 @@ public function submit(Form $form, array $values = []/*, array $serverParameters * @param string $button The text content, id, value or name of the form