wddx serialization works now

This commit is contained in:
Sascha Schumann 1999-09-16 12:00:58 +00:00
parent 92896a9945
commit a597f24b5e
2 changed files with 25 additions and 5 deletions

View file

@ -148,4 +148,11 @@ void session_adapt_uris(const char *, uint, char **, uint *);
#define session_adapt_uris(a,b,c,d) do { } while(0) #define session_adapt_uris(a,b,c,d) do { } while(0)
#endif #endif
#if 0
#if HAVE_WDDX
#define WDDX_SERIALIZER
#include "ext/wddx/php_wddx_api.h"
#endif
#endif
#endif #endif

View file

@ -79,8 +79,14 @@ PHP_INI_BEGIN()
PHP_INI_END() PHP_INI_END()
PS_SERIALIZER_FUNCS(php); PS_SERIALIZER_FUNCS(php);
#ifdef WDDX_SERIALIZER
PS_SERIALIZER_FUNCS(wddx);
#endif
const static ps_serializer ps_serializers[] = { const static ps_serializer ps_serializers[] = {
#ifdef WDDX_SERIALIZER
PS_SERIALIZER_ENTRY(wddx),
#endif
PS_SERIALIZER_ENTRY(php), PS_SERIALIZER_ENTRY(php),
{0} {0}
}; };
@ -201,17 +207,18 @@ PS_SERIALIZER_DECODE_FUNC(php)
return SUCCESS; return SUCCESS;
} }
#if 0 #ifdef WDDX_SERIALIZER
PS_SERIALIZER_ENCODE_FUNC(wddx) PS_SERIALIZER_ENCODE_FUNC(wddx)
{ {
wddx_packet *packet; wddx_packet *packet;
char *key; char *key;
ELS_FETCH();
zval **struc; zval **struc;
char *buf; char *buf;
ELS_FETCH();
packet = _php_wddx_constructor(); packet = _php_wddx_constructor();
if(!packet) return FAILURE;
_php_wddx_packet_start(packet, NULL); _php_wddx_packet_start(packet, NULL);
_php_wddx_add_chunk(packet, WDDX_STRUCT_S); _php_wddx_add_chunk(packet, WDDX_STRUCT_S);
@ -222,6 +229,7 @@ PS_SERIALIZER_ENCODE_FUNC(wddx)
if(zend_hash_find(&EG(symbol_table), key, strlen(key) + 1, (void **) &struc) == SUCCESS) { if(zend_hash_find(&EG(symbol_table), key, strlen(key) + 1, (void **) &struc) == SUCCESS) {
_php_wddx_serialize_var(packet, *struc, key); _php_wddx_serialize_var(packet, *struc, key);
} }
efree(key);
} }
_php_wddx_add_chunk(packet, WDDX_STRUCT_E); _php_wddx_add_chunk(packet, WDDX_STRUCT_E);
@ -244,7 +252,9 @@ PS_SERIALIZER_DECODE_FUNC(wddx)
int hash_type; int hash_type;
ELS_FETCH(); ELS_FETCH();
retval = (zval *) ecalloc(sizeof(zval), 1); if(vallen == 0) return FAILURE;
MAKE_STD_ZVAL(retval);
_php_wddx_deserialize(val, retval); _php_wddx_deserialize(val, retval);
@ -269,13 +279,16 @@ PS_SERIALIZER_DECODE_FUNC(wddx)
return SUCCESS; return SUCCESS;
} }
#endif #endif
static char *_php_session_encode(int *newlen PSLS_DC) static char *_php_session_encode(int *newlen PSLS_DC)
{ {
char *ret = NULL; char *ret = NULL;
PS(serializer)->encode(&ret, newlen PSLS_CC); if(PS(serializer)->encode(&ret, newlen PSLS_CC) == FAILURE) {
ret = NULL;
}
return ret; return ret;
} }