Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- index 87b3c8ac475..8cf9ffcdc6d 100644
- --- a/lib/filestorage/file_system.php
- +++ b/lib/filestorage/file_system.php
- @@ -416,11 +416,16 @@ abstract class file_system {
- protected function get_imageinfo_from_path($path) {
- $imageinfo = getimagesize($path);
- + if (!is_array($imageinfo)) {
- + return false; // Nothing to process, the file was not recognised as image by GD.
- + }
- +
- $image = array(
- - 'width' => !empty($imageinfo[0]) ? $imageinfo[0] : null,
- - 'height' => !empty($imageinfo[1]) ? $imageinfo[1] : null,
- - 'mimetype' => !empty($imageinfo[2]) ? image_type_to_mime_type($imageinfo[2]) : null,
- + 'width' => $imageinfo[0],
- + 'height' => $imageinfo[1],
- + 'mimetype' => image_type_to_mime_type($imageinfo[2]),
- );
- +
- if (empty($image['width']) or empty($image['height']) or empty($image['mimetype'])) {
- // GD can not parse it, sorry.
- return false;
- diff --git a/lib/form/filetypes.php b/lib/form/filetypes.php
- index 14c56019d16..9c70b5a8ff5 100644
- --- a/lib/form/filetypes.php
- +++ b/lib/form/filetypes.php
- @@ -221,7 +221,7 @@ class MoodleQuickForm_filetypes extends MoodleQuickForm_group {
- */
- public function validateSubmitValue($value) {
- - $value = $value ?? ['filetypes' => null]; // A null $value can arrive here. Coallesce, creating the default array.
- + $value = $value ?? ['filetypes' => null]; // A null $value can arrive here. Coalesce, creating the default array.
- if (!$this->allowall) {
- // Assert that there is an actual list provided.
- diff --git a/lib/tests/session_manager_test.php b/lib/tests/session_manager_test.php
- index fe20515e759..bbafd02aa10 100644
- --- a/lib/tests/session_manager_test.php
- +++ b/lib/tests/session_manager_test.php
- @@ -835,7 +835,7 @@ class core_session_manager_testcase extends advanced_testcase {
- $SESSION->recentsessionlocks = $this->sessionlock_history();
- $page = \core\session\manager::get_locked_page_at($time);
- - $this->assertEquals($url, is_array($page) ? $page['url'] : $page);
- + $this->assertEquals($url, is_array($page) ? $page['url'] : null);
- }
- /**
Advertisement
Add Comment
Please, Sign In to add comment