php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59045 DateTime not fetched/deserialized correctly
Submitted: 2010-01-25 16:27 UTC Modified: 2010-01-25 16:37 UTC
From: eda-qa at disemia dot com Assigned:
Status: Not a bug Package: APC (PECL)
PHP Version: 5.2.4 OS:
Private report: No CVE-ID: None
 [2010-01-25 16:27 UTC] eda-qa at disemia dot com
Description:
------------
DateTime objects are not properly retrieved from the cache. Attempting to work with the object results in a failure.

I'm accessing the sample code via a web page.

Reproduce code:
---------------
<?php

date_default_timezone_set('Europe/Berlin');
	
$d = new DateTime();
print( $d->format(DateTime::W3C) . "\n" );
apc_store( 'q1', $d );
print( apc_fetch( 'q1' )->format( DateTime::W3C ) . "\n" );

?>

Expected result:
----------------
The same datetime should be printed twice.

Actual result:
--------------
( ! ) Warning: DateTime::format() [function.DateTime-format]: The DateTime object has not been correctly initialized by its constructor in /home/projects/Current/vmed/web/test/datetime.php on line 7

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-25 16:30 UTC] rasmus@php.net
You can't cache internal objects.
 [2010-01-25 16:37 UTC] eda-qa at disemia dot com
For those interested:
http://bugs.php.net/bug.php?id=41334
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Jul 26 06:01:23 2021 UTC