Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/8.4' into 9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed Jan 28, 2025
2 parents d78a7b9 + 9e3814c commit 5f88b0b
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 91 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: ['8.2', '8.3']
php-versions: ['8.2', '8.3', '8.4']
# see https://mariadb.com/kb/en/mariadb-server-release-dates/
# this should be a current release, e.g. the LTS version
mariadb-versions: ['10.6']
Expand Down
2 changes: 1 addition & 1 deletion Neos.Cache/Classes/Backend/SimpleFileBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ protected function readCacheFile(string $cacheEntryPathAndFilename, int $offset
for ($i = 0; $i < 3; $i++) {
$data = false;
try {
$file = fopen($cacheEntryPathAndFilename, 'rb');
$file = @fopen($cacheEntryPathAndFilename, 'rb');
if ($file === false) {
continue;
}
Expand Down
1 change: 0 additions & 1 deletion Neos.Flow/Classes/Error/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ public function handleError(int $errorLevel, string $errorMessage, string $error
E_USER_ERROR => 'User Error',
E_USER_WARNING => 'User Warning',
E_USER_NOTICE => 'User Notice',
E_STRICT => 'Runtime Notice',
E_RECOVERABLE_ERROR => 'Catchable Fatal Error'
];

Expand Down
6 changes: 4 additions & 2 deletions Neos.Flow/Classes/I18n/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@ public function initializeObject()
$this->configuration = new Configuration($this->settings['defaultLocale']);
$this->configuration->setFallbackRule($this->settings['fallbackRule']);

if ($this->cache->has('availableLocales')) {
$this->localeCollection = $this->cache->get('availableLocales');
$cachedCollection = $this->cache->get('availableLocales');

if ($cachedCollection !== false) {
$this->localeCollection = $cachedCollection;
} elseif (isset($this->settings['availableLocales']) && !empty($this->settings['availableLocales'])) {
$this->generateAvailableLocalesCollectionFromSettings();
$this->cache->set('availableLocales', $this->localeCollection);
Expand Down
9 changes: 7 additions & 2 deletions Neos.Flow/Classes/Log/ThrowableStorage/FileStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,16 @@ protected function renderErrorInfo(\Throwable $error, array $additionalData = []
*/
protected function getErrorLogMessage(\Throwable $error)
{
$errorCodeNumber = ($error->getCode() > 0) ? ' #' . $error->getCode() : '';
// getCode() does not always return an integer, e.g. in PDOException it can be a string
if (is_int($error->getCode()) && $error->getCode() > 0) {
$errorCodeString = ' #' . $error->getCode();
} else {
$errorCodeString = ' [' . $error->getCode() . ']';
}
$backTrace = $error->getTrace();
$line = isset($backTrace[0]['line']) ? ' in line ' . $backTrace[0]['line'] . ' of ' . $backTrace[0]['file'] : '';

return 'Exception' . $errorCodeNumber . $line . ': ' . $error->getMessage();
return 'Exception' . $errorCodeString . $line . ': ' . $error->getMessage();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Neos.Flow/Configuration/Development/Settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Neos:
logException: true

errorHandler:
exceptionalErrors: ['%E_USER_ERROR%', '%E_RECOVERABLE_ERROR%', '%E_WARNING%', '%E_NOTICE%', '%E_USER_WARNING%', '%E_USER_NOTICE%', '%E_STRICT%']
exceptionalErrors: ['%E_USER_ERROR%', '%E_RECOVERABLE_ERROR%', '%E_WARNING%', '%E_NOTICE%', '%E_USER_WARNING%', '%E_USER_NOTICE%']

log:
psr3:
Expand Down
2 changes: 1 addition & 1 deletion Neos.Flow/Configuration/Testing/Settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Neos:
exceptionHandler:
className: 'Neos\Flow\Error\DebugExceptionHandler'
errorHandler:
exceptionalErrors: ['%E_USER_ERROR%', '%E_RECOVERABLE_ERROR%', '%E_WARNING%', '%E_NOTICE%', '%E_USER_WARNING%', '%E_USER_NOTICE%', '%E_STRICT%']
exceptionalErrors: ['%E_USER_ERROR%', '%E_RECOVERABLE_ERROR%', '%E_WARNING%', '%E_NOTICE%', '%E_USER_WARNING%', '%E_USER_NOTICE%']

log:
psr3:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,10 @@
<source>The image orientation "{0}" is not allowed</source>
<target state="translated">Não é permitida a orientação "{0}" da imagem</target>
</trans-unit>
<trans-unit id="1327865764" xml:space="preserve">
<source>The file extension "{0}" is not allowed.</source>
<target state="translated">A extensão de ficheiro "{0}" não é permitida.</target>
</trans-unit>
</body>
</file>
</xliff>
4 changes: 2 additions & 2 deletions Neos.Flow/Tests/Unit/I18n/ServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function initializeCorrectlyGeneratesAvailableLocales()
]];

$mockCache = $this->createMock(VariableFrontend::class);
$mockCache->expects(self::once())->method('has')->with('availableLocales')->will(self::returnValue(false));
$mockCache->expects(self::once())->method('get')->with('availableLocales')->will(self::returnValue(false));

$service = $this->getAccessibleMock(I18n\Service::class, ['dummy']);
$service->_set('localeBasePath', 'vfs://Foo/');
Expand Down Expand Up @@ -221,7 +221,7 @@ public function initializeCorrectlySkipsExcludedPathsFromScanningLocales()
]];

$mockCache = $this->getMockBuilder(VariableFrontend::class)->disableOriginalConstructor()->getMock();
$mockCache->expects(self::once())->method('has')->with('availableLocales')->will(self::returnValue(false));
$mockCache->expects(self::once())->method('get')->with('availableLocales')->will(self::returnValue(false));

$service = $this->getAccessibleMock(I18n\Service::class, ['dummy']);
$service->_set('localeBasePath', 'vfs://Foo/');
Expand Down

This file was deleted.

60 changes: 20 additions & 40 deletions Neos.FluidAdaptor/Tests/Functional/View/StandaloneViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
use Neos\Flow\Mvc\ActionRequest;
use Neos\Flow\Tests\FunctionalTestCase;
use Neos\FluidAdaptor\Core\ViewHelper\Exception\WrongEnctypeException;
use Neos\FluidAdaptor\Tests\Functional\View\Fixtures\View\StandaloneView;
use Neos\FluidAdaptor\View\Exception\InvalidTemplateResourceException;
use Neos\FluidAdaptor\View\StandaloneView;
use Psr\Http\Message\ServerRequestFactoryInterface;
use TYPO3Fluid\Fluid\Core\Parser\UnknownNamespaceException;

Expand All @@ -25,26 +25,6 @@
*/
class StandaloneViewTest extends FunctionalTestCase
{
/**
* @var string
*/
protected $standaloneViewNonce = '42';

/**
* Every testcase should run *twice*. First, it is run in *uncached* way, second,
* it is run *cached*. To make sure that the first run is always uncached, the
* $standaloneViewNonce is initialized to some random value which is used inside
* an overridden version of StandaloneView::createIdentifierForFile.
*/
public function runBare(): void
{
$this->standaloneViewNonce = uniqid('', true);
parent::runBare();
$numberOfAssertions = $this->getNumAssertions();
parent::runBare();
$this->addToAssertionCount($numberOfAssertions);
}

/**
* @test
*/
Expand All @@ -53,7 +33,7 @@ public function inlineTemplateIsEvaluatedCorrectly(): void
$httpRequest = $this->objectManager->get(ServerRequestFactoryInterface::class)->createServerRequest('GET', 'http://localhost');
$actionRequest = ActionRequest::fromHttpRequest($httpRequest);

$standaloneView = new StandaloneView($actionRequest, $this->standaloneViewNonce);
$standaloneView = new StandaloneView($actionRequest);
$standaloneView->assign('foo', 'bar');
$standaloneView->setTemplateSource('This is my cool {foo} template!');

Expand All @@ -70,7 +50,7 @@ public function renderSectionIsEvaluatedCorrectly(): void
$httpRequest = $this->objectManager->get(ServerRequestFactoryInterface::class)->createServerRequest('GET', 'http://localhost');
$actionRequest = ActionRequest::fromHttpRequest($httpRequest);

$standaloneView = new StandaloneView($actionRequest, $this->standaloneViewNonce);
$standaloneView = new StandaloneView($actionRequest);
$standaloneView->assign('foo', 'bar');
$standaloneView->setTemplateSource('Around stuff... <f:section name="innerSection">test {foo}</f:section> after it');

Expand All @@ -88,7 +68,7 @@ public function renderThrowsExceptionIfNeitherTemplateSourceNorTemplatePathAndFi
$httpRequest = $this->objectManager->get(ServerRequestFactoryInterface::class)->createServerRequest('GET', 'http://localhost');
$actionRequest = ActionRequest::fromHttpRequest($httpRequest);

$standaloneView = new StandaloneView($actionRequest, $this->standaloneViewNonce);
$standaloneView = new StandaloneView($actionRequest);
$standaloneView->render()->getContents();
}

Expand All @@ -101,7 +81,7 @@ public function renderThrowsExceptionSpecifiedTemplatePathAndFilenameDoesNotExis
$httpRequest = $this->objectManager->get(ServerRequestFactoryInterface::class)->createServerRequest('GET', 'http://localhost');
$actionRequest = ActionRequest::fromHttpRequest($httpRequest);

$standaloneView = new StandaloneView($actionRequest, $this->standaloneViewNonce);
$standaloneView = new StandaloneView($actionRequest);
$standaloneView->setTemplatePathAndFilename(__DIR__ . '/Fixtures/NonExistingTemplate.txt');
$standaloneView->render()->getContents();
}
Expand All @@ -115,7 +95,7 @@ public function renderThrowsExceptionIfWrongEnctypeIsSetForFormUpload(): void
$httpRequest = $this->objectManager->get(ServerRequestFactoryInterface::class)->createServerRequest('GET', 'http://localhost');
$actionRequest = ActionRequest::fromHttpRequest($httpRequest);

$standaloneView = new StandaloneView($actionRequest, $this->standaloneViewNonce);
$standaloneView = new StandaloneView($actionRequest);
$standaloneView->setTemplatePathAndFilename(__DIR__ . '/Fixtures/TestTemplateWithFormUpload.txt');
$standaloneView->render()->getContents();
}
Expand All @@ -129,7 +109,7 @@ public function renderThrowsExceptionIfSpecifiedTemplatePathAndFilenamePointsToA
$httpRequest = $this->objectManager->get(ServerRequestFactoryInterface::class)->createServerRequest('GET', 'http://localhost');
$actionRequest = ActionRequest::fromHttpRequest($httpRequest);

$standaloneView = new StandaloneView($actionRequest, $this->standaloneViewNonce);
$standaloneView = new StandaloneView($actionRequest);
$standaloneView->setTemplatePathAndFilename(__DIR__ . '/Fixtures');
$standaloneView->render()->getContents();
}
Expand All @@ -142,7 +122,7 @@ public function templatePathAndFilenameIsLoaded(): void
$httpRequest = $this->objectManager->get(ServerRequestFactoryInterface::class)->createServerRequest('GET', 'http://localhost');
$actionRequest = ActionRequest::fromHttpRequest($httpRequest);

