Bug #25908

ProxyClassBuilder produces invalid code for prototype arguments

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

Status:
Resolved
Priority:
Must have
Assignee:
Category:
Object
Target version:
-
Start date:
2011-04-12
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
Complexity:

Description

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

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

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

$preparedArguments[] = 'X';


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

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

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

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 prototypesRejectedRobert Lemke2010-11-02

Actions
Is duplicate of TYPO3.Flow - Bug #25448: Use of undefined constant 'X' during prototype injectionClosedRobert Lemke2011-03-30

Actions
#1

Updated by Karsten Dambekalns over 10 years ago

  • Status changed from New to Closed

Duplicate with nicer description provided by Bastian :)

#2

Updated by Bastian Waidelich over 10 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 10 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 10 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 10 years ago

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

Also available in: Atom PDF