[FileBackend] Added copy() sanity checks to FSFileBackend.
[lhc/web/wiklou.git] / includes / filerepo / backend / SwiftFileBackend.php
index 435931c..41d30dd 100644 (file)
@@ -1048,7 +1048,11 @@ abstract class SwiftFileBackendList implements Iterator {
         * @return bool
         */
        public function valid() {
-               return ( current( $this->bufferIter ) !== false ); // no paths can have this value
+               if ( $this->bufferIter === null ) {
+                       return false; // some failure?
+               } else {
+                       return ( current( $this->bufferIter ) !== false ); // no paths can have this value
+               }
        }
 
        /**
@@ -1059,7 +1063,7 @@ abstract class SwiftFileBackendList implements Iterator {
         * @param $after string|null
         * @param $limit integer
         * @param $params Array
-        * @return Traversable|Array|null
+        * @return Traversable|Array|null Returns null on failure
         */
        abstract protected function pageFromList( $container, $dir, &$after, $limit, array $params );
 }
@@ -1078,7 +1082,7 @@ class SwiftFileBackendDirList extends SwiftFileBackendList {
 
        /**
         * @see SwiftFileBackendList::pageFromList()
-        * @return Array
+        * @return Array|null
         */
        protected function pageFromList( $container, $dir, &$after, $limit, array $params ) {
                return $this->backend->getDirListPageInternal( $container, $dir, $after, $limit, $params );
@@ -1099,7 +1103,7 @@ class SwiftFileBackendFileList extends SwiftFileBackendList {
 
        /**
         * @see SwiftFileBackendList::pageFromList()
-        * @return Array
+        * @return Array|null
         */
        protected function pageFromList( $container, $dir, &$after, $limit, array $params ) {
                return $this->backend->getFileListPageInternal( $container, $dir, $after, $limit, $params );