Bug Report #1726

Captcha_Alpha_Driver::render() error

Added by Ivan Brotkin over 2 years ago. Updated over 2 years ago.

Status:Closed Start date:06/01/2009
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:Libraries:Captcha
Target version:2.4
Resolution:wontfix Points:

Description

// row 58
$chars = 'ABEFGJKLPQRTVY';
// row 84
$char = $chars[mt_rand(0, 14)];

$chars length is 14, but mt_rand(0, 14) can return a value from 0 to 14, so $chars[14] will generate a warning: Uninitialized string offset: 14

Possible solution:

$char = $chars[mt_rand(0, strlen($chars))];

History

Updated by Lewis Wright - over 2 years ago

Shouldn't it be strlen($chars) - 1? Since if $chars as 14 characters, 14 will still be returned.

Updated by Ivan Brotkin over 2 years ago

Yes, of course! Its my mistake.

Updated by Jeremy Bush over 2 years ago

  • Target version changed from 2.3.3 to 2.4

Updated by Rodrigo Dlugokenski over 2 years ago

  • 11 set to 2.3.4

My bad for reply... (didn't read note #2 - speed reading failure, and posted this reply ;P)

Already used the solution with "minus 1" and worked well.

Updated by Jeremy Bush over 2 years ago

  • Status changed from New to Closed
  • Resolution set to wontfix

Captcha is being removed from 2.4.

Also available in: Atom PDF