Skip to content

Commit

Permalink
MDL-67316 typo3: Pass correct hex chars to hexdec()
Browse files Browse the repository at this point in the history
Typo3 was relaying on the feature of base converter
functions silently removing invalid chars so, for example:

'U+00A0' => '00A0' => 160

Since php74, the existence of those invalid chars do produce
a deprecation warning, no matter the outcome continues being the same.

So, here, we are just converting that invalud 'U+' by '0x'
  • Loading branch information
stronk7 committed Apr 24, 2020
1 parent a6f315c commit f769b8f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/typo3/class.t3lib_cs.php
Original file line number Diff line number Diff line change
Expand Up @@ -1313,12 +1313,12 @@ function initUnicodeData($mode = NULL) {
array_push($code_decomp, chr($ord));
}
}
$ascii[$this->UnumberToChar(hexdec($from))] = join('', $code_decomp);
$ascii[$this->UnumberToChar(hexdec(str_replace('U+', '0x', $from)))] = join('', $code_decomp);
}

// add numeric decompositions
foreach ($number as $from => $to) {
$utf8_char = $this->UnumberToChar(hexdec($from));
$utf8_char = $this->UnumberToChar(hexdec(str_replace('U+', '0x', $from)));
if (!isset($ascii[$utf8_char])) {
$ascii[$utf8_char] = $to;
}
Expand Down
7 changes: 7 additions & 0 deletions lib/typo3/readme_moodle.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ Procedure:

Local changes (to verify/apply with new imports):

- MDL-67316: PHP 7.4 compatibility. Wrong chars in hexdec() operations.
Ensure that all the calls to hexdec() are passing exclusively
correct hex chars. Before php74 they were silently discarded but
with php74 a deprecation warning is produced. We haven't looked how
this is fixed upstream because plans include to remove this
library from core (see MDL-65809)

- MDL-67017: PHP 7.4 compatibility. Curly brackets.
Remove all the deprecated curly bracket uses {} to access to strings/arrays
by key. We haven't looked how this is fixed upstream because plans include
Expand Down

0 comments on commit f769b8f

Please sign in to comment.