Facing the same issue only when i want to edit one of my custom content types, it takes too much time to show the edit page (I added more php memory_limit), then it shows this error about MySQL. I don't know why this started happening suddenly (on production), am still inspecting about the issue as temporary fix, as I said I increased memory_limit on php.ini, and max_allowed_packet on my.cnf.
ok found it I think $fonts
returned on web/modules/contrib/captcha/modules/image_captcha/src/Service/ImageCaptchaRenderService.php:97:
public function generateImage($code) {
$fonts = _image_captcha_get_enabled_fonts();
Are not the same as $fonts returned on web/modules/contrib/captcha/modules/image_captcha/image_captcha.module:52 :
function _image_captcha_get_font_uri($token = NULL) {
$fonts = [
'BUILTIN' => 'BUILTIN',
];
$available_fonts = _image_captcha_get_available_fonts_from_directories();
foreach ($available_fonts as $file_token => $font_info) {
$fonts[$file_token] = $font_info['uri'];
}
return ((!empty($token) && !empty($fonts[$token])) ? $fonts[$token] : $fonts);
}
What fixed the issue for me is to do drush updb
, after doing it I started to see common fonts.
I'm facing the same issue after I did a composer update today, for #04 🐛 Error 500 in image_captcha image Closed: cannot reproduce , the param is already a token I confirm (key value of the $fonts).
Just the $fonts
recieved on param at captcha/modules/image_captcha/src/Service/ImageCaptchaRenderService.php:293
, are not the same $available_fonts
returned by _image_captcha_get_available_fonts_from_directories()
on web/modules/contrib/captcha/modules/image_captcha/image_captcha.module:54
. the list is different, which cause the token to not be found.