From 059c3c8708c9b94df80d43ab8cac0cfc9b867cb8 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 16 Dec 2013 15:38:12 +0100 Subject: [PATCH 1/2] fix issue with logging non utf8 chars --- lib/private/image.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/image.php b/lib/private/image.php index 7761a3c773..314a4216b8 100644 --- a/lib/private/image.php +++ b/lib/private/image.php @@ -416,7 +416,7 @@ class OC_Image { // exif_imagetype throws "read error!" if file is less than 12 byte if(!@is_file($imagePath) || !file_exists($imagePath) || filesize($imagePath) < 12 || !is_readable($imagePath)) { // Debug output disabled because this method is tried before loadFromBase64? - OC_Log::write('core', 'OC_Image->loadFromFile, couldn\'t load: '.$imagePath, OC_Log::DEBUG); + OC_Log::write('core', 'OC_Image->loadFromFile, couldn\'t load: ' . (string) $imagePath, OC_Log::DEBUG); return false; } $iType = exif_imagetype($imagePath); From 6f21da12e8c953bebdbd444460b07160821ba7a8 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Sat, 11 Jan 2014 12:07:28 +0100 Subject: [PATCH 2/2] encode imagePath and fix documentation of loadFromFile --- lib/private/image.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/private/image.php b/lib/private/image.php index 314a4216b8..91a9f91e1d 100644 --- a/lib/private/image.php +++ b/lib/private/image.php @@ -409,14 +409,14 @@ class OC_Image { /** * @brief Loads an image from a local file. - * @param $imageref The path to a local file. + * @param $imagePath The path to a local file. * @returns An image resource or false on error */ public function loadFromFile($imagePath=false) { // exif_imagetype throws "read error!" if file is less than 12 byte if(!@is_file($imagePath) || !file_exists($imagePath) || filesize($imagePath) < 12 || !is_readable($imagePath)) { // Debug output disabled because this method is tried before loadFromBase64? - OC_Log::write('core', 'OC_Image->loadFromFile, couldn\'t load: ' . (string) $imagePath, OC_Log::DEBUG); + OC_Log::write('core', 'OC_Image->loadFromFile, couldn\'t load: ' . (string) urlencode($imagePath), OC_Log::DEBUG); return false; } $iType = exif_imagetype($imagePath);