Skip to content

Commit

Permalink
Merge branch '4.x' into feature/response-context-rework
Browse files Browse the repository at this point in the history
  • Loading branch information
Toflar committed Jun 8, 2021
2 parents 205dafc + 87c2b97 commit 786b50c
Show file tree
Hide file tree
Showing 84 changed files with 1,698 additions and 379 deletions.
48 changes: 41 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, pcre, pdo, zlib
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, mysqli, pcre, pdo_mysql, zlib
tools: flex
coverage: pcov

Expand Down Expand Up @@ -48,7 +48,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, pcre, pdo, zlib
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, mysqli, pcre, pdo_mysql, zlib
tools: flex
coverage: none

Expand All @@ -68,14 +68,15 @@ jobs:
tools/ecs/vendor/bin/ecs check *-bundle/src/Resources/contao --config tools/ecs/vendor/contao/easy-coding-standard/config/legacy.php --no-progress-bar --ansi
tools/ecs/vendor/bin/ecs check *-bundle/src/Resources/contao/templates --config tools/ecs/vendor/contao/easy-coding-standard/config/template.php --no-progress-bar --ansi
- name: Analyze the code
- name: Analyze the PHP files
run: |
tools/phpstan/vendor/bin/phpstan analyse core-bundle/src core-bundle/tests --level=5 --no-progress
tools/psalm/vendor/bin/psalm --no-suggestions --no-progress
- name: Analyze the YAML files
run: |
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade setuptools wheel
python3 -m pip install --upgrade yamllint
/home/runner/.local/bin/yamllint .
Expand All @@ -88,7 +89,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, pcre, pdo, zlib
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, mysqli, pcre, pdo_mysql, zlib
tools: flex
coverage: none

Expand Down Expand Up @@ -132,7 +133,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, pcre, pdo_mysql, zlib
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, mysqli, pcre, pdo_mysql, zlib
tools: flex
coverage: none

Expand All @@ -155,6 +156,39 @@ jobs:
env:
DATABASE_URL: mysql://root:root@127.0.0.1:3306/contao_test

nightly:
name: PHP 8.1
runs-on: ubuntu-18.04
if: github.event_name != 'push'
continue-on-error: true
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, mysqli, pcre, pdo_mysql, zlib
tools: flex
coverage: none

- name: Initialize the database
run: |
sudo /etc/init.d/mysql start
mysql -uroot -proot -e "CREATE database contao_test"
- name: Checkout
uses: actions/checkout@v1

- name: Install the dependencies
run: composer install --ignore-platform-reqs --no-interaction --no-progress

- name: Run the unit tests
run: vendor/bin/phpunit --colors=always

- name: Run the functional tests
run: vendor/bin/phpunit --testsuite=functional --colors=always
env:
DATABASE_URL: mysql://root:root@127.0.0.1:3306/contao_test

prefer-lowest:
name: Prefer Lowest
runs-on: ubuntu-18.04
Expand All @@ -164,7 +198,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, pcre, pdo_mysql, zlib
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, mysqli, pcre, pdo_mysql, zlib
tools: flex
coverage: none

Expand Down Expand Up @@ -196,7 +230,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, pcre, pdo, zlib
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, mysqli, pcre, pdo_mysql, zlib
tools: flex
coverage: none

