Bug #89002

List view search can't search for integer search phrase

Added by Michal Cygankiewicz 4 months ago. Updated about 2 months ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2019-08-23
Due date:
% Done:

100%

TYPO3 Version:
8
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

My table TCA searchFields are:

'searchFields' => '......,customer_number',

My field configuration is

'customer_number' => [
.......
'config' => [
'type' => 'input',
'size' => 30,
'eval' => 'int, unique',
'readOnly' => 1,
'max' => 11
],
],

In case I put number as a search phrase in TYPO3 main backend search I can find my record.

In case I put number as a search phrase in TYPO3 list view search I can not find my record.

Related core code: https://github.com/TYPO3/TYPO3.CMS/blob/TYPO3_8-7/typo3/sysext/recordlist/Classes/RecordList/AbstractDatabaseRecordList.php#L979
TYPO3 is excluding from searchFields those fields which has "int" in "eval" configuration field.

Workaround for that is to add pidonly configuration so my field looks like:

'customer_number' => [
...
'config' => [
'type' => 'input',
'size' => 30,
'eval' => 'int, unique',
'readOnly' => 1,
'max' => 11,
'search' => [
'pidonly' => 'pidonly'
]
],
],

This looks strange for me and I consider it as a TYPO3 bug. Also https://docs.typo3.org/m/typo3/reference-tca/master/en-us/ColumnsConfig/Type/Input.html#id77 says pidonly should be bool but it have effect only if it is 'pidonly' => 'pidonly' because in_array function usage in https://github.com/TYPO3/TYPO3.CMS/blob/TYPO3_8-7/typo3/sysext/recordlist/Classes/RecordList/AbstractDatabaseRecordList.php#L990.

search.jpg View (60.4 KB) Michal Cygankiewicz, 2019-08-23 09:56

Associated revisions

Revision 0cf65f88 (diff)
Added by Christian Eßl about 2 months ago

[BUGFIX] Fix 'pidonly' check in backend search

The TCA setting 'pidonly', which is used to limit a field to be only
searched in the single page view in the list module, was broken and
didn't behave as described in the official TCA documentation.

First, the 'pidonly' setting is expected to be a boolean. However, the
'if' condition would fail for a boolean because the in_array() check in
the code was using strict type mode. Also, this check would never care
about the actual value of 'pidonly', only if it was set.

Second, you couldn't search for an integer value, while not using the
'pidonly' setting, at all.

This patch fixes this behaviour.

Resolves: #89002
Releases: master, 9.5
Change-Id: Iedac044c32b8dd500f4de175ae97ab17984725f8
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61884
Reviewed-by: Julian Geils <>
Reviewed-by: Sascha Rademacher <>
Reviewed-by: Felix P. <>
Reviewed-by: Henning Liebe <>
Reviewed-by: Jörg Bösche <>
Reviewed-by: Daniel Goerz <>
Tested-by: TYPO3com <>
Tested-by: Sascha Rademacher <>
Tested-by: Jörg Bösche <>
Tested-by: Daniel Goerz <>

Revision d83c0fe8 (diff)
Added by Christian Eßl about 2 months ago

[BUGFIX] Fix 'pidonly' check in backend search

The TCA setting 'pidonly', which is used to limit a field to be only
searched in the single page view in the list module, was broken and
didn't behave as described in the official TCA documentation.

First, the 'pidonly' setting is expected to be a boolean. However, the
'if' condition would fail for a boolean because the in_array() check in
the code was using strict type mode. Also, this check would never care
about the actual value of 'pidonly', only if it was set.

Second, you couldn't search for an integer value, while not using the
'pidonly' setting, at all.

This patch fixes this behaviour.

Resolves: #89002
Releases: master, 9.5
Change-Id: Iedac044c32b8dd500f4de175ae97ab17984725f8
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62061
Tested-by: TYPO3com <>
Tested-by: Daniel Goerz <>
Reviewed-by: Daniel Goerz <>

History

#1 Updated by Riccardo De Contardi 4 months ago

Is this related? #40347

#2 Updated by Michal Cygankiewicz 4 months ago

It is not exactly the same. Here TYPO3 is excluding from searchFields those fields which has 'int' in 'eval' configuration and which don't have search|pidonly configuration which does not make sense too me. And it only happens to list view search and not toolbar search.

#3 Updated by Gerrit Code Review 2 months ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61884

#4 Updated by Christian Eßl 2 months ago

I can't find the sense in this check for 'pidonly' either... I investigated where this piece of code in AbstractDatabaseRecordList and found he following review:

https://review.typo3.org/c/Packages/TYPO3.CMS/+/2189/

I made a fix for this behaviour and described my reasoning in the commit message:
https://review.typo3.org/c/Packages/TYPO3.CMS/+/61884

#5 Updated by Gerrit Code Review 2 months ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61884

#6 Updated by Gerrit Code Review 2 months ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61884

#7 Updated by Gerrit Code Review 2 months ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61884

#8 Updated by Gerrit Code Review about 2 months ago

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62061

#9 Updated by Christian Eßl about 2 months ago

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

Also available in: Atom PDF