[Pkg-owncloud-commits] [php-sabredav] 05/29: Calendar Objects records firstOccurence and lastOccurrence can't save… (#835)

David Prévot taffit at moszumanska.debian.org
Fri Jul 8 00:24:02 UTC 2016


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

taffit pushed a commit to branch master
in repository php-sabredav.

commit 72399026e7d343a043fa7ede48efa6128107078c
Author: omg1976 <omg1976 at users.noreply.github.com>
Date:   Tue May 17 23:57:33 2016 +0200

    Calendar Objects records firstOccurence and lastOccurrence can't save… (#835)
    
    * Calendar Objects records firstOccurence and lastOccurrence can't save dates before Unix epoch (negative values)
    
    When a client wants to sync dates before 1-1-1970 (for example birthdays), the server response with:
    
    <?xml version="1.0" encoding="utf-8"?>
    <d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
      <s:sabredav-version>3.1.2</s:sabredav-version>
      <s:exception>PDOException</s:exception>
      <s:message>SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'firstoccurence' at row 1</s:message>
    </d:error>
    
    Dates before 1-1-1970 are represented by negative values that can't be stored in database (the type of these records are unsigned int)
    
    Previous discussion here: https://github.com/fruux/Baikal/pull/537
    
    * Update PDO.php
    
    * Style correction
---
 lib/CalDAV/Backend/PDO.php | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/CalDAV/Backend/PDO.php b/lib/CalDAV/Backend/PDO.php
index 53838eb..b1c013d 100644
--- a/lib/CalDAV/Backend/PDO.php
+++ b/lib/CalDAV/Backend/PDO.php
@@ -686,6 +686,10 @@ SQL
                 }
 
             }
+            
+            // Ensure Occurence values are positive
+            if ($firstOccurence < 0) $firstOccurence = 0;
+            if ($lastOccurence < 0) $lastOccurence = 0;
         }
 
         // Destroy circular references to PHP will GC the object.

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



More information about the Pkg-owncloud-commits mailing list