php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48559 Object comparison using unserialized DateTime object causes segfault
Submitted: 2009-06-15 13:51 UTC Modified: 2015-01-19 23:04 UTC
Votes:4
Avg. Score:3.8 ± 0.8
Reproduced:4 of 4 (100.0%)
Same Version:2 (50.0%)
Same OS:3 (75.0%)
From: felipe@php.net Assigned: derick (profile)
Status: Not a bug Package: Date/time related
PHP Version: 5.2CVS-2009-06-15 (CVS) OS: Linux
Private report: No CVE-ID: None
 [2009-06-15 13:51 UTC] felipe@php.net
Description:
------------
This issue just occurs on 5.2.

See the code below.

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

unserialize(serialize(new datetime())) == new datetime;

Expected result:
----------------
No SIGSEGV.

Actual result:
--------------
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb6e89b70 (LWP 24361)]
0x080bed7a in date_object_compare_date (d1=0xa7a5308, d2=0xa7a5288, tsrm_ls=0xa5802a8) at /home/felipe/dev/php5_2/ext/date/php_date.c:1581
1581			if (!o1->time->sse_uptodate) {
(gdb) bt
#0  0x080bed7a in date_object_compare_date (d1=0xa7a5308, d2=0xa7a5288, tsrm_ls=0xa5802a8) at /home/felipe/dev/php5_2/ext/date/php_date.c:1581
#1  0x084e3773 in compare_function (result=0xbfc93f10, op1=0xa7a5308, op2=0xa7a5288, tsrm_ls=0xa5802a8) at /home/felipe/dev/php5_2/Zend/zend_operators.c:1416
#2  0x084e404c in is_equal_function (result=0xbfc93f10, op1=0xa7a5308, op2=0xa7a5288, tsrm_ls=0xa5802a8) at /home/felipe/dev/php5_2/Zend/zend_operators.c:1547
#3  0x0853b9f1 in ZEND_IS_EQUAL_SPEC_VAR_VAR_HANDLER (execute_data=0xbfc93f44, tsrm_ls=0xa5802a8) at /home/felipe/dev/php5_2/Zend/zend_vm_execute.h:11516
#4  0x085126e4 in execute (op_array=0xa7a5a10, tsrm_ls=0xa5802a8) at /home/felipe/dev/php5_2/Zend/zend_vm_execute.h:92
#5  0x084da6aa in zend_eval_string (str=0xbfc957dc "unserialize(serialize(new datetime())) == new datetime;", retval_ptr=0x0, 
    string_name=0x87fb6dc "Command line code", tsrm_ls=0xa5802a8) at /home/felipe/dev/php5_2/Zend/zend_execute_API.c:1214
#6  0x084da8e2 in zend_eval_string_ex (str=0xbfc957dc "unserialize(serialize(new datetime())) == new datetime;", retval_ptr=0x0, 
    string_name=0x87fb6dc "Command line code", handle_exceptions=1, tsrm_ls=0xa5802a8) at /home/felipe/dev/php5_2/Zend/zend_execute_API.c:1248
#7  0x08573484 in main (argc=3, argv=0xbfc94314) at /home/felipe/dev/php5_2/sapi/cli/php_cli.c:1201


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-06-23 20:24 UTC] sjoerd-php at linuxonly dot nl
Could reproduce on PHP 5.2.10 (cli), not on PHP 5.3.0RC4 (cli).
 [2010-02-19 08:08 UTC] thomas dot corbiere at free dot fr
Same problem with PHP 5.2.12 on Windows Server 2003 R2
 [2010-03-07 20:20 UTC] derick@php.net
-Status: Assigned +Status: Feedback
 [2010-03-07 20:20 UTC] derick@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

I can't reproduce this anymore; could you please check felipe? For me it shows:

derick@kossu:~/dev/php/php-src/branches/PHP_5_2$ sapi/cli/php -r 'var_dump(unserialize(serialize(new DateTime())));'
object(DateTime)#1 (0) {
}
 [2010-03-07 20:26 UTC] felipe@php.net
-Status: Feedback +Status: Assigned
 [2010-03-07 20:26 UTC] felipe@php.net
I can reproduce it making the object comparison.
unserialize(serialize(new datetime())) == new datetime;

[Switching to Thread 0xb7c3ead0 (LWP 11162)]
0x0808ff0e in date_object_compare_date (d1=0xa07cb1c, d2=0xa07ca9c, tsrm_ls=0x9f74050) at /home/felipe/dev/php5_2/ext/date/php_date.c:1592
1592			if (!o1->time->sse_uptodate) {
(gdb) p o1->time
$1 = (timelib_time *) 0x0
 [2015-01-19 23:04 UTC] derick@php.net
-Status: Assigned +Status: Not a bug
 [2015-01-19 23:04 UTC] derick@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

This is no longer a problem a PHP 5.3 and later. So closing it out.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 01:01:28 2024 UTC