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

Cannot Initialize Another Dialog - RuntimeException in FinTs.php #452

Open
mmnasir opened this issue Aug 26, 2024 · 1 comment
Open

Cannot Initialize Another Dialog - RuntimeException in FinTs.php #452

mmnasir opened this issue Aug 26, 2024 · 1 comment

Comments

@mmnasir
Copy link

mmnasir commented Aug 26, 2024

I encountered a fatal error when running the script related to the FinTS API. The error occurs in the FinTs.php file at line 429. The exact error message is:

PHP Fatal error: Uncaught RuntimeException: Cannot init another dialog. in /path/to/FinTs.php:429

It seems that the script is trying to initialize a new dialog while another dialog session is still active, which is causing the RuntimeException. This likely indicates that the previous session hasn't been properly closed before attempting to start a new one.

Relevant Code:

if ($this->dialogId !== null) { throw new \RuntimeException('Cannot init another dialog.'); }

This code is checking if a dialog session is already active by inspecting $this->dialogId. If it's not null, the exception is thrown.

Possible Causes:

A previous session might still be open and wasn't closed properly before a new one was initiated.
The flow of code might be incorrect, leading to multiple dialog initializations without proper session termination.

I did not change anything in my code since a while and suddenly yesterday got this error ! is anything changed by Sparkasse?

@Philipp91
Copy link
Contributor

Maybe you called persist() at a time when a dialog was still open, but also your code does something that needs a new dialog. So now whenever you load that persisted state, it has the open dialog and is expecting something like submitTan() to finish it up, but you're not delivering that.

In my own application, when I'm not doing something like submitTan() but when my application expects no dialog to be open, I call $fints->forgetDialog() right after restoring the FinTs instance. It fixes such corner cases where something went wrong / was interrupted previously, and it doesn't hurt in the normal case where there's no dialog to begin with.

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

4 participants
@Philipp91 @mmnasir and others