Bug #38988

Wrong arguments check in buildConstructorInjectionCode (class TYPO3\FLOW3\Object\DependencyInjection\ProxyClassBuilder)

Added by Kobbe van Daatselaar almost 9 years ago. Updated over 8 years ago.

Status:
Resolved
Priority:
Should have
Category:
Object
Start date:
2012-07-16
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
No
Complexity:

Description

On line 370 there is a wrong check on the constructor arguments.
The current code doesn't allow a NULL value to be send to a class contructor.
The isset() check should be replaced by an array_key_exists check:

if ($objectConfiguration->getScope() === \TYPO3\FLOW3\Object\Configuration\Configuration::SCOPE_SINGLETON) {
                $code .= '        if (!array_key_exists(' . $index . ', $arguments)) throw new \TYPO3\FLOW3\Object\Exception\UnresolvedDependenciesException(\'Missing required constructor argument $' . $parameterName . ' in class \' . __CLASS__ . \'. ' . 'Please check your calling code and Dependency Injection configuration.\', 1296143787);' . "\n";
                //$code .= '        if (!isset($arguments[' . $index . '])) throw new \TYPO3\FLOW3\Object\Exception\UnresolvedDependenciesException(\'Missing required constructor argument $' . $parameterName . ' in class \' . __CLASS__ . \'. ' . 'Please check your calling code and Dependency Injection configuration.\', 1296143787);' . "\n";
            } else {
                $code .= '        if (!array_key_exists(' . $index . ', $arguments)) throw new \TYPO3\FLOW3\Object\Exception\UnresolvedDependenciesException(\'Missing required constructor argument $' . $parameterName . ' in class \' . __CLASS__ . \'. ' . 'Note that constructor injection is only support for objects of scope singleton (and this is not a singleton) – for other scopes you must pass each required argument to the constructor yourself.\', 1296143788);' . "\n";
                //$code .= '        if (!isset($arguments[' . $index . '])) throw new \TYPO3\FLOW3\Object\Exception\UnresolvedDependenciesException(\'Missing required constructor argument $' . $parameterName . ' in class \' . __CLASS__ . \'. ' . 'Note that constructor injection is only support for objects of scope singleton (and this is not a singleton) – for other scopes you must pass each required argument to the constructor yourself.\', 1296143788);' . "\n";
            }
#1

Updated by Karsten Dambekalns almost 9 years ago

  • Project changed from TYPO3 Flow Base Distribution to TYPO3.Flow
  • Status changed from New to Accepted
  • Assignee set to Karsten Dambekalns
#2

Updated by Karsten Dambekalns almost 9 years ago

  • Category set to Object
  • Has patch set to No
#3

Updated by Gerrit Code Review almost 9 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/13047

#4

Updated by Karsten Dambekalns almost 9 years ago

  • Target version set to 1.1
#5

Updated by Gerrit Code Review almost 9 years ago

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

#6

Updated by Karsten Dambekalns almost 9 years ago

  • Target version changed from 1.1 to 1.1.1
#7

Updated by Gerrit Code Review over 8 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/13047

#8

Updated by Gerrit Code Review over 8 years ago

Patch set 1 for branch FLOW3-1.1 has been pushed to the review server.
It is available at https://review.typo3.org/17094

#9

Updated by Karsten Dambekalns over 8 years ago

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

Also available in: Atom PDF