Dont crash if we can't start a session when a file path doesnt exist #29363
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before
CRM_Core_Config_MagicMerge
tries to put warnings about file path issues into the session.If a situation arises where the warnings are the root cause of not being able to init the session, the system crashes. Users get an error about not being able to start the session (but no immediate indication this is because of the file path issues).
After
If there's an error with putting the warnings into the session, we print them to the screen and then continue.
The user gets the warning, which is more useful to them. They may get subsequent warnings.
Technical details
Potentially this would be good behaviour generally, and could live in
CRM_Core_Session::setStatus
- but felt a bit safer to restrict to these specific warnings (which have a specific relevant example with Standalone).Comments
For an example:
On a Standalone install, remove your custom extensions directory and make its parent directory unwriteable so the server can't recreate it ( e.g.
mv web/upload/ext web/upload/ext.moved && chmod a-w web/upload
). You get a crash about not having the Standalone SessionHandler (because the Standaloneusers extension that manages sessions can't be initialised, in turn because the Extension system can't boot up, because the config loading crashes at this point).