Skip to content

Commit d393779

Browse files
committed
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4: Add microseconds to the serialised form of DateTime objects.
2 parents 69d4a0b + fdb2709 commit d393779

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+415
-383
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? 2014, PHP 5.5.14
44

5+
- Date:
6+
. Fixed bug #67308 (Serialize of DateTime truncates fractions of second).
7+
(Adam)
8+
59
?? ??? 2014, PHP 5.5.13
610

711
- CLI server:

ext/date/php_date.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2213,7 +2213,7 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC)
22132213

22142214
/* first we add the date and time in ISO format */
22152215
MAKE_STD_ZVAL(zv);
2216-
ZVAL_STRING(zv, date_format("Y-m-d H:i:s", 12, dateobj->time, 1), 0);
2216+
ZVAL_STRING(zv, date_format("Y-m-d H:i:s.u", 14, dateobj->time, 1), 0);
22172217
zend_hash_update(props, "date", 5, &zv, sizeof(zv), NULL);
22182218

22192219
/* then we add the timezone name (or similar) */

ext/date/tests/012.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ echo "Done\n";
2121
--EXPECTF--
2222
object(DateTime)#1 (3) {
2323
["date"]=>
24-
string(19) "2006-01-23 00:00:00"
24+
string(26) "2006-01-23 00:00:00.000000"
2525
["timezone_type"]=>
2626
int(3)
2727
["timezone"]=>
@@ -34,7 +34,7 @@ bool(false)
3434
string(19) "2006/01/23 00:00:00"
3535
object(DateTime)#1 (3) {
3636
["date"]=>
37-
string(19) "2006-01-30 00:00:00"
37+
string(26) "2006-01-30 00:00:00.000000"
3838
["timezone_type"]=>
3939
int(3)
4040
["timezone"]=>
@@ -43,7 +43,7 @@ object(DateTime)#1 (3) {
4343
string(19) "2006/01/30 00:00:00"
4444
object(DateTime)#1 (3) {
4545
["date"]=>
46-
string(19) "2007-12-10 00:00:00"
46+
string(26) "2007-12-10 00:00:00.000000"
4747
["timezone_type"]=>
4848
int(3)
4949
["timezone"]=>

ext/date/tests/013.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ echo "Done\n";
2121
--EXPECTF--
2222
object(DateTime)#%d (3) {
2323
["date"]=>
24-
string(19) "2006-12-12 00:00:00"
24+
string(26) "2006-12-12 00:00:00.000000"
2525
["timezone_type"]=>
2626
int(3)
2727
["timezone"]=>
@@ -38,7 +38,7 @@ bool(false)
3838
string(19) "2006.12.12 00:00:00"
3939
object(DateTime)#1 (3) {
4040
["date"]=>
41-
string(19) "2006-02-15 00:00:00"
41+
string(26) "2006-02-15 00:00:00.000000"
4242
["timezone_type"]=>
4343
int(3)
4444
["timezone"]=>
@@ -47,7 +47,7 @@ object(DateTime)#1 (3) {
4747
string(19) "2006.02.15 00:00:00"
4848
object(DateTime)#1 (3) {
4949
["date"]=>
50-
string(19) "2008-01-29 00:00:00"
50+
string(26) "2008-01-29 00:00:00.000000"
5151
["timezone_type"]=>
5252
int(3)
5353
["timezone"]=>

ext/date/tests/014.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ echo "Done\n";
2020
--EXPECTF--
2121
object(DateTime)#%d (3) {
2222
["date"]=>
23-
string(19) "2006-12-12 00:00:00"
23+
string(26) "2006-12-12 00:00:00.000000"
2424
["timezone_type"]=>
2525
int(3)
2626
["timezone"]=>

ext/date/tests/DateTime_clone_basic2.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ object(DateTimeExt1)#%d (5) {
3737
["property2"]=>
3838
string(5) "Hello"
3939
["date"]=>
40-
string(19) "2009-02-03 12:34:41"
40+
string(26) "2009-02-03 12:34:41.000000"
4141
["timezone_type"]=>
4242
int(2)
4343
["timezone"]=>
@@ -49,7 +49,7 @@ object(DateTimeExt1)#%d (5) {
4949
["property2"]=>
5050
string(5) "Hello"
5151
["date"]=>
52-
string(19) "2009-02-03 12:34:41"
52+
string(26) "2009-02-03 12:34:41.000000"
5353
["timezone_type"]=>
5454
int(2)
5555
["timezone"]=>
@@ -65,7 +65,7 @@ object(DateTimeExt2)#%d (7) {
6565
["property2"]=>
6666
string(5) "Hello"
6767
["date"]=>
68-
string(19) "2009-02-03 12:34:41"
68+
string(26) "2009-02-03 12:34:41.000000"
6969
["timezone_type"]=>
7070
int(2)
7171
["timezone"]=>
@@ -81,7 +81,7 @@ object(DateTimeExt2)#%d (7) {
8181
["property2"]=>
8282
string(5) "Hello"
8383
["date"]=>
84-
string(19) "2009-02-03 12:34:41"
84+
string(26) "2009-02-03 12:34:41.000000"
8585
["timezone_type"]=>
8686
int(2)
8787
["timezone"]=>

ext/date/tests/DateTime_clone_basic3.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ var_dump($d2_clone);
3232
-- Create a DateTime object --
3333
object(DateTime)#%d (3) {
3434
["date"]=>
35-
string(19) "2009-02-03 12:34:41"
35+
string(26) "2009-02-03 12:34:41.000000"
3636
["timezone_type"]=>
3737
int(2)
3838
["timezone"]=>
@@ -42,7 +42,7 @@ object(DateTime)#%d (3) {
4242
-- Add some properties --
4343
object(DateTime)#%d (5) {
4444
["date"]=>
45-
string(19) "2009-02-03 12:34:41"
45+
string(26) "2009-02-03 12:34:41.000000"
4646
["timezone_type"]=>
4747
int(2)
4848
["timezone"]=>
@@ -56,7 +56,7 @@ object(DateTime)#%d (5) {
5656
-- clone it --
5757
object(DateTime)#%d (5) {
5858
["date"]=>
59-
string(19) "2009-02-03 12:34:41"
59+
string(26) "2009-02-03 12:34:41.000000"
6060
["timezone_type"]=>
6161
int(2)
6262
["timezone"]=>
@@ -70,7 +70,7 @@ object(DateTime)#%d (5) {
7070
-- Add some more properties --
7171
object(DateTime)#%d (7) {
7272
["date"]=>
73-
string(19) "2009-02-03 12:34:41"
73+
string(26) "2009-02-03 12:34:41.000000"
7474
["timezone_type"]=>
7575
int(2)
7676
["timezone"]=>
@@ -88,7 +88,7 @@ object(DateTime)#%d (7) {
8888
-- clone it --
8989
object(DateTime)#%d (7) {
9090
["date"]=>
91-
string(19) "2009-02-03 12:34:41"
91+
string(26) "2009-02-03 12:34:41.000000"
9292
["timezone_type"]=>
9393
int(2)
9494
["timezone"]=>

ext/date/tests/DateTime_construct_basic1.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ object(DateTime)#%d (3) {
4141
}
4242
object(DateTime)#%d (3) {
4343
["date"]=>
44-
string(19) "2005-07-14 22:30:41"
44+
string(26) "2005-07-14 22:30:41.000000"
4545
["timezone_type"]=>
4646
int(3)
4747
["timezone"]=>
4848
string(13) "Europe/London"
4949
}
5050
object(DateTime)#%d (3) {
5151
["date"]=>
52-
string(19) "2005-07-14 22:30:41"
52+
string(26) "2005-07-14 22:30:41.000000"
5353
["timezone_type"]=>
5454
int(2)
5555
["timezone"]=>

