Gregwar / Captcha

PHP Captcha library
MIT License
1.73k stars 290 forks source link

php7 error: Parameter must be an array or an object that implements C… #58

Closed sandropons closed 6 years ago

sandropons commented 6 years ago

…ountable in CaptchaBuilder.php on line 333

I got this error using xampp with php7 under windows 10 64bit.

Parameter must be an array or an object that implements Countable in CaptchaBuilder.php on line 333

I fixed it by declaring $textColor as array() at line 29.

romaricdrigon commented 6 years ago

Hello, Is this likely to get merged? Not supporting the current PHP version is a blocker :S

romaricdrigon commented 6 years ago

A workaround for now is to set textColor, in the library configuration: that will overwrite the default value of null, and avoid the error. FYI, textColor value should be 3 values, corresponding to RGB. For instance, setTextColor(0, 0, 0) for black.

Gregwar commented 6 years ago

Sorry for the delay Thanks for contributing

Glideh commented 3 years ago

For others like me that are stuck with a Symfony <4 but php >=7, as @romaricdrigon told, add this config option:

gregwar_captcha:
    text_color: [1, 1, 1] # (0, 0, 0 seems to render some kind of transparent)