Bug #55838

revExplode returns invalid values if no delimiter in string

Added by Alexander Stehlik over 6 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Should have
Category:
Backend API
Target version:
Start date:
2014-02-10
Due date:
% Done:

100%

TYPO3 Version:
6.2
PHP Version:
5.4
Tags:
Complexity:
easy
Is Regression:
Yes
Sprint Focus:

Description

Currently revExplode will return an invalid value in this case:

  1. $count is set to 2
  2. $delimiter does not exist in string

Example:

GeneralUtility::revExplode('_', 'test', 2),

Will return

array('', 'est')

but should return

array('test')

This also leads to an error in \TYPO3\CMS\Core\Resource\Filter\FileExtensionFilter->filterInlineChildren() when updating file reference records in a content element:

#1317178794: No fileusage (sys_file_reference) found for given UID.

because one letter is cut off from the UID.


Related issues

Related to TYPO3 Core - Task #55564: Improve GeneralUtility::revExplode performance Closed 2014-02-01
Related to TYPO3 Core - Bug #56405: GeneralUtility::revExplode returns unexpected result to getSingleField_typeFlex_draw() Closed 2014-02-28

Associated revisions

Revision dda0354d (diff)
Added by Alexander Stehlik over 6 years ago

[BUGFIX] Fix behavior of revExplode if delimiter not found

If the given delimiter is not found in the given string
GeneralUtility::revExplode() will return an array with a single element
containing the unexploded string.

Resolves: #55838
Releases: 6.2
Change-Id: I1146552a625a8057be86b2745febf808638a290c
Reviewed-on: https://review.typo3.org/27524
Reviewed-by: Andreas Wolf
Tested-by: Andreas Wolf
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn

History

#1 Updated by Gerrit Code Review over 6 years 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/27524

#2 Updated by Gerrit Code Review over 6 years 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/27524

#3 Updated by Alexander Stehlik over 6 years ago

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

#4 Updated by Riccardo De Contardi over 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF