Migrating from Flow 2.2.2 to 5.0.6


(Nedko Georgiev) #1

I’m trying to do a pretty big version update from Flow 2.2.2 to 5.0.6
So I’ve changed my composer.json to:

"require": {
        "typo3/flow": "5.0.*",
        "typo3/welcome": "5.0.*"
...
},
"require-dev": {
        "typo3/kickstart": "5.0.*",
        "typo3/buildessentials": "5.0.*",
...
}

And after runnining composer update I went for the upgrade-instructions. The ./flow flow:cache:flush --force went fine, but for the ./flow flow:core:migrate I had to specify each application package separately (it wouldn’t run automatically on all packages), otherwise it was throwing the error from below, which is now thrown on either of the next three commands. Looking at the packages, it successfully replaced TYPO3 with Neos.

PHP Fatal error:  Cannot declare class Neos\Flow\Aop\Exception, because the name is already in use in C:\xampp\htdocs\fsl\Packages\Framework\Neos.Flow\Classes\Aop\Exception.php on line 21
Fatal error: Cannot declare class Neos\Flow\Aop\Exception, because the
name is already in use in
C:\xampp\htdocs\fsl\Packages\Framework\Neos.Flow\Classes\Aop\Exception.php
on line 21

  Type: Neos\Flow\Core\Booting\Exception\SubProcessException
  Code: 1355480641
  File: C:\xampp\htdocs\fsl\Packages\Framework\Neos.Flow\Classes\Core\Booting\Scripts.php
  Line: 677

Any idea what could be the problem? Please note that quite a lot is changed now.


(Christian Müller) #2

You should jump from major to major and follow upgrade instructions for every major version. Directly jumping from 2.2 to 5.0 will probably not work otherwise.


(Nedko Georgiev) #3

Thanks for replying!
Do you think I have to fix all the outstanding issues after each major version upgrade or is it enough to just go through the upgrade instructions for each of them and then jump on to the next major?
And just to be sure, so from 2.2.2 I should go to 3.0 then 4.0 and then 5.0?
Or do you think it’ll be better to go to the last available of each major so 3.3, 4.3, 5.0?


(Christian Müller) #4

you can probably go to the latest minor version for each major, BUT make sure to follow the upgrade instructions for the major versions (so instructions from 2.2 to 3.0 then from 3.3 to 4.0 etc.).
I would probably check if it runs after following upgrade instructions before going to the next major, just to be sure at what point a problem was introduced. Will only become harder to find something the more change there is.


(Alexander Berl) #5

Everything that Christian said, plus notice the namespace change starting from 4.0: Instead of "typo3/*" the dependencies become "neos/*" (though the old namespace still works, but it’s deprecated).

If you stumble over issues, feel free to ask for specific problems.


(Nedko Georgiev) #6

