r86251 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86250‎ | r86251 | r86252 >
Date:07:59, 17 April 2011
Author:ialex
Status:ok
Tags:
Comment:
* (bug 28511) Use [] syntax instead of {} for string offset access
Modified paths:
  • /trunk/phase3/includes/EditPage.php (modified) (history)
  • /trunk/phase3/includes/Fallback.php (modified) (history)
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)
  • /trunk/phase3/includes/MacBinary.php (modified) (history)
  • /trunk/phase3/includes/User.php (modified) (history)
  • /trunk/phase3/includes/WebRequest.php (modified) (history)
  • /trunk/phase3/includes/filerepo/ForeignAPIFile.php (modified) (history)
  • /trunk/phase3/includes/json/Services_JSON.php (modified) (history)
  • /trunk/phase3/includes/normal/UtfNormal.php (modified) (history)
  • /trunk/phase3/includes/normal/UtfNormalUtil.php (modified) (history)
  • /trunk/phase3/includes/parser/DateFormatter.php (modified) (history)
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialBooksources.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUserrights.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/User.php
@@ -821,7 +821,7 @@
822822 $digit = mt_rand( 0, $pwlength - 1 );
823823 $np = '';
824824 for ( $i = 0; $i < $pwlength; $i++ ) {
825 - $np .= $i == $digit ? chr( mt_rand( 48, 57 ) ) : $pwchars{ mt_rand( 0, $l ) };
 825+ $np .= $i == $digit ? chr( mt_rand( 48, 57 ) ) : $pwchars[ mt_rand( 0, $l ) ];
826826 }
827827 return $np;
828828 }
Index: trunk/phase3/includes/json/Services_JSON.php
@@ -168,7 +168,7 @@
169169 return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
170170 }
171171
172 - $bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
 172+ $bytes = (ord($utf16[0]) << 8) | ord($utf16[1]);
173173
174174 switch(true) {
175175 case ((0x7F & $bytes) == $bytes):
@@ -182,11 +182,11 @@
183183 return chr(0xC0 | (($bytes >> 6) & 0x1F))
184184 . chr(0x80 | ($bytes & 0x3F));
185185
186 - case (0xFC00 & $bytes) == 0xD800 && strlen($utf16) >= 4 && (0xFC & ord($utf16{2})) == 0xDC:
 186+ case (0xFC00 & $bytes) == 0xD800 && strlen($utf16) >= 4 && (0xFC & ord($utf16[2])) == 0xDC:
187187 // return a 4-byte UTF-8 character
188188 $char = ((($bytes & 0x03FF) << 10)
189 - | ((ord($utf16{2}) & 0x03) << 8)
190 - | ord($utf16{3}));
 189+ | ((ord($utf16[2]) & 0x03) << 8)
 190+ | ord($utf16[3]));
191191 $char += 0x10000;
192192 return chr(0xF0 | (($char >> 18) & 0x07))
193193 . chr(0x80 | (($char >> 12) & 0x3F))
@@ -232,25 +232,25 @@
233233 case 2:
234234 // return a UTF-16 character from a 2-byte UTF-8 char
235235 // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
236 - return chr(0x07 & (ord($utf8{0}) >> 2))
237 - . chr((0xC0 & (ord($utf8{0}) << 6))
238 - | (0x3F & ord($utf8{1})));
 236+ return chr(0x07 & (ord($utf8[0]) >> 2))
 237+ . chr((0xC0 & (ord($utf8[0]) << 6))
 238+ | (0x3F & ord($utf8[1])));
239239
240240 case 3:
241241 // return a UTF-16 character from a 3-byte UTF-8 char
242242 // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
243 - return chr((0xF0 & (ord($utf8{0}) << 4))
244 - | (0x0F & (ord($utf8{1}) >> 2)))
245 - . chr((0xC0 & (ord($utf8{1}) << 6))
246 - | (0x7F & ord($utf8{2})));
 243+ return chr((0xF0 & (ord($utf8[0]) << 4))
 244+ | (0x0F & (ord($utf8[1]) >> 2)))
 245+ . chr((0xC0 & (ord($utf8[1]) << 6))
 246+ | (0x7F & ord($utf8[2])));
