forked from php/php-src
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made separate tests for each TZ type
Fixed handling of unserializing types 1 and 3
- Loading branch information
Lonny Kapelushnik
committed
Jan 14, 2013
1 parent
e76aa19
commit c2e11f0
Showing
6 changed files
with
124 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--TEST-- | ||
Test serialization of DateTimeZone objects | ||
--FILE-- | ||
<?php | ||
//Set the default time zone | ||
date_default_timezone_set("Europe/London"); | ||
|
||
$tz1 = date_create("2012-01-01 10:00 +1:00")->getTimezone(); | ||
var_dump( $tz1 ); | ||
$serialized = serialize($tz1); | ||
var_dump($serialized); | ||
|
||
$tz2 = unserialize($serialized); | ||
var_dump($tz2); | ||
// Try to use unserialzied object | ||
var_dump( $tz2->getName() ); | ||
|
||
?> | ||
===DONE=== | ||
--EXPECTF-- | ||
object(DateTimeZone)#%d (2) { | ||
["timezone_type"]=> | ||
int(1) | ||
["timezone"]=> | ||
string(6) "+01:00" | ||
} | ||
string(77) "O:12:"DateTimeZone":2:{s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+01:00";}" | ||
object(DateTimeZone)#%d (2) { | ||
["timezone_type"]=> | ||
int(1) | ||
["timezone"]=> | ||
string(6) "+01:00" | ||
} | ||
string(6) "+01:00" | ||
===DONE=== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--TEST-- | ||
Test serialization of DateTimeZone objects | ||
--FILE-- | ||
<?php | ||
//Set the default time zone | ||
date_default_timezone_set("Europe/London"); | ||
|
||
$tz1 = new DateTimeZone("EST"); | ||
var_dump( $tz1 ); | ||
$serialized = serialize($tz1); | ||
var_dump($serialized); | ||
|
||
$tz2 = unserialize($serialized); | ||
var_dump($tz2); | ||
// Try to use unserialzied object | ||
var_dump( $tz2->getName() ); | ||
|
||
?> | ||
===DONE=== | ||
--EXPECTF-- | ||
object(DateTimeZone)#%d (2) { | ||
["timezone_type"]=> | ||
int(3) | ||
["timezone"]=> | ||
string(16) "America/New_York" | ||
} | ||
string(88) "O:12:"DateTimeZone":2:{s:13:"timezone_type";i:3;s:8:"timezone";s:16:"America/New_York";}" | ||
object(DateTimeZone)#%d (2) { | ||
["timezone_type"]=> | ||
int(3) | ||
["timezone"]=> | ||
string(16) "America/New_York" | ||
} | ||
string(16) "America/New_York" | ||
===DONE=== |
File renamed without changes.