summaryrefslogtreecommitdiff
path: root/includes/normal/RandomTest.php
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-05-01 15:12:12 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-05-01 15:12:12 -0400
commitc9aa36da061816dee256a979c2ff8d2ee41824d9 (patch)
tree29f7002b80ee984b488bd047dbbd80b36bf892e9 /includes/normal/RandomTest.php
parentb4274e0e33eafb5e9ead9d949ebf031a9fb8363b (diff)
parentd1ba966140d7a60cd5ae4e8667ceb27c1a138592 (diff)
Merge branch 'archwiki'
# Conflicts: # skins/ArchLinux.php # skins/ArchLinux/archlogo.gif
Diffstat (limited to 'includes/normal/RandomTest.php')
-rw-r--r--includes/normal/RandomTest.php20
1 files changed, 10 insertions, 10 deletions
diff --git a/includes/normal/RandomTest.php b/includes/normal/RandomTest.php
index 06029868..0604d7bb 100644
--- a/includes/normal/RandomTest.php
+++ b/includes/normal/RandomTest.php
@@ -5,7 +5,7 @@
* difference. Will run forever until it finds one or you kill it.
*
* Copyright (C) 2004 Brion Vibber <brion@pobox.com>
- * http://www.mediawiki.org/
+ * https://www.mediawiki.org/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@
* @ingroup UtfNormal
*/
-if( PHP_SAPI != 'cli' ) {
+if ( PHP_SAPI != 'cli' ) {
die( "Run me from the command line please.\n" );
}
@@ -40,8 +40,9 @@ dl( 'php_utfnormal.so' );
function randomString( $length, $nullOk, $ascii = false ) {
$out = '';
- for( $i = 0; $i < $length; $i++ )
+ for ( $i = 0; $i < $length; $i++ )
$out .= chr( mt_rand( $nullOk ? 0 : 1, $ascii ? 127 : 255 ) );
+
return $out;
}
@@ -66,7 +67,7 @@ function showDiffs( $a, $b ) {
$funky = $formatter->format( $diffs );
$matches = array();
preg_match_all( '/<(?:ins|del) class="diffchange">(.*?)<\/(?:ins|del)>/', $funky, $matches );
- foreach( $matches[1] as $bit ) {
+ foreach ( $matches[1] as $bit ) {
$hex = bin2hex( $bit );
echo "\t$hex\n";
}
@@ -74,28 +75,27 @@ function showDiffs( $a, $b ) {
$size = 16;
$n = 0;
-while( true ) {
+while ( true ) {
$n++;
echo "$n\n";
- $str = randomString( $size, true);
+ $str = randomString( $size, true );
$clean = UtfNormal::cleanUp( $str );
$norm = donorm( $str );
echo strlen( $clean ) . ", " . strlen( $norm );
- if( $clean == $norm ) {
+ if ( $clean == $norm ) {
echo " (match)\n";
} else {
echo " (FAIL)\n";
echo "\traw: " . bin2hex( $str ) . "\n" .
- "\tphp: " . bin2hex( $clean ) . "\n" .
- "\ticu: " . bin2hex( $norm ) . "\n";
+ "\tphp: " . bin2hex( $clean ) . "\n" .
+ "\ticu: " . bin2hex( $norm ) . "\n";
echo "\n\tdiffs:\n";
showDiffs( $clean, $norm );
die();
}
-
$str = '';
$clean = '';
$norm = '';