Commit 01a24ae0 authored by crell's avatar crell Committed by Stefan Bürk
Browse files

[BUGFIX] Resolve a stray strpos call

This conversion got past the big conversion patch
before, probably due to the negation.

Resolves: #97640
Releases: main, 11.5
Change-Id: I67dd19c286ce25ad8cda71c1451fa84ed25dc971
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/74651


Tested-by: Simon Schaufelberger's avatarSimon Schaufelberger <simonschaufi+typo3@gmail.com>
Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: Simon Schaufelberger's avatarSimon Schaufelberger <simonschaufi+typo3@gmail.com>
Reviewed-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
parent 0193bc7c
Pipeline #27539 passed with stages
in 26 minutes and 2 seconds
......@@ -4365,11 +4365,6 @@ parameters:
count: 1
path: ../../typo3/sysext/recycler/Tests/Unit/Task/CleanerFieldProviderTest.php
-
message: "#^Strict comparison using \\=\\=\\= between bool and 0 will always evaluate to false\\.$#"
count: 1
path: ../../typo3/sysext/redirects/Classes/ViewHelpers/TargetPageIdViewHelper.php
-
message: "#^Call to an undefined method TYPO3\\\\CMS\\\\Redirects\\\\Service\\\\RedirectService\\:\\:method\\(\\)\\.$#"
count: 1
......
......@@ -45,7 +45,7 @@ final class TargetPageIdViewHelper extends AbstractViewHelper
*/
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext): string
{
if (!strpos($arguments['target'], 't3://page', 0) === 0) {
if (!str_starts_with($arguments['target'] ?? '', 't3://page')) {
return '';
}
......
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Redirects\Tests\Unit\ViewHelpers;
use TYPO3\CMS\Fluid\Core\Rendering\RenderingContext;
use TYPO3\CMS\Redirects\ViewHelpers\TargetPageIdViewHelper;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
/**
* @covers \TYPO3\CMS\Redirects\ViewHelpers\TargetPageIdViewHelper
*/
class TargetPageIdViewHelperTest extends UnitTestCase
{
/**
* @test
*/
public function nonTypo3TargetInRenderStaticReturnsEmptyString(): void
{
$renderingContext = new class() extends RenderingContext {
public function __construct()
{
}
};
$args = ['target' => 'nope'];
self::assertSame('', TargetPageIdViewHelper::renderStatic($args, static fn () => '', $renderingContext));
}
/**
* @test
*/
public function emptyTargetInRenderStaticReturnsEmptyString(): void
{
$renderingContext = new class() extends RenderingContext {
public function __construct()
{
}
};
$args = [];
self::assertSame('', TargetPageIdViewHelper::renderStatic($args, static fn () => '', $renderingContext));
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment