Edit report at http://bugs.php.net/bug.php?id=48559&edit=1

 ID:               48559
 Updated by:       fel...@php.net
 Reported by:      fel...@php.net
 Summary:          Object comparison using unserialized DateTime object
                   causes segfault
-Status:           Feedback
+Status:           Assigned
 Type:             Bug
 Package:          Date/time related
 Operating System: Linux
 PHP Version:      5.2CVS-2009-06-15 (CVS)
 Assigned To:      derick

 New Comment:

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


Previous Comments:
------------------------------------------------------------------------
[2010-03-07 20:20:24] der...@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:



der...@kossu:~/dev/php/php-src/branches/PHP_5_2$ sapi/cli/php -r
'var_dump(unserialize(serialize(new DateTime())));'

object(DateTime)#1 (0) {

}

------------------------------------------------------------------------
[2010-02-19 08:08:36] thomas dot corbiere at free dot fr

Same problem with PHP 5.2.12 on Windows Server 2003 R2

------------------------------------------------------------------------
[2009-06-23 20:24:59] sjoerd-php at linuxonly dot nl

Could reproduce on PHP 5.2.10 (cli), not on PHP 5.3.0RC4 (cli).

------------------------------------------------------------------------
[2009-06-15 13:51:45] fel...@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




------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=48559&edit=1

Reply via email to