[Pkg-owncloud-commits] [owncloud] 02/06: Ensure that passed argument is always a string

David Prévot taffit at moszumanska.debian.org
Tue Jun 2 01:40:56 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v6.0.8RC2
in repository owncloud.

commit 5154cc3e2c0e9d7f0a0e44d1609f3c3b83ccc402
Author: Lukas Reschke <lukas at owncloud.com>
Date:   Fri Feb 13 12:49:34 2015 +0100

    Ensure that passed argument is always a string
    
    Some code paths called the `normalizePath` functionality with types other than a string which resulted in unexpected behaviour.
    
    Thus the function is now manually casting the type to a string and I corrected the usage in list.php as well.
---
 apps/files/ajax/list.php         | 2 +-
 lib/private/files/filesystem.php | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/apps/files/ajax/list.php b/apps/files/ajax/list.php
index 0be38c3..d32f8e0 100644
--- a/apps/files/ajax/list.php
+++ b/apps/files/ajax/list.php
@@ -9,7 +9,7 @@ $RUNTIME_APPTYPES=array('filesystem');
 OCP\JSON::checkLoggedIn();
 
 // Load the files
-$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
+$dir = isset($_GET['dir']) ? (string)$_GET['dir'] : '';
 $dir = \OC\Files\Filesystem::normalizePath($dir);
 if (!\OC\Files\Filesystem::is_dir($dir . '/')) {
 	header("HTTP/1.0 404 Not Found");
diff --git a/lib/private/files/filesystem.php b/lib/private/files/filesystem.php
index 7b031cb..5e6bdfa 100644
--- a/lib/private/files/filesystem.php
+++ b/lib/private/files/filesystem.php
@@ -616,6 +616,14 @@ class Filesystem {
 	 * @return string
 	 */
 	public static function normalizePath($path, $stripTrailingSlash = true) {
+		/**
+		 * FIXME: This is a workaround for existing classes and files which call
+		 *        this function with another type than a valid string. This
+		 *        conversion should get removed as soon as all existing
+		 *        function calls have been fixed.
+		 */
+		$path = (string)$path;
+
 		if ($path == '') {
 			return '/';
 		}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list