[Flow] Fluid: Recent major changes

Bastian Waidelich bastian at typo3.org
Mon Dec 15 13:01:51 CET 2014


Fellow Fluid warriors,

in the last few days we submitted some long anticipated but partly 
breaking changes to Fluid.
This is a little heads-up so you can celebrate and possibly adjust your 
templates:

1. "[BUGFIX] Throw helpful exception if ViewHelper class can't be resolved"

This has been a major hurdle, especially for Fluid rookies:
If you mistyped a ViewHelper or confused upper- and lower-case this 
could lead to very confusing exceptions or even fatal errors.

With https://review.typo3.org/31953 those cases are now checked during 
parse time throwing some helpful exceptions if they occur.

This change is not breaking and is available with the next releases of 
Flow 2.2+


2. "[!!!][FEATURE] Throw exception for unresolved namespaces"

Another major issue people often have with Fluid is the handling of 
unknown namespaces.
For example if you move code to a partial and forget to copy the 
corresponding {namespace <xyz>} declarations this could lead to bad bad 
things because 3rd party ViewHelpers weren't identified.
I just had this recently:
I copied "<media:image asset="{image}" />" from another template but 
forgot to add the "{namespace media=TYPO3\Media\ViewHelpers}" 
declaration.. The result is that the parser ignores the tag but tries to 
render {image} as string... *bam*
To cut a long story short: This will be a thing of the past with 
https://review.typo3.org/30673

Unfortunately this improvement will only be released with Flow 3.0 
(probably the successor of the recently released version 2.3) because it 
is a breaking change. But it is merged in git master already!


3. "[FEATURE] Configurable namespaces" and "[FEATURE] Add PackageKeys as 
namespaces to TemplateParser"

Another feature for 3.0:
https://review.typo3.org/30718 adds a mechanism for registering 
ViewHelper namespace aliases via signal/slot*
And with https://review.typo3.org/30708 that mechanism is used to 
register all package keys of active packages so you can directly refer 
to <your.packageKey:viewHelper /> without having to import that 
namespace (e.g. "<typo3.neos:node />").


4. "[!!!][FEATURE] Consistent escaping behavior"

Now the not so good news..:
As previously discussed in this forum[1] the escaping behavior of Fluid 
is not perfectly consistent.. Last week I've hastily merged 
https://review.typo3.org/35294 (probably blinded by the chance of 
resolving 4 major Fluid issues within 24 hours) just to realize that 
this change completely breaks Neos (yes, I've tested this before but 
somehow failed to pull in the right changes).. Anyways, I immediately 
reverted the change and now there's also a fix for the Neos package 
(https://review.typo3.org/35307) but this experience rendered some 
uncertainty whether the "breakingness" of this change is maybe too much 
even for a major version jump.. I'm confident that we find a good 
solution for this issue (maybe some clever code migration) but it will 
take some more time and discussion I'm afraid.


Anyways, we hope you enjoy the improvements and we're interested in your 
experience and feedback!


* "f" is always registered for Fluid and namespaces and explicitly 
specified namespace aliases overrule additionally registered namespaces

[1] http://forum.typo3.org/index.php?t=msg&goto=724605

-- 
Bastian Waidelich


More information about the Flow mailing list