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
#1

Updated by Karsten Dambekalns over 9 years ago

  • Status changed from New to Accepted
  • Assignee set to Karsten Dambekalns
#2

Updated by Gerrit Code Review over 9 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/9125

#3

Updated by Karsten Dambekalns over 9 years ago

  • Target version set to 1.0.3
#4

Updated by Karsten Dambekalns over 9 years ago

  • Target version changed from 1.0.3 to 1.0.4
#5

Updated by Gerrit Code Review over 9 years ago

Patch set 1 for branch FLOW3-1.0 has been pushed to the review server.
It is available at http://review.typo3.org/9584

#6

Updated by Gerrit Code Review over 9 years ago

Patch set 2 for branch FLOW3-1.0 has been pushed to the review server.
It is available at http://review.typo3.org/9584

#7

Updated by Karsten Dambekalns over 9 years ago

  • Target version changed from 1.0.4 to 1.0.5
#8

Updated by Karsten Dambekalns over 9 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF