Commit 972d623d authored by Christian Kuhn's avatar Christian Kuhn Committed by Benni Mack
Browse files

[BUGFIX] Drop a strange internal DataHandler method

That's a seldom gem.

Method convNumEntityToByteValue() in DataHandler
is *seriously* strange. It exists since very early
TYPO3 claiming to fix a "very rare" MSIE bug. It
*tries* to convert the "{" of a string like
"foo{bar" to an ascii char ("{") and does
this with a weird logic that includes a microtime().

Testing this thing locally reveals the method
returns different results per execution!

The patch drops that @internal method and it's
caller.

Change-Id: If9da47cc39d7c811b80879a4b532af90e9ea6f20
Resolves: #95789
Releases: master
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/71985

Tested-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Jochen's avatarJochen <rothjochen@gmail.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: Jochen's avatarJochen <rothjochen@gmail.com>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent 177b087f
......@@ -79,7 +79,7 @@ if (PHP_MAJOR_VERSION === 8) {
[
'message' => '#^Parameter \\#1 \\$separator of function explode expects non-empty-string, string given\\.$#',
'path' => '%currentWorkingDirectory%/',
'count' => 8,
'count' => 7,
],
[
'message' => '#^Ternary operator condition is always true.$#',
......
......@@ -2021,9 +2021,7 @@ class DataHandler implements LoggerAwareInterface
if (is_array($value)) {
$value = implode(',', $value);
}
// This converts all occurrences of '&#123;' to the byte 123 in the string - this is needed in very rare cases where file names with special characters (e.g. ???, umlaut) gets sent to the server as HTML entities instead of bytes. The error is done only by MSIE, not Mozilla and Opera.
// Anyway, this should NOT disturb anything else:
$value = $this->convNumEntityToByteValue($value);
// When values are sent as group or select they come as comma-separated values which are exploded by this function:
$valueArray = $this->checkValue_group_select_explodeSelectGroupValue($value);
// If multiple is not set, remove duplicates:
......@@ -7931,29 +7929,6 @@ class DataHandler implements LoggerAwareInterface
return $result;
}
/**
* Converts a HTML entity (like &#123;) to the character '123'
*
* @param string $input Input string
* @return string Output string
* @internal should only be used from within DataHandler
*/
public function convNumEntityToByteValue($input)
{
$token = md5(microtime());
$parts = explode($token, (string)preg_replace('/(&#([0-9]+);)/', $token . '\\2' . $token, $input));
foreach ($parts as $k => $v) {
if ($k % 2) {
$v = (int)$v;
// Just to make sure that control bytes are not converted.
if ($v > 32) {
$parts[$k] = chr($v);
}
}
}
return implode('', $parts);
}
/**
* Disables the delete clause for fetching records.
* In general only undeleted records will be used. If the delete
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment