Bug #34872

Singleton validators never have their options passed

Added by Karsten Dambekalns about 1 year ago. Updated about 1 month ago.

Status:Resolved Start date:2012-03-15
Priority:Must have Due date:
Assignee:Adrian Föder % Done:

100%

Category:Validation
Target version:TYPO3 Flow Base Distribution - 2.0
PHP Version: Complexity:
Has patch:No FLOW3 version affected:FLOW3 1.0.3
Votes: 0

Description

The ValidatorResolver does not pass options to validators that are singletons:

            case Configuration::SCOPE_PROTOTYPE:
                $validator = new $validatorObjectName($validatorOptions);
                break;
            case Configuration::SCOPE_SINGLETON:
                $validator = $this->objectManager->get($validatorObjectName);
                break;

Since singletons cannot get constructor arguments via get() but only through object configuration, we should at least check for options given to a singleton here and inform the developer about a probably bug in his code…

Associated revisions

Revision 05fc389b
Added by Adrian Föder about 1 month ago

[BUGFIX] Throw exception when using options with singleton validators

Validators being singleton must not be called with options because
the options are then inherent properties of the Validator and cannot
be executed subsequently with other options.

An exception is thrown if such a case occurs because it is then
a design mistake of the developer.

Besides, this improves the namespace use a bit.

Change-Id: I4a7dbaaaf8fa39a3f4677bb43db044a3231b843f
Releases: master, 2.0
Fixes: #34872

History

Updated by Karsten Dambekalns about 1 year ago

  • Target version changed from 1.0.4 to 1.0.5

Updated by Karsten Dambekalns 12 months ago

  • Target version changed from 1.0.5 to 1.1 RC1

Updated by Karsten Dambekalns 11 months ago

  • Status changed from Accepted to New
  • Assignee deleted (Karsten Dambekalns)
  • Target version deleted (1.1 RC1)

Updated by Karsten Dambekalns 4 months ago

  • Subject changed from Singleton validators do not get their options to Singleton validators have never passed their options

Updated by Karsten Dambekalns 4 months ago

  • Subject changed from Singleton validators have never passed their options to Singleton validators never have their options passed

Updated by Adrian Föder 4 months ago

  • Status changed from New to Accepted
  • Assignee set to Adrian Föder
  • Target version set to 2.0
  • FLOW3 version affected changed from FLOW3 1.0.3 to Git master

Updated by Karsten Dambekalns 4 months ago

Why did you change the affected version?

Updated by Gerrit Code Review 4 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 https://review.typo3.org/17671

Updated by Adrian Föder 4 months ago

  • FLOW3 version affected changed from Git master to FLOW3 1.0.3

sorry didn't want to change it but was used to click "git any" at that box, without reading a present value...

Updated by Gerrit Code Review 4 months ago

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

Updated by Gerrit Code Review about 1 month ago

Patch set 1 for branch 2.0 has been pushed to the review server.
It is available at https://review.typo3.org/19562

Updated by Adrian Föder about 1 month ago

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

Also available in: Atom PDF