Thank you both for being so responsive!
I’ve tried going from 2.2 to 3.3, but it resulted in an error I wasn’t able to fix, so I decided to give 2.2->3.0 a try. It also gave me an error, but once I uninstalled the welcome package which I didn’t use either way, the migration went successfully with a small problem. My application was loading, but when loading any website, resources like css and js were not accessible.
I’m on windows 10 Pro if it matters and using xampp
Actually I had a strange problem for code like this:
__resource_base_path = {f:uri.resource(path: '') -> f:format.json();

After the migration to 3.0. it was resulting in:
__resource_base_path = &https:\/\/some.web.page\/_Resources\/Static\/Packages\/Cleversoft.FslConfigurator\/&;

So i just added htmlentitiesDecode to the end and it was working just fine. Like so:
__resource_base_path = {f:uri.resource(path: '') -> f:format.json() -> f:format.htmlentitiesDecode()};

CSS and JS resources are still unaccessible and the error this time is 404, not 403:
GET http://some.web.page/_Resources/Persistent/0c11f0d703454a16bb6649b86db0c88bbc8e9535.css 404 (Not Found)

What I noticed is that it’s actually now creating a folder with the name “0c11f0d703454a16bb6649b86db0c88bbc8e9535” and putting the main.css in it, instead of creating a css file with that name.

However I decided to go for 3.1 and after updating composer.json and running composer update, I executed the first two commands from the upgrade instructions successfully:
./flow flow:cache:flush --force
./flow core:migrate

But the old error (same as as when I tried to go to 5.0 and 3.3) came back:

Notice: Uninitialized string offset: 0 in C:\xampp\htdocs\fsl\Packages\Framework\TYPO3.Flow\Classes\TYPO3\Flow\Reflection\ReflectionService.php line 1434
Type: TYPO3\Flow\Error\Exception
Code: 1
File:
C:\xampp\htdocs\fsl\Packages\Framework\TYPO3.Flow\Classes\TYPO3\Flow\Error\ErrorHandler.php Line: 81
Open Data/Logs/Exceptions/20180815133838dd7727.txt for a full stack
trace.

Type: TYPO3\Flow\Core\Booting\Exception\SubProcessException
Code: 1355480641
File: C:\xampp\htdocs\fsl\Packages\Framework\TYPO3.Flow\Classes\TYPO3\Flow\Core\Booting\Scripts.ph Line: 574

Open Data/Logs/Exceptions/20180815133833cc88ce.txt for a full stack trace.

Here`s the exception log:

Exception #1 in line 1434 of C:\xampp\htdocs\project\Packages\Framework\TYPO3.Flow\Classes\TYPO3\Flow\Reflection\ReflectionService.php: Notice: Uninitialized string offset: 0 in C:\xampp\htdocs\project\Packages\Framework\TYPO3.Flow\Classes\TYPO3\Flow\Reflection\ReflectionService.php line 1434

26 TYPO3\Flow\Error\ErrorHandler::handleError(8, "Uninitialized string offset: 0", "C:\xampp\htdocs\project\Packages\Framework\TYPO3.Flow\Classes\TYPO3\Flow\Reflection\ReflectionService.php", 1434, array|2|)
25 TYPO3\Flow\Reflection\ReflectionService::expandType(TYPO3\Flow\Reflection\ClassReflection, "")
24 TYPO3\Flow\Reflection\ReflectionService::expandType(TYPO3\Flow\Reflection\ClassReflection, "<type>")
23 TYPO3\Flow\Reflection\ReflectionService::convertParameterReflectionToArray(TYPO3\Flow\Reflection\ParameterReflection, TYPO3\Flow\Reflection\MethodReflection)
22 TYPO3\Flow\Reflection\ReflectionService::reflectClassMethodParameter("Cleversoft\project\ViewHelpers\FondsVolumeViewHelper", TYPO3\Flow\Reflection\MethodReflection, TYPO3\Flow\Reflection\ParameterReflection)
21 TYPO3\Flow\Reflection\ReflectionService::reflectClassMethod("Cleversoft\project\ViewHelpers\FondsVolumeViewHelper", TYPO3\Flow\Reflection\MethodReflection)
20 TYPO3\Flow\Reflection\ReflectionService::reflectClass("Cleversoft\project\ViewHelpers\FondsVolumeViewHelper")
19 TYPO3\Flow\Reflection\ReflectionService::TYPO3\Flow\Reflection\{closure}("Cleversoft\project\ViewHelpers\FondsVolumeViewHelper")
18 array_filter(array|896|, Closure)
17 TYPO3\Flow\Reflection\ReflectionService::reflectEmergedClasses()
16 TYPO3\Flow\Reflection\ReflectionService::buildReflectionData(array|8|)
15 TYPO3\Flow\Object\CompileTimeObjectManager::initialize(array|59|)
14 TYPO3\Flow\Core\Booting\Scripts::initializeObjectManagerCompileTimeFinalize(TYPO3\Flow\Core\Bootstrap)
13 call_user_func(array|2|, TYPO3\Flow\Core\Bootstrap)
12 TYPO3\Flow\Core\Booting\Step::__invoke(TYPO3\Flow\Core\Bootstrap)
11 TYPO3\Flow\Core\Booting\Sequence::invokeStep(TYPO3\Flow\Core\Booting\Step, TYPO3\Flow\Core\Bootstrap)
10 TYPO3\Flow\Core\Booting\Sequence::invokeStep(TYPO3\Flow\Core\Booting\Step, TYPO3\Flow\Core\Bootstrap)
9 TYPO3\Flow\Core\Booting\Sequence::invokeStep(TYPO3\Flow\Core\Booting\Step, TYPO3\Flow\Core\Bootstrap)
8 TYPO3\Flow\Core\Booting\Sequence::invokeStep(TYPO3\Flow\Core\Booting\Step, TYPO3\Flow\Core\Bootstrap)
7 TYPO3\Flow\Core\Booting\Sequence::invokeStep(TYPO3\Flow\Core\Booting\Step, TYPO3\Flow\Core\Bootstrap)
6 TYPO3\Flow\Core\Booting\Sequence::invokeStep(TYPO3\Flow\Core\Booting\Step, TYPO3\Flow\Core\Bootstrap)
5 TYPO3\Flow\Core\Booting\Sequence::invokeStep(TYPO3\Flow\Core\Booting\Step, TYPO3\Flow\Core\Bootstrap)
4 TYPO3\Flow\Core\Booting\Sequence::invoke(TYPO3\Flow\Core\Bootstrap)
3 TYPO3\Flow\Cli\CommandRequestHandler::boot("Compiletime")
2 TYPO3\Flow\Cli\CommandRequestHandler::handleRequest()
1 TYPO3\Flow\Core\Bootstrap::run()

Any idea what could be the problem?


(Soren Malling) #7

Regarding not published resources, run ./flow resource:publish


(Nedko Georgiev) #8

Thanks @sorenmalling! That wasn’t the problem, but I’ve figured it out. I also got why I had to use the f:format.htmlentitiesDecode() and actually replaced it with f:format.raw() as advised in the 3.0’s upgrade instructions. Now I have some other fixes I need to do, but I’m pretty sure when I’m done and want to proceed with 3.1/3.3, I’ll get the ReflectionService.php error.


(Alexander Berl) #9

After the migration to 3.0. it was resulting in:

This is due to the changed escaping behaviour in 3.x, see https://flowframework.readthedocs.io/en/3.0/TheDefinitiveGuide/PartV/ReleaseNotes/300.html#id6

_Resources/Persistent/0c11f0d703454a16bb6649b86db0c88bbc8e9535

This is most likely due to the change in the persistent resources storage, for this, take a look at https://flowframework.readthedocs.io/en/3.0/TheDefinitiveGuide/PartV/ReleaseNotes/300.html#upgrading-your-web-server-configuration

Generally, you should really read through the upgrade instructions of each major version, because not all things can be covered by migrations.

PS: Regarding your reflection service error. You have an invalid type annotation in your FondsVolumeViewHelper, probably s.th. along the lines of @param <type>, which should either be @param array<Some\Type\Class> or just @param Some\Type\Class


(Nedko Georgiev) #10

Hi guys,

I’m still trying to upgrade here. I’ve upgraded relatively successfully from 2.2 to 3, but after moving to 4, I’m getting the following error in the console when I try to run the ./flow flow:cache:flush --force command:

"PHP Warning:  require_once(C:/xampp/htdocs/project/Packages/Framework/TYPO3.Fluid/Classes/TYPO3/Fluid/Package.php): failed to open stream: No such file or directory in C:\xampp\htdocs\project\Packages\Framework\Neos.Flow\Classes\Package\PackageFactory.php on line 47

PHP Fatal error:  require_once(): Failed opening required 'C:/xampp/htdocs/project/Packages/Framework/TYPO3.Fluid/Classes/TYPO3/Fluid/Package.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\project\Packages\Framework\Neos.Flow\Classes\Package\PackageFactory.php on line 47"

I get 4 times the warning and 3 times the error.
Any idea how to fix this? Thanks!


(Christian Müller) #11

delete Configuration/PackageStates.php and try again.


(Nedko Georgiev) #12

Thank you @christianm! Actually I forgot to change the TYPO3 to Neos for the postUpdateAndInstall scripts in the composer.json
Now the cache:flush is running properly, but I’m stuck on ./flow database:setcharset with the following error:

The object "string" which was specified as a property in the object configuration of object "Cleversoft\Base\Service\SubdomainHandler" (automatically registered class) does not exist.
Check for spelling mistakes and if that dependency is correctly

I think the problem is in these lines:

class SubdomainHandler {

	/**
	 * @var string
	 * @Flow\Inject(setting="subdomainHandler.pattern")
	 */
	protected $hostPattern = '';

Where this inject should include the Settings.yaml from the configuration and the respective subdomainHanlder.pattern.

Which in the settings file looks something like:

Company:
  Base:
    subdomainHandler:
     pattern: '(?P<customerName>.*)\.companydomain\.com'

I’m going through the change log, but can’t find anything related to this, any idea?

Thanks!


(Soren Malling) #13

You can no longer use @Flow\Inject you should use @Flow\InjectConfiguration. The changelog describes this change

https://flowframework.readthedocs.io/en/3.0/TheDefinitiveGuide/PartV/ReleaseNotes/300.html#new-annotation-injectconfiguration


(Nedko Georgiev) #14

Thank you very much! I don’t know how I’ve missed it, but this solved it. Now however I’m stuck on the next problem. I’m still trying to run ./flow database:setcharset and I’m also developing locally on Window 10 Pro if that matters.

Exception #1416244515 in line 44 of C:\xampp\htdocs\project\Data\Temporary\Development\Cache\Code\Flow_Object_Classes\Neos_Flow_ResourceManagement_Target_FileSystemSymlinkTarget.php: Could not publish "C:/xampp/htdocs/project/Packages/Application/Company.project/Resources/Public" into resource publishing target "localWebDirectoryStaticResourcesTarget" because the source directory could not be symlinked at target location.

25 Neos\Flow\ResourceManagement\Target\FileSystemSymlinkTarget_Original::publishDirectory("C:/xampp/htdocs/project/Packages/Application/Company.project/Resources/Public", "Company.project")
24 Neos\Flow\ResourceManagement\Target\FileSystemSymlinkTarget_Original::publishCollection(Neos\Flow\ResourceManagement\Collection)
23 Neos\Flow\ResourceManagement\Collection_Original::publish()
22 Neos\Flow\Package::Neos\Flow\{closure}("Flow_PublicResourcesFiles", array|1356|, "Neos\Flow\Monitor\FileMonitor::filesHaveChanged")
21 Closure::__invoke("Flow_PublicResourcesFiles", array|1356|, "Neos\Flow\Monitor\FileMonitor::filesHaveChanged")
20 call_user_func_array(array|2|, array|3|)
19 Neos\Flow\SignalSlot\Dispatcher::dispatch("Neos\Flow\Monitor\FileMonitor", "filesHaveChanged", array|2|)
18 Neos\Flow\Monitor\FileMonitor_Original::emitFilesHaveChanged("Flow_PublicResourcesFiles", array|1356|)
17 Neos\Flow\Monitor\FileMonitor_Original::detectChanges()
16 Neos\Flow\Package::Neos\Flow\{closure}(Neos\Flow\Core\Booting\Step, "runtime", "Neos\Flow\Core\Booting\Sequence::afterInvokeStep")
15 Closure::__invoke(Neos\Flow\Core\Booting\Step, "runtime", "Neos\Flow\Core\Booting\Sequence::afterInvokeStep")
14 call_user_func_array(array|2|, array|3|)
13 Neos\Flow\SignalSlot\Dispatcher::dispatch("Neos\Flow\Core\Booting\Sequence", "afterInvokeStep", array|2|)
12 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
11 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
10 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
9 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
8 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
7 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
6 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
5 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
4 Neos\Flow\Core\Booting\Sequence::invoke(Neos\Flow\Core\Bootstrap)
3 Neos\Flow\Cli\CommandRequestHandler::boot("Runtime")
2 Neos\Flow\Cli\CommandRequestHandler::handleRequest()
1 Neos\Flow\Core\Bootstrap::run()

Previous exception: Exception #1: Warning: rename(C:/xampp/htdocs/project/Web/_Resources/Static/Packages/Company.project.uBRh6DhH6y6jM.tmp,C:/xampp/htdocs/project/Web/_Resources/Static/Packages/Company.project): Access is denied. (code: 5) in C:\xampp\htdocs\project\Data\Temporary\Development\Cache\Code\Flow_Object_Classes\Neos_Flow_ResourceManagement_Target_FileSystemSymlinkTarget.php line 158

27 Neos\Flow\Error\ErrorHandler::handleError(2, "rename(C:/xampp/htdocs/project/Web/_Resources/Static/P…kages/Company.project): Access is denied. (code: 5)", "C:\xampp\htdocs\project\Data\Temporary\Development\Cac…ourceManagement_Target_FileSystemSymlinkTarget.php", 158, array|4|)
26 rename("C:/xampp/htdocs/project/Web/_Resources/Static/Packages/Company.project.uBRh6DhH6y6jM.tmp", "C:/xampp/htdocs/project/Web/_Resources/Static/Packages/Company.project")
25 Neos\Flow\ResourceManagement\Target\FileSystemSymlinkTarget_Original::publishDirectory("C:/xampp/htdocs/project/Packages/Application/Company.project/Resources/Public", "Company.project")
24 Neos\Flow\ResourceManagement\Target\FileSystemSymlinkTarget_Original::publishCollection(Neos\Flow\ResourceManagement\Collection)
23 Neos\Flow\ResourceManagement\Collection_Original::publish()
22 Neos\Flow\Package::Neos\Flow\{closure}("Flow_PublicResourcesFiles", array|1356|, "Neos\Flow\Monitor\FileMonitor::filesHaveChanged")
21 Closure::__invoke("Flow_PublicResourcesFiles", array|1356|, "Neos\Flow\Monitor\FileMonitor::filesHaveChanged")
20 call_user_func_array(array|2|, array|3|)
19 Neos\Flow\SignalSlot\Dispatcher::dispatch("Neos\Flow\Monitor\FileMonitor", "filesHaveChanged", array|2|)
18 Neos\Flow\Monitor\FileMonitor_Original::emitFilesHaveChanged("Flow_PublicResourcesFiles", array|1356|)
17 Neos\Flow\Monitor\FileMonitor_Original::detectChanges()
16 Neos\Flow\Package::Neos\Flow\{closure}(Neos\Flow\Core\Booting\Step, "runtime", "Neos\Flow\Core\Booting\Sequence::afterInvokeStep")
15 Closure::__invoke(Neos\Flow\Core\Booting\Step, "runtime", "Neos\Flow\Core\Booting\Sequence::afterInvokeStep")
14 call_user_func_array(array|2|, array|3|)
13 Neos\Flow\SignalSlot\Dispatcher::dispatch("Neos\Flow\Core\Booting\Sequence", "afterInvokeStep", array|2|)
12 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
11 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
10 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
9 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
8 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
7 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
6 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
5 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
4 Neos\Flow\Core\Booting\Sequence::invoke(Neos\Flow\Core\Bootstrap)
3 Neos\Flow\Cli\CommandRequestHandler::boot("Runtime")
2 Neos\Flow\Cli\CommandRequestHandler::handleRequest()
1 Neos\Flow\Core\Bootstrap::run()


    [array] => 
        previousException:
        [string] => Exception #1: Warning: rename(C:/xampp/htdocs/project/Web/_Resources/Static/Packages/Company.project.uBRh6DhH6y6jM.tmp,C:/xampp/htdocs/project/Web/_Resources/Static/Packages/Company.project): Access is denied. (code: 5) in C:\xampp\htdocs\project\Data\Temporary\Development\Cache\Code\Flow_Object_Classes\Neos_Flow_ResourceManagement_Target_FileSystemSymlinkTarget.php line 158

As a related issue I’ve found this one, but I’ve added permisions to Everybody and it still not working.


(Nedko Georgiev) #15

Okay, I actually decided to remove all of the _Resources and now it’s saying Database charset/collation fixing has been SKIPPED, the host backend option is not set in the configuration.
I’ve now added host: '127.0.0.1' for the Development env and the operation run successfully Database charset/collation was converted. .
The migration of the databse and publishing the new resources seems to have worked fine. Does it matter if I did them before running ./flow database:setcharset?


(Alexander Berl) #16

On windows, the workaround for the error when publishing is to open a command line with admin elevation. Then navigate to your flow root and run flow flow:cache:warmup once. When done you can close the admin CLI again. It’s a one time operation whenever you add a new package (with public resources).


(Nedko Georgiev) #17

Hi guys,

I’ve managed to update up to 5.1.3 and now most of the project is running, but there are still some outstanding issues for one of which I was hoping you can help me.
I have a Flow Aspect with a function that has the following annotation:

    /**
     * @param \Neos\Flow\Aop\JoinPointInterface $joinPoint
     * @Flow\Around("method(Neos\Flow\Mvc\Routing\Router->route())")
     * @return void
     */

The idea of the function is to match requested uri pattern to a custom one. So we’re creating a new HttpRequest and setting it’s value
$joinPoint->setMethodArgument('httpRequest', $newHttpRequest);
after which we just proceed
return $joinPoint->getAdviceChain()->proceed($joinPoint);

The problem is that before the upgrade with Flow 2.2.2 Router-.route() was returning
@return \TYPO3\Flow\Mvc\ActionRequest
and since Flow 2.3.0 it’s now returning
@return array The results of the matching route or NULL if no route matched
so now I’m doing almost the same as before, but adding the wrapper RouteContext

$newHttpRequest = new HttpRequest($_GET, $_POST, $_FILES, $_SERVER);
$newRouteContext = new RouteContext($newHttpRequest, RouteParameters::createEmpty());
return $joinPoint->getAdviceChain()->proceed($joinPoint);

however this returns an array of the matching route, but without appending exceeding arguments. How can add include these?


(Alexander Berl) #18

Glad you got this far already!

$newHttpRequest = new HttpRequest($_GET, $_POST, $_FILES, $_SERVER);
$newRouteContext = new RouteContext($newHttpRequest, RouteParameters::createEmpty());
return $joinPoint->getAdviceChain()->proceed($joinPoint);

A few things I notice here:

new HttpRequest($_GET, $_POST, $_FILES, $_SERVER) should probably be replaced with HttpRequest::createFromEnvironment() - it basically does the same, but it is more descriptive and will work when things change on how to create a new http request from globals (e.g. if we change constructor).

return $joinPoint->getAdviceChain()->proceed($joinPoint); hints that you don’t actually need an @Around advice, but rather an @Before. Doesn’t matter much, but it’s more fitting.

Anyway, are you sure you really need to create a completely new HttpRequest after the http component chain (which comes before routing)? You basically bypass ALL Http Components that work on the HttpRequest and adjust it before Routing.

I’m pretty sure what you want to achieve with this, can be done easier and with less side effects.

First of all, from the given code, you can do this completely without AOP, but with a simple HttpComponent that comes before Routing.

class CustomRoutingComponent implements ComponentInterface
{
    /**
     * @param ComponentContext $componentContext
     * @return void
     */
    public function handle(ComponentContext $componentContext) {
        $newHttpRequest = $componentContext->getHttpRequest()->withUri/Header/QueryParams(...);
        ...
        $componentContext->setHttpRequest($newHttpRequest);
    }
Neos:
  Flow:
    http:
      chain:
        'process':
          chain:
            'custom-routing':
              position: 'before routing'
              component: 'Acme\Foo\Routing\CustomRoutingComponent'

This works, because the Routing component will create the RouteContext from the ComponentContext’s HttpRequest that it receives. So it should be functionally equal to your AOP solution, just without the AOP “magic” and without having to know how the Router works internally with the RouteContext.

however this returns an array of the matching route, but without appending exceeding arguments.

Not sure what you mean by that, since route matching will normally not strip arguments, but resolving will. Could you share a bit more insight into this? What is an example incoming request and what the expected matched route?


(Nedko Georgiev) #19

Thank you very much! I did it as you suggested and it worked great!
I think I’m more or less done with Flow’s upgrade now.
What’s left is to accommodate for the upgrade of some libraries now.

I think I’ve learned quite a lot from this upgrade so thank you all for the help and support!