Fwd: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend.h zend_variables.c zend_variables.h

php.internals

Andi Gutmans

21 years ago
Is there something we can do about serialization breaking between 5.0.xand 5.1.x? IIRC we don't save the PHP version number with serialized data. If so, we could adjust the types according to version check. Comments/ideas? Andi From: "Andi Gutmans" <andi@php.net> To: zend-engine-cvs@lists.php.net Date: Sun, 26 Sep 2004 20:03:57 -0000 Subject: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend.h zend_variables.c zend_variables.h andi Sun Sep 26 16:03:57 2004 EDT Modified files: /ZendEngine2 zend.h zend_variables.c zend_variables.h Log: - Apply Thies and Sterling's patch which doesn't call ctor/dtor functions - for types which don't require it (BOOL/NULL/LONG/DOUBLE) - Breaks serialization!!! http://cvs.php.net/diff.php/ZendEngine2/zend.h?r1=1.262&r2=1.263&ty=u Index: ZendEngine2/zend.h diff -u ZendEngine2/zend.h:1.262 ZendEngine2/zend.h:1.263 --- ZendEngine2/zend.h:1.262 Wed Sep 22 08:49:08 2004 +++ ZendEngine2/zend.h Sun Sep 26 16:03:54 2004 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend.h,v 1.262 2004/09/22 12:49:08 hyanantha Exp $ */ +/* $Id: zend.h,v 1.263 2004/09/26 20:03:54 andi Exp $ */ #ifndef ZEND_H #define ZEND_H @@ -386,13 +386,14 @@ /* data types */ +/* All data types <= IS_BOOL have their constructor/destructors skipped */ #define IS_NULL 0 #define IS_LONG 1 #define IS_DOUBLE 2 -#define IS_STRING 3 +#define IS_BOOL 3 #define IS_ARRAY 4 #define IS_OBJECT 5 -#define IS_BOOL 6 +#define IS_STRING 6 #define IS_RESOURCE 7 #define IS_CONSTANT 8 #define IS_CONSTANT_ARRAY 9 http://cvs.php.net/diff.php/ZendEngine2/zend_variables.c?r1=1.58&r2=1.59&ty=u Index: ZendEngine2/zend_variables.c diff -u ZendEngine2/zend_variables.c:1.58 ZendEngine2/zend_variables.c:1.59 --- ZendEngine2/zend_variables.c:1.58 Mon Jul 19 03:19:03 2004 +++ ZendEngine2/zend_variables.c Sun Sep 26 16:03:54 2004 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_variables.c,v 1.58 2004/07/19 07:19:03 andi Exp $ */ +/* $Id: zend_variables.c,v 1.59 2004/09/26 20:03:54 andi Exp $ */ #include <stdio.h> #include "zend.h" @@ -27,11 +27,8 @@ #include "zend_list.h" -ZEND_API void _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC) +ZEND_API void _zval_dtor_func(zval *zvalue ZEND_FILE_LINE_DC) { - if (zvalue->type==IS_LONG) { - return; - } switch (zvalue->type & ~IS_CONSTANT_INDEX) { case IS_STRING: case IS_CONSTANT: @@ -104,7 +101,7 @@ } -ZEND_API int _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC) +ZEND_API int _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC) { switch (zvalue->type) { case IS_RESOURCE: { http://cvs.php.net/diff.php/ZendEngine2/zend_variables.h?r1=1.29&r2=1.30&ty=u Index: ZendEngine2/zend_variables.h diff -u ZendEngine2/zend_variables.h:1.29 ZendEngine2/zend_variables.h:1.30 --- ZendEngine2/zend_variables.h:1.29 Fri Feb 20 03:03:27 2004 +++ ZendEngine2/zend_variables.h Sun Sep 26 16:03:54 2004 @@ -17,17 +17,36 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_variables.h,v 1.29 2004/02/20 08:03:27 hholzgra Exp $ */ +/* $Id: zend_variables.h,v 1.30 2004/09/26 20:03:54 andi Exp $ */ #ifndef ZEND_VARIABLES_H #define ZEND_VARIABLES_H - BEGIN_EXTERN_C() + +ZEND_API void _zval_dtor_func(zval *zvalue ZEND_FILE_LINE_DC); + +static inline void _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC) +{ + if (zvalue->type <= IS_BOOL) { + return; + } + _zval_dtor_func(zvalue ZEND_FILE_LINE_CC); +} + +ZEND_API int _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC); + +static inline int _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC) +{ + if (zvalue->type <= IS_BOOL) { + return; + } + _zval_copy_ctor_func(zvalue ZEND_FILE_LINE_CC); +} + + ZEND_API int zend_print_variable(zval *var); -ZEND_API int _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC); -ZEND_API void _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC); ZEND_API void _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC); ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC); ZEND_API void _zval_internal_ptr_dtor(zval **zvalue ZEND_FILE_LINE_DC);
-- Zend Engine CVS Mailing List (http://cvs.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Andi Gutmans

21 years ago
False alarm. Marcus just pointed out that we don't use the values of the IS_BOOL and friends in serialization. So it doesn't break anything except for code which might rely on these numbers (which I don't think we have in the default distro). Andi At 01:06 PM 9/26/2004 -0700, Andi Gutmans wrote:

Andrey Hristov

21 years ago
Andi Gutmans wrote:
> False alarm. Marcus just pointed out that we don't use the values of the > IS_BOOL and friends in serialization. > So it doesn't break anything except for code which might rely on these > numbers (which I don't think we have in the default distro). > > Andi
Well, the binary serialization module is not still in PECL's CVS. Fumanchi is quite quiet lately Andrey P.S. To me it was also strange why it will break BC :)

l0t3k

21 years ago
> > Andi > Well, the binary serialization module is not still in PECL's CVS. > Fumanchi is quite quiet lately >
im not 100% sure, but bcompiler may be affected, but i seriously doubt its being used heavily at this point. l0t3k