Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use references instead of array_replace_recursive() #1

Merged

Conversation

ausi
Copy link

@ausi ausi commented Sep 21, 2018

I rewrote the DataContainerCallbackListener to use references to the $GLOBALS['TL_DCA'] array instead of using array_replace_recursive().

This fixes an issue with callback arrays that use string keys and should also consume less memory because it doesn’t copy the whole $GLOBALS['TL_DCA'][$table] array.

I hope you like it ☺️

}

$dca = $dca[$key];
$dcaRef = &$dcaRef[$key];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if this $key does not exist or is not an array?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem with references, they can point to non-existent array items, see https://3v4l.org/GhB32

}

krsort($callbacks, SORT_NUMERIC);

return array_merge(...$callbacks);
$preCallbacks = array_merge([], ...array_filter($callbacks, function($priority) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if array_filter returns an empty array?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem, array_merge() returns an empty array then.
That’s why I use an empty array as first paramenter, the second parameter is optional.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's funny. I assume it would recursively merge the first array into itself if you don't provide more than one argument, but due to an empty array just nothing happens 😂

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

array_merge() with only one argument just returns the array without modifications.

@aschempp aschempp merged commit fc597f1 into aschempp:feature/tagged-callbacks Sep 26, 2018
aschempp added a commit that referenced this pull request Oct 10, 2018
Description
-----------

Same as with hooks, you can now tag services as DCA callbacks.

Example tags: 
 - `{ name: contao.callback, table: tl_page, target: config.onload }`
 - `{ name: contao.callback, table: tl_member_group, target: list.label.label }`
 - `{ name: contao.callback, table: tl_article, target: fields.inColumn.options }`
 - `{ name: contao.callback, table: tl_content, target: fields.headline.save, method: mySaveMethod }`

Same as with hooks, the method is automatically generated if not given. E.g. `onLoadCallback` or `onOptionsCallback`.

**ToDo:**
 - [x] Unit Tests

Commits
-------

6577835 Initial draft
fb308ff Correctly generate method name for callback
7e19274 Fixed getting first callable for singleton callbacks
15bd746 Added return type information for mixed method
246137e Actually register the compiler pass
08a3926 Added first round of unit tests
05243be Added remaining unit tests for listener
78792a7 Merge branch 'master' into feature/tagged-callbacks
fc597f1 Use references instead of array_replace_recursive() (#1)
7158ae1 CS Fixer
0501aa4 Correctly handle callbacks for wizard
878b095 Fix the coding style and remove an unrelated change
aschempp pushed a commit that referenced this pull request Mar 2, 2020
…es command (see contao#866)

Description
-----------

Together with @Toflar we had a hard time debugging why the `contao:resize-images` command stopped at some point and did not want to continue. The error message was quite unclear especially that the requested file existed:

```
6/77b26349-9084f1ba.jpg......... failed
Unable to open image /var/www/vhosts/domain.tld/httpdocs/releases/233/assets/images/../../var/pim-images/77b26349.jpg
```

So we decided to introduce an option that allows to output more verbose error message simply by executing command in verbose mode `contao:resize-images -v`:

```
f/8ac5c4ec-213df40b.jpg.............. failed

 [ERROR] ImagickException: cache resources exhausted
         `/var/www/vhosts/domain.tld/httpdocs/releases/233/assets/images/../../var/pim-images/8ac5c4ec.jpg' @
         error/cache.c/OpenPixelCache/3864 in
         /var/www/vhosts/domain.tld/httpdocs/releases/233/vendor/imagine/imagine/src/Imagick/Imagine.php:69
         Stack trace:
         #0 /var/www/vhosts/domain.tld/httpdocs/releases/233/vendor/imagine/imagine/src/Imagick/Imagine.php(69):
         Imagick->__construct('/var/www/vhosts...')
         #1 /var/www/vhosts/domain.tld/httpdocs/releases/233/vendor/contao/image/src/Resizer.php(93):
         Imagine\Imagick\Imagine->open('/var/www/vhosts...')
         #2 /var/www/vhosts/domain.tld/httpdocs/releases/233/vendor/contao/image/src/DeferredResizer.php(185):
         Contao\Image\Resizer->executeResize(Object(Contao\Image\Image), Object(Contao\Image\ResizeCoordinates),
         '/var/www/vhosts...', Object(Contao\Image\ResizeOptions))
         #3 /var/www/vhosts/domain.tld/httpdocs/releases/233/vendor/contao/image/src/DeferredResizer.php(108):
         Contao\Image\DeferredResizer->executeDeferredResize('f/8ac5c4ec-213d...', Array,
         Object(Imagine\Imagick\Imagine))
         #4
         /var/www/vhosts/domain.tld/httpdocs/releases/233/vendor/contao/core-bundle/src/Command/ResizeImagesComma
         nd.php(189): Contao\Image\DeferredResizer->resizeDeferredImage(Object(Contao\Image\DeferredImage), false)
         #5
         /var/www/vhosts/domain.tld/httpdocs/releases/233/vendor/contao/core-bundle/src/Command/ResizeImagesComma
         nd.php(166): Contao\CoreBundle\Command\ResizeImagesCommand->resizeImage('f/8ac5c4ec-213d...',
         Object(Symfony\Component\Console\Style\SymfonyStyle))
         #6 /var/www/vhosts/domain.tld/httpdocs/releases/233/vendor/symfony/console/Command/Command.php(255):
```

Commits
-------

e9c6de9 Allow to output more verbose error messages in contao:resize-images command
aschempp pushed a commit that referenced this pull request Mar 2, 2020
Description
-----------

The install procedure fails with a special character in the database password or username.

<img width="318" alt="Screen Shot 2020-01-19 at 18 08 16" src="https://user-images.githubusercontent.com/1284725/72686048-b0bd9d00-3af0-11ea-971a-54a44a1a30a5.png">

The [Symfony docs](https://symfony.com/doc/current/doctrine.html#configuring-the-database) state:
> If the username, password, host or database name contain any character considered special in a URI (such as +, @, $, #, /, :, *, !), you must encode them. See RFC 3986 for the full list of reserved characters or use the urlencode function to encode them. In this case you need to remove the resolve: prefix in config/packages/doctrine.yaml to avoid errors: url: '%env(resolve:DATABASE_URL)%'

This PR is this issue by encoding those parameters when building the DATABASE_URL.
I am not sure if this is the correct approach though.

TODO:
- [x] tests

Commits
-------

9744069 Fix url encoding in DATABASE_URL
f7c75c3 Add test set
074e86f Merge branch '4.9' into patch-4
2037a54 Do not encode hostname
5ab607b Also double encode % char in mailer url
83aad8e Merge remote-tracking branch 'origin/patch-4' into patch-4
76fb3e4 Fix contao#1217
756f4f9 Merge pull request #1 from contao/patch-4-patch
aschempp pushed a commit that referenced this pull request Jun 17, 2020
Description
-----------

| Q                | A
| -----------------| ---
| Fixed issues     | Fixes contao#1553 
| Docs PR or issue | -

This sets `tl_user.locked = 0` and `tl_user.loginCount = <defaultLoginCount>` when resetting the password. 

@leofeyer Do you want me to create another PR against the 4.9 branch that adapts the changes to use the new `loginAttempts` vs `loginCount` or do you do that yourself when merging? (imo it's a one liner there)

Commits
-------

a5c3777 reset lock + login count when resetting password
a609cdd Simplify the code
7d29603 Merge pull request #1 from leofeyer/fix/user-password-command

Simplify the code
aschempp pushed a commit that referenced this pull request Aug 4, 2020
Description
-----------

With @Toflar we have discovered by accident that if a URL is double-encoded (for some reason, doesn't matter) the Contao's `RouteProvider` will eventually throw an error trying to query a database.

```
URL original: drachenlochmuseum-v%25c3%25a4ttis.html
URL decoded: drachenlochmuseum-v%c3%a4ttis.html
URL decoded 2nd time: drachenlochmuseum-vättis.html
```

The decoded URL is used in the database query and that fails because the database driver would like to replace wildcards `%c` with parameters that were not provided.

Stack trace:

```
Exception: Too few arguments to build the query string
contao#27 vendor/contao/core-bundle/src/Resources/contao/library/Contao/Database/Statement.php(304): replaceWildcards
contao#26 vendor/contao/core-bundle/src/Resources/contao/library/Contao/Database/Statement.php(249): execute
contao#25 vendor/contao/core-bundle/src/Resources/contao/library/Contao/Model.php(1102): find
contao#24 vendor/contao/core-bundle/src/Resources/contao/library/Contao/Model.php(973): findBy
contao#23 vendor/contao/core-bundle/src/Framework/Adapter.php(38): __call
contao#22 vendor/contao/core-bundle/src/Routing/RouteProvider.php(493): findPages
contao#21 vendor/contao/core-bundle/src/Routing/RouteProvider.php(88): getRouteCollectionForRequest
contao#20 vendor/contao/core-bundle/src/Routing/LegacyRouteProvider.php(43): getRouteCollectionForRequest
contao#19 vendor/symfony-cmf/routing/src/NestedMatcher/NestedMatcher.php(141): matchRequest
contao#18 vendor/contao/core-bundle/src/Routing/Matcher/LegacyMatcher.php(69): matchRequest
contao#17 vendor/symfony-cmf/routing/src/DynamicRouter.php(271): matchRequest
contao#16 vendor/symfony-cmf/routing/src/ChainRouter.php(188): doMatch
contao#15 vendor/symfony-cmf/routing/src/ChainRouter.php(158): matchRequest
contao#14 vendor/symfony/http-kernel/EventListener/RouterListener.php(115): onKernelRequest
contao#13 vendor/symfony/event-dispatcher/EventDispatcher.php(212): doDispatch
#12 vendor/symfony/event-dispatcher/EventDispatcher.php(44): dispatch
#11 vendor/symfony/http-kernel/HttpKernel.php(126): handleRaw
#10 vendor/symfony/http-kernel/HttpKernel.php(67): handle
#9 vendor/symfony/http-kernel/Kernel.php(198): handle
#8 vendor/symfony/http-kernel/HttpCache/SubRequestHandler.php(85): handle
#7 vendor/symfony/http-kernel/HttpCache/HttpCache.php(448): forward
#6 vendor/symfony/framework-bundle/HttpCache/HttpCache.php(57): forward
#5 vendor/symfony/http-kernel/HttpCache/HttpCache.php(420): fetch
#4 vendor/contao/manager-bundle/src/HttpKernel/ContaoCache.php(46): fetch
#3 vendor/symfony/http-kernel/HttpCache/HttpCache.php(317): lookup
#2 vendor/symfony/http-kernel/HttpCache/HttpCache.php(192): handle
#1 vendor/friendsofsymfony/http-cache/src/SymfonyCache/EventDispatchingHttpCache.php(98): handle
#0 web/app.php(58): null
```

Commits
-------

8ae2582 Fix a potential error if the URL has percentage in it
8caaf25 Fix unit tests
509f762 Correctly encode the page aliases
aschempp pushed a commit that referenced this pull request Jun 4, 2021
Description
-----------

This is a POC (though thoroughly discussed with @aschempp so it's probably a bit more than just a POC :)) to have a new way to **add or change page meta data dynamically**.
This includes all the things like

* Changing the page tilte, description and robots meta content (included in this PR for demonstration purposes)
* Adding `<script>` tags on the fly (replacing `$GLOBALS['TL_JAVASCRIPT']`)
* Adding `<link>` tags on the fly (replacing `$GLOBALS['TL_CSS']` or `$GLOBALS['TL_HEAD']`)
* etc.

While discussing with @aschempp what all of this represents, we noticed that all of it is basically

> adding information to the future response which is not generated yet.

Examples:

* When you set `$objPage->pageTitle` you do so, because the `Response` has not been generated yet and you cannot set `<title>` right away.
* When you use `$GLOBALS['TL_JAVASCRIPT']` you do so, because there's no way for you to access the current `Response` and add this to the future HTML somehow because it's not even generated yet. 
* etc.

Moreover:

> You don't even know if a script, page title, page description etc. is even going to be used or if you potentially waste resources generating something that's then never required.

Hence, here's what we noticed: What we need is a **ResponseContext**.
A page controller cannot generate the `Response` for you beforehand but it can tell, what context is going to be applied and thus, what options you have:

* Is it a regular `WebpageContext` (terminology taken from schema.org) you're going to generate? So a typical HTML page? If so there sure is a `setTitle()` and a `setDescription()`.
* Is it an ESI fragment? It would probably use an `EsiContext` because `setTitle()` or `setDescription()` typically make no sense.

Proof (or rather, why we think) that this concept is going to work:

* It will play nicely with the future real page controllers, @aschempp is working on in contao#2015. The process for a page controller would be like so:
    1. Set the `ResponseContext` according to what the controller does. Will it output `XML` only? Then don't set it to `WebpageContext` because offering `setTitle()` and `setDescription()` makes no sense. But maybe something else makes sense? 
    2. Generate the modules, content elements (if you want to do that in your page type). Anything collected here will write to the `ResponseContext` if provided and implementing the correct interfaces.
    3. The resulting `ResponseContext` has to be applied to the final response by the page controller. It's entirely the developer's responsibility to apply this. In other words, as a developer you specify the `ResponseContext` you **are going to** to return. Then you generate code you **do not control** like third party modules which **have access to the current context and can thus decide what to do**. Finally, you apply the changes **you said you were going to pass on** to the final response.
* It also plays very nicely with the centralized JSON-LD PR proposed in contao#2962. I will update the PR shortly to show how this now works together beautifully. The context specifies that it understands JSON-LD which enables modules to access the `JsonLdManager` and add more information. And here's the beauty in this concept. Both, the `WebpageContext` as well as a possible `EsiContext` can implement the correct interface and thus **indicate to modules, elements, templates** that **they are going to** use this data. For the `WebpageContext` this is rather obvious because the data will be displayed before the closing `</body>` but JSON-LD works perfectly fine for an ESI fragment as well. You just have to make sure to output it inline. :-)

## Design decisions:

* The `ResponseContext` is deliberately optional. A page controller is not required to provide a `ResponseContext` at all. If there is none, then no module, content element etc. can add anything to the context which is the intended behaviour.
* There are multiple providers for different `ResponseContextInterface` implementations. These serve as factories. This enables container access, you'll see a use case in the JSON-LD PR where we need access to the EventDispatcher.
* The `WebpageContext` does not have any interface because I don't feel like it's worth it. I don't want to have 30 interfaces for every single feature a `ResponseContext` might support. We can still extract them in the future if we see that something can be re-used a lot across different contexts (such as JSON-LD in the other PR).

## Additional notes

* I've only replaced the deprecations in the `news-bundle` so far to show how easy it is to get rid of those and switch to the new context. We should ideally get rid of all deprecation notices but it's not a requirement to finish this PR.
* No unit tests so far as I would like to know if the Core team likes the concept first. I'll clean up afterwards.

Commits
-------

efb3272 Implemented POC for new ResponseContext concept
90af128 Example of how to get rid of deprecation notices and use the new concept within the news bundle
657406d Implemented ResponseContext factories to enable arbitrary services
4b706b3 Fixed BC
4042b44 Renamed method to be clear that this does not map the whole context but only the header bag
dcf8fb0 CS
131d470 Renamed context to be more precise
0941b6f Added unit tests
4773766 Merge branch '4.x' into feature/response-context
5e69b26 Ensure we have a completely empty header bag for the response context
e9b6dc2 Fixed namespace issue
bb3c494 Compatibility with lowest deps
83bbacc Only trigger deprecation notice if the properties are set on the global page object
58f3728 CS
44e2445 CS
e199e23 move psalm generics annotations from class to method level
9cb98df use real class for supports test
b20a48e Merge pull request #1 from m-vo/feature/reponse-context/psalm
97d6405 Implemented terminating a response context and dispatching a core event for that (totally optional)
8a16913 Add response to TerminateResponseContextEvent
8f41be7 Renamed methods
8901784 Do not set the response context again in PageRegular. It must be at the beginning of every controller.
3e07b34 Reworked concept again
bb5a70f Merge branch '4.x' into feature/response-context
deeab1a Make sure we set the current context in PageRegular not FrontendIndex
d829f75 Fixed missing robots support for ContaoWebpageResponseContext
eae2ddc Re-add finalize() method to ResponseContext interface
2373eac Merge branch '4.x' into feature/response-context

* 4.x:
  CS fixes for 4.x (see contao#3005)
a45772f CS
ec26b84 Merge branch '4.x' into feature/response-context
0dfab0b CS
753a048 Adjust the other classes as well
bd9a4a3 Remove the assertInstanceOf() check in the CoreResponseFactoryTest
@ausi ausi deleted the feature/tagged-callbacks branch December 3, 2021 14:48
leofeyer pushed a commit that referenced this pull request Mar 22, 2022
Description
-----------

-

Commits
-------

3ae08e7c Use phpunit/phpunit ^7.0 and some CS fixes
205e6af7 Updated license
4d722f22 Fixen die phpdoc
aschempp pushed a commit that referenced this pull request May 3, 2023
Description
-----------

`tl_content.html` is nullable and thus the following error can occur:

```
TypeError:
Contao\CoreBundle\Twig\Runtime\InsertTagRuntime::replaceInsertTags(): Argument #1 ($text) must be of type string, null given, called in var\cache\dev\twig\d3\d3515c7374c86e1675c9bdc71501583c.php on line 95

  at vendor\contao\contao\core-bundle\src\Twig\Runtime\InsertTagRuntime.php:33
  at Contao\CoreBundle\Twig\Runtime\InsertTagRuntime->replaceInsertTags(null)
     (var\cache\dev\twig\d3\d3515c7374c86e1675c9bdc71501583c.php:95)
  at __TwigTemplate_ec9b51ce37f7fdfbb114fb5f8d792795->block_html(array('type' => 'html', 'template' => 'content_element/html', … 
```

Commits
-------

220ea22 fix error in html template
aschempp pushed a commit that referenced this pull request Nov 13, 2023
Description
-----------

When you use the `{{form_session_data::*}}` insert tag the following error will occur:

```
TypeError:
Contao\CoreBundle\InsertTag\InsertTagResult::__construct(): Argument #1 ($value) must be of type Stringable|string, null given, called in vendor\contao\contao\core-bundle\src\InsertTag\Resolver\FormInsertTag.php on line 32

  at vendor\contao\contao\core-bundle\src\InsertTag\InsertTagResult.php:20
  at Contao\CoreBundle\InsertTag\InsertTagResult->__construct(null, object(OutputType))
     (vendor\contao\contao\core-bundle\src\InsertTag\Resolver\FormInsertTag.php:32)
  at Contao\CoreBundle\InsertTag\Resolver\FormInsertTag->replaceSessionData(object(ResolvedInsertTag))
     (vendor\contao\contao\core-bundle\src\InsertTag\InsertTagParser.php:419)
  at Contao\CoreBundle\InsertTag\InsertTagParser->renderSubscription(object(ResolvedInsertTag), false)
     (vendor\contao\contao\core-bundle\src\InsertTag\InsertTagParser.php:391)
  at Contao\CoreBundle\InsertTag\InsertTagParser->executeReplace(object(ParsedSequence), false, object(OutputType))
     (vendor\contao\contao\core-bundle\src\InsertTag\InsertTagParser.php:155)
  at Contao\CoreBundle\InsertTag\InsertTagParser->replaceInline('<p>{{form_session_data::foobar}}</p>')
     (vendor\contao\contao\core-bundle\src\Twig\Runtime\InsertTagRuntime.php:35)
  at Contao\CoreBundle\Twig\Runtime\InsertTagRuntime->replaceInsertTags('<p>{{form_session_data::foobar}}</p>')
     (var\cache\dev\twig\c0\c00587c3bfdf175108bed29053e23923.php:164)
```

Commits
-------

9698b1d fix type error in FormInsertTAg
leofeyer pushed a commit that referenced this pull request Jan 17, 2024
Description
-----------

If a `MAILER_DSN` environment variable is defined in the system, the `PluginTest` tests of the `contao/manager-bundle` will fail:

```
1) Contao\ManagerBundle\Tests\ContaoManager\PluginTest::testSetsTheMailerDsn with data set #0 ('mail', null, null, null, null, null, 'native://default')
Undefined array key "env(MAILER_DSN)"

vendor\contao\contao\manager-bundle\tests\ContaoManager\PluginTest.php:835

2) Contao\ManagerBundle\Tests\ContaoManager\PluginTest::testSetsTheMailerDsn with data set #1 ('sendmail', '127.0.0.1', null, null, 25, null, 'native://default')
Undefined array key "env(MAILER_DSN)"

vendor\contao\contao\manager-bundle\tests\ContaoManager\PluginTest.php:835
```

This PR fixes that by unsetting the env var (just like with the `DATABASE_URL` env var).

Commits
-------

cbf9bcb fix test when MAILER_DSN env var is defined
aschempp pushed a commit that referenced this pull request Apr 18, 2024
Description
-----------

We encountered an `ErrorException` when the page of external redirect type has an insert tag that returns an empty string.

The problem in fact happens in the `UrlHelper` component of Symfony, but I think we should fix it on our side nevertheless.

Stack trace:

```
ErrorException: Warning: Uninitialized string offset 0
contao#36 /vendor/symfony/http-foundation/UrlHelper.php(42): Symfony\Component\HttpFoundation\UrlHelper::getAbsoluteUrl
contao#35 /vendor/contao/core-bundle/src/Routing/Content/StringResolver.php(40): Contao\CoreBundle\Routing\Content\StringResolver::resolve
contao#34 /vendor/contao/core-bundle/src/Routing/ContentUrlGenerator.php(150): Contao\CoreBundle\Routing\ContentUrlGenerator::resolveContent
contao#33 /vendor/contao/core-bundle/src/Routing/ContentUrlGenerator.php(161): Contao\CoreBundle\Routing\ContentUrlGenerator::resolveContent
contao#32 /vendor/contao/core-bundle/src/Routing/ContentUrlGenerator.php(70): Contao\CoreBundle\Routing\ContentUrlGenerator::generate
contao#31 /vendor/contao/core-bundle/contao/modules/Module.php(349): Contao\Module::renderNavigation
contao#30 /vendor/contao/core-bundle/contao/modules/Module.php(326): Contao\Module::renderNavigation
contao#29 /vendor/contao/core-bundle/contao/modules/Module.php(326): Contao\Module::renderNavigation
contao#28 /vendor/contao/core-bundle/contao/modules/ModuleNavigation.php(82): Contao\ModuleNavigation::compile
contao#27 /vendor/contao/core-bundle/contao/modules/Module.php(213): Contao\Module::generate
contao#26 /vendor/contao/core-bundle/contao/modules/ModuleNavigation.php(45): Contao\ModuleNavigation::generate
contao#25 /vendor/contao/core-bundle/contao/library/Contao/Controller.php(410): Contao\Controller::getFrontendModule
…
#1 /vendor/friendsofsymfony/http-cache/src/SymfonyCache/EventDispatchingHttpCache.php(96): Contao\ManagerBundle\HttpKernel\ContaoCache::handle
#0 /public/index.php(42): null
```

Commits
-------

756336e Fix a potential issue if the insert tags return an empty string in th…
0a9330c Throw an exception if the insert tag returns an empty value
46de08e CS + Unit test
8952153 Rename the test method
aschempp added a commit that referenced this pull request May 27, 2024
…licating a page (see contao#7102)

Description
-----------

If a user who is not an admin copies a page, the articles (and thus all content) are no longer copied, as it was the case in Contao 4. Instead a new empty article is created.
This is because the check whether the user is allowed to create the articles depends on the pagemountCache in the BackendAccessVoter, which is only set once per request and user. 
As the page does not yet exist when the cache is first set and has not been reset after the page has been created, the check as to whether the user is allowed to access the newly created page fails.

This PR adds a check if a new page has been created before accessing the pagemountCache in the BackendAccessVoter and clears the cache if this is the case.


Steps to reproduce:

1. Login as a user without admin privileges
2. Copy and paste a page that has content elements in its article
3. The original article(s) will not be copied but a new one will be created

Commits
-------

45f2cbb Change pagemountCache structure in BackendAccessVoter
5257361 Store true/false in the pagemountsCache
c53c4e1 Merge pull request #1 from aschempp/fix/page-access
f30b8f0 Merge pull request #2 from lukasbableck/5.3
ed3f337 run rector
479dad1 run ecs fix
0c3bba2 Revert "Change pagemountCache structure in BackendAccessVoter"
d031b28 check if page is in pagemountsCache and rebuild cache if not before r…

Co-authored-by: aschempp <andreas.schempp@terminal42.ch>
aschempp pushed a commit that referenced this pull request Jun 3, 2024
…ontao#7248)

Description
-----------

If a `tl_article` record still contains `keywords` from previous Contao versions and you reference this article in an `article` content element, the following warning will appear in the back end:

```
ErrorException: Warning: Undefined global variable $TL_KEYWORDS
contao#24 /vendor/contao/core-bundle/src/Resources/contao/modules/ModuleArticle.php(207): Contao\ModuleArticle::compile
contao#23 /vendor/contao/core-bundle/src/Resources/contao/modules/Module.php(214): Contao\Module::generate
contao#22 /vendor/contao/core-bundle/src/Resources/contao/modules/ModuleArticle.php(70): Contao\ModuleArticle::generate
contao#21 /vendor/contao/core-bundle/src/Resources/contao/library/Contao/Controller.php(550): Contao\Controller::getArticle
contao#20 /vendor/contao/core-bundle/src/Resources/contao/elements/ContentArticle.php(30): Contao\ContentArticle::generate
contao#19 /vendor/contao/core-bundle/src/Resources/contao/library/Contao/Controller.php(622): Contao\Controller::getContentElement
contao#18 /var/cache/prod/contao/dca/tl_content.php(318): tl_content::addCteType
contao#17 /vendor/contao/core-bundle/src/Resources/contao/drivers/DC_Table.php(4717): Contao\DC_Table::parentView
contao#16 /vendor/contao/core-bundle/src/Resources/contao/drivers/DC_Table.php(313): Contao\DC_Table::showAll
contao#15 /vendor/contao/core-bundle/src/Resources/contao/classes/Backend.php(667): Contao\Backend::getBackendModule
contao#14 /vendor/contao/core-bundle/src/Resources/contao/controllers/BackendMain.php(168): Contao\BackendMain::run
contao#13 /vendor/contao/core-bundle/src/Controller/BackendController.php(49): Contao\CoreBundle\Controller\BackendController::mainAction
#12 /vendor/symfony/http-kernel/HttpKernel.php(163): Symfony\Component\HttpKernel\HttpKernel::handleRaw
#11 /vendor/symfony/http-kernel/HttpKernel.php(75): Symfony\Component\HttpKernel\HttpKernel::handle
#10 /vendor/symfony/http-kernel/Kernel.php(202): Symfony\Component\HttpKernel\Kernel::handle
#9 /vendor/symfony/http-kernel/HttpCache/SubRequestHandler.php(86): Symfony\Component\HttpKernel\HttpCache\SubRequestHandler::handle
#8 /vendor/symfony/http-kernel/HttpCache/HttpCache.php(481): Symfony\Component\HttpKernel\HttpCache\HttpCache::forward
#7 /vendor/symfony/framework-bundle/HttpCache/HttpCache.php(73): Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache::forward
#6 /vendor/symfony/http-kernel/HttpCache/HttpCache.php(454): Symfony\Component\HttpKernel\HttpCache\HttpCache::fetch
#5 /vendor/contao/manager-bundle/src/HttpKernel/ContaoCache.php(66): Contao\ManagerBundle\HttpKernel\ContaoCache::fetch
#4 /vendor/symfony/http-kernel/HttpCache/HttpCache.php(348): Symfony\Component\HttpKernel\HttpCache\HttpCache::lookup
#3 /vendor/symfony/http-kernel/HttpCache/HttpCache.php(226): Symfony\Component\HttpKernel\HttpCache\HttpCache::handle
#2 /vendor/friendsofsymfony/http-cache/src/SymfonyCache/EventDispatchingHttpCache.php(96): Contao\ManagerBundle\HttpKernel\ContaoCache::handle
#1 /web/index.php(44): require
#0 /web/app.php(13): null
```

This is because `$GLOBALS['TL_KEYWORDS']` is only initialised in the front end within `PageRegular::prepare()`. This PR simply ignores it if not set.

Commits
-------

e54dc2b fix warning when legacy keywords are present
aschempp added a commit that referenced this pull request Jun 15, 2024
…ontao#7268)

Description
-----------

Got this erro in my logs:

```
RuntimeException: The Symfony container is not available, did you initialize the Contao framework? in vendor/contao/core-bundle/contao/library/Contao/System.php:143 Stack trace:
#0 vendor/contao/core-bundle/contao/library/Contao/System.php(97): Contao\System->import('Contao\\Config', 'Config')
#1 vendor/contao/core-bundle/contao/library/Contao/DcaExtractor.php(105): Contao\System->__construct()
#2 vendor/contao/core-bundle/contao/library/Contao/DcaExtractor.php(140): Contao\DcaExtractor->__construct('tl_opt_in')
#3 vendor/contao/core-bundle/contao/library/Contao/Model.php(291): Contao\DcaExtractor::getInstance('tl_opt_in')
#4 vendor/contao/core-bundle/contao/library/Contao/Model.php(1084): Contao\Model::getUniqueFields()
#5 vendor/contao/core-bundle/contao/models/OptInModel.php(87): Contao\Model::findBy(Array, 1716888783, Array)
#6 vendor/contao/core-bundle/src/Framework/Adapter.php(38): Contao\OptInModel::findExpiredTokens()
#7 vendor/contao/core-bundle/src/OptIn/OptIn.php(76): Contao\CoreBundle\Framework\Adapter->__call('findExpiredToke...', Array)
#8 vendor/contao/core-bundle/src/Cron/PurgeOptInTokensCron.php(30): Contao\CoreBundle\OptIn\OptIn->purgeTokens()
#9 vendor/contao/core-bundle/src/Cron/CronJob.php(44): Contao\CoreBundle\Cron\PurgeOptInTokensCron->__invoke('cli')
#10 vendor/contao/core-bundle/src/Cron/Cron.php(197): Contao\CoreBundle\Cron\CronJob->__invoke('cli')
#11 vendor/contao/core-bundle/src/Cron/Cron.php(182): Contao\CoreBundle\Cron\Cron->executeCrons(Array, 'cli', Object(Closure))
#12 vendor/contao/core-bundle/src/Cron/Cron.php(97): Contao\CoreBundle\Cron\Cron->doRun(Array, 'cli', false)
contao#13 vendor/contao/core-bundle/src/Command/CronCommand.php(53): Contao\CoreBundle\Cron\Cron->run('cli', false)
contao#14 vendor/symfony/console/Command/Command.php(326): Contao\CoreBundle\Command\CronCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
contao#15 vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
contao#16 vendor/symfony/framework-bundle/Console/Application.php(126): Symfony\Component\Console\Application->doRunCommand(Object(Contao\CoreBundle\Command\CronCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
contao#17 vendor/symfony/console/Application.php(324): Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand(Object(Contao\CoreBundle\Command\CronCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
contao#18 vendor/symfony/framework-bundle/Console/Application.php(80): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
contao#19 vendor/symfony/console/Application.php(175): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
contao#20 vendor/contao/manager-bundle/bin/contao-console(40): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput))
contao#21 vendor/bin/contao-console(119):  contao#22
```

Commits
-------

9ee76a0 Initialize the Contao framework when working with opt-in tokens
leofeyer added a commit that referenced this pull request Aug 21, 2024
…ontao#7367)

Description
-----------

In Contao 5 if there is enough content in an element for its height to be limited, the content overlaps the .limit_toggler. This makes the toggler very hard to see. Also the content is cut off right at the border.
With this PR it looks more like Contao 4.13 again, but with a gradient at the bottom.

C4.13
<img width="706" alt="image" src="https://github.com/user-attachments/assets/581a475c-ba75-4039-8bbd-94d693bd0db2">

C5.3 currently
<img width="897" alt="image" src="https://github.com/user-attachments/assets/419115bc-0c4e-4035-b5fb-5b58ec755769">

C5.3 with this change
see contao#7367 (comment)

Commits
-------

7fd8ffc Add z-index to .limit_toggler
5c8630d Add gradient to .limit_toggler and border to button
b93646a Fix .limit_toggler background gradient on hover
ea9decd only set background gradient on .limit_toggler if target is collapsed
1173d47 Update core-bundle/contao/themes/flexible/styles/main.css
cf4c30a Consider hover-background on limit-toggler gradient
b5ba8d8 Gradient adjustments for better visibility
525babc Merge pull request #1 from zoglo/fix/limit-toggler-visibility
33e3dbf Remove border from `limit-toggler`
b0a80fe Rebuild the assets

Co-authored-by: zoglo <55794780+zoglo@users.noreply.github.com>
Co-authored-by: leofeyer <1192057+leofeyer@users.noreply.github.com>
aschempp pushed a commit that referenced this pull request Oct 1, 2024
Description
-----------

Implements contao#7271

Commits
-------

2bc4301 Update swiper.html.twig
d8d36d1 Update swiper.html.twig
c6d2885 Revert "Update swiper.html.twig"
a0ce54a build slider_settings in controller
29ef7f7 remove asset
48ce730 fix typo
51e767f Merge pull request #1 from fritzmg/swiper-7470
c1364ea remove asset
6a2111d fix test
d9cdb37 update assets
516970e rename variable
9403040 Merge remote-tracking branch 'origin/5.x' into 7470-fix-ci
0ba3867 Merge pull request #2 from fritzmg/7470-fix-ci
63d9874 added comment with example swiper.html.twig
9990937 correcting some space swiper.html.twig
61c6e12 Update core-bundle/contao/templates/twig/content_element/swiper.html.…
30bc355 Remove the old data attributes
0f1d999 Fix the unit test

Co-authored-by: fritzmg <fmg@inspiredminds.at>
Co-authored-by: leofeyer <1192057+leofeyer@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants