Project

General

Profile

Actions

Story #94055

closed

Deprecation: #83094 IgnoreValidation results in exception

Added by Franz Holzinger almost 3 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
-- undefined --
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2021-05-04
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.3
Tags:
Sprint Focus:

Description

The deprecation #83094 has not been taken care of in the function initializeActionMethodValidators of class ActionController .

This leads to a PHP exception.

PHP Warning: array_flip(): Can only flip STRING and INTEGER values in /var/www/html/typo3_src-9.5.24/typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php line 254

See the blog example extension:

https://github.com/FriendsOfTYPO3/blog_example/issues/10

This fix solves the issue for this case:

$ignoreValidationAnnotations = array_unique(array_flip(
$classSchema->getMethod($this->actionMethodName)['tags']['TYPO3\CMS\Extbase\Annotation\IgnoreValidation'] ?? []
));

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #83094: Replace @ignorevalidation with @Extbase\IgnoreValidationClosed2017-11-25

Actions
Actions #1

Updated by Xavier Perseguers almost 3 years ago

  • Status changed from New to Accepted
  • Priority changed from Should have to Must have
  • Is Regression set to Yes

I can confirm this bug.

According to what Franz wrote, in v9 we should support both @ignorevalidation and TYPO3\CMS\Extbase\Annotation\IgnoreValidation.

I'd say we must support this syntax as well:

@TYPO3\CMS\Extbase\Annotation\Validate("some-custom-validator", param="someField")
Actions #2

Updated by Xavier Perseguers almost 3 years ago

  • Related to Feature #83094: Replace @ignorevalidation with @Extbase\IgnoreValidation added
Actions #3

Updated by Alexander Schnitzler almost 3 years ago

  • Status changed from Accepted to Needs Feedback
  • Priority changed from Must have to Could have
  • Is Regression changed from Yes to No

Xavier Perseguers wrote in #note-1:

I can confirm this bug.

According to what Franz wrote, in v9 we should support both @ignorevalidation and TYPO3\CMS\Extbase\Annotation\IgnoreValidation.

I'd say we must support this syntax as well:

[...]

I checked this and it's not a core bug but wrong usage in the blog example. The Feature rst explains the new usage:
https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/9.0/Feature-83094-ReplaceIgnorevalidationWithTYPO3CMSExtbaseAnnotationIgnoreValidation.html#

Wrong usage:

@TYPO3\CMS\Extbase\Annotation\IgnoreValidation $param

Right usage:
@TYPO3\CMS\Extbase\Annotation\IgnoreValidation(param)

What we can do is to add a detection if doctrine/annotations tell us there is a IgnoreValidation annotation in use but without a param defined. But still, that would result in the same problem: Having an exception thrown and the need to update the user land code base.

Actions #4

Updated by Xavier Perseguers almost 3 years ago

Actually, I too migrated wrongly to the new way, but it looks like we both did it wrong:

Previously:

/**
 * snip
 *
 * @ignorevalidation $someParameter
 */

WRONG MIGRATION (but according to deprecation documentation which lacks useful information):

/**
 * snip
 *
 * @TYPO3\CMS\Extbase\Annotation\IgnoreValidation $someParameter
 */

CORRECT MIGRATION:

/**
 * snip
 *
 * @TYPO3\CMS\Extbase\Annotation\IgnoreValidation("someParameter")
 */

this one is fine as well:

/**
 * snip
 *
 * @TYPO3\CMS\Extbase\Annotation\IgnoreValidation(argumentName="someParameter")
 */
Actions #5

Updated by Franz Holzinger almost 3 years ago

  • Tracker changed from Bug to Story
  • Priority changed from Could have to -- undefined --
  • % Done changed from 0 to 100
  • Is Regression deleted (No)

Good point.

Actions #6

Updated by Christian Kuhn about 2 years ago

  • Status changed from Needs Feedback to Closed

Looks as if this is resolved and no core issue.

Actions

Also available in: Atom PDF