Open TheTomcat14 opened 9 months ago
Hi @TheTomcat14 Thanks for reporting. Chamilo 1.11.* does not support PHP 8 officially, indeed. We're racing to release 2.0 in a few months to take care of that. In the meantime, it's a bit of a hassle, we know. Sorry about that.
I'm leaving this open in case we do find a solution, but for now our focus is on 2.0 and on security issues that might affect 1.11.
When editing a social group, with an uploaded picture Chamilo throws an exception.
The URL of the functionality is: CHAMILO_URL/main/social/group_edit.php?id={$id_of_the_group}
The exception thrown is: Fatal error: Uncaught Imagine\Exception\RuntimeException: Unable to open image ...
The code responsible for the error is located in the package imagine/imagine It is located in the file CHAMILO_DIR\vendor\imagine\imagine\lib\Imagine\Gd\Imagine.php lines 94-98 & 190-194, methods open () & doLoad()
$resource = imagecreatefromstring($data);
if (!is_resource($resource)) {
throw new RuntimeException(sprintf('Unable to open image %s', $path));
}
This seems to be related to this bug report on bugs.php.net, https://bugs.php.net/bug.php?id=80342
The code no longer works with PHP8, the image is no longer a resource but an object.
I'm not sure PHP8 is officially supported by Chamilo, and the Chamilo team can't change the external package.
But if other users download Chamilo from git releases and install it on server with PHP8 they can manually fix the bug by changing the code above to
$resource = imagecreatefromstring($data);
if ($resource === false) {
throw new RuntimeException(sprintf('Unable to open image %s', $path));
}