ext/date/tests/DateTime_construct_variation1.phpt

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,15 @@ FAILED: DateTime::__construct(): Failed to parse time string (-12345) at positio
142142
-- float 10.5 --
143143
object(DateTime)#%d (3) {
144144
["date"]=>
145-
string(19) "%s"
145+
string(26) "%s"
146146
["timezone_type"]=>
147147
int(3)
148148
["timezone"]=>
149149
string(13) "Europe/London"
150150
}
151151
object(DateTime)#%d (3) {
152152
["date"]=>
153-
string(19) "%s"
153+
string(26) "%s"
154154
["timezone_type"]=>
155155
int(3)
156156
["timezone"]=>
@@ -164,15 +164,15 @@ FAILED: DateTime::__construct(): Failed to parse time string (-10.5) at position
164164
-- float .5 --
165165
object(DateTime)#%d (3) {
166166
["date"]=>
167-
string(19) "%s"
167+
string(26) "%s"
168168
["timezone_type"]=>
169169
int(3)
170170
["timezone"]=>
171171
string(13) "Europe/London"
172172
}
173173
object(DateTime)#%d (3) {
174174
["date"]=>
175-
string(19) "%s"
175+
string(26) "%s"
176176
["timezone_type"]=>
177177
int(3)
178178
["timezone"]=>
@@ -198,15 +198,15 @@ FAILED: DateTime::__construct() expects parameter 1 to be string, array given
198198
-- uppercase NULL --
199199
object(DateTime)#%d (3) {
200200
["date"]=>
201-
string(19) "%s"
201+
string(26) "%s"
202202
["timezone_type"]=>
203203
int(3)
204204
["timezone"]=>
205205
string(13) "Europe/London"
206206
}
207207
object(DateTime)#%d (3) {
208208
["date"]=>
209-
string(19) "%s"
209+
string(26) "%s"
210210
["timezone_type"]=>
211211
int(3)
212212
["timezone"]=>
@@ -216,15 +216,15 @@ object(DateTime)#%d (3) {
216216
-- lowercase null --
217217
object(DateTime)#%d (3) {
218218
["date"]=>
219-
string(19) "%s"
219+
string(26) "%s"
220220
["timezone_type"]=>
221221
int(3)
222222
["timezone"]=>
223223
string(13) "Europe/London"
224224
}
225225
object(DateTime)#%d (3) {
226226
["date"]=>
227-
string(19) "%s"
227+
string(26) "%s"
228228
["timezone_type"]=>
229229
int(3)
230230
["timezone"]=>
@@ -238,15 +238,15 @@ FAILED: DateTime::__construct(): Failed to parse time string (1) at position 0 (
238238
-- lowercase false --
239239
object(DateTime)#%d (3) {
240240
["date"]=>
241-
string(19) "%s"
241+
string(26) "%s"
242242
["timezone_type"]=>
243243
int(3)
244244
["timezone"]=>
245245
string(13) "Europe/London"
246246
}
247247
object(DateTime)#%d (3) {
248248
["date"]=>
249-
string(19) "%s"
249+
string(26) "%s"
250250
["timezone_type"]=>
251251
int(3)
252252
["timezone"]=>
@@ -260,15 +260,15 @@ FAILED: DateTime::__construct(): Failed to parse time string (1) at position 0 (
260260
-- uppercase FALSE --
261261
object(DateTime)#%d (3) {
262262
["date"]=>
263-
string(19) "%s"
263+
string(26) "%s"
264264
["timezone_type"]=>
265265
int(3)
266266
["timezone"]=>
267267
string(13) "Europe/London"
268268
}
269269
object(DateTime)#%d (3) {
270270
["date"]=>
271-
string(19) "%s"
271+
string(26) "%s"
272272
["timezone_type"]=>
273273
int(3)
274274
["timezone"]=>
@@ -278,15 +278,15 @@ object(DateTime)#%d (3) {
278278
-- empty string DQ --
279279
object(DateTime)#%d (3) {
280280
["date"]=>
281-
string(19) "%s"
281+
string(26) "%s"
282282
["timezone_type"]=>
283283
int(3)
284284
["timezone"]=>
285285
string(13) "Europe/London"
286286
}
287287
object(DateTime)#%d (3) {
288288
["date"]=>
289-
string(19) "%s"
289+
string(26) "%s"
290290
["timezone_type"]=>
291291
int(3)
292292
["timezone"]=>
@@ -296,15 +296,15 @@ object(DateTime)#%d (3) {
296296
-- empty string SQ --
297297
object(DateTime)#%d (3) {
298298
["date"]=>
299-
string(19) "%s"
299+
string(26) "%s"
300300
["timezone_type"]=>
301301
int(3)
302302
["timezone"]=>
303303
string(13) "Europe/London"
304304
}
305305
object(DateTime)#%d (3) {
306306
["date"]=>
307-
string(19) "%s"
307+
string(26) "%s"
308308
["timezone_type"]=>
309309
int(3)
310310
["timezone"]=>
@@ -338,15 +338,15 @@ FAILED: DateTime::__construct() expects parameter 1 to be string, object given
338338
-- undefined var --
339339
object(DateTime)#%d (3) {
340340
["date"]=>
341-
string(19) "%s"
341+
string(26) "%s"
342342
["timezone_type"]=>
343343
int(3)
344344
["timezone"]=>
345345
string(13) "Europe/London"
346346
}
347347
object(DateTime)#%d (3) {
348348
["date"]=>
349-
string(19) "%s"
349+
string(26) "%s"
350350
["timezone_type"]=>
351351
int(3)
352352
["timezone"]=>
@@ -356,15 +356,15 @@ object(DateTime)#%d (3) {
356356
-- unset var --
357357
object(DateTime)#%d (3) {
358358
["date"]=>
359-
string(19) "%s"
359+
string(26) "%s"
360360
["timezone_type"]=>
361361
int(3)
362362
["timezone"]=>
363363
string(13) "Europe/London"
364364
}
365365
object(DateTime)#%d (3) {
366366
["date"]=>
367-
string(19) "%s"
367+
string(26) "%s"
368368
["timezone_type"]=>
369369
int(3)
370370
["timezone"]=>

ext/date/tests/DateTime_construct_variation2.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, array gi
153153
-- uppercase NULL --
154154
object(DateTime)#%d (3) {
155155
["date"]=>
156-
string(19) "2005-07-14 22:30:41"
156+
string(26) "2005-07-14 22:30:41.000000"
157157
["timezone_type"]=>
158158
int(3)
159159
["timezone"]=>
@@ -163,7 +163,7 @@ object(DateTime)#%d (3) {
163163
-- lowercase null --
164164
object(DateTime)#%d (3) {
165165
["date"]=>
166-
string(19) "2005-07-14 22:30:41"
166+
string(26) "2005-07-14 22:30:41.000000"
167167
["timezone_type"]=>
168168
int(3)
169169
["timezone"]=>
@@ -209,7 +209,7 @@ FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, object g
209209
-- undefined var --
210210
object(DateTime)#%d (3) {
211211
["date"]=>
212-
string(19) "2005-07-14 22:30:41"
212+
string(26) "2005-07-14 22:30:41.000000"
213213
["timezone_type"]=>
214214
int(3)
215215
["timezone"]=>
@@ -219,7 +219,7 @@ object(DateTime)#%d (3) {
219219
-- unset var --
220220
object(DateTime)#%d (3) {
221221
["date"]=>
222-
string(19) "2005-07-14 22:30:41"
222+
string(26) "2005-07-14 22:30:41.000000"
223223
["timezone_type"]=>
224224
int(3)
225225
["timezone"]=>

0 commit comments

Comments
 (0)