-
Notifications
You must be signed in to change notification settings - Fork 653
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Forward initiator to typo3/html-sanitizer
A new `SanitizerInitiator` is added and forwarded to `typo3/html-sanitizer`. This allows getting a full stack-trace when HTML nodes have been sanitized/modified and to debug the actual cause (initiator) much better. To receive corresponding initiator stack-traces * logging for TYPO3.HtmlSanitizer namespace needs to be enabled * TypoScript `config.debug = 1` must be set, or as a fall-back `$GLOBALS['TYPO3_CONF_VARS']['FE']['debug'] = true;` must be set * HTML sanitizer must have found and modified invalid tags/attributes Resolves: #94837 Releases: master, 11.3, 10.4, 9.5 Change-Id: I0239785d347d2c4ad6153ccb26130556399949d8 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/70509 Tested-by: core-ci <typo3@b13.com> Tested-by: Oliver Hader <oliver.hader@typo3.org> Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
- Loading branch information
Showing
3 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the TYPO3 project. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under the terms | ||
* of the MIT License (MIT). For the full copyright and license information, | ||
* please read the LICENSE file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
namespace TYPO3\CMS\Core\Html; | ||
|
||
use TYPO3\HtmlSanitizer\InitiatorInterface; | ||
|
||
/** | ||
* Initiator for HTML sanitization process, forwarded to sanitizer and used during logging. | ||
* | ||
* @internal | ||
*/ | ||
class SanitizerInitiator implements InitiatorInterface | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $trace; | ||
|
||
public function __construct(string $trace) | ||
{ | ||
$this->trace = $trace; | ||
} | ||
|
||
public function __toString(): string | ||
{ | ||
return $this->trace; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters