]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fixed Sabre Node implementation to correctly return timestamps as int
authorVincent Petry <pvince81@owncloud.com>
Tue, 8 Apr 2014 09:57:33 +0000 (11:57 +0200)
committerVincent Petry <pvince81@owncloud.com>
Thu, 10 Apr 2014 15:46:36 +0000 (17:46 +0200)
Negative timestamps were returned as string and were confusing other

Sabre API like Sabre_DAV_Property_GetLastModified.

This fix makes sure the timestamp is returned as int when defined.

Backport of 4f11786 from master

lib/private/connector/sabre/node.php

index 993aa73faeb15b54c0d9040572b98c49626b6d71..ed167aaa6697101aa814a9717360f68b7618a700 100644 (file)
@@ -134,12 +134,15 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
 
        /**
         * @brief Returns the last modification time, as a unix timestamp
-        * @return int
+        * @return int timestamp as integer
         */
        public function getLastModified() {
                $this->getFileinfoCache();
-               return $this->fileinfo_cache['mtime'];
-
+               $timestamp = $this->fileinfo_cache['mtime'];
+               if (!empty($timestamp)) {
+                       return (int)$timestamp;
+               }
+               return $timestamp;
        }
 
        /**