Bug #33932

AOP Proxy Compiler does not handle numeric annotation parameters

Added by Alexander Berl over 3 years ago. Updated about 3 years ago.

Status:Resolved Start date:2012-02-15
Priority:Must have Due date:
Assigned To:Karsten Dambekalns % Done:

100%

Category:AOP
Target version:TYPO3 Flow Base Distribution - 1.0.5
PHP Version: Complexity:no-brainer
Has patch:No Affected Flow version:Git 1.0

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

duplicated by TYPO3.Flow - Bug #34018: Annotation with a numeric value is not correctly generated Closed 2012-02-16

Associated revisions

Revision 895d48b9
Added by Karsten Dambekalns over 3 years ago

[BUGFIX] Fixes handling of numeric annotation parameters

Annotations like @FooBar(amount=2) lost their parameter value
in renderAnnotation(). This change fixes that.

Change-Id: I89934bfdbc2ff07eba6abd8c976a17ed46e223b0
Fixes: #33932
Releases: 1.0, 1.1

Revision 1fb98a95
Added by Karsten Dambekalns over 3 years ago

[BUGFIX] Fixes handling of numeric annotation parameters

Annotations like @FooBar(amount=2) lost their parameter value
in renderAnnotation(). This change fixes that.

Change-Id: I4805b72a4056270426f79a85e18be3464004f140
Fixes: #33932
Releases: 1.0, 1.1

History

#1 Updated by Karsten Dambekalns over 3 years ago

  • Status changed from New to Accepted
  • Assigned To set to Karsten Dambekalns

#2 Updated by Gerrit Code Review over 3 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 3 years ago

  • Target version set to 1.0.3
  • Affected Flow version changed from Git master to Git 1.0

#4 Updated by Karsten Dambekalns over 3 years ago

  • Target version changed from 1.0.3 to 1.0.4

#5 Updated by Gerrit Code Review over 3 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 3 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 3 years ago

  • Target version changed from 1.0.4 to 1.0.5

#8 Updated by Karsten Dambekalns about 3 years ago

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

Also available in: Atom PDF