From c4ec0e7e6e11d54bae35aea0d983d6084f9f2b7b Mon Sep 17 00:00:00 2001 From: Igor V Belousov Date: Tue, 15 Dec 2015 21:20:26 +0300 Subject: [PATCH] =?UTF-8?q?Fix=20Encode:=20=D1=81=D0=B8=D0=BC=D1=84=D0=B5?= =?UTF-8?q?=D1=80=D0=BE=D0=BF=D0=BE=D0=BB=D1=8C-=D0=BC=D0=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- idna.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/idna.php b/idna.php index 16106c8..4d39405 100644 --- a/idna.php +++ b/idna.php @@ -102,6 +102,8 @@ function EncodePunycodeIDN( $value ) $input_len = count( $input ); $h = $b; + $ord_input = array(); + while ( $h < $input_len ) { $m = 0x10FFFF; for ( $i = 0; $i < $input_len; ++$i ) @@ -158,16 +160,16 @@ function EncodePunycodeIDN( $value ) $q = ( $q - $t ) / ( 36 - $t ); } - $output[]= chr(($q + 22 + 75 * ($q < 26))); + $output[] = chr( ( $q + 22 + 75 * ( $q < 26 ) ) ); /* http://tools.ietf.org/html/rfc3492#section-6.1 */ $delta = ( $h == $b )?$delta/700:$delta>>1; - $delta += ( $delta / ( $h + 1 ) ); + $delta += intval( $delta / ( $h + 1 ) ); $k2 = 0; while ( $delta > 455 ) { - $delta /= 35; + $delta = intval( $delta / 35 ); $k2 += 36; } $bias= intval( $k2 + ( ( 36 * $delta ) / ( $delta + 38 ) ) );