Skip to content

Commit

Permalink
TASK: 7.3 upmerges
Browse files Browse the repository at this point in the history
  • Loading branch information
dlubitz committed Feb 23, 2024
2 parents 027ebca + 797dcd9 commit 0a935b6
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 14 deletions.
2 changes: 2 additions & 0 deletions Neos.Flow/Classes/Core/Booting/Scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,7 @@ protected static function ensureCLISubrequestsUseCurrentlyRunningPhpBinary($phpB
$command[] = '2>&1'; // Output errors in response

// Try to resolve which binary file PHP is pointing to
$output = [];
exec(join(' ', $command), $output, $result);

if ($result === 0 && count($output) === 1) {
Expand All @@ -878,6 +879,7 @@ protected static function ensureCLISubrequestsUseCurrentlyRunningPhpBinary($phpB
$realPhpBinary = @realpath(PHP_BINARY);
if ($realPhpBinary === false) {
// bypass with exec open_basedir restriction
$output = [];
exec(PHP_BINARY . ' -r "echo realpath(PHP_BINARY);"', $output);
$realPhpBinary = $output[0];
}
Expand Down
11 changes: 2 additions & 9 deletions Neos.Flow/Classes/Mvc/Controller/ActionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
use Neos\Flow\Property\Exception\TargetNotFoundException;
use Neos\Flow\Property\TypeConverter\Error\TargetNotFoundError;
use Neos\Flow\Reflection\ReflectionService;
use Neos\Flow\Security\Exception\InvalidArgumentForHashGenerationException;
use Neos\Flow\Security\Exception\InvalidHashException;
use Neos\Utility\TypeHandling;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
Expand Down Expand Up @@ -227,13 +225,8 @@ public function processRequest(ActionRequest $request, ActionResponse $response)
if (method_exists($this, $actionInitializationMethodName)) {
call_user_func([$this, $actionInitializationMethodName]);
}
try {
$this->mvcPropertyMappingConfigurationService->initializePropertyMappingConfigurationFromRequest($this->request, $this->arguments);
} catch (InvalidArgumentForHashGenerationException|InvalidHashException $e) {
$message = $this->throwableStorage->logThrowable($e);
$this->logger->notice('Property mapping configuration failed due to HMAC errors. ' . $message, LogEnvironment::fromMethodName(__METHOD__));
$this->throwStatus(400, null, 'Invalid HMAC submitted');
}

$this->mvcPropertyMappingConfigurationService->initializePropertyMappingConfigurationFromRequest($this->request, $this->arguments);

try {
$this->mapRequestArgumentsToControllerArguments();
Expand Down
5 changes: 5 additions & 0 deletions Neos.Flow/Configuration/Development/Settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ Neos:
defaultRenderingOptions:
renderTechnicalDetails: true

renderingGroups:
noStacktraceExceptionGroup:
options:
logException: true

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

Expand Down
9 changes: 8 additions & 1 deletion Neos.Flow/Configuration/Settings.Error.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ Neos:
variables:
errorDescription: 'Sorry, the database connection couldn''t be established.'

noStacktraceExceptionGroup:
matchingExceptionClassNames: ['Neos\Flow\Security\Exception\InvalidHashException']
options:
logException: false
templatePathAndFilename: 'resource://Neos.Flow/Private/Templates/Error/Default.html'
variables:
errorDescription: 'Sorry, something went wrong.'

errorHandler:

# Defines which errors should result in an exception thrown - all other error
Expand Down Expand Up @@ -73,4 +81,3 @@ Neos:

# Maximal recursion for the debugger
recursionLimit: 5

4 changes: 2 additions & 2 deletions Neos.Flow/Configuration/Settings.Log.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Neos:
optionsByImplementation:
'Neos\Flow\Log\ThrowableStorage\FileStorage':
storagePath: '%FLOW_PATH_DATA%Logs/Exceptions'
# The maximum age of throwable dump in seconds, 0 to disable cleaning based on age, default 30 days
# The maximum age of throwable dump in seconds, 0 to disable cleaning based on age
maximumThrowableDumpAge: 0
# The maximum number of throwable dumps to store, 0 to disable cleaning based on count, default 10.000
# The maximum number of throwable dumps to store, 0 to disable cleaning based on count
maximumThrowableDumpCount: 0
4 changes: 2 additions & 2 deletions Neos.Flow/Documentation/TheDefinitiveGuide/PartIII/Http.rst
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ that defines the ``process($request, $next)`` method::
*/
final class SomeMiddleware implements MiddlewareInterface
{
public function process(ServerRequestInterface $request, RequestHandlerInterface $next): ResponseInterface;
$response = $next->handle($httpRequest);
public function process(ServerRequestInterface $request, RequestHandlerInterface $next): ResponseInterface {
$response = $next->handle($request);
return $response->withAddedHeader('X-MyHeader', '123');
}
}
Expand Down

0 comments on commit 0a935b6

Please sign in to comment.