Project

General

Profile

Actions

Bug #16042

closed

Incorrect bitwise operation in t3lib_cs at utf8_encode function...

Added by Eloy Lafuente over 18 years ago. Updated over 18 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
-
Start date:
2006-04-13
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.0
PHP Version:
4
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

In the section of the function where it is reading the input string and combining the bytes to create a single character,

for ($a=0;$a<$strLen;$a++) { // Traverse each char in string.
$chr=substr($str,$a,1);
$ord=ord($chr);
if (isset($this->twoByteSets[$charset])) { // If the charset has two bytes per char
$ord2 = ord($str{$a+1});
$ord = $ord<<8 & $ord2; // assume big endian

//etc...

The line

$ord = $ord<<8 & $ord2;

doesn't seem right, isn't this just going to discard whatever is value in $ord2? (It's always going to & it against 0's)

I think the correct operation here would be,

$ord = $ord<<8 | $ord2;

instead.

Received in moodle.org bug tracker, it isn't critical for us because it's only executed if neither iconv, mbstring nor recode are available, but...

(text copied from http://moodle.org/bugs/bug.php?op=show&bugid=5165)

P.S.: Congratulations for your new release! B-)
(issue imported from #M3251)

Actions #1

Updated by Martin Kutschker over 18 years ago

Right: fixed in CVS.

Actions

Also available in: Atom PDF