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

Standalone form cannot render the end of the form when using protection #239

Closed
RobinManoli opened this issue Feb 12, 2020 · 0 comments
Closed

Comments

@RobinManoli
Copy link

TLDR;
When using standalone forms change
$form->addProtection('Expired');
to
$form->addProtection('Expired')->getToken();

Error
The error is with the headers as seen below. This should be in the documentation! Solution found here: https://forum.nette.org/en/32032-using-csrf-protection-with-manual-rendering

Warning: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time in ./vendor/nette/http/src/Http/Session.php on line 406

Warning: session_set_cookie_params(): Cannot change session cookie parameters when headers already sent in ./vendor/nette/http/src/Http/Session.php on line 416

Warning: session_id(): Cannot change session id when headers already sent in ./vendor/nette/http/src/Http/Session.php on line 81

Fatal error: Uncaught Nette\InvalidStateException: Cannot start session when headers already sent in ./vendor/nette/http/src/Http/Session.php:90 Stack trace: #0 ./vendor/nette/utils/src/Utils/Callback.php(96): Nette\Http\Session->Nette\Http{closure}('Cannot start se...', 2) #1 [internal function]: Nette\Utils\Callback::Nette\Utils{closure}(2, 'session_start()...', '/home/...', 104, Array) #2 [internal function]: session_start() #3 ./vendor/nette/utils/src/Utils/Callback.php(104): call_user_func_array('session_start', Array) #4 ./vendor/nette/http/src/Http/Session.php(91): Nette\Utils\Callback::invokeSafe('session_start', Array, Object(Closure)) #5 ./vendor/nette/http/src/Http/SessionSection.php(53): Nette\Http\Session->start() #6 ./vendor/nette/http/src/Http/SessionSection.php(112): Nette\Http\SessionSection->start() in ./vendor/nette/http/src/Http/Session.php on line 90

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

1 participant