Do not create error in Symfony Expression Language on missing User Agent

This commit is contained in:
Daniel Siepmann 2022-04-14 10:16:41 +02:00
parent 7f63ae8262
commit 3b0fb209c2
3 changed files with 42 additions and 1 deletions

View file

@ -59,6 +59,7 @@ services:
$rule: > $rule: >
not (context.getAspect("backend.user").isLoggedIn()) not (context.getAspect("backend.user").isLoggedIn())
and not (context.getAspect("frontend.preview").isPreview()) and not (context.getAspect("frontend.preview").isPreview())
and request.getHeader("User-Agent")[0]
and not (request.getHeader("User-Agent")[0] matches "/^TYPO3|TYPO3 linkvalidator/") and not (request.getHeader("User-Agent")[0] matches "/^TYPO3|TYPO3 linkvalidator/")
and not (request.getHeader("User-Agent")[0] matches "/Wget|curl|Go-http-client/") and not (request.getHeader("User-Agent")[0] matches "/Wget|curl|Go-http-client/")
and not (request.getHeader("User-Agent")[0] matches "/Googlebot|Bingbot|bingbot|Slurp|DuckDuckBot|Baiduspider|YandexBot|Sogou|Exabot|NextCloud-News|Feedly|XING FeedReader|CCBot|SemrushBot|SEOkicks|Twitterbot|Seekport Crawler|SemanticScholarBot|ia_archiver|PaperLiBot|TrendsmapResolver|AhrefsBot|Nuzzel/") and not (request.getHeader("User-Agent")[0] matches "/Googlebot|Bingbot|bingbot|Slurp|DuckDuckBot|Baiduspider|YandexBot|Sogou|Exabot|NextCloud-News|Feedly|XING FeedReader|CCBot|SemrushBot|SEOkicks|Twitterbot|Seekport Crawler|SemanticScholarBot|ia_archiver|PaperLiBot|TrendsmapResolver|AhrefsBot|Nuzzel/")

View file

@ -0,0 +1,40 @@
1.1.6
=====
Breaking
--------
Nothing
Features
--------
Nothing
Fixes
-----
* Do not break Symfony Expression Language in case no user agent is provided.
Some requests might ommit the user agent header.
The default configuration for tracking pageviews would result in an error raised
from Symfony Expression Language.
This got fixed as the existence is checked first, before comparing against agents
that should not be tracked.
You should check your own rules if you defined any, see: :ref:`pageview` as well as
:ref:`recordview`.
The raised error looks like this on my own website:
Core: Exception handler (WEB): Uncaught TYPO3 Exception: Argument 2 passed to Symfony\Component\ExpressionLanguage\Node\BinaryNode::evaluateMatches() must be of the type string, null given, called in vendor/symfony/expression-language/Node/BinaryNode.php on line 167 | TypeError thrown in file vendor/symfony/expression-language/Node/BinaryNode.php in line 176. Requested URL: https://daniel-siepmann.localhost/
Tasks
-----
Nothing
Deprecation
-----------
Nothing

View file

@ -11,7 +11,7 @@ $EM_CONF[$_EXTKEY] = [
'author' => 'Daniel Siepmann', 'author' => 'Daniel Siepmann',
'author_email' => 'coding@daniel-siepmann.de', 'author_email' => 'coding@daniel-siepmann.de',
'author_company' => '', 'author_company' => '',
'version' => '1.1.2', 'version' => '1.1.6',
'constraints' => [ 'constraints' => [
'depends' => [ 'depends' => [
'core' => '', 'core' => '',