Warning: mt_rand() [<a href='function.mt-rand'>function.mt-rand</a>]: max(-1) is smaller than min(0) in /usr/local/apache/common-local/php-1.20wmf10/extensions/ConfirmEdit/FancyCaptcha.class.php on
line 135
Change-Id: I344504c133c84aea24ce38a4a4c05c2a0c12041b
if ( !is_dir( $directory ) ) {
return false;
}
- $n = mt_rand( 0, $this->countFiles( $directory ) - 1 );
+ $dirCount = $this->countFiles( $directory );
+ if ( $dirCount === 0 ) {
+ return false;
+ }
+ $n = mt_rand( 0, $dirCount - 1 );
$dir = opendir( $directory );
$count = 0;