5.2.0 (2018-12-07)

Overview of merged pull requests

TASK: Add support for DateTimeImmutable classes mapping with doctrine

This change correctly maps DateTimeImmutable property types with doctrine.

Depends on #1442

FEATURE: Add map, reduce, filter, some and every methods to Array Eel-helper

Implemented map, reduce, filter, some and every according to the JavaScript specs as functional Eel helpers in ArrayHelper.

  • Packages: Eel Flow

BUGFIX: Make session caches persistent by default

Previously Flow sessions were stored like any other cache. Thus they were deleted whenever the cache was flushed. This lead to users being logged out after deployments if not taken special care. From now on sessions are stored in a persistent cache by default so that authentication status and other sessions related information is not lost when flushing caches. This is a breaking change because session data is stored using PHPs serialize function that could break if the underlying object implementation changed.

In those cases, the sessions can be deleted manually using

` ./flow flow:session:destroyAll `

  • Packages: Flow

TASK: Fix duplicate FLOW_VERSION_BRANCH declaration after upmerge

A duplicate declaration of FLOW_VERSION_BRANCH slipped in while upmerging from 4.3

  • Packages: Flow FluidAdaptor ObjectHandling

BUGFIX: Properly parse `DateTimeImmutable` types

Currently, a type string of DateTimeImmutable will be parsed as DateTime. This, for example, leads to any entity properties annotated as @var DateTimeImmutable to be hydrated into a DateTime class instead.

Note that this is a hotfix at most, because the real issue is, that the regex does not check for a type ending character, like whitespace, line end or another non-word character. Therefore, it eagerly parses DateTimeImmutable by matching the DateTime prefix and taking that as the parsed type, which is wrong.

  • Packages: ObjectHandling

BUGFIX: Fix format for json_encoded DateTime conversion

The format for converting from JSON encoded DateTime was wrong. The format doesn’t use the \T separator, but a whitespace and as it seems, v is not a valid format specifier for DateTime::createFromFormat while it is for date().

http://php.net/manual/en/datetime.createfromformat.php > In most cases, the same letters as for the [date()](http://php.net/manual/en/function.date.php) can be used.

Also, this provides a test to actually verify the functionality. Related to #1415

  • Packages: Flow

BUGFIX: Support the parser halt fluid token

This adds the missing template pre-processor to the Neos.FluidAdaptor RenderingContext. Actually, it is not missing but gets removed upon setting the template pre-processors.

Fixes #1449

  • Packages: FluidAdaptor

BUGFIX: Make cache application identifier configurable

In multiple permutations, we tried to fix problems with cache identifier uniqueness in cache backends that are shared like apcu or memcache. In earlier days it included the PHP_SAPI and then in more recent times the context and root path. With the refactoring of caches, these two became the hardcoded applicationIdentifier which can be used by any backend to add more specificity to cache identifiers.

It turns out that the root path doesn’t work well for some environments and can result in bugs when used with eg. the PdoBackend and a deployment that changes the root path (typical Surf or Deployer).

The only backward compatible way to fix this was to make the applicationIdentifier configurable with a default that matches the previously hardcoded values. That way nothing changes in existing installations but if the bug appears it can be easily fixed.

  • Packages: Flow

FEATURE: Customizable lock holding page via environment variable

When a site (or Flow Application) is locked because it is currently being parsed, a note that the service is not available will be shown. The appearance and contents of this message can now be customized using the new environment variable FLOW_LOCKHOLDINGPAG`E that overrides the path (relative to the `FLOW_PATH_PACKAGES) to the page shown when the site is locked.

Example: `bash export FLOW_LOCKHOLDINGPAGE=Application/Acme.Foo/Resources/Private/CustomLockHoldingPage.html `

  • Packages: Flow

BUGFIX: Fix log environment when used in a closure

If LogEnvironment::fromMethodName was used in a closure the given methodName does not contain :: and the explode fails.

  • Packages: Flow

BUGFIX: Tests adapted to new behavior in PackageManger

The PackageManager::createPackage method now can create packages into a possibly existing DistributionPackages directory “automagically”, which then triggers a composer update. While this is a good idea to push the concept of distribution packages, it also breaks tests that clearly do not want to run composer update. This can be fixed by providing a defined package path.

