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

[Bug]: Driver Session not working #45

Open
2 tasks done
Quetlo opened this issue Apr 23, 2024 · 2 comments
Open
2 tasks done

[Bug]: Driver Session not working #45

Quetlo opened this issue Apr 23, 2024 · 2 comments
Assignees
Labels

Comments

@Quetlo
Copy link

Quetlo commented Apr 23, 2024

Bug report requirements

  • I have confirmed that this is a bug and not a configuration/user error.
  • I have searched for existing issues and confirmed that my issue has not been reported before.

IconCaptcha version

4.0.3

PHP version

8.0

Browsers affected

Google Chrome

Expectation

When we click on an image, the backend should not retrieve an error 500.

Actual behaviour

The backend crashes on a division by zero after a click on an image. I suppose count($this->session->icons) should never be 0.
Implementation was done using tutorial steps, except that the domain of the backend is different from the frontend.

Here is the trace :

Array
(
[0] => Array
(
[file] => vendor/fabianwennink/iconcaptcha/src/Challenge/Challenge.php
[line] => 232
[function] => determineClickedIcon
[class] => IconCaptcha\Challenge\Challenge
[type] => ->
)

[1] => Array
    (
        [file] => vendor/fabianwennink/iconcaptcha/src/Request.php
        [line] => 119
        [function] => makeSelection
        [class] => IconCaptcha\Challenge\Challenge
        [type] => ->
    )

Relevant log information

It appears that the session id returned in the first captcha load response header is not used for the verification request; so the session is simply not working.
The problem is that the first php session id is only returned through the first call via XHR.
Thus the browser does not use it as main session cookies for the next XHR.
A very good solution would be a hook to retrieve the php session id from the load call, and an option to set the session id to use for the next calls.

Additional information

No response

@Quetlo Quetlo added the bug label Apr 23, 2024
@Quetlo Quetlo changed the title [Bug]: Division by zero (no iconAmount in challenge) [Bug]: Driver Session not working Apr 23, 2024
@fabianwennink
Copy link
Owner

Hi @Quetlo! Thanks for the report! I will look into this, as well as your other issue report, as soon as possible.

@ba77osai
Copy link

ba77osai commented Jul 2, 2024

It seems like we are running into the same issue on our production environment.
It would also help in the meanwhile if it was a catchable exception and not a fatal error, so we can at least handle the error gracefully.

Best regards

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

No branches or pull requests

3 participants