php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31356 Serializing StdClass objects causes segfault
Submitted: 2004-12-30 16:58 UTC Modified: 2004-12-31 00:34 UTC
From: sebastian@php.net Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 5CVS-2004-12-30 (dev) OS: Windows XP SP-2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: sebastian@php.net
New email:
PHP Version: OS:

 

 [2004-12-30 16:58 UTC] sebastian@php.net
Description:
------------
Serializing StdClass objects causes segfault in PHP_5_0 but not in HEAD.

zend_std_get_method() (third stackframe) is called with __sleep as the value for the method_name parameter so it looks like the serializer tries to call a non-existant __sleep() method on the object.

Reproduce code:
---------------
<?php
print serialize(new StdClass);
?>


Expected result:
----------------
HEAD: O:8:"stdClass":0:{}

Actual result:
--------------
PHP_5_0:

php5ts_debug.dll!zend_object_store_get_object(_zval_struct * zobject=0x00000001, void * * * tsrm_ls=0x00902c48)  Line 200 + 0x3	C
php5ts_debug.dll!zend_objects_get_address(_zval_struct * zobject=0x00000001, void * * * tsrm_ls=0x00902c48)  Line 111 + 0xd	C
php5ts_debug.dll!zend_std_get_method(_zval_struct * * object_ptr=0x00a31d50, char * method_name=0x1058f1c8, int method_len=7, void * * * tsrm_ls=0x00902c48)  Line 680 + 0xd	C
php5ts_debug.dll!zend_call_function(_zend_fcall_info * fci=0x0012ecc8, _zend_fcall_info_cache * fci_cache=0x00000000, void * * * tsrm_ls=0x00902c48)  Line 688 + 0x30	C
php5ts_debug.dll!call_user_function_ex(_hashtable * function_table=0x00908d40, _zval_struct * * object_pp=0x00a214e4, _zval_struct * function_name=0x0012ef60, _zval_struct * * retval_ptr_ptr=0x0012ef78, unsigned int param_count=0, _zval_struct * * * params=0x00000000, int no_separation=1, _hashtable * symbol_table=0x00000000, void * * * tsrm_ls=0x00902c48)  Line 551 + 0xf	C
php5ts_debug.dll!php_var_serialize_intern(smart_str * buf=0x0012f3b0, _zval_struct * * struc=0x00a214e4, _hashtable * var_hash=0x0012f3c4, void * * * tsrm_ls=0x00902c48)  Line 678 + 0x38	C
php5ts_debug.dll!php_var_serialize(smart_str * buf=0x0012f3b0, _zval_struct * * struc=0x00a214e4, _hashtable * var_hash=0x0012f3c4, void * * * tsrm_ls=0x00902c48)  Line 771 + 0x15	C
php5ts_debug.dll!zif_serialize(int ht=1, _zval_struct * return_value=0x00a31de0, _zval_struct * this_ptr=0x00000000, int return_value_used=1, void * * * tsrm_ls=0x00902c48)  Line 794 + 0x15	C
php5ts_debug.dll!zend_do_fcall_common_helper(_zend_execute_data * execute_data=0x0012f744, _zend_op * opline=0x00a31a88, _zend_op_array * op_array=0x00a31680, void * * * tsrm_ls=0x00902c48)  Line 2711 + 0x32	C
php5ts_debug.dll!zend_do_fcall_handler(_zend_execute_data * execute_data=0x0012f744, _zend_op * opline=0x00a31a88, _zend_op_array * op_array=0x00a31680, void * * * tsrm_ls=0x00902c48)  Line 2843 + 0x15	C
php5ts_debug.dll!execute(_zend_op_array * op_array=0x00a31680, void * * * tsrm_ls=0x00902c48)  Line 1400 + 0x17	C
php5ts_debug.dll!zend_execute_scripts(int type=8, void * * * tsrm_ls=0x00902c48, _zval_struct * * retval=0x00000000, int file_count=3, ...)  Line 1060 + 0x21	C
php5ts_debug.dll!php_execute_script(_zend_file_handle * primary_file=0x0012ff2c, void * * * tsrm_ls=0x00902c48)  Line 1628 + 0x1b	C
php.exe!main(int argc=2, char * * argv=0x00904c68)  Line 943 + 0x13	C
php.exe!mainCRTStartup()  Line 398 + 0x11	C
kernel32.dll!7c816d4f()
kernel32.dll!7c8399f3()

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-30 18:50 UTC] wez@php.net
Are you sure that you have a clean build?
 [2004-12-30 22:29 UTC] sebastian@php.net
I made a clean checkout and rebuilt -- and not it works.

Below is the build script I use which I think should clean everything before building:

cscript /nologo win32\build\cvsclean.js
rmdir /S /Q debug_ts
cscript /nologo win32\build\buildconf.js
cscript /nologo configure.js --with-php-build=..\build\php_build --enable-debug --with-mysql=shared --with-xsl=shared
nmake
 [2004-12-30 22:30 UTC] sebastian@php.net
-not +now :-)
 [2004-12-31 00:34 UTC] johannes@php.net
no bug -> bogus 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 07 17:01:33 2024 UTC