session_write_close() errors during Behat
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mahara |
Fix Released
|
Medium
|
Unassigned |
Bug Description
The session changes that we made for the Bug 1352028 bulk loader status bar (closing the session after each update) cause the Behat CLI installer script to throw a whole lot of the following PHP warning:
PHP Warning: session_
ensure session!
/home/aaronw/
743cc5981da7bf0
PHP Stack trace:
PHP 1. {main}() /home/aaronw/
PHP 2. BehatTestingUti
PHP 3. upgrade_mahara() /home/aaronw/
PHP 4. log_info() /home/aaronw/
PHP 5. log_message() /home/aaronw/
PHP 6. Session-
PHP 7. Session-
PHP 8. session_
PHP 9. error() /home/aaronw/
PHP 10. log_message() /home/aaronw/
PHP 11. Session-
PHP 12. Session-
PHP 13. session_
Changed in mahara: | |
status: | New → Fix Committed |
importance: | Undecided → Medium |
milestone: | none → 15.04.0 |
Changed in mahara: | |
status: | Fix Committed → Fix Released |
After much investigation I'm not sure of the precise cause of this problem, except that it's caused by calling session_ write_close( ) repeatedly during CLI execution of the install script by Behat. Running the install script normally, doesn't cause this problem. And doing the install through the web interface instead of CLI, also doesn't cause this problem.
Since the CLI interface doesn't actually generate and use sessions anyway, the easiest fix is just to make the functions in our Session class short-circuit if you're running in CLI.