"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "framework/vendors/Net_IDNA2/Net/IDNA2.php" between
yii-1.1.21.733ac5.tar.gz and yii-1.1.22.bf1d26.tar.gz

About: Yii is a high-performance component-based PHP framework for developing large-scale Web applications. Hint: Yii 1.1 is now in maintenance mode.

IDNA2.php  (yii-1.1.21.733ac5):IDNA2.php  (yii-1.1.22.bf1d26)
skipping to change at line 2683 skipping to change at line 2683
// If nothing left after removing the prefix, it is hopeless // If nothing left after removing the prefix, it is hopeless
if (!$encode_test) { if (!$encode_test) {
return false; return false;
} }
// Find last occurence of the delimiter // Find last occurence of the delimiter
$delim_pos = strrpos($encoded, '-'); $delim_pos = strrpos($encoded, '-');
if ($delim_pos > self::_byteLength($this->_punycode_prefix)) { if ($delim_pos > self::_byteLength($this->_punycode_prefix)) {
for ($k = self::_byteLength($this->_punycode_prefix); $k < $delim_po s; ++$k) { for ($k = self::_byteLength($this->_punycode_prefix); $k < $delim_po s; ++$k) {
$decoded[] = ord($encoded{$k}); $decoded[] = ord($encoded[$k]);
} }
} else { } else {
$decoded = array(); $decoded = array();
} }
$deco_len = count($decoded); $deco_len = count($decoded);
$enco_len = self::_byteLength($encoded); $enco_len = self::_byteLength($encoded);
// Wandering through the strings; init // Wandering through the strings; init
$is_first = true; $is_first = true;
$bias = $this->_initial_bias; $bias = $this->_initial_bias;
$idx = 0; $idx = 0;
$char = $this->_initial_n; $char = $this->_initial_n;
for ($enco_idx = ($delim_pos)? ($delim_pos + 1) : 0; $enco_idx < $enco_l en; ++$deco_len) { for ($enco_idx = ($delim_pos)? ($delim_pos + 1) : 0; $enco_idx < $enco_l en; ++$deco_len) {
for ($old_idx = $idx, $w = 1, $k = $this->_base; 1 ; $k += $this->_b ase) { for ($old_idx = $idx, $w = 1, $k = $this->_base; 1 ; $k += $this->_b ase) {
$digit = $this->_decodeDigit($encoded{$enco_idx++}); $digit = $this->_decodeDigit($encoded[$enco_idx++]);
$idx += $digit * $w; $idx += $digit * $w;
$t = ($k <= $bias) ? $t = ($k <= $bias) ?
$this->_tmin : $this->_tmin :
(($k >= $bias + $this->_tmax)? $this->_tmax : ($k - $bias)); (($k >= $bias + $this->_tmax)? $this->_tmax : ($k - $bias));
if ($digit < $t) { if ($digit < $t) {
break; break;
} }
skipping to change at line 3112 skipping to change at line 3112
* @access private * @access private
*/ */
private function _utf8_to_ucs4($input) private function _utf8_to_ucs4($input)
{ {
$output = array(); $output = array();
$out_len = 0; $out_len = 0;
$inp_len = self::_byteLength($input, '8bit'); $inp_len = self::_byteLength($input, '8bit');
$mode = 'next'; $mode = 'next';
$test = 'none'; $test = 'none';
for ($k = 0; $k < $inp_len; ++$k) { for ($k = 0; $k < $inp_len; ++$k) {
$v = ord($input{$k}); // Extract byte from input string $v = ord($input[$k]); // Extract byte from input string
if ($v < 128) { // We found an ASCII char - put into stirng as is if ($v < 128) { // We found an ASCII char - put into stirng as is
$output[$out_len] = $v; $output[$out_len] = $v;
++$out_len; ++$out_len;
if ('add' == $mode) { if ('add' == $mode) {
throw new UnexpectedValueException('Conversion from UTF-8 to UCS-4 failed: malformed input at byte '.$k); throw new UnexpectedValueException('Conversion from UTF-8 to UCS-4 failed: malformed input at byte '.$k);
} }
continue; continue;
} }
if ('next' == $mode) { // Try to find the next start byte; determine the width of the Unicode char if ('next' == $mode) { // Try to find the next start byte; determine the width of the Unicode char
skipping to change at line 3279 skipping to change at line 3279
if (!$inp_len) { if (!$inp_len) {
return $output; return $output;
} }
for ($i = 0, $out_len = -1; $i < $inp_len; ++$i) { for ($i = 0, $out_len = -1; $i < $inp_len; ++$i) {
// Increment output position every 4 input bytes // Increment output position every 4 input bytes
if (!$i % 4) { if (!$i % 4) {
$out_len++; $out_len++;
$output[$out_len] = 0; $output[$out_len] = 0;
} }
$output[$out_len] += ord($input{$i}) << (8 * (3 - ($i % 4) ) ); $output[$out_len] += ord($input[$i]) << (8 * (3 - ($i % 4) ) );
} }
return $output; return $output;
} }
/** /**
* Echo hex representation of UCS4 sequence. * Echo hex representation of UCS4 sequence.
* *
* @param array $input UCS4 sequence * @param array $input UCS4 sequence
* @param boolean $include_bit Include bitmask in output * @param boolean $include_bit Include bitmask in output
* *
 End of changes. 4 change blocks. 
4 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)