247247
248248 case 4:
249249 // return a UTF-16 surrogate pair from a 4-byte UTF-8 char
250 - if(ord($utf8{0}) > 0xF4) return ''; # invalid
251 - $char = ((0x1C0000 & (ord($utf8{0}) << 18))
252 - | (0x03F000 & (ord($utf8{1}) << 12))
253 - | (0x000FC0 & (ord($utf8{2}) << 6))
254 - | (0x00003F & ord($utf8{3})));
 250+ if(ord($utf8[0]) > 0xF4) return ''; # invalid
 251+ $char = ((0x1C0000 & (ord($utf8[0]) << 18))
 252+ | (0x03F000 & (ord($utf8[1]) << 12))
 253+ | (0x000FC0 & (ord($utf8[2]) << 6))
 254+ | (0x00003F & ord($utf8[3])));
255255 if($char > 0x10FFFF) return ''; # invalid
256256 $char -= 0x10000;
257257 return chr(0xD8 | (($char >> 18) & 0x03))
@@ -331,7 +331,7 @@
332332 */
333333 for ($c = 0; $c < $strlen_var; ++$c) {
334334
335 - $ord_var_c = ord($var{$c});
 335+ $ord_var_c = ord($var[$c]);
336336
337337 switch (true) {
338338 case $ord_var_c == 0x08:
@@ -354,18 +354,18 @@
355355 case $ord_var_c == 0x2F:
356356 case $ord_var_c == 0x5C:
357357 // double quote, slash, slosh
358 - $ascii .= '\\'.$var{$c};
 358+ $ascii .= '\\'.$var[$c];
359359 break;
360360
361361 case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
362362 // characters U-00000000 - U-0000007F (same as ASCII)
363 - $ascii .= $var{$c};
 363+ $ascii .= $var[$c];
364364 break;
365365
366366 case (($ord_var_c & 0xE0) == 0xC0):
367367 // characters U-00000080 - U-000007FF, mask 110XXXXX
368368 // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
369 - $char = pack('C*', $ord_var_c, ord($var{$c + 1}));
 369+ $char = pack('C*', $ord_var_c, ord($var[$c + 1]));
370370 $c += 1;
371371 $utf16 = $this->utf82utf16($char);
372372 $ascii .= sprintf('\u%04s', bin2hex($utf16));
@@ -375,8 +375,8 @@
376376 // characters U-00000800 - U-0000FFFF, mask 1110XXXX
377377 // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
378378 $char = pack('C*', $ord_var_c,
379 - ord($var{$c + 1}),
380 - ord($var{$c + 2}));
 379+ ord($var[$c + 1]),
 380+ ord($var[$c + 2]));
381381 $c += 2;
382382 $utf16 = $this->utf82utf16($char);
383383 $ascii .= sprintf('\u%04s', bin2hex($utf16));
@@ -387,9 +387,9 @@
388388 // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
389389 // These will always return a surrogate pair
390390 $char = pack('C*', $ord_var_c,
391 - ord($var{$c + 1}),
392 - ord($var{$c + 2}),
393 - ord($var{$c + 3}));
 391+ ord($var[$c + 1]),
 392+ ord($var[$c + 2]),
 393+ ord($var[$c + 3]));
