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

Only start the session if needed to find data in FORM_DATA #1471

Merged
merged 2 commits into from
Apr 11, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Resources/contao/library/Contao/Input.php
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,9 @@ public static function findPost($strKey)
return $_POST[$strKey];
}

if (isset($_SESSION['FORM_DATA'][$strKey]))
/** @var \Symfony\Component\HttpFoundation\Request $request */
$request = System::getContainer()->get('request_stack')->getMasterRequest();
if (null !== $request && $request->hasPreviousSession() && isset($_SESSION['FORM_DATA'][$strKey]))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will the isset() check not start the session already?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHP will stop evaluating if the second or first condition evaluate to false already no? :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True.

{
return ($strKey == 'FORM_SUBMIT') ? preg_replace('/^auto_/i', '', $_SESSION['FORM_DATA'][$strKey]) : $_SESSION['FORM_DATA'][$strKey];
}
Expand Down