mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-11-12 09:32:55 +00:00
Fix max(-1) is smaller than min(0) warning
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
This commit is contained in:
parent
3ef1ab740a
commit
881ab04b19
|
@ -132,7 +132,11 @@ class FancyCaptcha extends SimpleCaptcha {
|
|||
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;
|
||||
|
|
Loading…
Reference in a new issue