- Sep 15, 2024
-
-
Elias Häußler authored
The TSFE->cacheExpires property was removed in #102422. This patch removes an existing property access and replaces it with its successor in PrepareTypoScriptFrontendRendering middleware. Resolves: #104975 Related: #102422 Releases: main Change-Id: I106209ac5aa896abdd7838f6922cbb20f8411106 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/86105 Reviewed-by:
Anja Leichsenring <aleichsenring@ab-softlab.de> Tested-by:
Stefan Bürk <stefan@buerk.tech> Tested-by:
core-ci <typo3@b13.com> Reviewed-by:
Stefan Bürk <stefan@buerk.tech> Tested-by:
Anja Leichsenring <aleichsenring@ab-softlab.de>
-
- Sep 14, 2024
-
-
Sascha Nowak authored
A new API has been introduced to collect cache tags and their lifetime during frontend rendering. This API is used in the core to collect cache tags from page cache and content object cache. The API is implemented as a new PSR-7 request attribute `frontend.cache.collector` to remove the dependency from TSFE. Every cache tag has a lifetime. The minimum lifetime is calculated from all given cache tags. API users don't have to deal with it individually. The default lifetime for a cache tag is 86400 seconds (24 hours). The current TSFE api is deprecated in favor of the new API as the current API implementation does not allow to set a lifetime and extension authors have to workaround it. The TSFE api will be removed with the next major version. The frontend employs the following strategy: A relatively early middleware adds an empty new cacheDataCollector instance as attribute to request. Extensions rendering code based on database records can then add cache tags to this attribute. The FE rendering adds the final cache content, the middleware then compiles the final cache entries and triggers their persistence. There is an additional event `AddCacheTagEvent` the middleware listens to. It allows adding cache tags at places where the request is not available. This is a tribute to technical debt that can not be avoided at the moment. That event is however marked `@internal` and may vanish later. Resolves: #102422 Releases: main Change-Id: Ice7b3b8aba7c4df3e48d3895d6388f5641fdad63 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81801 Tested-by:
Torben Hansen <derhansen@gmail.com> Tested-by:
Benjamin Franzke <ben@bnf.dev> Reviewed-by:
Stefan Bürk <stefan@buerk.tech> Reviewed-by:
Benjamin Franzke <ben@bnf.dev> Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by:
Torben Hansen <derhansen@gmail.com> Tested-by:
Stefan Bürk <stefan@buerk.tech> Tested-by:
Guido Schmechel <guido.schmechel@brandung.de> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch> Tested-by:
core-ci <typo3@b13.com> Reviewed-by:
Guido Schmechel <guido.schmechel@brandung.de> Reviewed-by:
Benni Mack <benni@typo3.org> Tested-by:
Sascha Nowak <typo3@saschanowak.me> Reviewed-by:
Sascha Nowak <typo3@saschanowak.me>
-
- Sep 10, 2024
-
-
Thomas Hohn authored
If the 'contentSecurityPolicies' value is not filled properly in the site configuration, the call to $site->getConfiguration()['contentSecurityPolicies'] will fail. The access should we guarded with a null coalescing operator. Resolves: #104873 Releases: main, 12.4 Change-Id: Ie49a25d8ca9a194629c4a389b17b299091d44031 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/85977 Reviewed-by:
Garvin Hicking <gh@faktor-e.de> Tested-by:
Benni Mack <benni@typo3.org> Tested-by:
core-ci <typo3@b13.com> Tested-by:
Garvin Hicking <gh@faktor-e.de> Reviewed-by:
Benni Mack <benni@typo3.org>
-
- Aug 28, 2024
-
-
Oliver Hader authored
+ new feature flag `security.frontend.reportContentSecurityPolicy`, to be used next to `security.frontend.enforceContentSecurityPolicy`, resulting in `Content-Security-Policy-Report-Only` and/or `Content-Security-Policy` HTTP headers + new `enforce` and `report` segments in `csp.yaml` site config + possibility to disable CSP for a particular site by either setting `active: false` in the `csp.yaml` site config + allows having the HTTP headers `Content-Security-Policy` and `Content-Security-Policy-Report-Only` side-by-side in the frontend Resolves: #101580 Resolves: #104549 Releases: main, 12.4 Change-Id: I8c1a8305702629eac1bfedddbecbc19b452fd500 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/85632 Tested-by:
Benjamin Franzke <ben@bnf.dev> Reviewed-by:
Garvin Hicking <gh@faktor-e.de> Tested-by:
Oliver Hader <oliver.hader@typo3.org> Tested-by:
core-ci <typo3@b13.com> Tested-by:
Garvin Hicking <gh@faktor-e.de> Reviewed-by: ...
-
- Aug 15, 2024
-
-
Oliver Hader authored
Aims to combine disabling site-specific CSP with report-only mode later. This reverts commit acf70306. Reverts: #104549 Resolves: #104633 Releases: main, 12.4 Change-Id: I651f60d7b5cc24133801412c8f09b1efba98d3f4 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/85646 Reviewed-by:
Garvin Hicking <gh@faktor-e.de> Tested-by:
Oliver Hader <oliver.hader@typo3.org> Reviewed-by:
Oliver Hader <oliver.hader@typo3.org> Tested-by:
Garvin Hicking <gh@faktor-e.de>
-
- Aug 14, 2024
-
-
Oliver Hader authored
This change allows to disable CSP headers for a particular site configured in `sites/<my-site>/csp.yaml` by using the assignment `enable: false`. Resolves: #104549 Releases: main, 12.4 Change-Id: I9e17b5658610e5d47915a5e45ca6a33a870e8d76 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/85591 Reviewed-by:
Stefan Bürk <stefan@buerk.tech> Reviewed-by:
Garvin Hicking <gh@faktor-e.de> Tested-by:
Oliver Hader <oliver.hader@typo3.org> Tested-by:
Georg Ringer <georg.ringer@gmail.com> Tested-by:
Garvin Hicking <gh@faktor-e.de> Reviewed-by:
Georg Ringer <georg.ringer@gmail.com> Reviewed-by:
Oliver Hader <oliver.hader@typo3.org> Tested-by:
core-ci <typo3@b13.com> Tested-by:
Stefan Bürk <stefan@buerk.tech>
-
- Jul 23, 2024
-
-
Georg Ringer authored
Provide a new type of static routes `assets` to expose assets shipped by extensions. Resolves: #101472 Releases: main Change-Id: I46d5b8af795b1037c6a3e2554454df6a6e7174ea Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/85268 Reviewed-by:
Georg Ringer <georg.ringer@gmail.com> Tested-by:
Benni Mack <benni@typo3.org> Tested-by:
Garvin Hicking <gh@faktor-e.de> Tested-by:
Georg Ringer <georg.ringer@gmail.com> Reviewed-by:
Benni Mack <benni@typo3.org> Tested-by:
core-ci <typo3@b13.com> Reviewed-by:
Garvin Hicking <gh@faktor-e.de>
-
- Jun 26, 2024
-
-
Oliver Bartsch authored
For additional context does the PolicyMutatedEvent now provide the current PSR-7 Request. Resolves: #104141 Releases: main, 12.4 Change-Id: I1817366e77f20f6c43eef0ee209fbb419e7237e2 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/84913 Tested-by:
Oliver Bartsch <bo@cedev.de> Reviewed-by:
Oliver Bartsch <bo@cedev.de> Reviewed-by:
Georg Ringer <georg.ringer@gmail.com> Tested-by:
Benni Mack <benni@typo3.org> Tested-by:
core-ci <typo3@b13.com> Reviewed-by:
Benni Mack <benni@typo3.org> Tested-by:
Georg Ringer <georg.ringer@gmail.com>
-
- May 27, 2024
-
-
Christian Kuhn authored
Using PHP attributes to configure DI within classes directly is more easy to understand since developers don't need to constantly look up DI configuration Services.yaml files, but have everything in one place. The patch switches all classes that previously used '@cache.xy' to get a specific cache injected to an `Autowire` attribute. Resolves: #103921 Releases: main Change-Id: I16b064242cdbc2bbcfbed89700c97afac012fdf8 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/84406 Tested-by:
Benjamin Franzke <ben@bnf.dev> Reviewed-by:
Stefan Bürk <stefan@buerk.tech> Reviewed-by:
Benjamin Franzke <ben@bnf.dev> Tested-by:
core-ci <typo3@b13.com> Tested-by:
Stefan Bürk <stefan@buerk.tech>
-
- Apr 12, 2024
-
-
Georg Ringer authored
`DateTimeImmutable::setTimestamp()` requires the timestamp to be an integer. Resolves: #103588 Related: #99627 Related: #98045 Releases: main, 12.4, 11.5 Change-Id: I2dba1b3836063872fa04ea38d58b5bd499a8f7d1 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83742 Reviewed-by:
Stefan Bürk <stefan@buerk.tech> Tested-by:
Georg Ringer <georg.ringer@gmail.com> Reviewed-by:
Georg Ringer <georg.ringer@gmail.com> Reviewed-by:
Rafał Jania <rr.jania@gmail.com> Tested-by:
Rafał Jania <rr.jania@gmail.com> Tested-by:
Stefan Bürk <stefan@buerk.tech> Tested-by:
core-ci <typo3@b13.com> Tested-by:
Simon Schaufelberger <simonschaufi+typo3@gmail.com> Reviewed-by:
Oliver Klee <typo3-coding@oliverklee.de> Tested-by:
Oliver Klee <typo3-coding@oliverklee.de> Reviewed-by:
Simon Schaufelberger <simonschaufi+typo3@gmail.com>
-
- Apr 07, 2024
-
-
Markus Klein authored
As documented by PHP, `\DateTime` or `\DateTimeImmutable` objects created with a timestamp only ('@12345678') as the first constructor argument will use UTC as TimeZone. Creating an object instance without any constructor arguments will use the `date_default_timezone_get()` timezone for the object - and setting the timestamp using `setTimestamp()` will not change the object's timezone. That means, that formatting the value will be done using the object Timezone and **NOT** the default PHP Timezone (`date_default_timezone_get()`). Consequently, this may lead to wrong interpretation of the displayed formatted value in the context of another timezone - if no timezone information (+0000/-0100) is included. This change streamlines this for a couple of places were it is expected to format date, datetime or time values for the current context timezone by ensuring objects get the current timezone set instead of `UTC`. Note: Changing the date default timezone on the fly after an object has been created will show a similar effect like using constructor values, even if the object has been created by using the `setTimestamp()` method. [1] https://3v4l.org/sGEe2 Resolves: #98045 Resolves: #99627 Releases: main, 12.4, 11.5 Change-Id: I095a0b0b376361e25396647d02727ac08f35cae0 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81915 Tested-by:
Garvin Hicking <gh@faktor-e.de> Reviewed-by:
Garvin Hicking <gh@faktor-e.de> Tested-by:
core-ci <typo3@b13.com> Tested-by:
Oliver Klee <typo3-coding@oliverklee.de> Reviewed-by:
Andreas Wolf <andreas.wolf@typo3.org> Tested-by:
Stefan Bürk <stefan@buerk.tech> Reviewed-by:
Stefan Bürk <stefan@buerk.tech> Reviewed-by:
Oliver Klee <typo3-coding@oliverklee.de>
-
Benjamin Franzke authored
TYPO3 sites are enhanced to be able to operate as TypoScript templates. They act similar to sys_template records with "clear" and "root" flags set. By design a site TypoScript provider always defines a new scope (root-flag) and does not inherit from parent sites (in the rootline). That means it behaves as if the clear-flag is set in a sys_template record. This behavior is not configurable by design, as TypoScript code sharing is intended to be implemented via sharable sets (introduced in #103437). TypoScript dependencies can be included via sets dependencies. This mechanism supersedes the previous static_file_include's or manual `@import` statements (they are still fine for local includes, but should be avoided for cross-set/extensions dependencies), as sets are automatically ordered and deduplicated. Resolves: #103439 Releases: main Change-Id: I971743fc551e51d945f45335dc6ad76404c6edba Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83119 Tested-by:
Benjamin Kott <benjamin.kott@outlook.com> Reviewed-by:
Benjamin Franzke <ben@bnf.dev> Reviewed-by:
Benni Mack <benni@typo3.org> Tested-by:
core-ci <typo3@b13.com> Tested-by:
Benjamin Franzke <ben@bnf.dev> Tested-by:
Benni Mack <benni@typo3.org> Reviewed-by:
Benjamin Kott <benjamin.kott@outlook.com>
-
- Mar 19, 2024
-
-
Christian Kuhn authored
In version 12, the introduction of the new TypoScript parser was accompanied by the implementation of factories for PageTsConfig and UserTsConfig. A factory for Frontend TypoScript has not been added, though: Frontend TypoScript creation ended up in TSFE->getFromCache(). At this point, establishing a proper factory was unfeasible due to the numerous dependencies of TypoScript creation to TSFE internals. With recent refactorings around TSFE, coupled with lots of state now being represented as request attributes, it's now possible to decompose getFromCache() and establish a FrontendTypoScriptFactory. getFromCache() is a complex beast: It influences Frontend rendering performance a lot, and tries to trigger the least amount of calculations, especially in 'fully cached pages' context. This results in high required complexity due to lots of state with diverse cross dependencies. The method composes of three main steps: 1. Bootstrap TypoScript setting ("constants") and calculate setup condition verdicts. This creates required TypoScript related state needed to calculate the page cache identifier. 2. Access page cache, lock page rendering if needed, and see if a possible page cache content contains uncached ("_INT") sections. 3. Calculate at least setup "config." depending on given type/typeNum, but create full TypoScript setup if a cached page contains uncached sections or could not be retrieved from cache. The patch extracts parts 1 and 3 to FrontendTypoScriptFactory. Part 2 is moved into PrepareTypoScriptFrontendRendering middleware. This approach allowed these related refactorings: * The release of rendering locks is now consolidated within the PrepareTypoScriptFrontendRendering middleware. This guarantees locks are released, even in scenarios where lower middleware components encounter errors. This addresses an issue where locks retained during crashes, leading to deadlock situations in subsequent requests. * Dependencies to TSFE within ext:redirects RedirectService are reduced, and it no longer locks page rendering. * The Extbase BackendConfigurationManager utilizes the new factory, eliminating the need for its own implementation. The patch unlocks further refactorings: It especially allows removing the cache related properties from TSFE by representing them as request attributes. Subsequent patches will address this task accordingly. Resolves: #103410 Related: #97816 Related: #98914 Related: #102932 Releases: main Change-Id: I7fd158cffeebe6b2c64e0e3595284b8780fb73cf Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83179 Tested-by:
Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by:
Stefan Bürk <stefan@buerk.tech> Reviewed-by:
Garvin Hicking <gh@faktor-e.de> Tested-by:
Stefan Bürk <stefan@buerk.tech> Tested-by:
core-ci <typo3@b13.com> Tested-by:
Garvin Hicking <gh@faktor-e.de> Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch>
-
- Mar 08, 2024
-
-
Benni Mack authored
All PageTsConfig options are now in DrawingConfiguration and named properly. All plain labels are now moved to Fluid directly via <f:translate> Random id="{uniqueId}" are removed from markup, reducing the usages to the AbstractGridObject, which hopefully will vanish in the near future. RecordRememberer is a singleton and injected as much as possible. The "languageMode" is now resolved into a PageViewMode enum. Resolves: #103345 Releases: main Change-Id: I78f33fed409db2a1c5528e734ed19ad67aeb4e89 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83322 Reviewed-by:
Nikita Hovratov <nikita.h@live.de> Tested-by:
Benni Mack <benni@typo3.org> Reviewed-by:
Benni Mack <benni@typo3.org> Tested-by:
core-ci <typo3@b13.com> Tested-by:
Andreas Kienast <a.fernandez@scripting-base.de> Reviewed-by:
Andreas Kienast <a.fernandez@scripting-base.de> Tested-by:
Nikita Hovratov <nikita.h@live.de>
-
- Mar 07, 2024
-
-
Christian Kuhn authored
It was never clear if and why typeNum needs to be a number. With recent TSFE refactorings, it becomes more clear we can easily allow strings. The patch adapts this as covers various scenarios around PAGE determination with functional tests. Resolves: #103321 Releases: main Change-Id: I8320129e25acbc1ef3c1dd52ec267608b12c4494 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83305 Reviewed-by:
Benni Mack <benni@typo3.org> Tested-by:
core-ci <typo3@b13.com> Reviewed-by:
Stefan Bürk <stefan@buerk.tech> Tested-by:
Benni Mack <benni@typo3.org> Tested-by:
Stefan Bürk <stefan@buerk.tech>
-
- Jan 29, 2024
-
-
Benni Mack authored
The TimeTracker exists for a very long time and did not receive much love over the years. It comes with fishy internal structures and needs a bigger overhaul. While various parts throughout the core and extensions actively use the "write" API - push(), pull() and setTSlogMessage() - the "init" API is only used by middlewares and the "read" and "print" API only by EXT:adminpanel. The patch moves the "print" related methods to the admin panel extension as is, and declares everything except the "write" methods `@internal`. This allows future refactoring of the now internal data structures and API. Resolves: #102976 Releases: main Change-Id: Ida37154a71dd4b04cb5bcea79208824f4e6f4293 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82677 Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch> Tested-by:
Stefan Bürk <stefan@buerk.tech> Tested-by:
core-ci <typo3@b13.com> Reviewed-by:
Stefan Bürk <stefan@buerk.tech> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch>
-
- Jan 26, 2024
-
-
Christian Kuhn authored
Frontend TypoScript has two special details, next to 'configuration' ("constants") and 'setup'. First, there is the determined "PAGE" object that depends on type / typeNum. It allows to render multiple different variants of a pages content. Historically, this has often been a "print" view, nowadays, this is usually a "json" variant, or some XML for sitemaps. A frontend is not rendered without a proper PAGE object. The FE rendering chain determines the given 'type' and maps it to a configured PAGE with this 'typeNum', defaulting to zero '0'. The patch models the determined PAGE object to the Request attribute 'FrontendTypoScript' now, which is used by FE RequestHandler to manage rendering of this PAGE type. Second special thing is 'config' TypoScript as top-level 'config' settings. Those can be overridden by the specific PAGE object (often 'page.config'). A typical use case is 'json.config.disableAllHeaderCode = 1'. This "merged" 'config' array has been available as TSFE->config['config'] before. The patch makes the merged config available in the 'FrontendTypoScript' object as well, available in the Request object as 'frontend.typoscript' attribute. The patch adapts all usages of TSFE->config['config'] to the attribute. There is a special quirk with 'config': This part of TypoScript 'setup' is so important, that it needs to be available in 'fully cached page' scenarios as well, to for instance decide if a content-length header should be added to the response. This has been the reason 'config' has been cached along with page cache content in 'page' cache before. The patch changes this and adds dedicated cache entries for 'merged config' in the (file based) 'typoscript' cache. This reduces page cache size a bit and allows re-using these 'config' cache accross different pages when they are identical, which is determined by the cache identifiers. All these changes are logical follow-ups to the TypoScript parser that has been implemented with v12. They pave the way to extract TypoScript calculation from TypoScriptFrontendController with upcoming patches. Next to this refactoring, the existing hooks in this area had to fall, especially to get rid of their dependency to "pObj" TypoScriptFrontendController. They are mostly substituted by new events, details are documented with the .rst files and class comments. The patch reduces usages of $GLOBALS['TSFE'] and usages of TypoScriptFrontendController in general. $GLOBALS['TSFE']->config['config'] is still available as b/w compat layer (a dedicated deprecation will follow), but core usages have been removed. This became a bit complicated with TimeTrackerInitialization and WorkspacePreview middlewares: Both are run before the final TypoScript 'config' is determined, so they do not have that attribute attached to their incoming Request. But they still need to know TS 'config' details to decide on details *after* calling lower handle() middlewares. They by now accessed $GLOBALS['TSFE'], which is (still) set by a lower middleware. To avoid this indirect state usage, these middlewares now register an event listener that is dispatched after TypoScript 'config' has been determined, and set local state to know if they should add additional Response data. Resolves: #102932 Releases: main Change-Id: I8282f7a93fe9594e78865db63a3e656cc4d5f8da Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82522 Tested-by:
Stefan Bürk <stefan@buerk.tech> Tested-by:
Benni Mack <benni@typo3.org> Reviewed-by:
Benni Mack <benni@typo3.org> Reviewed-by:
Stefan Bürk <stefan@buerk.tech> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch> Tested-by:
core-ci <typo3@b13.com> Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch>
-
- Jan 19, 2024
-
-
Christian Kuhn authored
FE knows two root lines: TSFE->rootLine, which is the 'full' path to pid 0, and TSFE->config['rootLine'], which is only the 'local' path to the 'root' sys_template record. The full root line is already PageInformation->getRootLine(), created by 'TypoScriptFrontendInitialization' middleware. The very next middleware 'PrepareTypoScriptFrontendRendering' then gets sys_template records and calculates the local root line. The patch relocates sys_template fetching and calculation of the local root line to 'TypoScriptFrontendInitialization', now additionally handled in PageInformationFactory. Both sys_template rows and the local root line are now modeled in PageInformation, which is already attached as 'frontend.page.information' Request attribute. Both root lines are now parellal to each other in the same object, making the entire thing hopefully more easy to understand. Usages are adapted accordingly, further reducing dependencies to TSFE. Note the sys_template row getter is marked @internal since extensions usually don't need to mess around with this. As a side effect, the local root line is no longer cached in page cache: Caching this was duplicate data since sys_template rows need to be fetched for *every* call, and deriving local root line is quick and trivial. This slightly reduces the size of the page cache for a calculation that happens anyway. Resolves: #102873 Releases: main Change-Id: I79c1c138c6ae43fb67dca0d056f67c3c24266f5f Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82517 Tested-by:
core-ci <typo3@b13.com> Reviewed-by:
Stefan Bürk <stefan@buerk.tech> Reviewed-by:
Benni Mack <benni@typo3.org> Reviewed-by:
Sascha Nowak <sascha.nowak@netlogix.de> Tested-by:
Stefan Bürk <stefan@buerk.tech> Tested-by:
Benni Mack <benni@typo3.org>
-
Christian Kuhn authored
Next logical step on the 'get rid of TSFE' path: Avoid the @internal public getters getSite() and getLanguage(), retrieve them from the Request where needed instead. By additionally avoiding already unused PageArguments, TSFE __construct() no longer needs manual arguments. Resolves: #102868 Releases: main Change-Id: I395cc1d628174df657edc1332c703a4aa84666b5 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82510 Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch> Tested-by:
core-ci <typo3@b13.com> Reviewed-by:
Nikita Hovratov <nikita.h@live.de> Tested-by:
Stefan Bürk <stefan@buerk.tech> Reviewed-by:
Stefan Bürk <stefan@buerk.tech> Tested-by:
Oliver Klee <typo3-coding@oliverklee.de>
-
- Jan 18, 2024
-
-
Christian Kuhn authored
This patch is the result of a careful refactoring of the TypoScriptFrontendInitialization 'body' methods. The patch establishes the new PageInformationFactory which does all the main lifting. It either returns the verified PageInformation object, or throws an early dedicated exception carrying a response from the ErrorController when something went wrong (access checks, language overlays ...), or a StatusException when ErrorController itself error'ed. When PageInformation could be determined, rendering is dispatched to middlewares below. In case of error, the code flow is streamlined to always *return* the early response, so upper middlewares can kick in. This was a mixed bag before, where such exceptions sometimes bubbled up, skipping upper middlewares. While most error scenarios are covered by the complex 'SiteHandling' related functional tests already, a set of simple additional tests is set up to check for casual things in a more obvious way. Note the internal code flow within PageInformationFactory can still be simplified and disentangled some more, but the outer class communication is fine now and the internal handling is already much more easy to follow. As drive-by, @internal getUriToCurrentPageForRedirect() is moved from TSFE to the consuming 'shortcut and mountpoint redirect' middleware. The patch also outlines flaws of the PageRepository strategy, that becomes obvious after disentangling the consuming code. It adds a todo on how PageRepository could be improved. We should follow this path soon, since the entire area with all the access and logic checks is security relevant: We want to end up with code that is as easy to grasp and follow as possible. Resolves: #102856 Related: #102715 Releases: main Change-Id: Icf65dd21ced16af521735f9af003b65ec94909c9 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82452 Tested-by:
core-ci <typo3@b13.com> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by:
Benni Mack <benni@typo3.org> Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch> Tested-by:
Stefan Bürk <stefan@buerk.tech> Reviewed-by:
Stefan Bürk <stefan@buerk.tech> Tested-by:
Benni Mack <benni@typo3.org>
-
linawolf authored
If you happen to have inconsistent data in the config.yaml like: ``` routes: - route: robots.txt type: staticText source: 'EXT:my_sitepackage_mysite/Resources/Public/robots.txt' ``` Currently a PHP type error is thrown instead of a proper exception. Resolves: #102773 Releases: main, 12.4 Change-Id: If16a93b851237c9d39893cd3e56fa9693986721d Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82367 Reviewed-by:
Oliver Klee <typo3-coding@oliverklee.de> Tested-by:
core-ci <typo3@b13.com> Tested-by:
Benjamin Franzke <ben@bnf.dev> Reviewed-by:
Benjamin Franzke <ben@bnf.dev>
-
- Jan 12, 2024
-
-
Christian Kuhn authored
This removes usages of those properties from TSFE that have been modeled as PageInformation object attached to the Request as attribute 'frontend.page.information' with #102715. The patch is relatively intrusive since especially TSFE->page and TSFE->id were frequently consumed properties. It however allows us to reduce dependencies to TSFE quite significantly, the number of calls to $GLOBALS['TSFE'] shrinks. It also shows that we still have a couple of constructs that need to get the Request hand over, in particular the data processors and more importantly the LinkFactory and link builders: Those tend to either get the Request using "parent" ContentObjectRenderer->getRequest() (that method should be declared protected later) or from $GLOBALS['TYPO3_REQUEST']. We accept this for now since using $GLOBALS['TYPO3_REQUEST'] is at least less worse than using $GLOBALS['TSFE']. A dedicated patch will resolve that situation later, though. Note most remaining use TSFE->config, especially TSFE->config['config']. To model this in a good way, we need a preparation within the TypoScript calculation in getFromCache(), which will be a target of one of the next patches. Resolves: #102824 Related: #102715 Releases: main Change-Id: I9336b4215155eb53422016254f8ef2edb0ee86cf Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82416 Reviewed-by:
Benni Mack <benni@typo3.org> Tested-by:
Benni Mack <benni@typo3.org> Reviewed-by:
Nikita Hovratov <nikita.h@live.de> Tested-by:
Nikita Hovratov <nikita.h@live.de> Tested-by:
core-ci <typo3@b13.com> Tested-by:
Stefan Bürk <stefan@buerk.tech> Reviewed-by:
Stefan Bürk <stefan@buerk.tech> Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch>
-
- Jan 09, 2024
-
-
Christian Kuhn authored
Based on the new PageInformation object attached to the Request from #102715, we can get rid of usages of TSFE->MP property. The patch does this and streamlines an admin panel class and the seo CanonicalGenerator class along the way. Change-Id: I0597fdfe5392128a6ae1932305e21a7d25076e29 Resolves: #102797 Related: #102715 Releases: main Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82277 Reviewed-by:
Benni Mack <benni@typo3.org> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch> Tested-by:
Benni Mack <benni@typo3.org> Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by:
Oliver Bartsch <bo@cedev.de> Tested-by:
Oliver Bartsch <bo@cedev.de> Reviewed-by:
Stefan Bürk <stefan@buerk.tech> Tested-by:
Stefan Bürk <stefan@buerk.tech>
-
- Jan 08, 2024
-
-
Benni Mack authored
The following methods now have a strict method signature for all arguments and their return types. - PageRepository->getPage() - PageRepository->getPage_noCheck() - PageRepository->getPageOverlay() - PageRepository->getPagesOverlay() - PageRepository->checkRecord() - PageRepository->getRawRecord() - PageRepository->enableFields() - PageRepository->getMultipleGroupsWhereClause() - PageRepository->versionOL() Calling one of the methods now require proper arguments of the respective types. Resolves: #102775 Releases: main Change-Id: I789453974001113263bc1fdff047adf0eb92c570 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82364 Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by:
Benni Mack <benni@typo3.org> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch> Tested-by:
Oliver Klee <typo3-coding@oliverklee.de> Tested-by:
Benni Mack <benni@typo3.org> Tested-by:
Oliver Bartsch <bo@cedev.de> Reviewed-by:
Oliver Bartsch <bo@cedev.de> Tested-by:
core-ci <typo3@b13.com>
-
- Jan 04, 2024
-
-
Benni Mack authored
PHP-CS-Fixer rule `array_indentation` is activated to have consistent indentation of arrays. In addition, a full run of php-cs-fixer without caches shows also affected areas where comments did not apply properly. Resolves: #102753 Releases: main, 12.4, 11.5 Change-Id: I759149606c4b042f1ac4329d4f5b7166d591456b Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/79239 Reviewed-by:
Simon Schaufelberger <simonschaufi+typo3@gmail.com> Reviewed-by:
Oliver Klee <typo3-coding@oliverklee.de> Tested-by:
core-ci <typo3@b13.com> Reviewed-by:
Oliver Bartsch <bo@cedev.de> Tested-by:
Simon Schaufelberger <simonschaufi+typo3@gmail.com> Tested-by:
Oliver Klee <typo3-coding@oliverklee.de> Tested-by:
Oliver Bartsch <bo@cedev.de> Reviewed-by:
Benni Mack <benni@typo3.org> Tested-by:
Benni Mack <benni@typo3.org>
-
- Dec 30, 2023
-
-
Benni Mack authored
Since TYPO3 v9, PageRepository dependencies are in better shape with the introduction of Context API. With TYPO3 v12, it is fully encapsulated and can now be called and instantiated when needed, instead of using TSFE->sys_page. This patch migrates the last occurrences in TYPO3 Core and only sets TSFE->sys_page as b/w compat layer (deprecation later together with other properties). Resolves: #102723 Releases: main Change-Id: I7a21ba28bfc0a22e4b980cc582c055864ebbaedd Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82276 Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch> Tested-by:
Oliver Klee <typo3-coding@oliverklee.de> Reviewed-by:
Sascha Nowak <sascha.nowak@netlogix.de> Tested-by:
core-ci <typo3@b13.com> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch>
-
- Dec 23, 2023
-
-
Christian Kuhn authored
The patch extracts TSFE->determineId() and its sub methods from TSFE into TypoScriptFrontendInitialization middleware. The information created by these methods is modeled into the new DTO PageInformation, which is added as 'frontend.page.information' request attribute before handling other middlewares below. The non-internal old properties within TSFE are set and kept as b/w compat layer for now. This is a powerful change: It allows us to reduce dependencies to TSFE significantly, which we will start to leverage with upcoming patches. The patch is an intermediate change as such: Looking at determineId() and its related methods makes clear the code can benefit heavily from further refactoring. The method could be ultimately extracted into a service class that only returns the 'final' PageInformation object, or throws exceptions for 'early' responses. To keep the patch reviewable at this point, these refactorings will continue with additional patches. Detail notes: * TSFE->sys_page PageRepository instance is for now modeled as (@internal) PageInformation->pageRepository. This can be refactored away later: Consumers should create instances of that class on demand. * "original mount and shortcut page record" are also modeled as (@internal) PageInformation properties for now. They are internal handling since the redirects can only be created after TypoScript has been calculated later on, so the information has to be carried around for now. We *may* be able to change this later. * The two middleware properties $pageNotFound and $pageAccessFailureHistory are a tribute to the current code flow in determineId(). They should be refactored away when the code is further shuffled around. The properties currently require a hack that needs to make the middleware "shared: false" to circumvent side effects in combination with error handling sub requests. * The code flow around determineId() updates local state and state of PageInformation multiple times and is in general very hard to follow. The patch crafted this carefully and did not refactor the code flow heavily for now. Changing the early response creation strategy will make the code flow much more straightforward later. * determineId() and with it the PageInformation object is now created *before* TSFE is instantiated, shifting the instantiation to a slightly later point. * getPageAccessFailureReasons() is for now transferred to the middleware as well. It can be later dissolved when determineId() receives further refactoring. Two consumers (indirectly) by ShortcutAndMountPointRedirect middleware could be dissolved already, so the method could be removed from TSFE. * TSFE->linkVars needs to be dissolved soon: The strategy should be to create "linkVars" on demand within the link handling code and eventually encapsulate it with a runtime cache entry. * getRedirectUriForMountPoint() and getRedirectUriForShortcut() are relocated to ShortcutAndMountPointRedirect middleware. TSFE->getUriToCurrentPageForRedirect() had to be made (@internal) public to do that, but that method can be refactored away when TSFE->linkVars is dissolved. * The hacks within RedirectService are extended to deal with the new situation for now. The entire thing needs to fall at a later point completely. * Further patches should start avoiding the TSFE properties that are now set as b/w compat layer, and start using the PageInformation request attribute instead. This will reduce overall dependencies to TSFE significantly. Resolves: #102715 Releases: main Change-Id: I6470899cf65cbaaeb2177a8b20c0800f045a070c Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82267 Reviewed-by:
Benni Mack <benni@typo3.org> Reviewed-by:
Stefan Bürk <stefan@buerk.tech> Tested-by:
Benni Mack <benni@typo3.org> Tested-by:
core-ci <typo3@b13.com> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch> Tested-by:
Stefan Bürk <stefan@buerk.tech> Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch>
-
- Dec 09, 2023
-
-
Christian Kuhn authored
The context object is injectable singleton state - "Not good but not terrible". There is no need to have a getter in TypoScriptFrontendController for it. Refactor this. A test case mocking can be simplified significantly with this. The "originally requested id" can be retrieved from the 'routing' Request attribute, there is not need to carry a copy as TSFE property around. Resolves: #102640 Releases: main Change-Id: I816570339464ab38bb44b4e8df6773c2ed5c5a8e Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82158 Reviewed-by:
Stefan Bürk <stefan@buerk.tech> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by:
Nikita Hovratov <nikita.h@live.de> Tested-by:
Stefan Bürk <stefan@buerk.tech> Tested-by:
core-ci <typo3@b13.com> Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch> Tested-by:
Nikita Hovratov <nikita.h@live.de>
-
Christian Kuhn authored
Refactor TSFE->no_cache towards the new Request attribute 'frontend.cache.instruction': This attribute can be created by middlewares early when they need to disable cache mechanics of middlewares later in the stack. The new construct *requires* a reason when caching is disabled, and the disable instruction can be set by multiple middlewares which can result in multiple reasons being gathered. The admin panel now lists any "cache has been disabled" reasons. Resolves: #102628 Releases: main Change-Id: I86584f17c5a90fe76923cfbf75c3b987da13fd95 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82073 Tested-by:
Oliver Bartsch <bo@cedev.de> Reviewed-by:
Benni Mack <benni@typo3.org> Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch> Tested-by:
Benni Mack <benni@typo3.org> Reviewed-by:
Oliver Bartsch <bo@cedev.de> Tested-by:
core-ci <typo3@b13.com> Reviewed-by:
Sascha Nowak <sascha.nowak@netlogix.de> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch>
-
- Dec 05, 2023
-
-
Christian Kuhn authored
TypoScriptFrontendController->fe_user is the current FrontendUserAuthentication object. It is set when constructing the instance. Since TypoScriptFrontendController is also still set as $GLOBALS['TSFE'], some extensions tend to fetch the current FE user from this global state, and sometimes even inject that into other classes like repositories. Extension felogin is a victim here: It models some state of FrontendUserAuthentication in the service object 'UserService', to then inject this into repositories and other classes. This indirection is an anti-pattern. The current Frontend user is already available either as Request attribute 'frontend.user', and a limited list of user details is also available as context aspect. The patch removes TSFE->fe_user entirely and dissolves the offending felogin class. Various other core usages are adapted as well to avoid fetching this state from TypoScriptFrontendController. Resolves: #102605 Releases: main Change-Id: Ibc33cefa2b24658406a7c0f7ce8fd80eaf7c9f3b Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82089 Reviewed-by:
Sascha Nowak <sascha.nowak@netlogix.de> Reviewed-by:
Stefan Bürk <stefan@buerk.tech> Tested-by:
core-ci <typo3@b13.com> Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by:
Benni Mack <benni@typo3.org> Tested-by:
Benni Mack <benni@typo3.org> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch> Tested-by:
Stefan Bürk <stefan@buerk.tech>
-
- Dec 01, 2023
-
-
Benni Mack authored
When PHP 8.0 support was added, a lot of places received extra checks with the $conf ?? []. PHPStan complained about this now, as methods already have native PHP types added now, and the check is not needed anymore, so it can be simplified A few other places did not receive proper PHPdoc annotations which has been fixed as well. In addition, some str_ends_with calls are migrated. Resolves: #102528 Releases: main Change-Id: I031d677473d4e9601fbf9d7c90214c311cfea863 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81975 Tested-by:
core-ci <typo3@b13.com> Reviewed-by:
Andreas Kienast <a.fernandez@scripting-base.de> Tested-by:
Andreas Kienast <a.fernandez@scripting-base.de> Tested-by:
Oliver Bartsch <bo@cedev.de> Reviewed-by:
Oliver Bartsch <bo@cedev.de>
-
- Nov 23, 2023
-
-
Benni Mack authored
When a hidden page is previewed in the Backend, the PreviewSimulator has a valid BE_USER object in place. However, when a preview link is generated, the PreviewUser does not have a group, thus the PreviewSimulator is not activated. For this reason, the check if the PreviewSimulator is active, needs to consider if we are in an offline workspace Resolves: #102216 Releases: main, 12.4 Change-Id: I95aadaad1de69ce6eed91acd82f4d42171a6500d Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81499 Tested-by:
Benni Mack <benni@typo3.org> Tested-by:
core-ci <typo3@b13.com> Tested-by:
Oliver Bartsch <bo@cedev.de> Tested-by:
Andreas Wolf <andreas.wolf@typo3.org> Reviewed-by:
Andreas Wolf <andreas.wolf@typo3.org> Reviewed-by:
Benni Mack <benni@typo3.org> Reviewed-by:
Oliver Bartsch <bo@cedev.de>
-
- Oct 30, 2023
-
-
Christian Kuhn authored
Minor CGL streamlinings from latest php-cs-fixer. > composer req --dev friendsofphp/php-cs-fixer:^3.37.1 > Build/Scripts/runTests.sh -s cgl Resolves: #102285 Releases: main, 12.4, 11.5 Change-Id: I0cc1fe3c0f81f62a49df00d62d57ef3c593c57df Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81609 Tested-by:
core-ci <typo3@b13.com> Reviewed-by:
Benjamin Franzke <ben@bnf.dev> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch> Tested-by:
Oliver Klee <typo3-coding@oliverklee.de> Reviewed-by:
Oliver Klee <typo3-coding@oliverklee.de> Tested-by:
Benjamin Franzke <ben@bnf.dev>
-
- Oct 26, 2023
-
-
Oliver Hader authored
To identify whether a nonce values was actually used (consumed), `ConsumableNonce` instances are used, instead of `Nonce` objects. The new `ConsumableNonce` inherits from `ConsumableString`. As a result, the `<f:security.nonce>` view helper would increase the consumption counter. This is important for additional cache handling in the frontend rendering context. Resolves: #101751 Releases: main, 12.4 Change-Id: Iea147b0130e3d350f5913dc75f33af61c18e8af3 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80235 Tested-by:
core-ci <typo3@b13.com> Tested-by:
Oliver Hader <oliver.hader@typo3.org> Reviewed-by:
Oliver Hader <oliver.hader@typo3.org>
-
- Oct 24, 2023
-
-
Christian Kuhn authored
It's time to update to latest changes of php-cs-fixer to align with current community rules. This brings a rather huge series of changes, main changes due to single_line_empty_body rule which now formats empty class and method body curly braces into a single line, plus changes from function_declaration rule which tends to avoid more whitespaces. The change has a slight impact on phpstan, we regenerate baseline. To reduce backport headaches, this change is backported to v12 and v11. > composer req --dev friendsofphp/php-cs-fixer:^3.35.1 > Build/Scripts/runTests.sh -s cgl > Build/Scripts/runTests.sh -s phpstanGenerateBaseline Resolves: #102236 Releases: main, 12.4, 11.5 Change-Id: Iea45b10667951672b2194033216c49f580799f55 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81512 Tested-by:
core-ci <typo3@b13.com> Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch> Tested-by:
Jasmina Ließmann <minapokhalo+typo3@gmail.com> Reviewed-by:
Jasmina Ließmann <minapokhalo+typo3@gmail.com>
-
- Oct 23, 2023
-
-
Christoph Lehmann authored
The PreviewSimulator might turn on the includeHiddenPages flag in VisibilityAspect due to hidden pages in current the rootline. The flag is now taken into account when generating the rootline cache identifier and thus the rootline cache doesn't need to get flushed. Resolves: #102205 Related: #17599 Releases: main, 12.4 Change-Id: If5246c9297d00071852968d48801d35f4060d110 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81484 Tested-by:
Georg Ringer <georg.ringer@gmail.com> Reviewed-by:
Benni Mack <benni@typo3.org> Reviewed-by:
Georg Ringer <georg.ringer@gmail.com> Reviewed-by:
Stefan Bürk <stefan@buerk.tech> Tested-by:
Benni Mack <benni@typo3.org> Tested-by:
core-ci <typo3@b13.com>
-
- Oct 18, 2023
-
-
Benjamin Franzke authored
An `instanceof Type` on `Type|null` is unneeded and is to be replaced by a null-check (or modern alternatives like optional chaning or the null coalescing operator) in order to avoid narrowing code branches unnecessarily. We call them "pseudo" uncertain checks there is no need to express uncertainty regarding the type in a condition where native type declarations define a specific type *or* null: It is `null` or `!null`. Definition of a pseudo uncertain instanceof check: `$foo instanceof Bar` is fully equivalent to `$foo !== null`, when `$foo` is defined (via native PHP types) to be `Bar|null`. ⇒ `instanceof` expresses pseudo uncertainty regarding the type. From what we have seen in previous gerrit discussions, there were two reasons why instanceof was preferred over null checks although being unneeded: 1) Cognitive load for an instanceof check is perceived to be lower in contrast to negated null (not null) conditions 2) Preparatory safe-guard against type of $foo being changed at sometime later 1) Cognitive load is a subjective term and the opinions actually differ a lot. Some developers prefer narrowing instanceof conditions because they claim the desired type for a certain code branch. Some others say that's a clear signal for code that needs refactoring and perceive a high cognitive load because they do not understand why the type is unnecessarily checked if it can only be null or not null. Lets call that: "reverse cognitive load". That means, this argument basically boils down to "congitive load" (for the good "then" case: inner code block) vs "reverse cognitive load" (for the bad "else" case: outer code block) ⇒ Due to being subjective "cognitive load" is not a good argument to base a decision upon. 2) The second argument is that an instanceof ensures a method that is to be called actually exists and doesn't lead to an error – that is a "preparatory safe-guard". This is true and works, but doesn't "answer" the question, what happens if the object is not an instance of the desired type (but not null). While preparatory safe-guards against the type of variable being changed sometime later was probably a pretty good idea for code that is not statically analyzed and had no native type declarations, but such checks effectively preclude that the type must/should never change (which might not be true!) and has no chance of actually detecting when that case (type change/extension) ever happens. All advantages offered by pseudo uncertain instanceof checks are accomplished with static code analysis as well, but with the added downside that an `instanceof` hardcodes our human static code analysis result, instead of letting the static analyzer do the job. To explain that: If the type of the variable under test is actually widened (like a union type, or change to a base class), it will never be automatically detected that there is an instanceof condition that restricts the type too narrowly. It will always be valid code from static code analysis perspective. In comparison to that, static analysis on null-checked variables will report invalid method calls or assignments not allowed by the (natively defined) types and will notify in case a type change requires the code to be adapted. We gain the advantage that the code will not be forgotten to be updated to a new type. That means !== null combined with static code analysis has the same level of being a safeguard against the bad cases, while instanceof silently transforms new "good"-cases into bugs, where !== null is a transparent and secure passthrough. Actually to make an uncertain instanceof robust, an elseif branch would be needed to be somehow notified about new good-cases without silently ignoring them: if ($foo instanceof Foo) { … } elseif ($foo !== null) { throw new MustNeverHappenException(…); } In other words an unneeded pseudo uncertain instanceof check is basically like a switch construct without a default case. Just to be explicit: Of course, instanceof is fine to be used when multiples types are to be expected and handled in different code branches. That means pseudo uncertain instanceof usage instead of null-checks is an antipattern for the following reasons: * It narrow code branches for the sake of less cognitive load * The cognitive load appears to be lower, but actually future-bad cases are overseen and are never auto-detectable in future – while null-checks will resolve to static analysis errors in case the input type is *ever* widened (which uncertain `instanceof` checks try to prepare for, but actually introduce future-bugs because of missing `else` cases) * It embraces deep nesting instead of early returns via null-checks * It embraces conditions over newer and more elegant PHP techniques like optional chaing * Tries to "help" the developer by explicitly anotating the current type of the variable under test ⇒ This is a clear sign of code smell, that needs to refactored into smaller chunks and methods and type autocompletion/information can be provided by IDEs when using proper types (which this change is about) anyway * Has zero advantages over static code analysis Resolves: #102140 Releases: main, 12.4 Change-Id: I10de41e9744a814c9e24255573b5a5eaf6fb8b0f Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80859 Tested-by:
Andreas Kienast <a.fernandez@scripting-base.de> Tested-by:
core-ci <typo3@b13.com> Tested-by:
Oliver Hader <oliver.hader@typo3.org> Reviewed-by:
Oliver Hader <oliver.hader@typo3.org> Tested-by:
Benjamin Franzke <ben@bnf.dev> Reviewed-by:
Benjamin Franzke <ben@bnf.dev> Reviewed-by:
Andreas Kienast <a.fernandez@scripting-base.de> Reviewed-by:
Nikita Hovratov <nikita.h@live.de>
-
- Sep 25, 2023
-
-
Torben Hansen authored
The `AfterUserLoggedInEvent` introduced with TYPO3 12.3 is currently only triggered for a successful backend login. With this change, the `AfterUserLoggedInEvent` is now also dispatched, when a successful frontend user login is performed. Resolves: #101933 Releases: main Signed-off-by:
Torben Hansen <derhansen@gmail.com> Change-Id: Iab3361032697fc214040a1cd4d2b54e5a91ac496 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81033 Tested-by:
Georg Ringer <georg.ringer@gmail.com> Tested-by:
core-ci <typo3@b13.com> Tested-by:
Benjamin Franzke <ben@bnf.dev> Reviewed-by:
Benjamin Franzke <ben@bnf.dev> Reviewed-by:
Benni Mack <benni@typo3.org> Reviewed-by:
Georg Ringer <georg.ringer@gmail.com>
-
- Sep 09, 2023
-
-
Stefan Bürk authored
php-cs-fixer rules have been changed and only partially applied yet, also with the recently merged php-cs-fixer raise and mitigation of a deprecated rule in #101888. That patch should have used the `-s cgl` instead of `-s cglGit` which only scans within php files included in the very same commit - not applying it across all files. This change mitigates this by executing the php-cs-fixer against all files. Used command(s): > Build/Scripts/runTests.sh -s cgl Resolves: #101889 Related: #101888 Releases: main Change-Id: Ibbda9de9b977d04f35dec11d9986ca9557ce3316 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80935 Reviewed-by:
Stefan Bürk <stefan@buerk.tech> Reviewed-by:
Oliver Wand <wand@itaw.de> Tested-by:
core-ci <typo3@b13.com> Reviewed-by:
Anja Leichsenring <aleichsenring@ab-softlab.de> Tested-by:
Oliver Wand <wand@itaw.de> Tested-by:
Anja Leichsenring <aleichsenring@ab-softlab.de> Tested-by:
Stefan Bürk <stefan@buerk.tech>
-
- Jul 28, 2023
-
-
Stefan Bürk authored
Resolves: #101394 Releases: main, 12.4, 11.5 Change-Id: I1d0cbb99496108180cf1f06045934bb510abcd3f Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80188 Tested-by:
Alexander Schnitzler <git@alexanderschnitzler.de> Tested-by:
Oliver Klee <typo3-coding@oliverklee.de> Tested-by:
core-ci <typo3@b13.com> Reviewed-by:
Thomas Hohn <tho@gyldendal.dk> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by:
Oliver Klee <typo3-coding@oliverklee.de> Reviewed-by:
Alexander Schnitzler <git@alexanderschnitzler.de> Tested-by:
Thomas Hohn <tho@gyldendal.dk>
-