Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base64 encoding does not work #4

Open
blablabla1234678 opened this issue Dec 7, 2023 · 3 comments
Open

Base64 encoding does not work #4

blablabla1234678 opened this issue Dec 7, 2023 · 3 comments

Comments

@blablabla1234678
Copy link

blablabla1234678 commented Dec 7, 2023

I am trying to use base64 encoded image, but it runs on this error:

Typed property SimpleCaptcha\Builder::$image must not be accessed before initialization

#0 /.../vendor/s1syphos/php-simple-captcha/src/Builder.php(1016): SimpleCaptcha\Builder->gd2img()
#1 /.../vendor/s1syphos/php-simple-captcha/src/Builder.php(1031): SimpleCaptcha\Builder->output()
#2 /.../vendor/s1syphos/php-simple-captcha/src/Builder.php(1046): SimpleCaptcha\Builder->fetch()
#3 /.../presentation/template/registration.php(23): SimpleCaptcha\Builder->inline()

All I do is instantiating the Builder class with the captcha string (only English characters and numbers) and calling the inline method:

        return $this->renderer->render($response, 'registration.php', [
            'csrf' => $this->csrf, 
            'captcha' => new CaptchaBuilder($this->security->getCaptcha()), 
            'values' => $values, 
            'errors' => $errors
        ]);
<img src="<?php $html->addAttribute($captcha->inline()); ?>" />

I guess the bug is in your code. https://stackoverflow.com/a/59265626/607033

@blablabla1234678
Copy link
Author

Probably GD is not working on my server and the error message is not that helpful. At least in a different lib writes, that it got null instead of GD Image.

@blablabla1234678
Copy link
Author

Nope, I checked, GD is enabled. The problem is with the code. Either the upper is not enough to render the captcha or there is a bug in the lib. I use PHP 8.2.

@S1SYPHOS
Copy link
Owner

Sorry for not responding, as you may already have guessed, my time and resources right now are very limited. Thanks for bringing this to my attention! I'll look into it as soon as possible 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants