Bug #38459

Accessing a not present property/method should error verbosely

Added by Adrian Föder over 9 years ago. Updated over 9 years ago.

Status:
New
Priority:
Must have
Target version:
-
Start date:
2012-06-28
Due date:
% Done:

0%

Estimated time:

Description

in my case, I erroneously wrote

page.body.title = ${context.attr('title')}

which resulted in

<!-- Exception while rendering page&lt;TYPO3.TYPO3:Page&gt;/body :
Catchable Fatal Error: Object of class TYPO3\Eel\FlowQuery\FlowQuery
could not be converted to string in /var/www/Data/Temporary/Development⸗
/Cache/Code/Fluid_TemplateCache/Standalone_template_file_Site_5d5f8dc75⸗
b9c07fb770fba32529975b68fe55c41.php line 1193 -->

Christian perfectly summarized it to

yep, so the parser correctly detects the FlowQuery and creates the FlowQuery object but it seems it isn't evaluated

He also provided the reason: there is no `attr`, it must be `property`.
So please provide a better exception catch for such cases. I filed this as Bug because I think it's pretty important for users.

#1

Updated by Christopher Hlubek over 9 years ago

  • Assignee set to Sebastian Kurfuerst

I think this is due to the behaviour in FLowQuery::__call where a unknown operation should rather throw an exception instead of returning the FlowQuery object itself.

#2

Updated by Christopher Hlubek over 9 years ago

But when adding some more Unit Tests to Context I found some cases where also Eel itself did not throw an exception but returned NULL. Nesting expressions like foo.bar.baz should be safe in Eel by design, even if NULL values are in the path. But I think if the callee is a method or array there should be an exception. If the callee is NULL I would return NULL to make chaining safer.

Also available in: Atom PDF