Bug #25908

ProxyClassBuilder produces invalid code for prototype arguments

Added by Bastian Waidelich over 4 years ago. Updated over 4 years ago.

Status:Resolved Start date:2011-04-12
Priority:Must have Due date:
Assigned To:Robert Lemke % Done:

100%

Category:Object
Target version:-
PHP Version: Complexity:
Has patch: Affected Flow version:

Description

When using SwiftMailer the ProxyClassBuilder creates following code in F3_SwiftMailer_Message.php:

1private function FLOW3_Proxy_injectProperties() {
2    $this->mailer = new \F3\SwiftMailer\Mailer(X);
3}

This obviously leads to an exception here.
I got this fixed by changing line 99 of the ProxyClassBuilder from

1$preparedArguments[] = 'X';


to
1$preparedArguments[] = '\F3\FLOW3\Core\Bootstrap::$staticObjectManager->get(\'' . $argumentValue . '\')';

Additionally I needed to add following lines to the beginning of the ObjectManager::create() method:

1if (isset($this->objects[$objectName]['f'])) {
2    return $this->buildObjectByFactory($objectName);
3}

Not sure, if that is a clean solution, but it seems to fix the issue for me.


Related issues

related to TYPO3.Flow - Bug #10595: ObjectManager should not allow injection of prototypes Rejected 2010-11-02
duplicates TYPO3.Flow - Bug #25448: Use of undefined constant 'X' during prototype injection Closed 2011-03-30

Associated revisions

Revision feff686a
Added by Bastian Waidelich over 4 years ago

[BUGFIX] ProxyClassBuilder produces valid code for prototype arguments

Currently FLOW3 does not support the injection of prototype objects
that require constructor arguments. Instead the ProxyClassBuilder
statically inserts "X" as constructor argument.

Change-Id: I5650866cc2aa117dc580d16867a5e9a686d0c1f2
Resolves: #25908

History

#1 Updated by Karsten Dambekalns over 4 years ago

  • Status changed from New to Closed

Duplicate with nicer description provided by Bastian :)

#2 Updated by Bastian Waidelich over 4 years ago

  • Status changed from Closed to New

Karsten Dambekalns wrote:

Duplicate with nicer description provided by Bastian :)

sorry for the duplicate, but at least one of the issues should stay open *g

#3 Updated by Mr. Hudson over 4 years ago

Patch set 1 of change I5650866cc2aa117dc580d16867a5e9a686d0c1f2 has been pushed to the review server.
It is available at http://review.typo3.org/1830

#4 Updated by Mr. Hudson over 4 years ago

Patch set 2 of change I5650866cc2aa117dc580d16867a5e9a686d0c1f2 has been pushed to the review server.
It is available at http://review.typo3.org/1830

#5 Updated by Bastian Waidelich over 4 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF