21293 Posts in 5733 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1021 Views |
-
Bug with Zend_Date (Zend framework with SS 2.4.0) ?

21 June 2010 at 8:41pm
Hello,
I use a Date field in Silverstripe and i know Silverstripe 2.4.0 use Zend_Date. But i think there is a problem with dates 1848-02-** and Zend_Date : when i display these dates, Zend_Date add +1 day each time !?
I try this code to show the problem (i think it's not a silverstripe problem) :
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
</head>
<body><?php
require_once 'Zend/Date.php';
$frDates = array(
"31/01/1848",
"01/02/1848",
"02/02/1848",
"03/02/1848",
"01/03/1848"
);$dates = array(
"1848-01-31",
"1848-02-01",
"1848-02-02",
"1848-02-03",
"1848-03-01"
);date_default_timezone_set('Europe/Paris');
print "<h1>Zend_Date (Zend Framework with Silverstripe 2.4.0)</h1>";
foreach($dates as $index => $date) {
$oDate = new Zend_Date($date);
$stroDate = $oDate->get('dd/MM/yyyy');
$test = ($frDates[$index] !== $stroDate);
$style = ($test ? ' style="color:red;" ' : '');
$sign = ($test ? '!=' : '=');print "<div $style >" . $frDates[$index] . " $sign $stroDate</div>";
}print "<h1>Test avec DateTime (PHP version " . phpversion() . ")</h1>";
foreach($dates as $index => $date) {
$oDate = new DateTime($date);
$stroDate = $oDate->format('d/m/Y');
$test = ($frDates[$index] !== $stroDate);
$style = ($test ? ' style="color:red;" ' : '');
$sign = ($test ? '!=' : '=');
print "<div $style >" . $frDates[$index] . " $sign $stroDate</div>";
}?>
</body>
</html>And the result :
Zend_Date (Zend Framework with Silverstripe 2.4.0)
31/01/1848 = 31/01/1848
*01/02/1848 != 02/02/1848
*02/02/1848 != 03/02/1848
*03/02/1848 != 04/02/1848
01/03/1848 = 01/03/1848Test avec DateTime (PHP version 5.2.6-1+lenny8)
31/01/1848 = 31/01/1848
01/02/1848 = 01/02/1848
02/02/1848 = 02/02/1848
03/02/1848 = 03/02/1848
01/03/1848 = 01/03/1848Snirf :'(
A solution ? -
Re: Bug with Zend_Date (Zend framework with SS 2.4.0) ?

24 June 2010 at 3:32am Last edited: 24 June 2010 3:34am
To resolve my problem, i've upgraded Zend to the last version (1.10.6)...
1 - I've downloaded the minimale version
2 - I've extracted the archive in a temp folder. I've got a "/tmp/ZendFramework-1.10.6-minimal" folder
3 - I've make a backup of my "sapphire/thirdparty/Zend"
mv sapphire/thirdparty/Zend sapphire/thirdparty/_Zend
4 - I've moved my last Zend version in "sapphire/thirdparty/Zend"
mv /tmp/ZendFramework-1.10.6-minimal/library/Zend sapphire/thirdparty/
It seem to work...
Do I have to modify something in Zend files so that it is compatible with Silverstripe 2.4.0/Sapphire ?
-
Re: Bug with Zend_Date (Zend framework with SS 2.4.0) ?

2 July 2010 at 8:44am
Weird - could you point us to the ticket or bugfix in Zend_framework that resolves this?
I've created a ticket for updating zend: http://open.silverstripe.org/ticket/5767
| 1021 Views | ||
|
Page:
1
|
Go to Top |


