Skip to content
Snippets Groups Projects
Commit c53a565d authored by Stefan Bürk's avatar Stefan Bürk Committed by Georg Ringer
Browse files

[TASK] Avoid PHP8.2 related deprecation failure in unit test

With PHP8.2 setting dynamic properties has been deprecated. This
is also valid if it is set through unserialization and emits a
deprecation warning. Thus this fails hard in tests.

Thus one test fails, which is expclicitly testing unserialization
with invalid dynamic class properties.

This change moves the test to unitDeprecated tests, which will not
fail on deprecation warnings. This acts pre-patch to update PHP8.2
testing to `PHP8.2.0 RC1`.

Resolves: #98266
Releases: main, 11.5
Change-Id: I7bf87b0ade906727f6222d31a1b735f452717138
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/75616


Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarOliver Klee <typo3-coding@oliverklee.de>
Tested-by: default avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: default avatarOliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: default avatarGeorg Ringer <georg.ringer@gmail.com>
parent 74eafb8a
Branches
Tags
No related merge requests found
......@@ -94,19 +94,4 @@ class ReflectionServiceTest extends UnitTestCase
self::assertInstanceOf(ReflectionService::class, $reflectionService);
self::assertInstanceOf(ClassSchema::class, $reflectionService->getClassSchema($class));
}
/**
* @test
*/
public function reflectionServiceIsResetDuringWakeUp(): void
{
$insecureString = file_get_contents(__DIR__ . '/Fixture/InsecureSerializedReflectionService.txt');
$reflectionService = unserialize($insecureString);
$reflectionClass = new \ReflectionClass($reflectionService);
$classSchemaProperty = $reflectionClass->getProperty('classSchemata');
$classSchemaProperty->setAccessible(true);
self::assertSame([], $classSchemaProperty->getValue($reflectionService));
}
}
<?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\Extbase\Tests\UnitDeprecated\Reflection;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
class ReflectionServiceTest extends UnitTestCase
{
/**
* @test
*
* Note: Starting with PHP8.2 unserializing dynamic properties (undefined properties) emits a deprecation
* warning, which fails in normal tests. This moved here to avoid failing tests.
*/
public function reflectionServiceIsResetDuringWakeUp(): void
{
$insecureString = file_get_contents(__DIR__ . '/Fixture/InsecureSerializedReflectionService.txt');
$reflectionService = unserialize($insecureString);
$reflectionClass = new \ReflectionClass($reflectionService);
$classSchemaProperty = $reflectionClass->getProperty('classSchemata');
$classSchemaProperty->setAccessible(true);
self::assertSame([], $classSchemaProperty->getValue($reflectionService));
}
}
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