Index: trunk/phase3/includes/User.php |
— | — | @@ -821,7 +821,7 @@ |
822 | 822 | $digit = mt_rand( 0, $pwlength - 1 ); |
823 | 823 | $np = ''; |
824 | 824 | 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 ) ]; |
826 | 826 | } |
827 | 827 | return $np; |
828 | 828 | } |
Index: trunk/phase3/includes/json/Services_JSON.php |
— | — | @@ -168,7 +168,7 @@ |
169 | 169 | return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16'); |
170 | 170 | } |
171 | 171 | |
172 | | - $bytes = (ord($utf16{0}) << 8) | ord($utf16{1}); |
| 172 | + $bytes = (ord($utf16[0]) << 8) | ord($utf16[1]); |
173 | 173 | |
174 | 174 | switch(true) { |
175 | 175 | case ((0x7F & $bytes) == $bytes): |
— | — | @@ -182,11 +182,11 @@ |
183 | 183 | return chr(0xC0 | (($bytes >> 6) & 0x1F)) |
184 | 184 | . chr(0x80 | ($bytes & 0x3F)); |
185 | 185 | |
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: |
187 | 187 | // return a 4-byte UTF-8 character |
188 | 188 | $char = ((($bytes & 0x03FF) << 10) |
189 | | - | ((ord($utf16{2}) & 0x03) << 8) |
190 | | - | ord($utf16{3})); |
| 189 | + | ((ord($utf16[2]) & 0x03) << 8) |
| 190 | + | ord($utf16[3])); |
191 | 191 | $char += 0x10000; |
192 | 192 | return chr(0xF0 | (($char >> 18) & 0x07)) |
193 | 193 | . chr(0x80 | (($char >> 12) & 0x3F)) |
— | — | @@ -232,25 +232,25 @@ |
233 | 233 | case 2: |
234 | 234 | // return a UTF-16 character from a 2-byte UTF-8 char |
235 | 235 | // 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]))); |
239 | 239 | |
240 | 240 | case 3: |
241 | 241 | // return a UTF-16 character from a 3-byte UTF-8 char |
242 | 242 | // 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]))); |
247 | 247 | |
248 | 248 | case 4: |
249 | 249 | // 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]))); |
255 | 255 | if($char > 0x10FFFF) return ''; # invalid |
256 | 256 | $char -= 0x10000; |
257 | 257 | return chr(0xD8 | (($char >> 18) & 0x03)) |
— | — | @@ -331,7 +331,7 @@ |
332 | 332 | */ |
333 | 333 | for ($c = 0; $c < $strlen_var; ++$c) { |
334 | 334 | |
335 | | - $ord_var_c = ord($var{$c}); |
| 335 | + $ord_var_c = ord($var[$c]); |
336 | 336 | |
337 | 337 | switch (true) { |
338 | 338 | case $ord_var_c == 0x08: |
— | — | @@ -354,18 +354,18 @@ |
355 | 355 | case $ord_var_c == 0x2F: |
356 | 356 | case $ord_var_c == 0x5C: |
357 | 357 | // double quote, slash, slosh |
358 | | - $ascii .= '\\'.$var{$c}; |
| 358 | + $ascii .= '\\'.$var[$c]; |
359 | 359 | break; |
360 | 360 | |
361 | 361 | case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)): |
362 | 362 | // characters U-00000000 - U-0000007F (same as ASCII) |
363 | | - $ascii .= $var{$c}; |
| 363 | + $ascii .= $var[$c]; |
364 | 364 | break; |
365 | 365 | |
366 | 366 | case (($ord_var_c & 0xE0) == 0xC0): |
367 | 367 | // characters U-00000080 - U-000007FF, mask 110XXXXX |
368 | 368 | // 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])); |
370 | 370 | $c += 1; |
371 | 371 | $utf16 = $this->utf82utf16($char); |
372 | 372 | $ascii .= sprintf('\u%04s', bin2hex($utf16)); |
— | — | @@ -375,8 +375,8 @@ |
376 | 376 | // characters U-00000800 - U-0000FFFF, mask 1110XXXX |
377 | 377 | // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 |
378 | 378 | $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])); |
381 | 381 | $c += 2; |
382 | 382 | $utf16 = $this->utf82utf16($char); |
383 | 383 | $ascii .= sprintf('\u%04s', bin2hex($utf16)); |
— | — | @@ -387,9 +387,9 @@ |
388 | 388 | // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 |
389 | 389 | // These will always return a surrogate pair |
390 | 390 | $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])); |
394 | 394 | $c += 3; |
395 | 395 | $utf16 = $this->utf82utf16($char); |
396 | 396 | if($utf16 == '') { |
— | — | @@ -575,7 +575,7 @@ |
576 | 576 | for ($c = 0; $c < $strlen_chrs; ++$c) { |
577 | 577 | |
578 | 578 | $substr_chrs_c_2 = substr($chrs, $c, 2); |
579 | | - $ord_chrs_c = ord($chrs{$c}); |
| 579 | + $ord_chrs_c = ord($chrs[$c]); |
580 | 580 | |
581 | 581 | switch (true) { |
582 | 582 | case $substr_chrs_c_2 == '\b': |
— | — | @@ -605,7 +605,7 @@ |
606 | 606 | case $substr_chrs_c_2 == '\\/': |
607 | 607 | if (($delim == '"' && $substr_chrs_c_2 != '\\\'') || |
608 | 608 | ($delim == "'" && $substr_chrs_c_2 != '\\"')) { |
609 | | - $utf8 .= $chrs{++$c}; |
| 609 | + $utf8 .= $chrs[++$c]; |
610 | 610 | } |
611 | 611 | break; |
612 | 612 | |
— | — | @@ -628,7 +628,7 @@ |
629 | 629 | break; |
630 | 630 | |
631 | 631 | case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F): |
632 | | - $utf8 .= $chrs{$c}; |
| 632 | + $utf8 .= $chrs[$c]; |
633 | 633 | break; |
634 | 634 | |
635 | 635 | case ($ord_chrs_c & 0xE0) == 0xC0: |
— | — | @@ -675,7 +675,7 @@ |
676 | 676 | } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) { |
677 | 677 | // array, or object notation |
678 | 678 | |
679 | | - if ($str{0} == '[') { |
| 679 | + if ($str[0] == '[') { |
680 | 680 | $stk = array(SERVICES_JSON_IN_ARR); |
681 | 681 | $arr = array(); |
682 | 682 | } else { |
— | — | @@ -714,7 +714,7 @@ |
715 | 715 | $top = end($stk); |
716 | 716 | $substr_chrs_c_2 = substr($chrs, $c, 2); |
717 | 717 | |
718 | | - if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) { |
| 718 | + if (($c == $strlen_chrs) || (($chrs[$c] == ',') && ($top['what'] == SERVICES_JSON_SLICE))) { |
719 | 719 | // found a comma that is not inside a string, array, etc., |
720 | 720 | // OR we've reached the end of the character list |
721 | 721 | $slice = substr($chrs, $top['where'], ($c - $top['where'])); |
— | — | @@ -756,37 +756,37 @@ |
757 | 757 | |
758 | 758 | } |
759 | 759 | |
760 | | - } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) { |
| 760 | + } elseif ((($chrs[$c] == '"') || ($chrs[$c] == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) { |
761 | 761 | // 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])); |
763 | 763 | //print("Found start of string at {$c}\n"); |
764 | 764 | |
765 | | - } elseif (($chrs{$c} == $top['delim']) && |
| 765 | + } elseif (($chrs[$c] == $top['delim']) && |
766 | 766 | ($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] == '\\'))) { |
769 | 769 | // found a quote, we're in a string, and it's not escaped |
770 | 770 | array_pop($stk); |
771 | 771 | //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n"); |
772 | 772 | |
773 | | - } elseif (($chrs{$c} == '[') && |
| 773 | + } elseif (($chrs[$c] == '[') && |
774 | 774 | in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { |
775 | 775 | // found a left-bracket, and we are in an array, object, or slice |
776 | 776 | array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false)); |
777 | 777 | //print("Found start of array at {$c}\n"); |
778 | 778 | |
779 | | - } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) { |
| 779 | + } elseif (($chrs[$c] == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) { |
780 | 780 | // found a right-bracket, and we're in an array |
781 | 781 | array_pop($stk); |
782 | 782 | //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); |
783 | 783 | |
784 | | - } elseif (($chrs{$c} == '{') && |
| 784 | + } elseif (($chrs[$c] == '{') && |
785 | 785 | in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { |
786 | 786 | // found a left-brace, and we are in an array, object, or slice |
787 | 787 | array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false)); |
788 | 788 | //print("Found start of object at {$c}\n"); |
789 | 789 | |
790 | | - } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) { |
| 790 | + } elseif (($chrs[$c] == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) { |
791 | 791 | // found a right-brace, and we're in an object |
792 | 792 | array_pop($stk); |
793 | 793 | //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 @@ |
2715 | 2715 | // Decode and validate input string |
2716 | 2716 | $input = strtolower( $input ); |
2717 | 2717 | for( $i = 0; $i < strlen( $input ); $i++ ) { |
2718 | | - $n = strpos( $digitChars, $input{$i} ); |
| 2718 | + $n = strpos( $digitChars, $input[$i] ); |
2719 | 2719 | if( $n === false || $n > $sourceBase ) { |
2720 | 2720 | return false; |
2721 | 2721 | } |
Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -2152,7 +2152,7 @@ |
2153 | 2153 | } |
2154 | 2154 | |
2155 | 2155 | for ( $i = 0; $i < $shorter; ++$i ) { |
2156 | | - if ( $st1{$i} != $st2{$i} ) { |
| 2156 | + if ( $st1[$i] != $st2[$i] ) { |
2157 | 2157 | break; |
2158 | 2158 | } |
2159 | 2159 | } |
— | — | @@ -2450,7 +2450,7 @@ |
2451 | 2451 | $stack = 0; |
2452 | 2452 | $len = strlen( $str ); |
2453 | 2453 | for( $i = 0; $i < $len; $i++ ) { |
2454 | | - $c = $str{$i}; |
| 2454 | + $c = $str[$i]; |
2455 | 2455 | |
2456 | 2456 | switch( $state ) { |
2457 | 2457 | # (Using the number is a performance hack for common cases) |
Index: trunk/phase3/includes/parser/DateFormatter.php |
— | — | @@ -182,8 +182,8 @@ |
183 | 183 | $bits = array(); |
184 | 184 | $key = $this->keys[$this->mSource]; |
185 | 185 | 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]; |
188 | 188 | } |
189 | 189 | } |
190 | 190 | |
— | — | @@ -224,7 +224,7 @@ |
225 | 225 | } |
226 | 226 | |
227 | 227 | for ( $p=0; $p < strlen( $format ); $p++ ) { |
228 | | - $char = $format{$p}; |
| 228 | + $char = $format[$p]; |
229 | 229 | switch ( $char ) { |
230 | 230 | case 'd': # ISO day of month |
231 | 231 | $text .= $bits['d']; |
— | — | @@ -327,7 +327,7 @@ |
328 | 328 | * @todo document |
329 | 329 | */ |
330 | 330 | function makeNormalYear( $iso ) { |
331 | | - if ( $iso{0} == '-' ) { |
| 331 | + if ( $iso[0] == '-' ) { |
332 | 332 | $text = (intval( substr( $iso, 1 ) ) + 1) . ' BC'; |
333 | 333 | } else { |
334 | 334 | $text = intval( $iso ); |
Index: trunk/phase3/includes/filerepo/ForeignAPIFile.php |
— | — | @@ -196,7 +196,7 @@ |
197 | 197 | $handle = opendir( $dir ); |
198 | 198 | if ( $handle ) { |
199 | 199 | while ( false !== ( $file = readdir($handle) ) ) { |
200 | | - if ( $file{0} != '.' ) { |
| 200 | + if ( $file[0] != '.' ) { |
201 | 201 | $files[] = $file; |
202 | 202 | } |
203 | 203 | } |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -2661,7 +2661,7 @@ |
2662 | 2662 | $result = ""; |
2663 | 2663 | $working = 0; |
2664 | 2664 | for( $i = 0; $i < strlen( $invalue ); $i++ ) { |
2665 | | - $bytevalue = ord( $invalue{$i} ); |
| 2665 | + $bytevalue = ord( $invalue[$i] ); |
2666 | 2666 | if ( $bytevalue <= 0x7F ) { //0xxx xxxx |
2667 | 2667 | $result .= chr( $bytevalue ); |
2668 | 2668 | $bytesleft = 0; |
— | — | @@ -2698,13 +2698,13 @@ |
2699 | 2699 | function unmakesafe( $invalue ) { |
2700 | 2700 | $result = ""; |
2701 | 2701 | 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' ) ) { |
2703 | 2703 | $i += 3; |
2704 | 2704 | $hexstring = ""; |
2705 | 2705 | do { |
2706 | | - $hexstring .= $invalue{$i}; |
| 2706 | + $hexstring .= $invalue[$i]; |
2707 | 2707 | $i++; |
2708 | | - } while( ctype_xdigit( $invalue{$i} ) && ( $i < strlen( $invalue ) ) ); |
| 2708 | + } while( ctype_xdigit( $invalue[$i] ) && ( $i < strlen( $invalue ) ) ); |
2709 | 2709 | |
2710 | 2710 | // Do some sanity checks. These aren't needed for reversability, |
2711 | 2711 | // but should help keep the breakage down if the editor |
Index: trunk/phase3/includes/WebRequest.php |
— | — | @@ -526,7 +526,7 @@ |
527 | 527 | if( $hash !== false ) { |
528 | 528 | $base = substr( $base, 0, $hash ); |
529 | 529 | } |
530 | | - if( $base{0} == '/' ) { |
| 530 | + if( $base[0] == '/' ) { |
531 | 531 | return $base; |
532 | 532 | } else { |
533 | 533 | // We may get paths with a host prepended; strip it. |
Index: trunk/phase3/includes/Fallback.php |
— | — | @@ -76,7 +76,7 @@ |
77 | 77 | // This will cut out most of our slow time on Latin-based text, |
78 | 78 | // and 1/2 to 1/3 on East European and Asian scripts. |
79 | 79 | $bytePos = $splitPos; |
80 | | - while ( $bytePos < $byteLen && $str{$bytePos} >= "\x80" && $str{$bytePos} < "\xc0" ) { |
| 80 | + while ( $bytePos < $byteLen && $str[$bytePos] >= "\x80" && $str[$bytePos] < "\xc0" ) { |
81 | 81 | ++$bytePos; |
82 | 82 | } |
83 | 83 | $charPos = mb_strlen( substr( $str, 0, $bytePos ) ); |
— | — | @@ -88,7 +88,7 @@ |
89 | 89 | while( $charPos++ < $splitPos ) { |
90 | 90 | ++$bytePos; |
91 | 91 | // 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" ) { |
93 | 93 | ++$bytePos; |
94 | 94 | } |
95 | 95 | } |
— | — | @@ -99,7 +99,7 @@ |
100 | 100 | while( $bytePos > 0 && $charPos-- >= $splitPosX ) { |
101 | 101 | --$bytePos; |
102 | 102 | // 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" ) { |
104 | 104 | --$bytePos; |
105 | 105 | } |
106 | 106 | } |
Index: trunk/phase3/includes/specials/SpecialUserrights.php |
— | — | @@ -317,7 +317,7 @@ |
318 | 318 | return Status::newFatal( 'nouserspecified' ); |
319 | 319 | } |
320 | 320 | |
321 | | - if( $name{0} == '#' ) { |
| 321 | + if( $name[0] == '#' ) { |
322 | 322 | // Numeric ID can be specified... |
323 | 323 | // We'll do a lookup for the name internally. |
324 | 324 | $id = intval( substr( $name, 1 ) ); |
Index: trunk/phase3/includes/specials/SpecialBooksources.php |
— | — | @@ -72,26 +72,26 @@ |
73 | 73 | if( strlen( $isbn ) == 13 ) { |
74 | 74 | for( $i = 0; $i < 12; $i++ ) { |
75 | 75 | if($i % 2 == 0) { |
76 | | - $sum += $isbn{$i}; |
| 76 | + $sum += $isbn[$i]; |
77 | 77 | } else { |
78 | | - $sum += 3 * $isbn{$i}; |
| 78 | + $sum += 3 * $isbn[$i]; |
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
82 | 82 | $check = (10 - ($sum % 10)) % 10; |
83 | | - if ($check == $isbn{12}) { |
| 83 | + if ($check == $isbn[12]) { |
84 | 84 | return true; |
85 | 85 | } |
86 | 86 | } elseif( strlen( $isbn ) == 10 ) { |
87 | 87 | for($i = 0; $i < 9; $i++) { |
88 | | - $sum += $isbn{$i} * ($i + 1); |
| 88 | + $sum += $isbn[$i] * ($i + 1); |
89 | 89 | } |
90 | 90 | |
91 | 91 | $check = $sum % 11; |
92 | 92 | if($check == 10) { |
93 | 93 | $check = "X"; |
94 | 94 | } |
95 | | - if($check == $isbn{9}) { |
| 95 | + if($check == $isbn[9]) { |
96 | 96 | return true; |
97 | 97 | } |
98 | 98 | } |
Index: trunk/phase3/includes/MacBinary.php |
— | — | @@ -110,7 +110,7 @@ |
111 | 111 | return false; |
112 | 112 | } |
113 | 113 | |
114 | | - if( $head{0} != "\x00" || $head{74} != "\x00" ) { |
| 114 | + if( $head[0] != "\x00" || $head[74] != "\x00" ) { |
115 | 115 | wfDebug( "$fname: header bytes 0 and 74 not null\n" ); |
116 | 116 | return false; |
117 | 117 | } |
— | — | @@ -127,7 +127,7 @@ |
128 | 128 | } |
129 | 129 | } else { |
130 | 130 | $crc = sprintf( "%x != %x", $storedCRC, $calculatedCRC ); |
131 | | - if( $storedCRC == 0 && $head{82} == "\x00" && |
| 131 | + if( $storedCRC == 0 && $head[82] == "\x00" && |
132 | 132 | substr( $head, 101, 24 ) == str_repeat( "\x00", 24 ) ) { |
133 | 133 | wfDebug( "$fname: no CRC, looks like MacBinary I\n" ); |
134 | 134 | $this->version = 1; |
— | — | @@ -142,7 +142,7 @@ |
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
146 | | - $nameLength = ord( $head{1} ); |
| 146 | + $nameLength = ord( $head[1] ); |
147 | 147 | if( $nameLength < 1 || $nameLength > 63 ) { |
148 | 148 | wfDebug( "$fname: invalid filename size $nameLength\n" ); |
149 | 149 | return false; |
— | — | @@ -220,7 +220,7 @@ |
221 | 221 | $len = strlen( $data ); |
222 | 222 | $crc = $seed; |
223 | 223 | for( $i = 0; $i < $len; $i++ ) { |
224 | | - $crc ^= ord( $data{$i} ) << 8; |
| 224 | + $crc ^= ord( $data[$i] ) << 8; |
225 | 225 | $crc &= 0xFFFF; |
226 | 226 | $crc = ($crc << 8) ^ $MAGIC[$crc >> 8]; |
227 | 227 | $crc &= 0xFFFF; |
— | — | @@ -257,7 +257,7 @@ |
258 | 258 | $line = sprintf( "%04x:", $at ); |
259 | 259 | $printable = ''; |
260 | 260 | for( $i = 0; $i < $width && $remaining - $i > 0; $i++ ) { |
261 | | - $byte = ord( $data{$at++} ); |
| 261 | + $byte = ord( $data[$at++] ); |
262 | 262 | $line .= sprintf( " %02x", $byte ); |
263 | 263 | $printable .= ($byte >= 32 && $byte <= 126 ) |
264 | 264 | ? chr( $byte ) |
Index: trunk/phase3/includes/normal/UtfNormalUtil.php |
— | — | @@ -91,7 +91,7 @@ |
92 | 92 | */ |
93 | 93 | function utf8ToCodepoint( $char ) { |
94 | 94 | # Find the length |
95 | | - $z = ord( $char{0} ); |
| 95 | + $z = ord( $char[0] ); |
96 | 96 | if ( $z & 0x80 ) { |
97 | 97 | $length = 0; |
98 | 98 | while ( $z & 0x80 ) { |
— | — | @@ -116,7 +116,7 @@ |
117 | 117 | # Add in the free bits from subsequent bytes |
118 | 118 | for ( $i=1; $i<$length; $i++ ) { |
119 | 119 | $z <<= 6; |
120 | | - $z |= ord( $char{$i} ) & 0x3f; |
| 120 | + $z |= ord( $char[$i] ) & 0x3f; |
121 | 121 | } |
122 | 122 | |
123 | 123 | return $z; |
Index: trunk/phase3/includes/normal/UtfNormal.php |
— | — | @@ -210,7 +210,7 @@ |
211 | 211 | UtfNormal::loadData(); |
212 | 212 | $len = strlen( $string ); |
213 | 213 | for( $i = 0; $i < $len; $i++ ) { |
214 | | - $c = $string{$i}; |
| 214 | + $c = $string[$i]; |
215 | 215 | $n = ord( $c ); |
216 | 216 | if( $n < 0x80 ) { |
217 | 217 | continue; |
— | — | @@ -301,7 +301,7 @@ |
302 | 302 | foreach( $matches[1] as $str ) { |
303 | 303 | $chunk = strlen( $str ); |
304 | 304 | |
305 | | - if( $str{0} < "\x80" ) { |
| 305 | + if( $str[0] < "\x80" ) { |
306 | 306 | # ASCII chunk: guaranteed to be valid UTF-8 |
307 | 307 | # and in normal form C, so skip over it. |
308 | 308 | $base += $chunk; |
— | — | @@ -319,13 +319,13 @@ |
320 | 320 | $len = $chunk + 1; # Counting down is faster. I'm *so* sorry. |
321 | 321 | |
322 | 322 | for( $i = -1; --$len; ) { |
323 | | - $remaining = $tailBytes[$c = $str{++$i}]; |
| 323 | + $remaining = $tailBytes[$c = $str[++$i]]; |
324 | 324 | if( $remaining ) { |
325 | 325 | # UTF-8 head byte! |
326 | 326 | $sequence = $head = $c; |
327 | 327 | do { |
328 | 328 | # 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" ) { |
330 | 330 | # Legal tail bytes are nice. |
331 | 331 | $sequence .= $c; |
332 | 332 | } else { |
— | — | @@ -513,7 +513,7 @@ |
514 | 514 | $len = strlen( $string ); |
515 | 515 | $out = ''; |
516 | 516 | for( $i = 0; $i < $len; $i++ ) { |
517 | | - $c = $string{$i}; |
| 517 | + $c = $string[$i]; |
518 | 518 | $n = ord( $c ); |
519 | 519 | if( $n < 0x80 ) { |
520 | 520 | # ASCII chars never decompose |
— | — | @@ -540,9 +540,9 @@ |
541 | 541 | # A lookup table would be slightly faster, |
542 | 542 | # but adds a lot of memory & disk needs. |
543 | 543 | # |
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) ) |
547 | 547 | - UNICODE_HANGUL_FIRST; |
548 | 548 | $l = intval( $index / UNICODE_HANGUL_NCOUNT ); |
549 | 549 | $v = intval( ($index % UNICODE_HANGUL_NCOUNT) / UNICODE_HANGUL_TCOUNT); |
— | — | @@ -575,7 +575,7 @@ |
576 | 576 | $combiners = array(); |
577 | 577 | $lastClass = -1; |
578 | 578 | for( $i = 0; $i < $len; $i++ ) { |
579 | | - $c = $string{$i}; |
| 579 | + $c = $string[$i]; |
580 | 580 | $n = ord( $c ); |
581 | 581 | if( $n >= 0x80 ) { |
582 | 582 | if( $n >= 0xf0 ) { |
— | — | @@ -631,7 +631,7 @@ |
632 | 632 | $x1 = ord(substr(UTF8_HANGUL_VBASE,0,1)); |
633 | 633 | $x2 = ord(substr(UTF8_HANGUL_TEND,0,1)); |
634 | 634 | for( $i = 0; $i < $len; $i++ ) { |
635 | | - $c = $string{$i}; |
| 635 | + $c = $string[$i]; |
636 | 636 | $n = ord( $c ); |
637 | 637 | if( $n < 0x80 ) { |
638 | 638 | # No combining characters here... |
— | — | @@ -691,8 +691,8 @@ |
692 | 692 | # |
693 | 693 | #$lIndex = utf8ToCodepoint( $startChar ) - UNICODE_HANGUL_LBASE; |
694 | 694 | #$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; |
697 | 697 | |
698 | 698 | $hangulPoint = UNICODE_HANGUL_FIRST + |
699 | 699 | UNICODE_HANGUL_TCOUNT * |
— | — | @@ -710,23 +710,23 @@ |
711 | 711 | $startChar <= UTF8_HANGUL_LAST && |
712 | 712 | !$lastHangul ) { |
713 | 713 | # $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); |
716 | 716 | |
717 | 717 | # Increment the code point by $tIndex, without |
718 | 718 | # the function overhead of decoding and recoding UTF-8 |
719 | 719 | # |
720 | | - $tail = ord( $startChar{2} ) + $tIndex; |
| 720 | + $tail = ord( $startChar[2] ) + $tIndex; |
721 | 721 | if( $tail > 0xbf ) { |
722 | 722 | $tail -= 0x40; |
723 | | - $mid = ord( $startChar{1} ) + 1; |
| 723 | + $mid = ord( $startChar[1] ) + 1; |
724 | 724 | if( $mid > 0xbf ) { |
725 | | - $startChar{0} = chr( ord( $startChar{0} ) + 1 ); |
| 725 | + $startChar[0] = chr( ord( $startChar[0] ) + 1 ); |
726 | 726 | $mid -= 0x40; |
727 | 727 | } |
728 | | - $startChar{1} = chr( $mid ); |
| 728 | + $startChar[1] = chr( $mid ); |
729 | 729 | } |
730 | | - $startChar{2} = chr( $tail ); |
| 730 | + $startChar[2] = chr( $tail ); |
731 | 731 | |
732 | 732 | # If there's another jamo char after this, *don't* try to merge it. |
733 | 733 | $lastHangul = 1; |
— | — | @@ -755,7 +755,7 @@ |
756 | 756 | $len = strlen( $string ); |
757 | 757 | $out = ''; |
758 | 758 | for( $i = 0; $i < $len; $i++ ) { |
759 | | - $out .= $string{$i}; |
| 759 | + $out .= $string[$i]; |
760 | 760 | } |
761 | 761 | return $out; |
762 | 762 | } |