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: | ||
| Assignee: | Karsten Dambekalns | % Done: | 100% |
|
| Category: | Object | |||
| Target version: | TYPO3 Flow Base Distribution - 1.1.1 | |||
| PHP Version: | Complexity: | |||
| Has patch: | No | FLOW3 version affected: | FLOW3 1.1.0 rc 1 | |
| Votes: | 0 |
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
Updated by Karsten Dambekalns 11 months ago
- Project changed from TYPO3 Flow Base Distribution to TYPO3.Flow
- Status changed from New to Accepted
- Assignee set to Karsten Dambekalns
Updated by Karsten Dambekalns 11 months ago
- Category set to Object
- Has patch set to No
Updated by Gerrit Code Review 11 months 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
Updated by Karsten Dambekalns 11 months ago
- Target version set to 1.1
Updated by Gerrit Code Review 11 months ago
Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/13047
Updated by Karsten Dambekalns 10 months ago
- Target version changed from 1.1 to 1.1.1
Updated by Gerrit Code Review 7 months ago
Patch set 3 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/13047
Updated by Gerrit Code Review 6 months 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
Updated by Karsten Dambekalns 6 months ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 798d2b324dd420c64cfbfad6359befdadbb59f45.