Bug #33932

AOP Proxy Compiler does not handle numeric annotation parameters

Added by Alexander Berl over 9 years ago. Updated over 9 years ago.

Status:
Resolved
Priority:
Must have
Category:
AOP
Start date:
2012-02-15
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
No
Complexity:
no-brainer

Description

In the TYPO3\FLOW3\Object\Proxy\Compiler::renderAnnotation function, there is currently no case for numeric annotation members, which leads to such values being parsed out of the original code.

When this happens, an Exception is thrown in Doctrine Annotation Parser that an identifier is expected instead of ")".

Test Case:
- Create new annotation with an integer class member (e.g. "amount").
- Annotate a method or class with the annotation, setting the amount via @annotation(amount=X)

Expected:
The proxy class contains the same annotation @annotation(amount=X)

Actual:
The proxy class contains the annotation @annotation(amount=) and a parsing exception is thrown within Doctrine.

If the parameter is set directly, no exception is thrown, but the parameter is also parsed out of the proxy class docblock (i.e. @annotation instead of @annotation(X))

Solution:
Add a elseif case inside renderAnnotation that checks for is_numeric:

    } elseif (is_numeric($optionValue)) {
        $optionValueAsString = $optionValue;


Related issues

Has duplicate TYPO3.Flow - Bug #34018: Annotation with a numeric value is not correctly generatedClosedKarsten Dambekalns2012-02-16

Actions

Also available in: Atom PDF