Bug #56993
Cached classloader fails with fluid and is_callable()
Status: | Resolved | Start date: | 2014-03-17 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | - | % Done: | 100% |
|
Category: | Fluid | Spent time: | - | |
Target version: | - | |||
TYPO3 Version: | 6.2 | Is Regression: | No | |
PHP Version: | Sprint Focus: | |||
Complexity: |
Description
The new cached classloader tells you
#1233057566: "12:47" is not a valid cache entry identifier.
when is_callable()
is used with a string that is not a proper class name.
Extbase/Fluid tries to determine if a fluid property path can be called with is_callable()
. During path processing, it may call is_callable()
with a string that is not a normal class name.
Steps to reproduce:
1. Extbase controller:
$this->view->assign('foo', '1:2');
2. Fluid template:
<if condition="{foo.bar}"></if>
This happens with TYPO3 6.2beta7.
Related issues
Associated revisions
[BUGFIX] Don't access property if subject is scalar
Trying to access a property if the subject is
a string, causes the class loader to be triggered
as is_callable is invoked.
We can avoid that by checking if the subject
is an object or array. We can neglect that
is_scalar also returns false for resource types
as this will not really happen in practice.
Resolves: #56993
Releases: 6.2
Change-Id: I94754cd919acc857cd9a8b8e486080c0bf567112
Reviewed-on: https://review.typo3.org/28586
Reviewed-by: Alexander Opitz
Tested-by: Alexander Opitz
Reviewed-by: Christian Weiske
Tested-by: Christian Weiske
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
History
#1 Updated by Christian Weiske over 1 year ago
The "Cleanup ClassLoader" task #56797 removed a try/catch-Block which caught this exception previously.
#2 Updated by Gerrit Code Review over 1 year ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28467
#3 Updated by Helmut Hummel over 1 year ago
- Status changed from Under Review to Needs Feedback
Christian Weiske wrote:
when
is_callable()
is used with a string that is not a proper class name.
can you please provide the class and line where these checks are performed?
Extbase/Fluid tries to determine if a fluid property path can be called with
is_callable()
. During path processing, it may callis_callable()
with a string that is not a normal class name.Steps to reproduce:
1. Extbase controller:
$this->view->assign('foo', '1:2');
2. Fluid template:
<if condition="{foo.bar}"></if>
could not trigger this with this code (class loader is not triggered with class name "1:2")
#4 Updated by Helmut Hummel over 1 year ago
Helmut Hummel wrote:
Christian Weiske wrote:
Steps to reproduce:
1. Extbase controller:
$this->view->assign('foo', '1:2');
2. Fluid template:
<if condition="{foo.bar}"></if>
could not trigger this with this code (class loader is not triggered with class name "1:2")
Ah, OK, could reproduce it now.
Can you provide a real use case where this can happen?
$this->view->assign('foo', '1:2'); and then <if condition="{foo.bar}"></if> is not nice to fatal there (which is fixed now btw), but it also does not look like it makes much sense to do things like that ;)
Anyway, if we can avoid triggering the class loader in Fluid, we should do so. For that we need to understand the use case and how we then can deal with that in Fluid
#5 Updated by Christian Weiske over 1 year ago
We have some partials that used to render generic data elements.
For example:
$data[] = (object)array('value' => 12.5, 'unit' => 'C'); $data[] = '12:05';
Those data are aggregated from different APIs.
Now our partial contains the following code to determine if it is a unit/value datum or not:
<if condition="{datum.value}"> <then>{datum.value} {datum.unit}</then> <else>{datum}</else> </if>
I think this is a sensible use case.
#6 Updated by Gerrit Code Review over 1 year ago
- Status changed from Needs Feedback to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28586
#7 Updated by Helmut Hummel over 1 year ago
Christian Weiske wrote:
We have some partials that used to render generic data elements.
Those data are aggregated from different APIs.
Now our partial contains the following code to determine if it is a unit/value datum or not:
Thanks.
I think this is a sensible use case.
Absolutely! I pushed a patchset to prevent the lookup if the subject is a scalar (neither array nor object)
#8 Updated by Helmut Hummel over 1 year ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 904dfaaae0688a87bdaacd02e33849417d94e508.