My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
PHP51  
Making SabreDAV work on PHP 5.1
Phase-Implementation
Updated Oct 9, 2011 by evert...@gmail.com

Introduction

SabreDAV requires PHP 5.2. This is mostly due to the heavy use of the DateTime and DateTimeZone object.

However, there is a PHP 5.1 branch. While this branch is not as maintained as the standard branch, it may suit your needs. In this branch DateTime and DateTimeZone have been replaced with custom classes and other fixes have been done to get things to work as expected.

The branch can be found here:

Important notes:

  • This branch is extremely likely to be older and will probably have bugs newer versions don't.
  • No official support is given for this branch, you're on your own.
  • It's very likely this branch has PHP 5.1 or DateTime-related bugs. No effort has been made to add unittests specific to new code.
Comment by IngoRats...@gmail.com, Jul 26, 2010

the calDAV plugin does not work with PHP 5.2 either as datetime comparison is not available until 5.3. Filtered collection will not be returned and an exception is thrown in PHP 5.2.

Comment by project member evert...@gmail.com, Jul 26, 2010

I should support 5.2, so if it's really broken in PHP5.2 I have some fixing to do. Thank you!

Comment by project member evert...@gmail.com, Jul 26, 2010

@IngoRatsdorf?:

I just tested it, it works fine on PHP 5.2. It won't work on PHP 5.1 though, so I added a note.

I tested this on PHP 5.2.13. Test script:

<?php

$date1 = new DateTime?('today'); $date2 = new DateTime?('yesterday');

echo $date1<$date2?'A':'B'; echo $date1>$date2?'B':'A'; echo "\n";

?>

Output on PHP 5.2.13 is 'BB', which is expected.

Comment by IngoRats...@gmail.com, Jul 26, 2010

<?php

$dateA = new DateTime?('yesterday'); $dateB = new DateTime?('tomorrow'); if ($dateB > $dateA) {
echo "yay, tomorrow happens after yesterday";
} else {
echo "someone call the ambulance!";
}

phpinfo();

?>

Returns

someone call the ambulance! PHP Version 5.2.0-8+etch16 [..]

Comment by project member evert...@gmail.com, Jul 27, 2010

The comparison must have been added in a later 5.2. version. I've been hunting through the changelog, but haven't been able to find anything yet.

Comment by project member evert...@gmail.com, Jul 27, 2010

It's also correct on PHP 5.2.6-1+lenny8

For now I'll just set the minimum required version to 5.2.6.

Comment by IngoRats...@gmail.com, Jul 27, 2010

I hacked the code with a nasty "public string DateTime?::format ( string $format )" into string and compare the strings instead. Performancewise not ideal but does the trick for me now until my ISP upgrades. :-)


Sign in to add a comment
Powered by Google Project Hosting