Bug #52944

Generating correct proxy classes for classes without a namespace

Added by Hendrik Frahmann almost 2 years ago. Updated about 1 year ago.

Status:Resolved Start date:2013-10-18
Priority:Should have Due date:
Assigned To:- % Done:

100%

Category:-
Target version:-
PHP Version: Complexity:
Has patch:No Affected Flow version:Git master

Description

When packages (that are loaded with composer to Libraries) containing classes without a namespace, Flow generates a corrupt proxy class.

class FooClass_Original {
}

namespace ; // empty namespace causing error
// Parse error: syntax error, unexpected ';', expecting T_STRING or T_NS_SEPARATOR or '{' in [filename]

class FooClass {
  // proxy class
}


Related issues

related to TYPO3.Flow - Bug #52945: Excluded classes should only be excluded from reflection ... New 2013-10-18

Associated revisions

Revision 9352bf3f
Added by Alexander Berl over 1 year ago

[BUGFIX] Classes without namespace create invalid proxy code

This change makes classes without namespace create proper proxy
class code, by optionally skipping the namespace declaration.
Before such classes would create an empty namespace statement,
which resulted in syntax errors, i.e.::

namespace ;

=> "syntax error, unexpected ';', expecting T_STRING or
T_NS_SEPARATOR or '{' in [filename]"

Change-Id: Ia7130b24ab149f00ac318c809c698db7c20934cb
Fixes: #52944
Releases: master, 2.0

Revision 649c3fa3
Added by Alexander Berl over 1 year ago

[BUGFIX] Classes without namespace create invalid proxy code

This change makes classes without namespace create proper proxy
class code, by optionally skipping the namespace declaration.
Before such classes would create an empty namespace statement,
which resulted in syntax errors, i.e.::

namespace ;

=> "syntax error, unexpected ';', expecting T_STRING or
T_NS_SEPARATOR or '{' in [filename]"

Change-Id: Ia7130b24ab149f00ac318c809c698db7c20934cb
Fixes: #52944
Releases: master, 2.0

Revision d9e103d2
Added by Alexander Berl over 1 year ago

[BUGFIX] Classes without namespace create invalid proxy code

This change makes classes without namespace create proper proxy
class code, by optionally skipping the namespace declaration.
Before such classes would create an empty namespace statement,
which resulted in syntax errors, i.e.::

namespace ;

=> "syntax error, unexpected ';', expecting T_STRING or
T_NS_SEPARATOR or '{' in [filename]"

Change-Id: Ia7130b24ab149f00ac318c809c698db7c20934cb
Fixes: #52944
Releases: master, 2.1, 2.0

History

#2 Updated by Alexander Berl almost 2 years ago

Should be trivial to fix with an if condition. See Object/Proxy/ProxyClass::render() line 195 ff.:
$classCode = "namespace $namespace;\n" .

#3 Updated by Gerrit Code Review almost 2 years ago

  • Status changed from New to Under Review

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

#4 Updated by Gerrit Code Review almost 2 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/24904

#5 Updated by Gerrit Code Review over 1 year ago

Patch set 3 for branch master of project Packages/TYPO3.Flow has been pushed to the review server.
It is available at https://review.typo3.org/24904

#6 Updated by Alexander Berl over 1 year ago

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

#7 Updated by Gerrit Code Review over 1 year ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch 2.0 of project Packages/TYPO3.Flow has been pushed to the review server.
It is available at https://review.typo3.org/26799

#8 Updated by Gerrit Code Review over 1 year ago

Patch set 1 for branch 2.1 of project Packages/TYPO3.Flow has been pushed to the review server.
It is available at https://review.typo3.org/26871

#9 Updated by Alexander Berl about 1 year ago

  • Status changed from Under Review to Resolved

Also available in: Atom PDF