$standaloneView = new StandaloneView($actionRequest, $this->standaloneViewNonce);
$standaloneView = new StandaloneView($actionRequest);
$standaloneView->assign('name', 'Karsten');
$standaloneView->assign('name', 'Robert');
$standaloneView->setTemplatePathAndFilename(__DIR__ . '/Fixtures/TestTemplate.txt');
Expand All @@ -157,7 +137,7 @@ public function templatePathAndFilenameIsLoaded(): void
*/
public function variablesAreEscapedByDefault(): void
{
$standaloneView = new StandaloneView(null, $this->standaloneViewNonce);
$standaloneView = new StandaloneView(null);
$standaloneView->assign('name', 'Sebastian <script>alert("dangerous");</script>');
$standaloneView->setTemplateSource('Hello {name}.');

Expand All @@ -171,7 +151,7 @@ public function variablesAreEscapedByDefault(): void
*/
public function variablesAreNotEscapedIfEscapingIsDisabled(): void
{
$standaloneView = new StandaloneView(null, $this->standaloneViewNonce);
$standaloneView = new StandaloneView(null);
$standaloneView->assign('name', 'Sebastian <script>alert("dangerous");</script>');
$standaloneView->setTemplateSource('{escapingEnabled=false}Hello {name}.');

Expand All @@ -185,7 +165,7 @@ public function variablesAreNotEscapedIfEscapingIsDisabled(): void
*/
public function variablesCanBeNested()
{
$standaloneView = new StandaloneView(null, $this->standaloneViewNonce);
$standaloneView = new StandaloneView(null);
$standaloneView->assign('type', 'thing');
$standaloneView->assign('flavor', 'yellow');
$standaloneView->assign('config', ['thing' => ['value' => ['yellow' => 'Okayish']]]);
Expand All @@ -205,7 +185,7 @@ public function partialWithDefaultLocationIsUsedIfNoPartialPathIsSetExplicitly()
$actionRequest = ActionRequest::fromHttpRequest($httpRequest);
$actionRequest->setFormat('txt');

$standaloneView = new StandaloneView($actionRequest, $this->standaloneViewNonce);
$standaloneView = new StandaloneView($actionRequest);
$standaloneView->setTemplatePathAndFilename(__DIR__ . '/Fixtures/TestTemplateWithPartial.txt');

$expected = 'This is a test template. Hello Robert.';
Expand All @@ -222,7 +202,7 @@ public function explicitPartialPathIsUsed(): void
$actionRequest = ActionRequest::fromHttpRequest($httpRequest);
$actionRequest->setFormat('txt');

$standaloneView = new StandaloneView($actionRequest, $this->standaloneViewNonce);
$standaloneView = new StandaloneView($actionRequest);
$standaloneView->setTemplatePathAndFilename(__DIR__ . '/Fixtures/TestTemplateWithPartial.txt');
$standaloneView->setPartialRootPath(__DIR__ . '/Fixtures/SpecialPartialsDirectory');

Expand All @@ -240,7 +220,7 @@ public function layoutWithDefaultLocationIsUsedIfNoLayoutPathIsSetExplicitly():
$actionRequest = ActionRequest::fromHttpRequest($httpRequest);
$actionRequest->setFormat('txt');

$standaloneView = new StandaloneView($actionRequest, $this->standaloneViewNonce);
$standaloneView = new StandaloneView($actionRequest);
$standaloneView->setTemplatePathAndFilename(__DIR__ . '/Fixtures/TestTemplateWithLayout.txt');

$expected = 'Hey HEY HO';
Expand All @@ -256,7 +236,7 @@ public function explicitLayoutPathIsUsed(): void
$httpRequest = $this->objectManager->get(ServerRequestFactoryInterface::class)->createServerRequest('GET', 'http://localhost');
$actionRequest = ActionRequest::fromHttpRequest($httpRequest);
$actionRequest->setFormat('txt');
$standaloneView = new StandaloneView($actionRequest, $this->standaloneViewNonce);
$standaloneView = new StandaloneView($actionRequest);
$standaloneView->setTemplatePathAndFilename(__DIR__ . '/Fixtures/TestTemplateWithLayout.txt');
$standaloneView->setLayoutRootPath(__DIR__ . '/Fixtures/SpecialLayouts');

Expand All @@ -274,7 +254,7 @@ public function viewThrowsExceptionWhenUnknownViewHelperIsCalled(): void
$httpRequest = $this->objectManager->get(ServerRequestFactoryInterface::class)->createServerRequest('GET', 'http://localhost');
$actionRequest = ActionRequest::fromHttpRequest($httpRequest);
$actionRequest->setFormat('txt');
$standaloneView = new Fixtures\View\StandaloneView($actionRequest, $this->standaloneViewNonce);
$standaloneView = new StandaloneView($actionRequest);
$standaloneView->setTemplatePathAndFilename(__DIR__ . '/Fixtures/TestTemplateWithUnknownViewHelper.txt');
$standaloneView->setLayoutRootPath(__DIR__ . '/Fixtures/SpecialLayouts');

Expand All @@ -289,7 +269,7 @@ public function xmlNamespacesCanBeIgnored(): void
$httpRequest = $this->objectManager->get(ServerRequestFactoryInterface::class)->createServerRequest('GET', 'http://localhost');
$actionRequest = ActionRequest::fromHttpRequest($httpRequest);
$actionRequest->setFormat('txt');
$standaloneView = new Fixtures\View\StandaloneView($actionRequest, $this->standaloneViewNonce);
$standaloneView = new StandaloneView($actionRequest);
$standaloneView->setTemplatePathAndFilename(__DIR__ . '/Fixtures/TestTemplateWithCustomNamespaces.txt');
$standaloneView->setLayoutRootPath(__DIR__ . '/Fixtures/SpecialLayouts');

Expand All @@ -312,7 +292,7 @@ public function interceptorsWorkInPartialRenderedInStandaloneSection(): void
$actionRequest = ActionRequest::fromHttpRequest($httpRequest);
$actionRequest->setFormat('html');

$standaloneView = new StandaloneView($actionRequest, $this->standaloneViewNonce);
$standaloneView = new StandaloneView($actionRequest);
$standaloneView->assign('hack', '<h1>HACK</h1>');
$standaloneView->setTemplatePathAndFilename(__DIR__ . '/Fixtures/NestedRenderingConfiguration/TemplateWithSection.txt');

Expand All @@ -324,7 +304,7 @@ public function interceptorsWorkInPartialRenderedInStandaloneSection(): void
$templateCache = $this->objectManager->get(CacheManager::class)->getCache('Fluid_TemplateCache');
$templateCache->remove($partialCacheIdentifier);

$standaloneView = new StandaloneView($actionRequest, $this->standaloneViewNonce);
$standaloneView = new StandaloneView($actionRequest);
$standaloneView->assign('hack', '<h1>HACK</h1>');
$standaloneView->setTemplatePathAndFilename(__DIR__ . '/Fixtures/NestedRenderingConfiguration/TemplateWithSection.txt');

Expand Down Expand Up @@ -366,7 +346,7 @@ public function formViewHelpersOutsideOfFormWork(): void
$httpRequest = $this->objectManager->get(ServerRequestFactoryInterface::class)->createServerRequest('GET', 'http://localhost');
$actionRequest = ActionRequest::fromHttpRequest($httpRequest);

$standaloneView = new StandaloneView($actionRequest, $this->standaloneViewNonce);
$standaloneView = new StandaloneView($actionRequest);
$standaloneView->assign('name', 'Karsten');
$standaloneView->assign('name', 'Robert');
$standaloneView->setTemplatePathAndFilename(__DIR__ . '/Fixtures/TestTemplateWithFormField.txt');
Expand Down

0 comments on commit 5f88b0b

Please sign in to comment.