-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
4.2.8, STABLE backlog, 4.1.1, 4.1.11, 4.3.5, 4.4, 4.4.1
-
MOODLE_401_STABLE, MOODLE_402_STABLE, MOODLE_403_STABLE, MOODLE_404_STABLE
-
main
-
Description
When using PHP 8+ with the function "disk_free_space" disabled, this throws the following error:
Exception - Call to undefined function core\session\disk_free_space()
Cause
The error handling of the "@" character has changed with PHP 8 and PHP 8.1. If functions are addressed that are deactivated on the server side, a fatal error occurs even if this function is provided with an "@".
In this case, it happens in the following file:
/lib/classes/session/file.php:67
$freespace = @disk_free_space($this->sessiondir); |
Solution
in PHP 8+ we must check the function with "function_exists" implicit and not use "@", because in shared hosting some php functions could be disabled.
Change the mentioned line code with:
$freespace = function_exists('disk_free_space') ? disk_free_space($this->sessiondir) : false; |
Github Compare for pull-request: https://github.com/moodle/moodle/compare/main...fedealvz:moodle:main
- has a non-specific relationship to
-
MDL-43039 "The session partition is full.": false positive
- Closed