1999-04-17 00:37:12 +00:00
|
|
|
|
/*
|
|
|
|
|
+----------------------------------------------------------------------+
|
1999-07-16 13:13:16 +00:00
|
|
|
|
| PHP version 4.0 |
|
1999-04-17 00:37:12 +00:00
|
|
|
|
+----------------------------------------------------------------------+
|
2001-02-26 06:11:02 +00:00
|
|
|
|
| Copyright (c) 1997-2001 The PHP Group |
|
1999-04-17 00:37:12 +00:00
|
|
|
|
+----------------------------------------------------------------------+
|
2000-05-18 15:34:45 +00:00
|
|
|
|
| This source file is subject to version 2.02 of the PHP license, |
|
1999-07-16 13:13:16 +00:00
|
|
|
|
| that is bundled with this package in the file LICENSE, and is |
|
|
|
|
|
| available at through the world-wide-web at |
|
2000-05-18 15:34:45 +00:00
|
|
|
|
| http://www.php.net/license/2_02.txt. |
|
1999-07-16 13:13:16 +00:00
|
|
|
|
| If you did not receive a copy of the PHP license and are unable to |
|
|
|
|
|
| obtain it through the world-wide-web, please send a note to |
|
|
|
|
|
| license@php.net so we can mail you a copy immediately. |
|
1999-04-17 00:37:12 +00:00
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
|
| Authors: Jani Lehtim<EFBFBD>ki <jkl@njet.net> |
|
2000-10-29 09:14:55 +00:00
|
|
|
|
| Thies C. Arntzen <thies@thieso.net> |
|
2000-06-23 16:21:31 +00:00
|
|
|
|
| Sascha Schumann <sascha@schumann.cx> |
|
1999-04-17 00:37:12 +00:00
|
|
|
|
+----------------------------------------------------------------------+
|
2000-12-11 12:52:52 +00:00
|
|
|
|
*/
|
1999-04-17 00:37:12 +00:00
|
|
|
|
|
2001-08-11 17:03:37 +00:00
|
|
|
|
/* $Id: var.c
|
|
|
|
|
1.111 2001/08/06 13:36:08 thies Exp $ */
|
1999-09-15 11:09:32 +00:00
|
|
|
|
|
1999-04-25 12:41:18 +00:00
|
|
|
|
|
|
|
|
|
/* {{{ includes
|
|
|
|
|
*/
|
|
|
|
|
|
1999-04-17 00:37:12 +00:00
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <errno.h>
|
|
|
|
|
#include "php.h"
|
1999-12-04 19:19:57 +00:00
|
|
|
|
#include "php_string.h"
|
|
|
|
|
#include "php_var.h"
|
2001-08-03 07:25:27 +00:00
|
|
|
|
#include "php_smart_str.h"
|
2000-06-23 16:21:31 +00:00
|
|
|
|
#include "basic_functions.h"
|
2000-06-23 16:46:04 +00:00
|
|
|
|
#include "php_incomplete_class.h"
|
1999-04-17 00:37:12 +00:00
|
|
|
|
|
2000-06-09 15:13:36 +00:00
|
|
|
|
#define COMMON ((*struc)->is_ref?"&":"")
|
2000-02-07 18:00:16 +00:00
|
|
|
|
|
1999-04-25 12:41:18 +00:00
|
|
|
|
/* }}} */
|
1999-09-20 14:14:26 +00:00
|
|
|
|
/* {{{ php_var_dump */
|
1999-04-25 12:41:18 +00:00
|
|
|
|
|
2000-06-09 15:13:36 +00:00
|
|
|
|
static int php_array_element_dump(zval **zv, int num_args, va_list args, zend_hash_key *hash_key)
|
|
|
|
|
{
|
|
|
|
|
int level;
|
2001-08-05 15:55:43 +00:00
|
|
|
|
TSRMLS_FETCH();
|
2000-06-09 15:13:36 +00:00
|
|
|
|
|
|
|
|
|
level = va_arg(args, int);
|
|
|
|
|
|
|
|
|
|
if (hash_key->nKeyLength==0) { /* numeric key */
|
|
|
|
|
php_printf("%*c[%ld]=>\n", level + 1, ' ', hash_key->h);
|
|
|
|
|
} else { /* string key */
|
|
|
|
|
php_printf("%*c[\"%s\"]=>\n", level + 1, ' ', hash_key->arKey);
|
|
|
|
|
}
|
2001-08-05 15:55:43 +00:00
|
|
|
|
php_var_dump(zv, level + 2 TSRMLS_CC);
|
2000-06-09 15:13:36 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2001-08-05 15:55:43 +00:00
|
|
|
|
void php_var_dump(zval **struc, int level TSRMLS_DC)
|
1999-04-17 00:37:12 +00:00
|
|
|
|
{
|
1999-09-13 10:52:54 +00:00
|
|
|
|
HashTable *myht;
|
1999-04-17 00:37:12 +00:00
|
|
|
|
|
2000-06-09 15:13:36 +00:00
|
|
|
|
if (level>1) {
|
|
|
|
|
php_printf("%*c", level-1, ' ');
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-24 18:39:41 +00:00
|
|
|
|
switch ((*struc)->type) {
|
1999-07-01 09:26:05 +00:00
|
|
|
|
case IS_BOOL:
|
2001-07-09 09:03:06 +00:00
|
|
|
|
php_printf("%sbool(%s)\n", COMMON, Z_LVAL_PP(struc)?"true":"false");
|
1999-07-01 09:26:05 +00:00
|
|
|
|
break;
|
2000-01-04 13:22:58 +00:00
|
|
|
|
case IS_NULL:
|
2000-06-09 15:13:36 +00:00
|
|
|
|
php_printf("%sNULL\n", COMMON);
|
2000-01-02 11:49:27 +00:00
|
|
|
|
break;
|
1999-04-17 00:37:12 +00:00
|
|
|
|
case IS_LONG:
|
2001-07-09 09:03:06 +00:00
|
|
|
|
php_printf("%sint(%ld)\n", COMMON, Z_LVAL_PP(struc));
|
1999-04-17 00:37:12 +00:00
|
|
|
|
break;
|
1999-11-06 08:16:25 +00:00
|
|
|
|
case IS_DOUBLE: {
|
2000-06-09 15:13:36 +00:00
|
|
|
|
|
2001-07-09 09:03:06 +00:00
|
|
|
|
php_printf("%sfloat(%.*G)\n", COMMON, (int) EG(precision), Z_DVAL_PP(struc));
|
1999-11-06 08:16:25 +00:00
|
|
|
|
}
|
1999-04-17 00:37:12 +00:00
|
|
|
|
break;
|
|
|
|
|
case IS_STRING:
|
2001-07-09 09:03:06 +00:00
|
|
|
|
php_printf("%sstring(%d) \"", COMMON, Z_STRLEN_PP(struc));
|
|
|
|
|
PHPWRITE(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc));
|
2000-06-09 15:13:36 +00:00
|
|
|
|
PUTS("\"\n");
|
1999-04-17 00:37:12 +00:00
|
|
|
|
break;
|
|
|
|
|
case IS_ARRAY:
|
1999-09-15 11:08:25 +00:00
|
|
|
|
myht = HASH_OF(*struc);
|
2000-06-09 15:13:36 +00:00
|
|
|
|
php_printf("%sarray(%d) {\n", COMMON, zend_hash_num_elements(myht));
|
1999-04-17 00:37:12 +00:00
|
|
|
|
goto head_done;
|
|
|
|
|
case IS_OBJECT:
|
2001-07-29 08:14:29 +00:00
|
|
|
|
myht = Z_OBJPROP_PP(struc);
|
|
|
|
|
php_printf("%sobject(%s)(%d) {\n", COMMON, Z_OBJCE_PP(struc)->name, zend_hash_num_elements(myht));
|
2000-06-09 15:13:36 +00:00
|
|
|
|
head_done:
|
2001-07-15 22:49:25 +00:00
|
|
|
|
zend_hash_apply_with_arguments(myht, (apply_func_args_t) php_array_element_dump, 1, level);
|
2000-06-09 15:13:36 +00:00
|
|
|
|
if (level>1) {
|
2000-08-29 11:09:20 +00:00
|
|
|
|
php_printf("%*c", level-1, ' ');
|
1999-04-17 00:37:12 +00:00
|
|
|
|
}
|
2000-06-09 15:13:36 +00:00
|
|
|
|
PUTS("}\n");
|
2000-10-30 17:10:06 +00:00
|
|
|
|
break;
|
1999-09-24 18:57:02 +00:00
|
|
|
|
case IS_RESOURCE: {
|
2000-10-20 18:25:16 +00:00
|
|
|
|
char *type_name;
|
2001-07-30 04:58:07 +00:00
|
|
|
|
|
|
|
|
|
type_name = zend_rsrc_list_get_rsrc_type(Z_LVAL_PP(struc) TSRMLS_CC);
|
2001-07-09 09:03:06 +00:00
|
|
|
|
php_printf("%sresource(%ld) of type (%s)\n", COMMON, Z_LVAL_PP(struc), type_name ? type_name : "Unknown");
|
1999-09-24 18:57:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
1999-04-17 00:37:12 +00:00
|
|
|
|
default:
|
2001-08-11 17:03:37 +00:00
|
|
|
|
php_printf("%sUNKNOWN:0\n", COMMON);
|
2000-06-09 15:13:36 +00:00
|
|
|
|
break;
|
1999-04-17 00:37:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-25 12:41:18 +00:00
|
|
|
|
/* }}} */
|
1999-04-17 00:37:12 +00:00
|
|
|
|
|
1999-09-20 14:14:26 +00:00
|
|
|
|
|
2000-05-17 19:42:08 +00:00
|
|
|
|
/* {{{ proto void var_dump(mixed var)
|
|
|
|
|
Dumps a string representation of variable to output */
|
1999-04-17 00:37:12 +00:00
|
|
|
|
PHP_FUNCTION(var_dump)
|
|
|
|
|
{
|
1999-09-20 14:14:26 +00:00
|
|
|
|
zval ***args;
|
|
|
|
|
int argc;
|
|
|
|
|
int i;
|
|
|
|
|
|
2000-06-05 19:47:54 +00:00
|
|
|
|
argc = ZEND_NUM_ARGS();
|
1999-09-20 14:14:26 +00:00
|
|
|
|
|
|
|
|
|
args = (zval ***)emalloc(argc * sizeof(zval **));
|
2000-06-05 19:47:54 +00:00
|
|
|
|
if (ZEND_NUM_ARGS() == 0 || zend_get_parameters_array_ex(argc, args) == FAILURE) {
|
1999-09-20 14:14:26 +00:00
|
|
|
|
efree(args);
|
1999-04-17 00:37:12 +00:00
|
|
|
|
WRONG_PARAM_COUNT;
|
|
|
|
|
}
|
1999-09-20 14:14:26 +00:00
|
|
|
|
|
|
|
|
|
for (i=0; i<argc; i++)
|
2001-08-05 15:55:43 +00:00
|
|
|
|
php_var_dump(args[i], 1 TSRMLS_CC);
|
1999-09-20 14:14:26 +00:00
|
|
|
|
|
|
|
|
|
efree(args);
|
1999-04-17 00:37:12 +00:00
|
|
|
|
}
|
1999-04-25 12:41:18 +00:00
|
|
|
|
/* }}} */
|
1999-09-20 14:14:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* {{{ php_var_serialize */
|
1999-04-17 00:37:12 +00:00
|
|
|
|
|
2001-08-04 03:30:38 +00:00
|
|
|
|
static void php_var_serialize_intern(smart_str *buf, zval **struc, HashTable *var_hash TSRMLS_DC);
|
|
|
|
|
|
2001-07-15 14:08:58 +00:00
|
|
|
|
static inline int php_add_var_hash(HashTable *var_hash, zval *var, void *var_old)
|
|
|
|
|
{
|
2000-10-30 17:10:06 +00:00
|
|
|
|
ulong var_no;
|
2001-08-03 07:25:27 +00:00
|
|
|
|
char id[32], *p;
|
2000-10-30 17:10:06 +00:00
|
|
|
|
|
2001-08-03 07:25:27 +00:00
|
|
|
|
p = smart_str_print_long(id, (long) var);
|
|
|
|
|
*p = '\0';
|
2000-12-11 14:29:25 +00:00
|
|
|
|
|
2001-08-04 03:30:38 +00:00
|
|
|
|
if (var_old && zend_hash_find(var_hash, id, p - id, var_old) == SUCCESS) {
|
|
|
|
|
if (!var->is_ref) {
|
2000-12-11 14:29:25 +00:00
|
|
|
|
/* we still need to bump up the counter, since non-refs will
|
|
|
|
|
be counted separately by unserializer */
|
|
|
|
|
var_no = -1;
|
|
|
|
|
zend_hash_next_index_insert(var_hash, &var_no, sizeof(var_no), NULL);
|
|
|
|
|
}
|
2000-10-30 17:10:06 +00:00
|
|
|
|
return FAILURE;
|
|
|
|
|
}
|
|
|
|
|
|
2001-08-04 03:30:38 +00:00
|
|
|
|
/* +1 because otherwise hash will think we are trying to store NULL pointer */
|
|
|
|
|
var_no = zend_hash_num_elements(var_hash) + 1;
|
2001-08-03 07:25:27 +00:00
|
|
|
|
zend_hash_add(var_hash, id, p - id, &var_no, sizeof(var_no), NULL);
|
2000-10-30 17:10:06 +00:00
|
|
|
|
return SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
2001-08-04 03:30:38 +00:00
|
|
|
|
static inline void php_var_serialize_long(smart_str *buf, long val)
|
|
|
|
|
{
|
|
|
|
|
smart_str_appendl(buf, "i:", 2);
|
|
|
|
|
smart_str_append_long(buf, val);
|
|
|
|
|
smart_str_appendc(buf, ';');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void php_var_serialize_string(smart_str *buf, char *str, int len)
|
|
|
|
|
{
|
|
|
|
|
smart_str_appendl(buf, "s:", 2);
|
|
|
|
|
smart_str_append_long(buf, len);
|
|
|
|
|
smart_str_appendl(buf, ":\"", 2);
|
|
|
|
|
smart_str_appendl(buf, str, len);
|
|
|
|
|
smart_str_appendl(buf, "\";", 2);
|
|
|
|
|
}
|
|
|
|
|
|
2001-08-04 05:37:11 +00:00
|
|
|
|
static inline void php_var_serialize_class_name(smart_str *buf, zval **struc TSRMLS_DC)
|
2001-08-04 03:30:38 +00:00
|
|
|
|
{
|
|
|
|
|
PHP_CLASS_ATTRIBUTES;
|
|
|
|
|
|
|
|
|
|
PHP_SET_CLASS_ATTRIBUTES(*struc);
|
|
|
|
|
smart_str_appendl(buf, "O:", 2);
|
|
|
|
|
smart_str_append_long(buf, name_len);
|
|
|
|
|
smart_str_appendl(buf, ":\"", 2);
|
|
|
|
|
smart_str_appendl(buf, class_name, name_len);
|
|
|
|
|
smart_str_appendl(buf, "\":", 2);
|
|
|
|
|
PHP_CLEANUP_CLASS_ATTRIBUTES();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void php_var_serialize_class(smart_str *buf, zval **struc, zval *retval_ptr, HashTable *var_hash TSRMLS_DC)
|
|
|
|
|
{
|
|
|
|
|
int count = zend_hash_num_elements(HASH_OF(retval_ptr));
|
|
|
|
|
|
2001-08-04 05:37:11 +00:00
|
|
|
|
php_var_serialize_class_name(buf, struc TSRMLS_CC);
|
2001-08-04 03:30:38 +00:00
|
|
|
|
|
2001-08-04 17:29:54 +00:00
|
|
|
|
smart_str_append_long(buf, count);
|
|
|
|
|
smart_str_appendl(buf, ":{", 2);
|
|
|
|
|
|
2001-08-04 03:30:38 +00:00
|
|
|
|
if (count > 0) {
|
|
|
|
|
char *key;
|
|
|
|
|
zval **d, **name;
|
|
|
|
|
ulong index;
|
|
|
|
|
HashPosition pos;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
zend_hash_internal_pointer_reset_ex(HASH_OF(retval_ptr), &pos);
|
|
|
|
|
|
|
|
|
|
for (;; zend_hash_move_forward_ex(HASH_OF(retval_ptr), &pos)) {
|
|
|
|
|
i = zend_hash_get_current_key_ex(HASH_OF(retval_ptr), &key, NULL,
|
|
|
|
|
&index, 0, &pos);
|
|
|
|
|
|
|
|
|
|
if (i == HASH_KEY_NON_EXISTANT)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
zend_hash_get_current_data_ex(HASH_OF(retval_ptr),
|
|
|
|
|
(void **) &name, &pos);
|
|
|
|
|
|
|
|
|
|
if (Z_TYPE_PP(name) != IS_STRING) {
|
|
|
|
|
php_error(E_NOTICE, "__sleep should return an array only "
|
|
|
|
|
"containing the names of instance-variables to "
|
|
|
|
|
"serialize.");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (zend_hash_find(Z_OBJPROP_PP(struc), Z_STRVAL_PP(name),
|
|
|
|
|
Z_STRLEN_PP(name) + 1, (void *) &d) == SUCCESS) {
|
|
|
|
|
php_var_serialize_string(buf, Z_STRVAL_PP(name),
|
|
|
|
|
Z_STRLEN_PP(name));
|
|
|
|
|
php_var_serialize_intern(buf, d, var_hash TSRMLS_CC);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
smart_str_appendc(buf, '}');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void php_var_serialize_intern(smart_str *buf, zval **struc, HashTable *var_hash TSRMLS_DC)
|
1999-04-17 00:37:12 +00:00
|
|
|
|
{
|
1999-09-15 11:08:25 +00:00
|
|
|
|
int i;
|
2000-10-30 17:10:06 +00:00
|
|
|
|
ulong *var_already;
|
1999-09-15 11:08:25 +00:00
|
|
|
|
HashTable *myht;
|
1999-04-17 00:37:12 +00:00
|
|
|
|
|
2001-08-04 03:30:38 +00:00
|
|
|
|
if(var_hash
|
|
|
|
|
&& php_add_var_hash(var_hash, *struc, (void *) &var_already) == FAILURE
|
|
|
|
|
&& (*struc)->is_ref) {
|
2001-08-03 07:25:27 +00:00
|
|
|
|
smart_str_appendl(buf, "R:", 2);
|
|
|
|
|
smart_str_append_long(buf, *var_already);
|
|
|
|
|
smart_str_appendc(buf, ';');
|
2000-10-30 17:10:06 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2001-08-04 03:30:38 +00:00
|
|
|
|
switch (Z_TYPE_PP(struc)) {
|
1999-07-01 09:26:05 +00:00
|
|
|
|
case IS_BOOL:
|
2001-08-03 07:25:27 +00:00
|
|
|
|
smart_str_appendl(buf, "b:", 2);
|
|
|
|
|
smart_str_append_long(buf, Z_LVAL_PP(struc));
|
|
|
|
|
smart_str_appendc(buf, ';');
|
1999-07-01 09:26:05 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2000-01-04 13:22:58 +00:00
|
|
|
|
case IS_NULL:
|
2001-08-03 07:25:27 +00:00
|
|
|
|
smart_str_appendl(buf, "N;", 2);
|
2000-01-02 11:49:27 +00:00
|
|
|
|
return;
|
|
|
|
|
|
1999-04-17 00:37:12 +00:00
|
|
|
|
case IS_LONG:
|
2001-08-04 03:30:38 +00:00
|
|
|
|
php_var_serialize_long(buf, Z_LVAL_PP(struc));
|
1999-04-17 00:37:12 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2001-08-04 03:30:38 +00:00
|
|
|
|
case IS_DOUBLE: {
|
|
|
|
|
char s[256];
|
|
|
|
|
ulong slen;
|
|
|
|
|
|
2001-08-11 17:03:37 +00:00
|
|
|
|
slen = sprintf(s, "d:%.*G;", (int) EG(precision), Z_DVAL_PP(struc));
|
2001-08-04 03:30:38 +00:00
|
|
|
|
smart_str_appendl(buf, s, slen);
|
|
|
|
|
return;
|
|
|
|
|
}
|
1999-04-17 00:37:12 +00:00
|
|
|
|
|
2001-08-03 07:25:27 +00:00
|
|
|
|
case IS_STRING:
|
2001-08-04 03:30:38 +00:00
|
|
|
|
php_var_serialize_string(buf, Z_STRVAL_PP(struc), Z_STRLEN_PP(struc));
|
1999-04-17 00:37:12 +00:00
|
|
|
|
return;
|
2001-08-04 03:30:38 +00:00
|
|
|
|
|
2000-03-16 02:15:41 +00:00
|
|
|
|
case IS_OBJECT: {
|
2000-06-16 19:55:51 +00:00
|
|
|
|
zval *retval_ptr = NULL;
|
2001-08-04 17:29:54 +00:00
|
|
|
|
zval fname;
|
2000-03-16 02:15:41 +00:00
|
|
|
|
int res;
|
|
|
|
|
|
2001-08-04 17:29:54 +00:00
|
|
|
|
INIT_PZVAL(&fname);
|
|
|
|
|
ZVAL_STRINGL(&fname, "__sleep", sizeof("__sleep") - 1, 0);
|
|
|
|
|
res = call_user_function_ex(CG(function_table), struc, &fname,
|
2001-08-04 03:30:38 +00:00
|
|
|
|
&retval_ptr, 0, 0, 1, NULL TSRMLS_CC);
|
2000-03-16 02:15:41 +00:00
|
|
|
|
|
2000-06-18 10:25:39 +00:00
|
|
|
|
if (res == SUCCESS) {
|
2000-03-16 02:15:41 +00:00
|
|
|
|
if (retval_ptr) {
|
2001-08-04 03:30:38 +00:00
|
|
|
|
if (HASH_OF(retval_ptr))
|
|
|
|
|
php_var_serialize_class(buf, struc, retval_ptr,
|
|
|
|
|
var_hash TSRMLS_CC);
|
2000-06-18 10:25:39 +00:00
|
|
|
|
zval_ptr_dtor(&retval_ptr);
|
2000-03-16 02:15:41 +00:00
|
|
|
|
}
|
2001-08-04 03:30:38 +00:00
|
|
|
|
return;
|
2000-03-16 02:15:41 +00:00
|
|
|
|
}
|
2001-08-04 03:30:38 +00:00
|
|
|
|
if (retval_ptr)
|
2000-06-17 15:53:33 +00:00
|
|
|
|
zval_ptr_dtor(&retval_ptr);
|
2001-08-04 03:30:38 +00:00
|
|
|
|
/* fall-through */
|
2000-03-16 02:15:41 +00:00
|
|
|
|
}
|
1999-04-17 00:37:12 +00:00
|
|
|
|
case IS_ARRAY:
|
1999-09-15 11:08:25 +00:00
|
|
|
|
myht = HASH_OF(*struc);
|
|
|
|
|
i = zend_hash_num_elements(myht);
|
2001-08-04 03:30:38 +00:00
|
|
|
|
if (Z_TYPE_PP(struc) == IS_ARRAY) {
|
2001-08-03 07:25:27 +00:00
|
|
|
|
smart_str_appendl(buf, "a:", 2);
|
1999-09-15 11:08:25 +00:00
|
|
|
|
} else {
|
2001-08-04 05:37:11 +00:00
|
|
|
|
php_var_serialize_class_name(buf, struc TSRMLS_CC);
|
1999-09-15 11:08:25 +00:00
|
|
|
|
}
|
2001-08-03 07:25:27 +00:00
|
|
|
|
smart_str_append_long(buf, i);
|
|
|
|
|
smart_str_appendl(buf, ":{", 2);
|
1999-04-17 00:37:12 +00:00
|
|
|
|
if (i > 0) {
|
|
|
|
|
char *key;
|
2001-08-04 03:30:38 +00:00
|
|
|
|
zval **data;
|
1999-04-17 00:37:12 +00:00
|
|
|
|
ulong index;
|
2001-08-04 03:30:38 +00:00
|
|
|
|
ulong key_len;
|
2000-06-18 10:25:39 +00:00
|
|
|
|
HashPosition pos;
|
1999-04-17 00:37:12 +00:00
|
|
|
|
|
2000-06-18 10:25:39 +00:00
|
|
|
|
zend_hash_internal_pointer_reset_ex(myht, &pos);
|
|
|
|
|
for (;; zend_hash_move_forward_ex(myht, &pos)) {
|
2001-08-04 03:30:38 +00:00
|
|
|
|
i = zend_hash_get_current_key_ex(myht, &key, &key_len,
|
|
|
|
|
&index, 0, &pos);
|
|
|
|
|
if (i == HASH_KEY_NON_EXISTANT)
|
1999-04-17 00:37:12 +00:00
|
|
|
|
break;
|
2001-08-04 03:30:38 +00:00
|
|
|
|
|
|
|
|
|
if (zend_hash_get_current_data_ex(myht,
|
|
|
|
|
(void **) &data, &pos) != SUCCESS
|
|
|
|
|
|| !data
|
|
|
|
|
|| data == struc)
|
1999-04-25 12:41:18 +00:00
|
|
|
|
continue;
|
|
|
|
|
|
2000-10-18 18:32:32 +00:00
|
|
|
|
switch (i) {
|
2000-10-30 17:10:06 +00:00
|
|
|
|
case HASH_KEY_IS_LONG:
|
2001-08-04 03:30:38 +00:00
|
|
|
|
php_var_serialize_long(buf, index);
|
2000-10-18 18:32:32 +00:00
|
|
|
|
break;
|
|
|
|
|
case HASH_KEY_IS_STRING:
|
2001-08-04 17:29:54 +00:00
|
|
|
|
php_var_serialize_string(buf, key, key_len - 1);
|
2000-10-18 18:32:32 +00:00
|
|
|
|
break;
|
1999-04-17 00:37:12 +00:00
|
|
|
|
}
|
2001-08-04 03:30:38 +00:00
|
|
|
|
php_var_serialize_intern(buf, data, var_hash TSRMLS_CC);
|
1999-04-17 00:37:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2001-08-03 07:25:27 +00:00
|
|
|
|
smart_str_appendc(buf, '}');
|
1999-04-17 00:37:12 +00:00
|
|
|
|
return;
|
|
|
|
|
default:
|
2001-08-03 07:25:27 +00:00
|
|
|
|
smart_str_appendl(buf, "i:0;", 4);
|
1999-04-17 00:37:12 +00:00
|
|
|
|
return;
|
1999-09-15 11:08:25 +00:00
|
|
|
|
}
|
1999-04-17 00:37:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-08-05 16:52:29 +00:00
|
|
|
|
PHPAPI void php_var_serialize(smart_str *buf, zval **struc, HashTable *var_hash TSRMLS_DC)
|
2001-08-03 11:00:16 +00:00
|
|
|
|
{
|
2001-08-04 03:30:38 +00:00
|
|
|
|
php_var_serialize_intern(buf, struc, var_hash TSRMLS_CC);
|
2001-08-03 11:00:16 +00:00
|
|
|
|
smart_str_0(buf);
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-25 12:41:18 +00:00
|
|
|
|
/* }}} */
|
2001-08-05 15:55:43 +00:00
|
|
|
|
/* {{{ php_var_unserialize */
|
1999-04-17 00:37:12 +00:00
|
|
|
|
|
2001-08-05 16:52:29 +00:00
|
|
|
|
PHPAPI int php_var_unserialize(zval **rval, const char **p, const char *max, HashTable *var_hash TSRMLS_DC)
|
1999-04-17 00:37:12 +00:00
|
|
|
|
{
|
1999-07-01 05:47:06 +00:00
|
|
|
|
const char *q;
|
1999-04-17 00:37:12 +00:00
|
|
|
|
char *str;
|
|
|
|
|
int i;
|
1999-07-01 09:26:05 +00:00
|
|
|
|
char cur;
|
2000-10-30 17:10:06 +00:00
|
|
|
|
ulong id;
|
1999-09-15 11:08:25 +00:00
|
|
|
|
HashTable *myht;
|
2001-07-09 09:03:06 +00:00
|
|
|
|
zval **rval_ref;
|
1999-04-17 00:37:12 +00:00
|
|
|
|
|
2001-07-09 09:03:06 +00:00
|
|
|
|
if (var_hash && **p != 'R') { /* references aren't counted by serializer! */
|
2000-10-30 17:10:06 +00:00
|
|
|
|
zend_hash_next_index_insert(var_hash, rval, sizeof(*rval), NULL);
|
|
|
|
|
}
|
|
|
|
|
|
1999-07-01 09:26:05 +00:00
|
|
|
|
switch (cur = **p) {
|
2000-10-30 17:10:06 +00:00
|
|
|
|
case 'R':
|
|
|
|
|
if (*((*p) + 1) != ':') {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
q = *p;
|
|
|
|
|
while (**p && **p != ';') {
|
|
|
|
|
(*p)++;
|
|
|
|
|
}
|
|
|
|
|
if (**p != ';') {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
(*p)++;
|
|
|
|
|
id = atol(q + 2)-1; /* count starts with 1 */
|
2001-07-09 09:03:06 +00:00
|
|
|
|
if (!var_hash) {
|
2000-10-30 17:10:06 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
2001-07-09 09:03:06 +00:00
|
|
|
|
if (zend_hash_index_find(var_hash, id, (void *)&rval_ref) != SUCCESS) {
|
2000-10-30 17:10:06 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
2000-11-07 15:06:43 +00:00
|
|
|
|
zval_ptr_dtor(rval);
|
2000-10-30 17:10:06 +00:00
|
|
|
|
*rval = *rval_ref;
|
|
|
|
|
(*rval)->refcount++;
|
|
|
|
|
(*rval)->is_ref = 1;
|
|
|
|
|
return 1;
|
|
|
|
|
|
2000-01-02 11:49:27 +00:00
|
|
|
|
case 'N':
|
|
|
|
|
if (*((*p) + 1) != ';') {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
(*p)++;
|
|
|
|
|
INIT_PZVAL(*rval);
|
2001-07-09 09:03:06 +00:00
|
|
|
|
ZVAL_NULL(*rval);
|
2000-01-02 11:49:27 +00:00
|
|
|
|
(*p)++;
|
|
|
|
|
return 1;
|
|
|
|
|
|
1999-07-01 09:26:05 +00:00
|
|
|
|
case 'b': /* bool */
|
1999-04-17 00:37:12 +00:00
|
|
|
|
case 'i':
|
|
|
|
|
if (*((*p) + 1) != ':') {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
q = *p;
|
|
|
|
|
while (**p && **p != ';') {
|
|
|
|
|
(*p)++;
|
|
|
|
|
}
|
|
|
|
|
if (**p != ';') {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
(*p)++;
|
2001-07-09 09:03:06 +00:00
|
|
|
|
INIT_PZVAL(*rval);
|
1999-07-01 09:26:05 +00:00
|
|
|
|
if (cur == 'b') {
|
2001-08-11 17:03:37 +00:00
|
|
|
|
ZVAL_BOOL(*rval, atol(q + 2));
|
1999-07-01 09:26:05 +00:00
|
|
|
|
} else {
|
2001-08-11 17:03:37 +00:00
|
|
|
|
ZVAL_LONG(*rval, atol(q + 2));
|
1999-07-01 09:26:05 +00:00
|
|
|
|
}
|
1999-04-17 00:37:12 +00:00
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
case 'd':
|
|
|
|
|
if (*((*p) + 1) != ':') {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
q = *p;
|
|
|
|
|
while (**p && **p != ';') {
|
|
|
|
|
(*p)++;
|
|
|
|
|
}
|
|
|
|
|
if (**p != ';') {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
(*p)++;
|
1999-07-09 20:45:55 +00:00
|
|
|
|
INIT_PZVAL(*rval);
|
2001-08-11 17:03:37 +00:00
|
|
|
|
ZVAL_DOUBLE(*rval, atof(q + 2));
|
1999-04-17 00:37:12 +00:00
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
case 's':
|
|
|
|
|
if (*((*p) + 1) != ':') {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
(*p) += 2;
|
|
|
|
|
q = *p;
|
|
|
|
|
while (**p && **p != ':') {
|
|
|
|
|
(*p)++;
|
|
|
|
|
}
|
|
|
|
|
if (**p != ':') {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
i = atoi(q);
|
|
|
|
|
if (i < 0 || (*p + 3 + i) > max || *((*p) + 1) != '\"' ||
|
|
|
|
|
*((*p) + 2 + i) != '\"' || *((*p) + 3 + i) != ';') {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
(*p) += 2;
|
1999-10-22 06:59:05 +00:00
|
|
|
|
|
|
|
|
|
if (i == 0) {
|
|
|
|
|
str = empty_string;
|
|
|
|
|
} else {
|
2001-08-11 17:03:37 +00:00
|
|
|
|
str = estrndup(*p, i);
|
1999-04-17 00:37:12 +00:00
|
|
|
|
}
|
|
|
|
|
(*p) += i + 2;
|
1999-07-09 20:45:55 +00:00
|
|
|
|
INIT_PZVAL(*rval);
|
2001-08-11 17:03:37 +00:00
|
|
|
|
ZVAL_STRINGL(*rval, str, i, 0);
|
1999-04-17 00:37:12 +00:00
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
case 'a':
|
1999-09-15 11:08:25 +00:00
|
|
|
|
case 'o':
|
2000-06-23 16:21:31 +00:00
|
|
|
|
case 'O': {
|
|
|
|
|
zend_bool incomplete_class = 0;
|
|
|
|
|
char *class_name = NULL;
|
|
|
|
|
size_t name_len = 0;
|
2000-06-29 14:49:23 +00:00
|
|
|
|
int pi;
|
2000-06-23 16:21:31 +00:00
|
|
|
|
|
1999-07-09 20:45:55 +00:00
|
|
|
|
INIT_PZVAL(*rval);
|
1999-09-15 11:08:25 +00:00
|
|
|
|
|
|
|
|
|
if (cur == 'a') {
|
|
|
|
|
(*rval)->type = IS_ARRAY;
|
2000-02-02 11:31:37 +00:00
|
|
|
|
ALLOC_HASHTABLE((*rval)->value.ht);
|
1999-09-15 11:08:25 +00:00
|
|
|
|
myht = (*rval)->value.ht;
|
|
|
|
|
} else {
|
|
|
|
|
zend_class_entry *ce;
|
|
|
|
|
|
1999-09-16 08:05:17 +00:00
|
|
|
|
if (cur == 'O') { /* php4 serialized - we get the class-name */
|
|
|
|
|
if (*((*p) + 1) != ':') {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
(*p) += 2;
|
|
|
|
|
q = *p;
|
|
|
|
|
while (**p && **p != ':') {
|
|
|
|
|
(*p)++;
|
|
|
|
|
}
|
|
|
|
|
if (**p != ':') {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2000-06-23 16:21:31 +00:00
|
|
|
|
name_len = i = atoi(q);
|
1999-09-16 08:05:17 +00:00
|
|
|
|
if (i < 0 || (*p + 3 + i) > max || *((*p) + 1) != '\"' ||
|
|
|
|
|
*((*p) + 2 + i) != '\"' || *((*p) + 3 + i) != ':') {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
(*p) += 2;
|
|
|
|
|
class_name = emalloc(i + 1);
|
2000-06-29 14:49:23 +00:00
|
|
|
|
for(pi=0;pi<i;pi++) {
|
|
|
|
|
class_name[pi] = tolower((*p)[pi]);
|
1999-09-16 08:05:17 +00:00
|
|
|
|
}
|
|
|
|
|
class_name[i] = 0;
|
|
|
|
|
(*p) += i;
|
|
|
|
|
|
|
|
|
|
if (zend_hash_find(EG(class_table), class_name, i+1, (void **) &ce)==FAILURE) {
|
2000-06-23 16:21:31 +00:00
|
|
|
|
incomplete_class = 1;
|
2001-08-06 13:36:08 +00:00
|
|
|
|
ce = PHP_IC_ENTRY;
|
1999-09-16 08:05:17 +00:00
|
|
|
|
}
|
1999-12-18 04:01:20 +00:00
|
|
|
|
} else { /* old php 3.0 data 'o' */
|
1999-09-15 15:03:06 +00:00
|
|
|
|
ce = &zend_standard_class_def;
|
1999-09-15 11:08:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-07-29 08:14:29 +00:00
|
|
|
|
/* OBJECTS_FIXME */
|
|
|
|
|
object_init_ex(*rval, ce);
|
|
|
|
|
myht = Z_OBJPROP_PP(rval);
|
2000-06-23 16:21:31 +00:00
|
|
|
|
|
|
|
|
|
if (incomplete_class)
|
2000-06-23 16:58:30 +00:00
|
|
|
|
php_store_class_name(*rval, class_name, name_len);
|
2000-06-23 16:21:31 +00:00
|
|
|
|
|
|
|
|
|
if (class_name)
|
|
|
|
|
efree(class_name);
|
1999-06-10 15:34:20 +00:00
|
|
|
|
}
|
1999-04-17 00:37:12 +00:00
|
|
|
|
|
|
|
|
|
(*p) += 2;
|
|
|
|
|
i = atoi(*p);
|
1999-09-15 11:08:25 +00:00
|
|
|
|
|
|
|
|
|
if (cur == 'a') { /* object_init_ex will init the HashTable for objects! */
|
1999-12-21 17:14:31 +00:00
|
|
|
|
zend_hash_init(myht, i + 1, NULL, ZVAL_PTR_DTOR, 0);
|
1999-09-15 11:08:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-04-17 00:37:12 +00:00
|
|
|
|
while (**p && **p != ':') {
|
|
|
|
|
(*p)++;
|
|
|
|
|
}
|
|
|
|
|
if (**p != ':' || *((*p) + 1) != '{') {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
for ((*p) += 2; **p && **p != '}' && i > 0; i--) {
|
2001-07-09 09:03:06 +00:00
|
|
|
|
zval *key;
|
|
|
|
|
zval *data;
|
1999-04-17 00:37:12 +00:00
|
|
|
|
|
2000-03-14 07:49:42 +00:00
|
|
|
|
ALLOC_INIT_ZVAL(key);
|
|
|
|
|
ALLOC_INIT_ZVAL(data);
|
|
|
|
|
|
2001-08-05 16:52:29 +00:00
|
|
|
|
if (!php_var_unserialize(&key, p, max, NULL TSRMLS_CC)) {
|
2000-03-16 02:15:41 +00:00
|
|
|
|
zval_dtor(key);
|
|
|
|
|
FREE_ZVAL(key);
|
2000-02-02 11:31:37 +00:00
|
|
|
|
FREE_ZVAL(data);
|
1999-04-17 00:37:12 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
2001-08-05 16:52:29 +00:00
|
|
|
|
if (!php_var_unserialize(&data, p, max, var_hash TSRMLS_CC)) {
|
1999-12-09 11:24:51 +00:00
|
|
|
|
zval_dtor(key);
|
2000-03-16 02:15:41 +00:00
|
|
|
|
FREE_ZVAL(key);
|
1999-12-09 11:24:51 +00:00
|
|
|
|
zval_dtor(data);
|
2000-02-02 11:31:37 +00:00
|
|
|
|
FREE_ZVAL(data);
|
1999-04-17 00:37:12 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
1999-04-25 12:41:18 +00:00
|
|
|
|
switch (key->type) {
|
1999-04-17 00:37:12 +00:00
|
|
|
|
case IS_LONG:
|
2001-07-09 09:03:06 +00:00
|
|
|
|
zend_hash_index_update(myht, Z_LVAL_P(key), &data, sizeof(data), NULL);
|
1999-04-17 00:37:12 +00:00
|
|
|
|
break;
|
|
|
|
|
case IS_STRING:
|
2001-07-09 09:03:06 +00:00
|
|
|
|
zend_hash_update(myht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof(data), NULL);
|
1999-04-17 00:37:12 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2000-02-02 11:31:37 +00:00
|
|
|
|
zval_dtor(key);
|
|
|
|
|
FREE_ZVAL(key);
|
1999-04-17 00:37:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-03-16 02:15:41 +00:00
|
|
|
|
if ((*rval)->type == IS_OBJECT) {
|
2000-06-16 19:55:51 +00:00
|
|
|
|
zval *retval_ptr = NULL;
|
2001-08-04 17:29:54 +00:00
|
|
|
|
zval fname;
|
2000-03-16 02:15:41 +00:00
|
|
|
|
|
2001-08-04 17:29:54 +00:00
|
|
|
|
INIT_PZVAL(&fname);
|
|
|
|
|
ZVAL_STRINGL(&fname, "__wakeup", sizeof("__wakeup") - 1, 0);
|
|
|
|
|
call_user_function_ex(CG(function_table), rval, &fname, &retval_ptr, 0, 0, 1, NULL TSRMLS_CC);
|
2001-08-04 03:30:38 +00:00
|
|
|
|
|
2000-06-17 15:53:33 +00:00
|
|
|
|
if (retval_ptr)
|
|
|
|
|
zval_ptr_dtor(&retval_ptr);
|
2000-03-16 02:15:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return *((*p)++) == '}';
|
2000-06-23 16:21:31 +00:00
|
|
|
|
}
|
1999-04-17 00:37:12 +00:00
|
|
|
|
}
|
2000-03-16 02:15:41 +00:00
|
|
|
|
|
|
|
|
|
return 0;
|
1999-04-17 00:37:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-04-25 12:41:18 +00:00
|
|
|
|
/* }}} */
|
|
|
|
|
/* {{{ proto string serialize(mixed variable)
|
|
|
|
|
Returns a string representation of variable (which can later be unserialized) */
|
1999-04-17 00:37:12 +00:00
|
|
|
|
PHP_FUNCTION(serialize)
|
|
|
|
|
{
|
2001-07-09 09:03:06 +00:00
|
|
|
|
zval **struc;
|
2000-10-30 17:10:06 +00:00
|
|
|
|
php_serialize_data_t var_hash;
|
2001-08-03 07:25:27 +00:00
|
|
|
|
smart_str buf = {0};
|
1999-04-17 00:37:12 +00:00
|
|
|
|
|
2000-06-05 19:47:54 +00:00
|
|
|
|
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &struc) == FAILURE) {
|
1999-04-17 00:37:12 +00:00
|
|
|
|
WRONG_PARAM_COUNT;
|
|
|
|
|
}
|
2001-07-09 09:03:06 +00:00
|
|
|
|
|
1999-04-17 00:37:12 +00:00
|
|
|
|
return_value->type = IS_STRING;
|
|
|
|
|
return_value->value.str.val = NULL;
|
|
|
|
|
return_value->value.str.len = 0;
|
2000-10-30 17:10:06 +00:00
|
|
|
|
|
|
|
|
|
PHP_VAR_SERIALIZE_INIT(var_hash);
|
2001-08-05 16:52:29 +00:00
|
|
|
|
php_var_serialize(&buf, struc, &var_hash TSRMLS_CC);
|
2000-10-30 17:10:06 +00:00
|
|
|
|
PHP_VAR_SERIALIZE_DESTROY(var_hash);
|
2001-08-03 07:25:27 +00:00
|
|
|
|
RETVAL_STRINGL(buf.c, buf.len, 0);
|
1999-04-17 00:37:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-04-25 12:41:18 +00:00
|
|
|
|
/* }}} */
|
|
|
|
|
/* {{{ proto mixed unserialize(string variable_representation)
|
|
|
|
|
Takes a string representation of variable and recreates it */
|
|
|
|
|
|
1999-04-17 00:37:12 +00:00
|
|
|
|
|
|
|
|
|
PHP_FUNCTION(unserialize)
|
|
|
|
|
{
|
2001-07-09 09:03:06 +00:00
|
|
|
|
zval **buf;
|
2000-10-30 17:10:06 +00:00
|
|
|
|
php_serialize_data_t var_hash;
|
1999-04-17 00:37:12 +00:00
|
|
|
|
|
2000-06-05 19:47:54 +00:00
|
|
|
|
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &buf) == FAILURE) {
|
1999-04-17 00:37:12 +00:00
|
|
|
|
WRONG_PARAM_COUNT;
|
|
|
|
|
}
|
1999-10-22 06:59:05 +00:00
|
|
|
|
|
1999-09-15 11:42:28 +00:00
|
|
|
|
if ((*buf)->type == IS_STRING) {
|
|
|
|
|
const char *p = (*buf)->value.str.val;
|
1999-10-18 17:46:33 +00:00
|
|
|
|
|
2001-07-09 09:03:06 +00:00
|
|
|
|
if (Z_STRLEN_PP(buf) == 0) {
|
1999-10-22 06:59:05 +00:00
|
|
|
|
RETURN_FALSE;
|
|
|
|
|
}
|
1999-09-15 11:42:28 +00:00
|
|
|
|
|
2000-10-30 17:10:06 +00:00
|
|
|
|
PHP_VAR_UNSERIALIZE_INIT(var_hash);
|
2001-08-05 16:52:29 +00:00
|
|
|
|
if (!php_var_unserialize(&return_value, &p, p + Z_STRLEN_PP(buf), &var_hash TSRMLS_CC)) {
|
2000-10-30 17:10:06 +00:00
|
|
|
|
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
|
1999-12-08 14:40:46 +00:00
|
|
|
|
zval_dtor(return_value);
|
2001-08-11 17:03:37 +00:00
|
|
|
|
php_error(E_NOTICE, "unserialize() failed at offset %d of %d bytes", p - Z_STRVAL_PP(buf), Z_STRLEN_PP(buf));
|
1999-04-17 00:37:12 +00:00
|
|
|
|
RETURN_FALSE;
|
|
|
|
|
}
|
2000-10-30 17:10:06 +00:00
|
|
|
|
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
|
1999-04-17 00:37:12 +00:00
|
|
|
|
} else {
|
1999-10-18 17:46:33 +00:00
|
|
|
|
php_error(E_NOTICE, "argument passed to unserialize() is not an string");
|
1999-04-17 00:37:12 +00:00
|
|
|
|
RETURN_FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-06-15 17:06:22 +00:00
|
|
|
|
/* }}} */
|
1999-04-25 12:41:18 +00:00
|
|
|
|
|
1999-04-17 00:37:12 +00:00
|
|
|
|
/*
|
|
|
|
|
* Local variables:
|
|
|
|
|
* tab-width: 4
|
|
|
|
|
* c-basic-offset: 4
|
|
|
|
|
* End:
|
2001-06-06 13:06:12 +00:00
|
|
|
|
* vim600: sw=4 ts=4 tw=78 fdm=marker
|
|
|
|
|
* vim<600: sw=4 ts=4 tw=78
|
1999-04-17 00:37:12 +00:00
|
|
|
|
*/
|