Bug #38988
Wrong arguments check in buildConstructorInjectionCode (class TYPO3\FLOW3\Object\DependencyInjection\ProxyClassBuilder)
Status: | Resolved | Start date: | 2012-07-16 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | Karsten Dambekalns | % Done: | 100% |
|
Category: | Object | |||
Target version: | TYPO3 Flow Base Distribution - 1.1.1 | |||
PHP Version: | Complexity: | |||
Has patch: | No | Affected Flow version: | FLOW3 1.1.0 rc 1 |
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"; }
Associated revisions
[BUGFIX] Fix arguments check in buildConstructorInjectionCode, allow NULL
It was not possible to pass NULL as constructor arguments, because of
the use of isset() instead of array_key_exists().
Also a few other places needed to be changed and some tiny (unrelated)
tweaks were made.
Change-Id: I7470ff1a38a3b1ee9afc5771ab971478b59538e6
Fixes: #38988
Releases: 1.2
History
#1 Updated by Karsten Dambekalns about 3 years ago
- Project changed from TYPO3 Flow Base Distribution to TYPO3.Flow
- Status changed from New to Accepted
- Assigned To set to Karsten Dambekalns
#2 Updated by Karsten Dambekalns about 3 years ago
- Category set to Object
- Has patch set to No
#3 Updated by Gerrit Code Review about 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/13047
#4 Updated by Karsten Dambekalns about 3 years ago
- Target version set to 1.1
#5 Updated by Gerrit Code Review about 3 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 3 years ago
- Target version changed from 1.1 to 1.1.1
#7 Updated by Gerrit Code Review over 2 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 2 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 2 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 798d2b324dd420c64cfbfad6359befdadbb59f45.