Related #1433

  • Packages: Eel Flow FluidAdaptor Kickstarter

TASK: Apply fixes from StyleCI

This pull request applies code style fixes from an analysis carried out by [StyleCI](https://github.styleci.io).

  • Packages: Flow

BUGFIX: Throw MappingException in loadMetaDataForClass

When no class schema can be found in loadMetaDataForClass, a Doctrine MappingException is now thrown. This makes our code work nicely with the change in https://github.com/doctrine/doctrine2/pull/7471/ that otherwise leads to errors like this as of ORM 2.6.3:

``` FlowAnnotationDriver.php: No class schema found for “some-non-mapped-class”.

89 …\FlowAnnotationDriver_Original::getClassSchema(“some-non-mapped-class”) 88 …\FlowAnnotationDriver_Original::loadMetadataForClass(“some-non-mapped-class”, Neos\Flow\Persistence\Doctrine\Mapping\ClassMetadata) ```

Fixes #1453

  • Packages: Flow

FEATURE: Allow “remote” user sessions to be destroyed

A new method has been added to the Flow Security\Context that allows sessions to be removed for a specific Account, effectively logging out the corresponding user:

`php $someAccount = $this->accountRepository->findByAccountIdentifierAndAuthenticationProviderName($accountIdentifier, $authenticationProviderName); $reason = 'just for fun'; $this->securityContext->destroySessionsForAccount($someAccount, $reason); `

This method is automatically invoked whenever an account is deleted!

  • Packages: Flow

BUGFIX: Prevent overwriting source files

After switching from FileSystemSymlinkTarget to FileSystemTarget the symlinks are still present in the targetPath and therefore Flow tries to copy the stream content in the symlink (original file, same stream) which results in a 0-byte file.

We handle this issue by removing the symlinks if present.

  • Packages: Flow

FEATURE: Add chr, ord, sha1 and nl2br to String Eel-Helper

Adds the functions chr(), ord(), sha1() and nl2br() to the StringHelper, all simple wrappers for the corresponding PHP functions.

  • Packages: Eel

FEATURE: Add set method to Array Eel-helper

This allows to set keys which are calculated at runtime in Eel. A possible use case for this is the Neos.Fusion:Reduce prototype that can be used for grouping with set.

  • Packages: Cache Eel Flow

BUGFIX: Fix console helpers

Fix description for select method and return type an therefore tests for askAndValidate.

  • Packages: Flow

!!! BUGFIX: Allow actually reconfiguring the ThrowableStorage

This fixes the instantiation and configuration of ThrowableStorage implementations and also fixes stack traces and HTTP request information in stored throwables.

This change is not breaking but as pre notice that in the next major the ThrowableStorageInterface will have an additional method that is currently commented and already used to instantiate throwable storages. If you implement the interface you must already implement that additional method despite it being not part of the interface. As the object configuration for throwable storage doesn’t work without this change there cannot be a working alternative implementation yet, so this shouldn’t break any project.

  • Packages: Flow

FEATURE: Use localDistributionFolders on ``package:create``

If the composer file has a local distribution folder identified by type path and a local folder reference in the url new packages are created in the distributionFolder and are required via composer require … @dev.

  • Packages: Flow FluidAdaptor

TASK: Adjust XSD domain to neos.io

The XSD file generator is now set to neos.io

Resolves: #1186

  • Packages: FluidAdaptor

FEATURE: Setupable Cache Backends

Introduces two new interfaces WithSetupInterface and WithStatusInterface that can be implemented by cache backends to allow them to be set up / investigated via CLI.

For this the following commands have been added:

  • cache:list
  • cache:show
  • cache:setup
  • cache:setupall

Resolves: #1383

  • Packages: Cache

TASK: Exception interfaces with HTTP status and reference code

Allows implementing Exceptions that provide an HTTP status and/or a reference code for Flow exception handling without extending from the Flow base Exception implementation.

  • Packages: Flow

TASK: Separate security context and authentication manager

This contains a break up of the cross-dependency between AuthenticationProviderManager and Security context.

First, a new TokenAndProviderFactory (with an interface) is introduced to serve both the constructed tokens and providers from the configuration. Additionally the session persistent data was moved from the Context to the new SessionDataContainer (marked internal). This makes the context a simple singleton to the outside, avoiding duplication (security context injected before the session was started would create a duplicate instance without the session data (most notably some SQL security could have that).

Additionally, it fixes ONE_PER_REQUEST CSRF protection tokens which wouldn’t correctly behave.

  • Packages: Flow

TASK: Security code refactoring

This is a comprehensive refactoring of internal code, nothing should change on the outside.

Mostly reducing nested structures and complexity, breaking up larger methods and avoiding complicated structures.

  • Packages: Flow

BUGFIX: Avoid “wrong” error if Redis is unavailable

At least when running unit tests for the MultiBackend the connect() call raises an error that circumvents exception handling and breaks correct execution.

  • Packages: Cache Flow

BUGFIX: Add nullable parameter detection

Nullable paramters (type prepended with ?) were introduced with PHP 7.1 see https://secure.php.net/manual/en/migration71.new-features.php#migration71.new-features.nullable-types

We need to support a syntax like functionName(?string $param). Without this fix, this function will get extended as functionName(string $param), which is incompatible.

Starting with PHP 7.1 functionName(string $param = null) can also be written as functionName(?string $param = null) (but not as ~~`functionName(?string $param)`~~).

For the upmerge with Flow >= 5.0, the PHP version check in line 275 can be removed since at least PHP 7.1 is required there.

  • Packages: Flow

TASK: Remove Readme.rst & Upgrading.rst from “installer essentials”

This removes Readme.rst and Upgrading.rst from the “installer essentials” in Neos.Flow. The information contained here is available in the documentation and/or redundant.

Removing them “frees” those files up for use by developers, no longer overriding those files in the project root.

Fixes https://github.com/neos/neos-development-collection/issues/1856

  • Packages: Flow

TASK: Fix typo in @see annotation

  • Packages: Flow FluidAdaptor

TASK: Support converting from json_serialized DateTime

This change adds support for converting values that are received from serializing a DateTimeInterface object with json_serialize. If the source array contains a property ‘timezone_type’ the source date string is assumed to be in the internal serialization format, which is “Y-m-d\TH:i:s.v” without timezone information, since the timezone is provided in the additional ‘timezone’ property.

Related to https://github.com/neos/Neos.EventSourcing/issues/181

  • Packages: Flow

Apply fixes from StyleCI

This pull request applies code style fixes from an analysis carried out by [StyleCI](https://github.styleci.io).

  • Packages: Cache Eel Flow FluidAdaptor

TASK: Convert arrays to short array syntax

This pull request applies code style fixes from an analysis carried out by [StyleCI](https://github.styleci.io).

  • Packages: Cache Files Flow FluidAdaptor Kickstarter ObjectHandling Schema Unicode

TASK: Enrich log messages with environment

Enriches log messages of severity > debug with log environment.

  • Packages: Flow

TASK: Economize use of settings

Removes settings injection when the settings are actually not used and keep the only necessary subset of settings and not all of it.

  • Packages: Flow

FEATURE: Support HTML5 dialog method

Update to support ‘dialog’ method used in HTML5 <dialog> element eg. <form method=”dialog” …>

[See form submission point 20.](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#form-submission-2)

  • Packages: FluidAdaptor

BUGFIX: Enable maxlength for the form.textarea viewhelper

Bugfix because it is possible to configure a maxlength in the form framework, but this leads to an exception. I didn’t realize there was no maxlength when I put it in form framework and the reviewers didn’t notice either, so now it is required to have it in the viewhelper.

maxlength in textarea is possible since html5 and is supported by all major browsers including IE since 10 ;)

Checklist

  • Packages: Flow FluidAdaptor

FEATURE: Add maxlength to TextArea view helper

This adds support for the maxlength property to TextArea.

Related to https://github.com/neos/form/issues/87

  • Packages: FluidAdaptor

BUGFIX: Correct naming for setting

Resolves: #1409

Checklist

TASK: Make ContentStream easier to use

This adds a new named constructor fromContents() to the ContentStream class making it easier to instantiate it from a given string.

  • Packages: Flow

FEATURE: Introduce an utility to add log environment from method name

This utility can be used to easily add the logging environment to log messages using the PSR compatible logger.

Example:

` $logger->debug('Running sub process loop.', LogEnvironment::fromMethodName(__METHOD__)); `

  • Packages: Flow

TASK: Deprecate LoggerFactory and ThrowableLoggerInterface

Both are just consequences of already existing deprecations and were overseen when the rest was deprecated. They should be removed with the rest of the legacy logging in the next major.

  • Packages: Flow

TASK: Make HTTP application token static compiled

This should increase performance in cases version output is configured (which is the default) as that requires accessing the composer.lock file and parsing for the respective version.

  • Packages: Flow

TASK: Update symfony/dom-crawler requirement from ~4.0.0 to ~4.1.5

Updates the requirements on [symfony/dom-crawler](https://github.com/symfony/dom-crawler) to permit the latest version.

  • Packages: Flow

TASK: Require composer autoloader in entry scripts

Instead of requiring the bootstrap class file and then requiring Composer autoloader in the Bootstrap constructor, we can require the autoloader early in the two entry scripts.

This makes it possible to set FLOW_CONTEXT through .env files e.g with packages like helhum/dotenv-connector

  • Packages: Flow

` BUGFIX: doctrine:migrationgenerate won’t move file to selected package <https://github.com/neos/flow-development-collection/pull/1394>`_

Fixes an issue where running doctrine:migrationgenerate would never move the migration-file to the selected package. After doctrine:migrationgenerate has generated a migration, it asks whether the migration-file should be moved to a specific package. No matter what you choose, it would assume you chose “Don’t Move”.

Also fixes two related issues in the ConsoleOutput’s select method: - Wrong typehint on $default, breaking the default answer functionality - Wrong phpdoc typehint on $attempts, as it is an integer, not a boolean.

I added a testcase and modified a couple of other testcases for the ConsoleOutput as well.

  • Packages: Flow

[TASK] Remove incorrect folder structure example

The Object Management chapter contained two examples of the former Classes file structure, that included VendorName and PackageName. * Packages: Flow

FEATURE: Make fizzle filter operations capable of dealing with arrays

This commit amends the implementation for the ^=, $= and *= fizzle operators by checking if the given property is an array and if so, checking whether the filter matches in the following way:

  • *= matches if the array contains an item that matches the filter string exactly.
  • ^= matches if the array’s first item matches the filter string exactly.
  • $= matches if the array’s last item matches the filter string exactly.

If the given property is not an array the filter operations behave the same way as before.

  • Packages: Eel Flow

BUGFIX: Allow nullable constructor arguments

In PropertyMapper checks if the $targetType is nullable and the given source, too. If this is true, return null. Also, in ReflectionService, the annotated type is properly expanded when annotated with ‘|null' or 'null|’.

Checklist

Alternative push for #1353

Fixes #1361

  • Packages: Flow

BUGFIX: correctly handle 410 redirect exceptions

The redirect package throws exceptions on 410, but currently they are not caught, the way 404 exceptions are handled.

Checklist

  • Packages: Flow

TASK: Verify that FormViewHelpers outside of Form work

Resolves #583

  • Packages: Flow FluidAdaptor

BUGFIX: Extend the expected exceptions for missing templates and sections

typo3fluid/fluid expects specific exceptions to be thrown to implement the feature of optional sections and partials. Neos.FluidAdaptor has to throw these exceptions or derivates of them. Otherwise the exceptions won’t be catched and displayed to the user.

fixes: #1347

Follow-Up for #1348 with correct target.

  • Packages: Flow FluidAdaptor

Revert “BUGFIX: Extend the expected exceptions for missing templates and sections”

Reverts neos/flow-development-collection#1348

  • Packages: FluidAdaptor

BUGFIX: Extend the expected exceptions for missing templates and sections

typo3fluid/fluid expects specific exceptions to be thrown to implement the feature of optional sections and partials. Neos.FluidAdaptor has to throw these exceptions or derivates of them. Otherwise the exceptions won’t be catched and displayed to the user.

fixes: #1347

What I did

I implemented solution 1 from the issue

How I did it

I made the exceptions shipped with FluidAdaptor inherit from the expected ones from typo3fluid/fluid

How to verify it

Try to reproduce the issue after applying the patch

Checklist

  • Packages: Flow FluidAdaptor