Expand Down
37 changes: 19 additions & 18 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
* Fritz Michael Gschwantner ([fritzmg](https://github.com/fritzmg))
* Hannes ([xchs](https://github.com/xchs))
* Christian Schiffler ([discordier](https://github.com/discordier))
* David Greminger ([bytehead](https://github.com/bytehead))
* Moritz Vondano ([m-vo](https://github.com/m-vo))
* David Greminger ([bytehead](https://github.com/bytehead))
* Kamil Kuzminski ([qzminski](https://github.com/qzminski))
* David Molineus ([dmolineus](https://github.com/dmolineus))
* Dominik Tomasi ([dtomasi](https://github.com/dtomasi))
Expand All @@ -19,8 +19,8 @@
* Dominik Zogg ([dominikzogg](https://github.com/dominikzogg))
* Jim Schmid ([sheeep](https://github.com/sheeep))
* Henry ([Mynyx](https://github.com/Mynyx))
* Sergey Dyagovchenko ([DyaGa](https://github.com/DyaGa))
* Ralf Baussenwein ([rabauss](https://github.com/rabauss))
* Sergey Dyagovchenko ([DyaGa](https://github.com/DyaGa))
* Arne Stappen ([agoat](https://github.com/agoat))
* Nicky Hoff ([frontendschlampe](https://github.com/frontendschlampe))
* Michael Roitzsch ([mroi](https://github.com/mroi))
Expand All @@ -30,32 +30,33 @@
* Daniel Jahnsmüller ([Tastaturberuf](https://github.com/Tastaturberuf))
* Daniel Schwiperich ([DanielSchwiperich](https://github.com/DanielSchwiperich))
* Benedict Zinke ([bezin](https://github.com/bezin))
* Fabian Laule ([fabianlaule](https://github.com/fabianlaule))
* Simon Wohler ([bekanntmacher](https://github.com/bekanntmacher))
* Olli ([Olli](https://github.com/Olli))
* Patrick ([patrickjDE](https://github.com/patrickjDE))
* Arndt von Lucadou ([a-v-l](https://github.com/a-v-l))
* Blair Winans ([blairwinans](https://github.com/blairwinans))
* Christian Eggeling ([amisso](https://github.com/amisso))
* kroka ([kroka](https://github.com/kroka))
* Andreas Burg ([Aybee](https://github.com/Aybee))
* Cliff Parnitzky ([cliffparnitzky](https://github.com/cliffparnitzky))
* David Enke ([davidenke](https://github.com/davidenke))
* Fabian Laule ([fabianlaule](https://github.com/fabianlaule))
* Glen Langer ([BugBuster1701](https://github.com/BugBuster1701))
* Torsten Baldes ([tobaco](https://github.com/tobaco))
* Hendrik Obermayer ([henobi](https://github.com/henobi))
* initart ([initart](https://github.com/initart))
* Jamie Devine ([jamesdevine](https://github.com/jamesdevine))
* Takahiro Kambe ([taca](https://github.com/taca))
* Stefan Heimes ([stefanheimes](https://github.com/stefanheimes))
* John Brand ([brandbrilliance](https://github.com/brandbrilliance))
* Andreas Burg ([Aybee](https://github.com/Aybee))
* Christian Eggeling ([amisso](https://github.com/amisso))
* Simon Wohler ([bekanntmacher](https://github.com/bekanntmacher))
* Blair Winans ([blairwinans](https://github.com/blairwinans))
* kroka ([kroka](https://github.com/kroka))
* Arndt von Lucadou ([a-v-l](https://github.com/a-v-l))
* Olli ([Olli](https://github.com/Olli))
* Matey ([Matey](https://github.com/Matey))
* Roland Schütz ([rolandschuetz](https://github.com/rolandschuetz))
* Glen Langer ([BugBuster1701](https://github.com/BugBuster1701))
* Torsten Baldes ([tobaco](https://github.com/tobaco))
* Arndt H. Ziegler
* CMSworker ([CMSworker](https://github.com/CMSworker))
* Christian Romeni ([christianromeni](https://github.com/christianromeni))
* Cliff Parnitzky ([cliffparnitzky](https://github.com/cliffparnitzky))
* Dennis Bohn ([bohnmedia](https://github.com/bohnmedia))
* Joe Ray Gregory ([may17](https://github.com/may17))
* Leopold Seckendorff ([poddus](https://github.com/poddus))
* Patrick ([patrickjDE](https://github.com/patrickjDE))
* Patrick Landolt ([scuben](https://github.com/scuben))
* Patrick Froch ([eS-IT](https://github.com/eS-IT))
* Simon Reitinger ([simonreitinger](https://github.com/simonreitinger))
Expand All @@ -74,17 +75,17 @@
* Tsarma ([Tsarma](https://github.com/Tsarma))
* Vladimir Reznichenko ([kalessil](https://github.com/kalessil))
* Defcon0 ([Defcon0](https://github.com/Defcon0))
* Daniel Nemeth ([daniel-nemeth](https://github.com/daniel-nemeth))
* Daniele Sciannimanica
* Alexander Stulnikov ([alarstyle](https://github.com/alarstyle))
* Cédric Morin ([Cerdic](https://github.com/Cerdic))
* Daniel Nemeth ([daniel-nemeth](https://github.com/daniel-nemeth))
* Adrián Granado ([playmono](https://github.com/playmono))
* Cédric Morin ([Cerdic](https://github.com/Cerdic))
* Christian Kolb ([christian-kolb](https://github.com/christian-kolb))
* Benny Born ([bennyborn](https://github.com/bennyborn))
* Martin Schumann ([martinschumann](https://github.com/martinschumann))
* mkt ([mktcode](https://github.com/mktcode))
* Mike ([mvscheidt](https://github.com/mvscheidt))
* Bjarke Amann ([netzarbeiter](https://github.com/netzarbeiter))
* Arndt H. Ziegler
* Benny Born ([bennyborn](https://github.com/bennyborn))
* Andreas Fieger ([fiedsch](https://github.com/fiedsch))
* Martin Hauke ([soxrepo](https://github.com/soxrepo))
* Andreas Allacher ([AndreasA](https://github.com/AndreasA))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@
'exclude' => true,
'search' => true,
'inputType' => 'text',
'eval' => array('mandatory'=>true, 'rgxp'=>'url', 'decodeEntities'=>true, 'maxlength'=>255, 'dcaPicker'=>true, 'addWizardClass'=>false, 'tl_class'=>'w50'),
'eval' => array('mandatory'=>true, 'rgxp'=>'url', 'decodeEntities'=>true, 'maxlength'=>255, 'dcaPicker'=>true, 'tl_class'=>'w50'),
'sql' => "varchar(255) NOT NULL default ''"
),
'target' => array
Expand Down
16 changes: 14 additions & 2 deletions calendar-bundle/src/Resources/contao/modules/ModuleCalendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,18 @@ protected function compile()

// Find the boundaries
$objMinMax = $this->Database->query("SELECT MIN(startTime) AS dateFrom, MAX(endTime) AS dateTo, MAX(repeatEnd) AS repeatUntil FROM tl_calendar_events WHERE pid IN(" . implode(',', array_map('\intval', $this->cal_calendar)) . ")" . (!BE_USER_LOGGED_IN ? " AND published='1' AND (start='' OR start<='$time') AND (stop='' OR stop>'$time')" : ""));
$dateFrom = $objMinMax->dateFrom;
$dateTo = $objMinMax->dateTo;
$repeatUntil = $objMinMax->repeatUntil;

if (isset($GLOBALS['TL_HOOKS']['findCalendarBoundaries']) && \is_array($GLOBALS['TL_HOOKS']['findCalendarBoundaries']))
{
foreach ($GLOBALS['TL_HOOKS']['findCalendarBoundaries'] as $callback)
{
$this->import($callback[0]);
$this->{$callback[0]}->{$callback[1]}($dateFrom, $dateTo, $repeatUntil, $this);
}
}

// Store year and month
$intYear = date('Y', $this->Date->tstamp);
Expand All @@ -137,7 +149,7 @@ protected function compile()
$intPrevYm = (int) ($prevYear . str_pad($prevMonth, 2, 0, STR_PAD_LEFT));

// Only generate a link if there are events (see #4160)
if (($objMinMax->dateFrom !== null && $intPrevYm >= date('Ym', $objMinMax->dateFrom)) || $intPrevYm >= date('Ym'))
if (($dateFrom !== null && $intPrevYm >= date('Ym', $dateFrom)) || $intPrevYm >= date('Ym'))
{
$objTemplate->prevHref = $this->strUrl . '?month=' . $intPrevYm;
$objTemplate->prevTitle = StringUtil::specialchars($lblPrevious);
Expand All @@ -155,7 +167,7 @@ protected function compile()
$intNextYm = $nextYear . str_pad($nextMonth, 2, 0, STR_PAD_LEFT);

// Only generate a link if there are events (see #4160)
if ($intNextYm <= date('Ym') || ($objMinMax->dateTo !== null && $intNextYm <= date('Ym', max($objMinMax->dateTo, $objMinMax->repeatUntil))))
if ($intNextYm <= date('Ym') || ($dateTo !== null && $intNextYm <= date('Ym', max($dateTo, $repeatUntil))))
{
$objTemplate->nextHref = $this->strUrl . '?month=' . $intNextYm;
$objTemplate->nextTitle = StringUtil::specialchars($lblNext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,20 +139,20 @@ protected function compile()

if ($objEvent->pageTitle)
{
$htmlHeadBag->setTitle($objEvent->pageTitle);
$htmlHeadBag->setTitle($objEvent->pageTitle); // Already stored decoded
}
elseif ($objEvent->title)
{
$htmlHeadBag->setTitle(strip_tags(StringUtil::stripInsertTags($objEvent->title)));
$htmlHeadBag->setTitle(StringUtil::inputEncodedToPlainText($objEvent->title));
}

if ($objEvent->description)
{
$htmlHeadBag->setMetaDescription($objEvent->description);
$htmlHeadBag->setMetaDescription(StringUtil::inputEncodedToPlainText($objEvent->description));
}
elseif ($objEvent->teaser)
{
$htmlHeadBag->setMetaDescription($this->prepareMetaDescription($objEvent->teaser));
$htmlHeadBag->setMetaDescription(StringUtil::htmlToPlainText($objEvent->teaser));
}

if ($objEvent->robots)
Expand Down
35 changes: 12 additions & 23 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
"contao-components/tinymce4": "^4.7 || ^5.0",
"contao/image": "^1.0",
"contao/imagine-svg": "^0.2.3 || ^1.0",
"contao/polyfill-symfony": "^1.0",
"contao/maintenance-bundle-deprecated": "^2.1.5",
"contao/manager-plugin": "^2.6.2",
"doctrine/dbal": "^2.11",
"contao/polyfill-symfony": "^1.0",
"doctrine/dbal": "^2.13.1",
"doctrine/doctrine-bundle": "^1.8 || ^2.0",
"doctrine/orm": "^2.6.3",
"doctrine/persistence": "^1.3.3 || ^2.0",
Expand All @@ -67,17 +67,16 @@
"nelmio/security-bundle": "^2.2",
"nikic/php-parser": "^4.9",
"nyholm/psr7": "^1.2",
"ocramius/proxy-manager": "^2.1",
"paragonie/constant_time_encoding": "^2.2",
"patchwork/utf8": "^1.2",
"phpspec/php-diff": "^1.0",
"psr/log": "^1.0",
"ramsey/uuid": "^3.8",
"scheb/2fa-backup-code": "^5.0",
"scheb/2fa-bundle": "^5.0",
"scheb/2fa-trusted-device": "^5.0",
"scheb/2fa-backup-code": "^5.8",
"scheb/2fa-bundle": "^5.8",
"scheb/2fa-trusted-device": "^5.8",
"scrivo/highlight.php": "^9.18",
"scssphp/scssphp": "^1.4",
"scssphp/scssphp": "^1.5",
"simplepie/simplepie": "^1.3",
"spomky-labs/otphp": "^9.1 || ^10.0",
"symfony-cmf/routing-bundle": "^2.4",
Expand Down Expand Up @@ -118,7 +117,7 @@
"terminal42/service-annotation-bundle": "^1.1",
"toflar/psr6-symfony-http-cache-store": "^2.1 || ^3.0",
"true/punycode": "^2.1",
"twig/twig": "^2.7",
"twig/twig": "^2.11.3",
"ua-parser/uap-php": "^3.9",
"webignition/robots-txt-file": "^3.0",
"webmozart/path-util": "^2.2",
Expand Down Expand Up @@ -264,21 +263,11 @@
"tools/ecs/vendor/bin/ecs check *-bundle/src/Resources/contao --config tools/ecs/vendor/contao/easy-coding-standard/config/legacy.php --fix --ansi",
"tools/ecs/vendor/bin/ecs check *-bundle/src/Resources/contao/templates --config tools/ecs/vendor/contao/easy-coding-standard/config/template.php --fix --ansi"
],
"functional-tests": [
"vendor/bin/phpunit --testsuite=functional --colors=always"
],
"monorepo-tools": [
"tools/monorepo/vendor/bin/monorepo-tools composer-json --validate --ansi"
],
"phpstan": [
"tools/phpstan/vendor/bin/phpstan analyze core-bundle/src core-bundle/tests --level=5 --memory-limit=1G --ansi"
],
"psalm": [
"tools/psalm/vendor/bin/psalm --no-suggestions"
],
"unit-tests": [
"vendor/bin/phpunit --colors=always"
]
"functional-tests": "vendor/bin/phpunit --testsuite=functional --colors=always",
"monorepo-tools": "tools/monorepo/vendor/bin/monorepo-tools composer-json --validate --ansi",
"phpstan": "tools/phpstan/vendor/bin/phpstan analyze core-bundle/src core-bundle/tests --level=5 --memory-limit=1G --ansi",
"psalm": "tools/psalm/vendor/bin/psalm --no-suggestions",
"unit-tests": "vendor/bin/phpunit --colors=always"
},
"support": {
"issues": "https://github.com/contao/contao/issues",
Expand Down
12 changes: 6 additions & 6 deletions core-bundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"contao/image": "^1.0",
"contao/imagine-svg": "^0.2.3 || ^1.0",
"contao/polyfill-symfony": "^1.0",
"doctrine/dbal": "^2.11",
"doctrine/dbal": "^2.13.1",
"doctrine/doctrine-bundle": "^1.8 || ^2.0",
"doctrine/orm": "^2.6.3",
"doctrine/persistence": "^1.3.3 || ^2.0",
Expand All @@ -69,11 +69,11 @@
"phpspec/php-diff": "^1.0",
"psr/log": "^1.0",
"ramsey/uuid": "^3.8",
"scheb/2fa-backup-code": "^5.0",
"scheb/2fa-bundle": "^5.0",
"scheb/2fa-trusted-device": "^5.0",
"scheb/2fa-backup-code": "^5.8",
"scheb/2fa-bundle": "^5.8",
"scheb/2fa-trusted-device": "^5.8",
"scrivo/highlight.php": "^9.18",
"scssphp/scssphp": "^1.4",
"scssphp/scssphp": "^1.5",
"simplepie/simplepie": "^1.3",
"spomky-labs/otphp": "^9.1 || ^10.0",
"symfony-cmf/routing-bundle": "^2.4",
Expand Down Expand Up @@ -104,7 +104,7 @@
"terminal42/escargot": "^1.0",
"terminal42/service-annotation-bundle": "^1.1",
"true/punycode": "^2.1",
"twig/twig": "^2.7",
"twig/twig": "^2.11.3",
"ua-parser/uap-php": "^3.9",
"webignition/robots-txt-file": "^3.0",
"webmozart/path-util": "^2.2",
Expand Down
3 changes: 1 addition & 2 deletions core-bundle/src/Cors/WebsiteRootsConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ public function getOptions(Request $request): array
");

$stmt->bindValue('dns', preg_replace('@^https?://@', '', $request->headers->get('origin')));
$stmt->execute();

if (!$stmt->fetchOne()) {
if (!$stmt->executeQuery()->fetchOne()) {
return [];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function __invoke(RequestEvent $event): void
return;
}

$targetPath = $this->getTargetPath($request->getSession(), $token->getProviderKey());
$targetPath = $this->getTargetPath($request->getSession(), $token->getFirewallName());

if ($targetPath) {
// Redirect to the target path
Expand Down

0 comments on commit 786b50c

Please sign in to comment.