394394 $c += 3;
395395 $utf16 = $this->utf82utf16($char);
396396 if($utf16 == '') {
@@ -575,7 +575,7 @@
576576 for ($c = 0; $c < $strlen_chrs; ++$c) {
577577
578578 $substr_chrs_c_2 = substr($chrs, $c, 2);
579 - $ord_chrs_c = ord($chrs{$c});
 579+ $ord_chrs_c = ord($chrs[$c]);
580580
581581 switch (true) {
582582 case $substr_chrs_c_2 == '\b':
@@ -605,7 +605,7 @@
606606 case $substr_chrs_c_2 == '\\/':
607607 if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
608608 ($delim == "'" && $substr_chrs_c_2 != '\\"')) {
609 - $utf8 .= $chrs{++$c};
 609+ $utf8 .= $chrs[++$c];
610610 }
611611 break;
612612
@@ -628,7 +628,7 @@
629629 break;
630630
631631 case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
632 - $utf8 .= $chrs{$c};
 632+ $utf8 .= $chrs[$c];
633633 break;
634634
635635 case ($ord_chrs_c & 0xE0) == 0xC0:
@@ -675,7 +675,7 @@
676676 } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
677677 // array, or object notation
678678
679 - if ($str{0} == '[') {
 679+ if ($str[0] == '[') {
680680 $stk = array(SERVICES_JSON_IN_ARR);
681681 $arr = array();
682682 } else {
@@ -714,7 +714,7 @@
715715 $top = end($stk);
716716 $substr_chrs_c_2 = substr($chrs, $c, 2);
717717
718 - if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
 718+ if (($c == $strlen_chrs) || (($chrs[$c] == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
719719 // found a comma that is not inside a string, array, etc.,
720720 // OR we've reached the end of the character list
721721 $slice = substr($chrs, $top['where'], ($c - $top['where']));
@@ -756,37 +756,37 @@
757757
758758 }
759759
760 - } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
 760+ } elseif ((($chrs[$c] == '"') || ($chrs[$c] == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
761761 // found a quote, and we are not inside a string
762 - array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
 762+ array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs[$c]));
763763 //print("Found start of string at {$c}\n");
764764
765 - } elseif (($chrs{$c} == $top['delim']) &&
 765+ } elseif (($chrs[$c] == $top['delim']) &&
766766 ($top['what'] == SERVICES_JSON_IN_STR) &&
767 - (($chrs{$c - 1} != '\\') ||
768 - ($chrs{$c - 1} == '\\' && $chrs{$c - 2} == '\\'))) {
 767+ (($chrs[$c - 1] != '\\') ||
 768+ ($chrs[$c - 1] == '\\' && $chrs[$c - 2] == '\\'))) {
769769 // found a quote, we're in a string, and it's not escaped
770770 array_pop($stk);
771771 //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
772772
773 - } elseif (($chrs{$c} == '[') &&
 773+ } elseif (($chrs[$c] == '[') &&
774774 in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
775775 // found a left-bracket, and we are in an array, object, or slice
776776 array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
777777 //print("Found start of array at {$c}\n");
778778
779 - } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
 779+ } elseif (($chrs[$c] == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
780780 // found a right-bracket, and we're in an array
781781 array_pop($stk);
782782 //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
783783
784 - } elseif (($chrs{$c} == '{') &&
 784+ } elseif (($chrs[$c] == '{') &&
785785 in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
786786 // found a left-brace, and we are in an array, object, or slice
787787 array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
788788 //print("Found start of object at {$c}\n");
789789
790 - } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
 790+ } elseif (($chrs[$c] == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
791791 // found a right-brace, and we're in an object
792792 array_pop($stk);
793793 //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
Index: trunk/phase3/includes/GlobalFunctions.php
@@ -2714,7 +2714,7 @@
27152715 // Decode and validate input string
27162716 $input = strtolower( $input );
27172717 for( $i = 0; $i < strlen( $input ); $i++ ) {
2718 - $n = strpos( $digitChars, $input{$i} );
 2718+ $n = strpos( $digitChars, $input[$i] );
27192719 if( $n === false || $n > $sourceBase ) {
27202720 return false;
27212721 }
Index: trunk/phase3/includes/parser/Parser.php
@@ -2152,7 +2152,7 @@
21532153 }
21542154
21552155 for ( $i = 0; $i < $shorter; ++$i ) {
2156 - if ( $st1{$i} != $st2{$i} ) {
 2156+ if ( $st1[$i] != $st2[$i] ) {
21572157 break;
21582158 }
21592159 }
@@ -2450,7 +2450,7 @@
24512451 $stack = 0;
24522452 $len = strlen( $str );
24532453 for( $i = 0; $i < $len; $i++ ) {
2454 - $c = $str{$i};
 2454+ $c = $str[$i];
24552455
24562456 switch( $state ) {
24572457 # (Using the number is a performance hack for common cases)
Index: trunk/phase3/includes/parser/DateFormatter.php
@@ -182,8 +182,8 @@
183183 $bits = array();
184184 $key = $this->keys[$this->mSource];
185185 for ( $p=0; $p < strlen($key); $p++ ) {
186 - if ( $key{$p} != ' ' ) {
187 - $bits[$key{$p}] = $matches[$p+1];
 186+ if ( $key[$p] != ' ' ) {
 187+ $bits[$key[$p]] = $matches[$p+1];
188188 }
189189 }
190190
@@ -224,7 +224,7 @@
225225 }
226226
227227 for ( $p=0; $p < strlen( $format ); $p++ ) {
228 - $char = $format{$p};
 228+ $char = $format[$p];
229229 switch ( $char ) {
230230 case 'd': # ISO day of month
231231 $text .= $bits['d'];
@@ -327,7 +327,7 @@
328328 * @todo document
329329 */
330330 function makeNormalYear( $iso ) {
331 - if ( $iso{0} == '-' ) {
 331+ if ( $iso[0] == '-' ) {
332332 $text = (intval( substr( $iso, 1 ) ) + 1) . ' BC';
333333 } else {
334334 $text = intval( $iso );
Index: trunk/phase3/includes/filerepo/ForeignAPIFile.php
@@ -196,7 +196,7 @@
197197 $handle = opendir( $dir );
198198 if ( $handle ) {
199199 while ( false !== ( $file = readdir($handle) ) ) {
200 - if ( $file{0} != '.' ) {
 200+ if ( $file[0] != '.' ) {
201201 $files[] = $file;
202202 }
203203 }
Index: trunk/phase3/includes/EditPage.php
@@ -2661,7 +2661,7 @@
26622662 $result = "";
26632663 $working = 0;
26642664 for( $i = 0; $i < strlen( $invalue ); $i++ ) {
2665 - $bytevalue = ord( $invalue{$i} );
 2665+ $bytevalue = ord( $invalue[$i] );
26662666 if ( $bytevalue <= 0x7F ) { //0xxx xxxx
26672667 $result .= chr( $bytevalue );
26682668 $bytesleft = 0;
@@ -2698,13 +2698,13 @@
26992699 function unmakesafe( $invalue ) {
27002700 $result = "";
27012701 for( $i = 0; $i < strlen( $invalue ); $i++ ) {
2702 - if ( ( substr( $invalue, $i, 3 ) == "&#x" ) && ( $invalue{$i+3} != '0' ) ) {
 2702+ if ( ( substr( $invalue, $i, 3 ) == "&#x" ) && ( $invalue[$i+3] != '0' ) ) {
27032703 $i += 3;
27042704 $hexstring = "";
27052705 do {
2706 - $hexstring .= $invalue{$i};
 2706+ $hexstring .= $invalue[$i];
27072707 $i++;
2708 - } while( ctype_xdigit( $invalue{$i} ) && ( $i < strlen( $invalue ) ) );
 2708+ } while( ctype_xdigit( $invalue[$i] ) && ( $i < strlen( $invalue ) ) );
27092709
27102710 // Do some sanity checks. These aren't needed for reversability,
27112711 // but should help keep the breakage down if the editor
Index: trunk/phase3/includes/WebRequest.php
@@ -526,7 +526,7 @@
527527 if( $hash !== false ) {
528528 $base = substr( $base, 0, $hash );
529529 }
530 - if( $base{0} == '/' ) {
 530+ if( $base[0] == '/' ) {
531531 return $base;
532532 } else {
533533 // We may get paths with a host prepended; strip it.
Index: trunk/phase3/includes/Fallback.php
@@ -76,7 +76,7 @@
7777 // This will cut out most of our slow time on Latin-based text,
7878 // and 1/2 to 1/3 on East European and Asian scripts.
7979 $bytePos = $splitPos;
80 - while ( $bytePos < $byteLen && $str{$bytePos} >= "\x80" && $str{$bytePos} < "\xc0" ) {
 80+ while ( $bytePos < $byteLen && $str[$bytePos] >= "\x80" && $str[$bytePos] < "\xc0" ) {
8181 ++$bytePos;
8282 }
8383 $charPos = mb_strlen( substr( $str, 0, $bytePos ) );
@@ -88,7 +88,7 @@
8989 while( $charPos++ < $splitPos ) {
9090 ++$bytePos;
9191 // Move past any tail bytes
92 - while ( $bytePos < $byteLen && $str{$bytePos} >= "\x80" && $str{$bytePos} < "\xc0" ) {
 92+ while ( $bytePos < $byteLen && $str[$bytePos] >= "\x80" && $str[$bytePos] < "\xc0" ) {
9393 ++$bytePos;
9494 }
9595 }
@@ -99,7 +99,7 @@
100100 while( $bytePos > 0 && $charPos-- >= $splitPosX ) {
101101 --$bytePos;
102102 // Move past any tail bytes
103 - while ( $bytePos > 0 && $str{$bytePos} >= "\x80" && $str{$bytePos} < "\xc0" ) {
 103+ while ( $bytePos > 0 && $str[$bytePos] >= "\x80" && $str[$bytePos] < "\xc0" ) {
104104 --$bytePos;
105105 }
106106 }
Index: trunk/phase3/includes/specials/SpecialUserrights.php
@@ -317,7 +317,7 @@
318318 return Status::newFatal( 'nouserspecified' );
319319 }
320320
321 - if( $name{0} == '#' ) {
 321+ if( $name[0] == '#' ) {
322322 // Numeric ID can be specified...
323323 // We'll do a lookup for the name internally.
324324 $id = intval( substr( $name, 1 ) );
Index: trunk/phase3/includes/specials/SpecialBooksources.php
@@ -72,26 +72,26 @@
7373 if( strlen( $isbn ) == 13 ) {
7474 for( $i = 0; $i < 12; $i++ ) {
7575 if($i % 2 == 0) {
76 - $sum += $isbn{$i};
 76+ $sum += $isbn[$i];
7777 } else {
78 - $sum += 3 * $isbn{$i};
 78+ $sum += 3 * $isbn[$i];
7979 }
8080 }
8181
8282 $check = (10 - ($sum % 10)) % 10;
83 - if ($check == $isbn{12}) {
 83+ if ($check == $isbn[12]) {
8484 return true;
8585 }
8686 } elseif( strlen( $isbn ) == 10 ) {
8787 for($i = 0; $i < 9; $i++) {
88 - $sum += $isbn{$i} * ($i + 1);
 88+ $sum += $isbn[$i] * ($i + 1);
8989 }
9090
9191 $check = $sum % 11;
9292 if($check == 10) {
9393 $check = "X";
9494 }
95 - if($check == $isbn{9}) {
 95+ if($check == $isbn[9]) {
9696 return true;
9797 }
9898 }
Index: trunk/phase3/includes/MacBinary.php
@@ -110,7 +110,7 @@
111111 return false;
112112 }
113113
114 - if( $head{0} != "\x00" || $head{74} != "\x00" ) {
 114+ if( $head[0] != "\x00" || $head[74] != "\x00" ) {
115115 wfDebug( "$fname: header bytes 0 and 74 not null\n" );
116116 return false;
117117 }
@@ -127,7 +127,7 @@
128128 }
129129 } else {
130130 $crc = sprintf( "%x != %x", $storedCRC, $calculatedCRC );
131 - if( $storedCRC == 0 && $head{82} == "\x00" &&
 131+ if( $storedCRC == 0 && $head[82] == "\x00" &&
132132 substr( $head, 101, 24 ) == str_repeat( "\x00", 24 ) ) {
133133 wfDebug( "$fname: no CRC, looks like MacBinary I\n" );
134134 $this->version = 1;
@@ -142,7 +142,7 @@
143143 }
144144 }
145145
146 - $nameLength = ord( $head{1} );
 146+ $nameLength = ord( $head[1] );
147147 if( $nameLength < 1 || $nameLength > 63 ) {
148148 wfDebug( "$fname: invalid filename size $nameLength\n" );
149149 return false;
@@ -220,7 +220,7 @@
221221 $len = strlen( $data );
222222 $crc = $seed;
223223 for( $i = 0; $i < $len; $i++ ) {
224 - $crc ^= ord( $data{$i} ) << 8;
 224+ $crc ^= ord( $data[$i] ) << 8;
225225 $crc &= 0xFFFF;
226226 $crc = ($crc << 8) ^ $MAGIC[$crc >> 8];
227227 $crc &= 0xFFFF;
@@ -257,7 +257,7 @@
258258 $line = sprintf( "%04x:", $at );
259259 $printable = '';
260260 for( $i = 0; $i < $width && $remaining - $i > 0; $i++ ) {
261 - $byte = ord( $data{$at++} );
 261+ $byte = ord( $data[$at++] );
262262 $line .= sprintf( " %02x", $byte );
263263 $printable .= ($byte >= 32 && $byte <= 126 )
264264 ? chr( $byte )
Index: trunk/phase3/includes/normal/UtfNormalUtil.php
@@ -91,7 +91,7 @@
9292 */
9393 function utf8ToCodepoint( $char ) {
9494 # Find the length
95 - $z = ord( $char{0} );
 95+ $z = ord( $char[0] );
9696 if ( $z & 0x80 ) {
9797 $length = 0;
9898 while ( $z & 0x80 ) {
@@ -116,7 +116,7 @@
117117 # Add in the free bits from subsequent bytes
118118 for ( $i=1; $i<$length; $i++ ) {
119119 $z <<= 6;
120 - $z |= ord( $char{$i} ) & 0x3f;
 120+ $z |= ord( $char[$i] ) & 0x3f;
121121 }
122122
123123 return $z;
Index: trunk/phase3/includes/normal/UtfNormal.php
@@ -210,7 +210,7 @@
211211 UtfNormal::loadData();
212212 $len = strlen( $string );
213213 for( $i = 0; $i < $len; $i++ ) {
214 - $c = $string{$i};
 214+ $c = $string[$i];
215215 $n = ord( $c );
216216 if( $n < 0x80 ) {
217217 continue;
@@ -301,7 +301,7 @@
302302 foreach( $matches[1] as $str ) {
303303 $chunk = strlen( $str );
304304
305 - if( $str{0} < "\x80" ) {
 305+ if( $str[0] < "\x80" ) {
306306 # ASCII chunk: guaranteed to be valid UTF-8
307307 # and in normal form C, so skip over it.
308308 $base += $chunk;
@@ -319,13 +319,13 @@
320320 $len = $chunk + 1; # Counting down is faster. I'm *so* sorry.
321321
322322 for( $i = -1; --$len; ) {
323 - $remaining = $tailBytes[$c = $str{++$i}];
 323+ $remaining = $tailBytes[$c = $str[++$i]];
324324 if( $remaining ) {
325325 # UTF-8 head byte!
326326 $sequence = $head = $c;
327327 do {
328328 # Look for the defined number of tail bytes...
329 - if( --$len && ( $c = $str{++$i} ) >= "\x80" && $c < "\xc0" ) {
 329+ if( --$len && ( $c = $str[++$i] ) >= "\x80" && $c < "\xc0" ) {
330330 # Legal tail bytes are nice.
331331 $sequence .= $c;
332332 } else {
@@ -513,7 +513,7 @@
514514 $len = strlen( $string );
515515 $out = '';
516516 for( $i = 0; $i < $len; $i++ ) {
517 - $c = $string{$i};
 517+ $c = $string[$i];
518518 $n = ord( $c );
519519 if( $n < 0x80 ) {
520520 # ASCII chars never decompose
@@ -540,9 +540,9 @@
541541 # A lookup table would be slightly faster,
542542 # but adds a lot of memory & disk needs.
543543 #
544 - $index = ( (ord( $c{0} ) & 0x0f) << 12
545 - | (ord( $c{1} ) & 0x3f) << 6
546 - | (ord( $c{2} ) & 0x3f) )
 544+ $index = ( (ord( $c[0] ) & 0x0f) << 12
 545+ | (ord( $c[1] ) & 0x3f) << 6
 546+ | (ord( $c[2] ) & 0x3f) )
547547 - UNICODE_HANGUL_FIRST;
548548 $l = intval( $index / UNICODE_HANGUL_NCOUNT );
549549 $v = intval( ($index % UNICODE_HANGUL_NCOUNT) / UNICODE_HANGUL_TCOUNT);
@@ -575,7 +575,7 @@
576576 $combiners = array();
577577 $lastClass = -1;
578578 for( $i = 0; $i < $len; $i++ ) {
579 - $c = $string{$i};
 579+ $c = $string[$i];
580580 $n = ord( $c );
581581 if( $n >= 0x80 ) {
582582 if( $n >= 0xf0 ) {
@@ -631,7 +631,7 @@
632632 $x1 = ord(substr(UTF8_HANGUL_VBASE,0,1));
633633 $x2 = ord(substr(UTF8_HANGUL_TEND,0,1));
634634 for( $i = 0; $i < $len; $i++ ) {
635 - $c = $string{$i};
 635+ $c = $string[$i];
636636 $n = ord( $c );
637637 if( $n < 0x80 ) {
638638 # No combining characters here...
@@ -691,8 +691,8 @@
692692 #
693693 #$lIndex = utf8ToCodepoint( $startChar ) - UNICODE_HANGUL_LBASE;
694694 #$vIndex = utf8ToCodepoint( $c ) - UNICODE_HANGUL_VBASE;
695 - $lIndex = ord( $startChar{2} ) - 0x80;
696 - $vIndex = ord( $c{2} ) - 0xa1;
 695+ $lIndex = ord( $startChar[2] ) - 0x80;
 696+ $vIndex = ord( $c[2] ) - 0xa1;
697697
698698 $hangulPoint = UNICODE_HANGUL_FIRST +
699699 UNICODE_HANGUL_TCOUNT *
@@ -710,23 +710,23 @@
711711 $startChar <= UTF8_HANGUL_LAST &&
712712 !$lastHangul ) {
713713 # $tIndex = utf8ToCodepoint( $c ) - UNICODE_HANGUL_TBASE;
714 - $tIndex = ord( $c{2} ) - 0xa7;
715 - if( $tIndex < 0 ) $tIndex = ord( $c{2} ) - 0x80 + (0x11c0 - 0x11a7);
 714+ $tIndex = ord( $c[2] ) - 0xa7;
 715+ if( $tIndex < 0 ) $tIndex = ord( $c[2] ) - 0x80 + (0x11c0 - 0x11a7);
716716
717717 # Increment the code point by $tIndex, without
718718 # the function overhead of decoding and recoding UTF-8
719719 #
720 - $tail = ord( $startChar{2} ) + $tIndex;
 720+ $tail = ord( $startChar[2] ) + $tIndex;
721721 if( $tail > 0xbf ) {
722722 $tail -= 0x40;
723 - $mid = ord( $startChar{1} ) + 1;
 723+ $mid = ord( $startChar[1] ) + 1;
724724 if( $mid > 0xbf ) {
725 - $startChar{0} = chr( ord( $startChar{0} ) + 1 );
 725+ $startChar[0] = chr( ord( $startChar[0] ) + 1 );
726726 $mid -= 0x40;
727727 }
728 - $startChar{1} = chr( $mid );
 728+ $startChar[1] = chr( $mid );
729729 }
730 - $startChar{2} = chr( $tail );
 730+ $startChar[2] = chr( $tail );
731731
732732 # If there's another jamo char after this, *don't* try to merge it.
733733 $lastHangul = 1;
@@ -755,7 +755,7 @@
756756 $len = strlen( $string );
757757 $out = '';
758758 for( $i = 0; $i < $len; $i++ ) {
759 - $out .= $string{$i};
 759+ $out .= $string[$i];
760760 }
761761 return $out;
762762 }

Status & tagging log