Bug #31363

Windows newline in annotation block throws exception

Added by Christof Rodejohann almost 4 years ago. Updated over 3 years ago.

Status:Resolved Start date:2011-10-27
Priority:Should have Due date:
Assigned To:Karsten Dambekalns % Done:

100%

Category:Reflection
Target version:TYPO3 Flow Base Distribution - 1.0.2
PHP Version: Complexity:
Has patch:No Affected Flow version:FLOW3 1.0.0

Description

If a class annotation contains Windows newline character instead of the expected UNIX version, FLOW3 will quit with an Uncaught Exception.

Because of this a fresh clone from /FLOW3/Distributions/Base.git might fail under some circumstances (Windows and git config "core.autocrlf = true"). This can be avoided with a correct git configuration, which is now documented in the wiki ( http://forge.typo3.org/projects/flow3/wiki/Installation_hints8 ). An example exception thrown by this configuration can be found here: http://pastebin.de/raw/?id=19666 and the bug under http://forge.typo3.org/issues/31087 is related to this issue.

The expected behavior is FLOW3 working with Windows new-line in annotations block.

PS: Thx to the #flow3 IRC channel and afoeder for figuring this out.


Related issues

related to TYPO3.Flow - Bug #32466: Strange exception: Invalid annotation Resolved 2011-12-12

Associated revisions

Revision 40af60c9
Added by Karsten Dambekalns over 3 years ago

[BUGFIX] "Wrong" EOL characters break parsing of doc comments

When \r\n was used as EOL instead of just \n the parsed doc comments
would retain the \r which would cause confusing exceptions in some
cases later on.

Change-Id: I632ced42f1f337cb7546ed411bcfde2e92011c2e
Fixes: #31363
Related: #32466
Related: #31087
Releases: 1.0, 1.1

Revision 6ca1f9b2
Added by Karsten Dambekalns over 3 years ago

[BUGFIX] "Wrong" EOL characters break parsing of doc comments

When \r\n was used as EOL instead of just \n the parsed doc comments
would retain the \r which would cause confusing exceptions in some
cases later on.

Change-Id: I5210bb5308558640f7b1e567eaf9a184c1f5a2d5
Fixes: #31363
Related: #32466
Related: #31087
Releases: 1.0, 1.1

History

#1 Updated by Christof Rodejohann almost 4 years ago

Having trouble with my git environment, so i can't push the patch. The solution is a one-line change in

Packages\Framework\TYPO3.FLOW3\Classes\Reflection\DocCommentParser.php

In Line 50, the $line has to be stripped of all newline characters. Adding the following line there will fix the bug:

$line = str_replace(array("\r\n", "\n", "\r"), "", $line);

#2 Updated by Karsten Dambekalns over 3 years ago

  • Category set to Reflection
  • Status changed from New to Accepted
  • Assigned To set to Karsten Dambekalns
  • Target version set to 1.0.2

#3 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/7287

#4 Updated by Karsten Dambekalns over 3 years ago

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

#5 Updated by Gerrit Code Review over 3 years ago

  • Status changed from Resolved to Under Review

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

#6 Updated by Karsten Dambekalns over 3 years ago

  • Status changed from Under Review to Resolved

Also available in: Atom PDF