Cleanup (1-st round)

This commit is contained in:
Dmitry Stogov 2014-04-15 15:40:40 +04:00
parent 93d3a613d8
commit 050d7e38ad
139 changed files with 921 additions and 1185 deletions

View file

@ -242,7 +242,7 @@ again:
}
case IS_BOOL:
if (Z_LVAL_P(expr)) {
// TODO: ??? use interned string
// TODO: use interned string ???
ZVAL_NEW_STR(expr_copy, STR_INIT("1", 1, 0));
} else {
TSRMLS_FETCH();
@ -259,7 +259,7 @@ again:
break;
case IS_ARRAY:
zend_error(E_NOTICE, "Array to string conversion");
// TODO: ??? use interned string
// TODO: use interned string ???
ZVAL_NEW_STR(expr_copy, STR_INIT("Array", sizeof("Array") - 1, 0));
break;
case IS_OBJECT:

View file

@ -583,11 +583,6 @@ ZEND_API void free_estring(char **str_p);
ZEND_API void free_string_zval(zval *zv);
END_EXTERN_C()
/* FIXME: Check if we can save if (ptr) too */
//???#define STR_FREE(ptr) if (ptr) { str_efree(ptr); }
//???#define STR_FREE_REL(ptr) if (ptr) { str_efree_rel(ptr); }
/* output support */
#define ZEND_WRITE(str, str_len) zend_write((str), (str_len))
#define ZEND_WRITE_EX(str, str_len) write_func((str), (str_len))
@ -680,18 +675,6 @@ END_EXTERN_C()
} \
} while (0)
//??? this macro should be used to get argument value passed by referebce
//??? unfortunately it's not always work as expected
#if 0
#define ZVAL_DEREF_REF(z) do { \
ZEND_ASSERT(Z_ISREF_P(z)); \
(z) = Z_REFVAL_P(z); \
} while (0)
#else
#define ZVAL_DEREF_REF(z) \
ZVAL_DEREF(z)
#endif
#define ZVAL_DUP_DEREF(z, v) \
do { \
zval *__z1 = (z); \
@ -710,14 +693,6 @@ END_EXTERN_C()
efree(ref); \
} while (0)
// TODO: invalud ???
#define INIT_PZVAL_COPY(z, v) \
do { \
ZVAL_COPY_VALUE(z, v); \
Z_SET_REFCOUNT_P(z, 1); \
Z_UNSET_ISREF_P(z); \
} while (0)
#define SEPARATE_ZVAL(zv) do { \
zval *_zv = (zv); \
if (Z_REFCOUNTED_P(_zv)) { \
@ -769,33 +744,6 @@ END_EXTERN_C()
} \
} while (0)
// TODO: remove ???
#define COPY_PZVAL_TO_ZVAL(zv, pzv) \
ZVAL_COPY_VALUE(&(zv), (pzv)); \
if (Z_OPT_REFCOUNTED_P(pzv)) { \
if (Z_REFCOUNT_P(pzv)>1) { \
zval_copy_ctor(&(zv)); \
Z_DELREF_P((pzv)); \
} \
} \
// TODO: remove ???
#define REPLACE_ZVAL_VALUE(ppzv_dest, pzv_src, copy) { \
int is_ref, refcount; \
\
SEPARATE_ZVAL_IF_NOT_REF(ppzv_dest); \
is_ref = Z_ISREF_PP(ppzv_dest); \
refcount = Z_REFCOUNT_PP(ppzv_dest); \
zval_dtor(*ppzv_dest); \
ZVAL_COPY_VALUE(*ppzv_dest, pzv_src); \
if (copy) { \
zval_opt_copy_ctor(*ppzv_dest); \
} \
Z_SET_ISREF_TO_PP(ppzv_dest, is_ref); \
Z_SET_REFCOUNT_PP(ppzv_dest, refcount); \
}
#define SEPARATE_ARG_IF_REF(varptr) do { \
zval *_varptr = (varptr); \
if (Z_ISREF_P(_varptr)) { \

View file

@ -1207,7 +1207,6 @@ ZEND_API void object_properties_init(zend_object *object, zend_class_entry *clas
int i;
if (class_type->default_properties_count) {
//??? object->properties_table = emalloc(sizeof(zval*) * class_type->default_properties_count);
for (i = 0; i < class_type->default_properties_count; i++) {
#if ZTS
ZVAL_DUP(&object->properties_table[i], &class_type->default_properties_table[i]);
@ -1392,22 +1391,20 @@ ZEND_API int add_assoc_str_ex(zval *arg, const char *key, uint key_len, zend_str
}
/* }}} */
ZEND_API int add_assoc_string_ex(zval *arg, const char *key, uint key_len, char *str, int duplicate) /* {{{ */
ZEND_API int add_assoc_string_ex(zval *arg, const char *key, uint key_len, char *str) /* {{{ */
{
zval *ret, tmp;
//??? ZVAL_STRING(tmp, str, duplicate);
ZVAL_STRING(&tmp, str);
ret = zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp);
return ret ? SUCCESS : FAILURE;
}
/* }}} */
ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, char *str, uint length, int duplicate) /* {{{ */
ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, char *str, uint length) /* {{{ */
{
zval *ret, tmp;
//??? ZVAL_STRINGL(tmp, str, length, duplicate);
ZVAL_STRINGL(&tmp, str, length);
ret = zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp);
return ret ? SUCCESS : FAILURE;
@ -1477,23 +1474,20 @@ ZEND_API int add_index_str(zval *arg, ulong index, zend_string *str) /* {{{ */
}
/* }}} */
ZEND_API int add_index_string(zval *arg, ulong index, const char *str, int duplicate) /* {{{ */
ZEND_API int add_index_string(zval *arg, ulong index, const char *str) /* {{{ */
{
zval tmp;
//??? ZVAL_STRING(tmp, str, duplicate);
ZVAL_STRING(&tmp, str);
return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp) ? SUCCESS : FAILURE;
}
/* }}} */
ZEND_API int add_index_stringl(zval *arg, ulong index, const char *str, uint length, int duplicate) /* {{{ */
ZEND_API int add_index_stringl(zval *arg, ulong index, const char *str, uint length) /* {{{ */
{
zval tmp;
//??? ZVAL_STRINGL(tmp, str, length, duplicate);
ZVAL_STRINGL(&tmp, str, length);
return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp) ? SUCCESS : FAILURE;
}
/* }}} */
@ -1558,21 +1552,19 @@ ZEND_API int add_next_index_str(zval *arg, zend_string *str) /* {{{ */
}
/* }}} */
ZEND_API int add_next_index_string(zval *arg, const char *str, int duplicate) /* {{{ */
ZEND_API int add_next_index_string(zval *arg, const char *str) /* {{{ */
{
zval tmp;
//??? ZVAL_STRING(&tmp, str, duplicate);
ZVAL_STRING(&tmp, str);
return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp) ? SUCCESS : FAILURE;
}
/* }}} */
ZEND_API int add_next_index_stringl(zval *arg, const char *str, uint length, int duplicate) /* {{{ */
ZEND_API int add_next_index_stringl(zval *arg, const char *str, uint length) /* {{{ */
{
zval tmp;
//??? ZVAL_STRINGL(&tmp, str, length, duplicate);
ZVAL_STRINGL(&tmp, str, length);
return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp) ? SUCCESS : FAILURE;
}
@ -1584,22 +1576,20 @@ ZEND_API int add_next_index_zval(zval *arg, zval *value) /* {{{ */
}
/* }}} */
ZEND_API zval *add_get_assoc_string_ex(zval *arg, const char *key, uint key_len, const char *str, int duplicate) /* {{{ */
ZEND_API zval *add_get_assoc_string_ex(zval *arg, const char *key, uint key_len, const char *str) /* {{{ */
{
zval tmp, *ret;
//??? ZVAL_STRING(tmp, str, duplicate);
ZVAL_STRING(&tmp, str);
ret = zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp);
return ret;
}
/* }}} */
ZEND_API zval *add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, int duplicate) /* {{{ */
ZEND_API zval *add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length) /* {{{ */
{
zval tmp, *ret;
//??? ZVAL_STRING(tmp, str, length, duplicate);
ZVAL_STRINGL(&tmp, str, length);
ret = zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp);
return ret;
@ -1628,27 +1618,24 @@ ZEND_API zval *add_get_index_str(zval *arg, ulong index, zend_string *str) /* {{
{
zval tmp;
//??? ZVAL_STRING(tmp, str, duplicate);
ZVAL_STR(&tmp, str);
return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp);
}
/* }}} */
ZEND_API zval *add_get_index_string(zval *arg, ulong index, const char *str, int duplicate) /* {{{ */
ZEND_API zval *add_get_index_string(zval *arg, ulong index, const char *str) /* {{{ */
{
zval tmp;
//??? ZVAL_STRING(tmp, str, duplicate);
ZVAL_STRING(&tmp, str);
return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp);
}
/* }}} */
ZEND_API zval *add_get_index_stringl(zval *arg, ulong index, const char *str, uint length, int duplicate) /* {{{ */
ZEND_API zval *add_get_index_stringl(zval *arg, ulong index, const char *str, uint length) /* {{{ */
{
zval tmp;
//??? ZVAL_STRINGL(tmp, str, length, duplicate);
ZVAL_STRINGL(&tmp, str, length);
return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp);
}
@ -1762,12 +1749,11 @@ ZEND_API int add_property_double_ex(zval *arg, const char *key, uint key_len, do
}
/* }}} */
ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, const char *str, int duplicate TSRMLS_DC) /* {{{ */
ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, const char *str TSRMLS_DC) /* {{{ */
{
zval tmp;
zval z_key;
//??? ZVAL_STRING(tmp, str, duplicate);
ZVAL_STRING(&tmp, str);
ZVAL_STRINGL(&z_key, key, key_len);
Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, 0 TSRMLS_CC);
@ -1777,12 +1763,11 @@ ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, co
}
/* }}} */
ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, int duplicate TSRMLS_DC) /* {{{ */
ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length TSRMLS_DC) /* {{{ */
{
zval tmp;
zval z_key;
//??? ZVAL_STRINGL(tmp, str, length, duplicate);
ZVAL_STRINGL(&tmp, str, length);
ZVAL_STRINGL(&z_key, key, key_len);
Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, 0 TSRMLS_CC);

View file

@ -380,8 +380,8 @@ ZEND_API int add_assoc_bool_ex(zval *arg, const char *key, uint key_len, int b);
ZEND_API int add_assoc_resource_ex(zval *arg, const char *key, uint key_len, zend_resource *r);
ZEND_API int add_assoc_double_ex(zval *arg, const char *key, uint key_len, double d);
ZEND_API int add_assoc_str_ex(zval *arg, const char *key, uint key_len, zend_string *str);
ZEND_API int add_assoc_string_ex(zval *arg, const char *key, uint key_len, char *str, int duplicate);
ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, char *str, uint length, int duplicate);
ZEND_API int add_assoc_string_ex(zval *arg, const char *key, uint key_len, char *str);
ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, char *str, uint length);
ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, uint key_len, zval *value);
#define add_assoc_long(__arg, __key, __n) add_assoc_long_ex(__arg, __key, strlen(__key), __n)
@ -390,8 +390,8 @@ ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, uint key_len, zval *v
#define add_assoc_resource(__arg, __key, __r) add_assoc_resource_ex(__arg, __key, strlen(__key), __r)
#define add_assoc_double(__arg, __key, __d) add_assoc_double_ex(__arg, __key, strlen(__key), __d)
#define add_assoc_str(__arg, __key, __str) add_assoc_str_ex(__arg, __key, strlen(__key), __str)
#define add_assoc_string(__arg, __key, __str, __duplicate) add_assoc_string_ex(__arg, __key, strlen(__key), __str, __duplicate)
#define add_assoc_stringl(__arg, __key, __str, __length, __duplicate) add_assoc_stringl_ex(__arg, __key, strlen(__key), __str, __length, __duplicate)
#define add_assoc_string(__arg, __key, __str) add_assoc_string_ex(__arg, __key, strlen(__key), __str)
#define add_assoc_stringl(__arg, __key, __str, __length) add_assoc_stringl_ex(__arg, __key, strlen(__key), __str, __length)
#define add_assoc_zval(__arg, __key, __value) add_assoc_zval_ex(__arg, __key, strlen(__key), __value)
/* unset() functions are only suported for legacy modules and null() functions should be used */
@ -406,8 +406,8 @@ ZEND_API int add_index_bool(zval *arg, ulong idx, int b);
ZEND_API int add_index_resource(zval *arg, ulong idx, zend_resource *r);
ZEND_API int add_index_double(zval *arg, ulong idx, double d);
ZEND_API int add_index_str(zval *arg, ulong idx, zend_string *str);
ZEND_API int add_index_string(zval *arg, ulong idx, const char *str, int duplicate);
ZEND_API int add_index_stringl(zval *arg, ulong idx, const char *str, uint length, int duplicate);
ZEND_API int add_index_string(zval *arg, ulong idx, const char *str);
ZEND_API int add_index_stringl(zval *arg, ulong idx, const char *str, uint length);
ZEND_API int add_index_zval(zval *arg, ulong index, zval *value);
ZEND_API int add_next_index_long(zval *arg, long n);
@ -416,21 +416,21 @@ ZEND_API int add_next_index_bool(zval *arg, int b);
ZEND_API int add_next_index_resource(zval *arg, zend_resource *r);
ZEND_API int add_next_index_double(zval *arg, double d);
ZEND_API int add_next_index_str(zval *arg, zend_string *str);
ZEND_API int add_next_index_string(zval *arg, const char *str, int duplicate);
ZEND_API int add_next_index_stringl(zval *arg, const char *str, uint length, int duplicate);
ZEND_API int add_next_index_string(zval *arg, const char *str);
ZEND_API int add_next_index_stringl(zval *arg, const char *str, uint length);
ZEND_API int add_next_index_zval(zval *arg, zval *value);
ZEND_API zval *add_get_assoc_string_ex(zval *arg, const char *key, uint key_len, const char *str, int duplicate);
ZEND_API zval *add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, int duplicate);
ZEND_API zval *add_get_assoc_string_ex(zval *arg, const char *key, uint key_len, const char *str);
ZEND_API zval *add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length);
#define add_get_assoc_string(__arg, __key, __str, __duplicate) add_get_assoc_string_ex(__arg, __key, strlen(__key), __str, __duplicate)
#define add_get_assoc_stringl(__arg, __key, __str, __length, __duplicate) add_get_assoc_stringl_ex(__arg, __key, strlen(__key), __str, __length, __duplicate)
#define add_get_assoc_string(__arg, __key, __str) add_get_assoc_string_ex(__arg, __key, strlen(__key), __str)
#define add_get_assoc_stringl(__arg, __key, __str, __length) add_get_assoc_stringl_ex(__arg, __key, strlen(__key), __str, __length)
ZEND_API zval *add_get_index_long(zval *arg, ulong idx, long l);
ZEND_API zval *add_get_index_double(zval *arg, ulong idx, double d);
ZEND_API zval *add_get_index_str(zval *arg, ulong index, zend_string *str);
ZEND_API zval *add_get_index_string(zval *arg, ulong idx, const char *str, int duplicate);
ZEND_API zval *add_get_index_stringl(zval *arg, ulong idx, const char *str, uint length, int duplicate);
ZEND_API zval *add_get_index_string(zval *arg, ulong idx, const char *str);
ZEND_API zval *add_get_index_stringl(zval *arg, ulong idx, const char *str, uint length);
ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value TSRMLS_DC);
@ -439,8 +439,8 @@ ZEND_API int add_property_null_ex(zval *arg, const char *key, uint key_len TSRML
ZEND_API int add_property_bool_ex(zval *arg, const char *key, uint key_len, int b TSRMLS_DC);
ZEND_API int add_property_resource_ex(zval *arg, const char *key, uint key_len, zend_resource *r TSRMLS_DC);
ZEND_API int add_property_double_ex(zval *arg, const char *key, uint key_len, double d TSRMLS_DC);
ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, const char *str, int duplicate TSRMLS_DC);
ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, int duplicate TSRMLS_DC);
ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, const char *str TSRMLS_DC);
ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length TSRMLS_DC);
ZEND_API int add_property_zval_ex(zval *arg, const char *key, uint key_len, zval *value TSRMLS_DC);
#define add_property_long(__arg, __key, __n) add_property_long_ex(__arg, __key, strlen(__key), __n TSRMLS_CC)
@ -448,8 +448,8 @@ ZEND_API int add_property_zval_ex(zval *arg, const char *key, uint key_len, zval
#define add_property_bool(__arg, __key, __b) add_property_bool_ex(__arg, __key, strlen(__key), __b TSRMLS_CC)
#define add_property_resource(__arg, __key, __r) add_property_resource_ex(__arg, __key, strlen(__key), __r TSRMLS_CC)
#define add_property_double(__arg, __key, __d) add_property_double_ex(__arg, __key, strlen(__key), __d TSRMLS_CC)
#define add_property_string(__arg, __key, __str, __duplicate) add_property_string_ex(__arg, __key, strlen(__key), __str, __duplicate TSRMLS_CC)
#define add_property_stringl(__arg, __key, __str, __length, __duplicate) add_property_stringl_ex(__arg, __key, strlen(__key), __str, __length, __duplicate TSRMLS_CC)
#define add_property_string(__arg, __key, __str) add_property_string_ex(__arg, __key, strlen(__key), __str TSRMLS_CC)
#define add_property_stringl(__arg, __key, __str, __length) add_property_stringl_ex(__arg, __key, strlen(__key), __str, __length TSRMLS_CC)
#define add_property_zval(__arg, __key, __value) add_property_zval_ex(__arg, __key, strlen(__key), __value TSRMLS_CC)
@ -535,10 +535,10 @@ ZEND_API ZEND_FUNCTION(display_disabled_class);
END_EXTERN_C()
#if ZEND_DEBUG
#define CHECK_ZVAL_STRING(z) \
if (Z_STRVAL_P(z)[ Z_STRLEN_P(z) ] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s)", Z_STRVAL_P(z)); }
#define CHECK_ZVAL_STRING_REL(z) \
if (Z_STRVAL_P(z)[ Z_STRLEN_P(z) ] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s) (source: %s:%d)", Z_STRVAL_P(z) ZEND_FILE_LINE_RELAY_CC); }
#define CHECK_ZVAL_STRING(str) \
if ((str)->val[(str)->len] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s)", (str)->val); }
#define CHECK_ZVAL_STRING_REL(str) \
if ((str)->val[(str)->len] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s) (source: %s:%d)", (str)->val ZEND_FILE_LINE_RELAY_CC); }
#else
#define CHECK_ZVAL_STRING(z)
#define CHECK_ZVAL_STRING_REL(z)
@ -638,88 +638,6 @@ END_EXTERN_C()
#define RETURN_ZVAL_FAST(z) { RETVAL_ZVAL_FAST(z); return; }
#define SET_VAR_STRING(n, v) { \
{ \
zval *var; \
ALLOC_ZVAL(var); \
ZVAL_STRING(var, v, 0); \
ZEND_SET_GLOBAL_VAR(n, var); \
} \
}
#define SET_VAR_STRINGL(n, v, l) { \
{ \
zval *var; \
ALLOC_ZVAL(var); \
ZVAL_STRINGL(var, v, l, 0); \
ZEND_SET_GLOBAL_VAR(n, var); \
} \
}
#define SET_VAR_LONG(n, v) { \
{ \
zval *var; \
ALLOC_ZVAL(var); \
ZVAL_LONG(var, v); \
ZEND_SET_GLOBAL_VAR(n, var); \
} \
}
#define SET_VAR_DOUBLE(n, v) { \
{ \
zval *var; \
ALLOC_ZVAL(var); \
ZVAL_DOUBLE(var, v); \
ZEND_SET_GLOBAL_VAR(n, var); \
} \
}
#define ZEND_SET_SYMBOL(symtable, name, var) \
{ \
char *_name = (name); \
\
ZEND_SET_SYMBOL_WITH_LENGTH(symtable, _name, strlen(_name), var, 1, 0); \
}
#define ZEND_SET_SYMBOL_WITH_LENGTH(symtable, name, name_length, var, _refcount, _is_ref) \
{ \
zval *orig_var; \
\
if ((orig_var = zend_hash_str_find(symtable, (name), (name_length))) != NULL \
&& Z_ISREF_P(orig_var)) { \
if (Z_REFCOUNTED_P(var)) { \
Z_SET_REFCOUNT_P(var, Z_REFCOUNT_P(orig_var)); \
if (_refcount) { \
Z_SET_REFCOUNT_P(var, Z_REFCOUNT_P(var) + _refcount - 1); \
} \
} \
zval_dtor(orig_var); \
ZVAL_COPY_VALUE(orig_var, var); \
/*???FREE_ZVAL(var);*/ \
} else { \
/*???Z_SET_ISREF_TO_P(var, _is_ref);*/ \
if (_refcount && Z_REFCOUNTED_P(var)) { \
Z_SET_REFCOUNT_P(var, _refcount); \
} \
zend_hash_str_update(symtable, (name), (name_length), var); \
} \
}
#define ZEND_SET_GLOBAL_VAR(name, var) \
ZEND_SET_SYMBOL(&EG(symbol_table).ht, name, var)
#define ZEND_SET_GLOBAL_VAR_WITH_LENGTH(name, name_length, var, _refcount, _is_ref) \
ZEND_SET_SYMBOL_WITH_LENGTH(&EG(symbol_table).ht, name, name_length, var, _refcount, _is_ref)
#define ZEND_DEFINE_PROPERTY(class_ptr, name, value, mask) \
{ \
char *_name = (name); \
int namelen = strlen(_name); \
zend_declare_property(class_ptr, _name, namelen, value, mask TSRMLS_CC); \
}
#define HASH_OF(p) (Z_TYPE_P(p)==IS_ARRAY ? Z_ARRVAL_P(p) : ((Z_TYPE_P(p)==IS_OBJECT ? Z_OBJ_HT_P(p)->get_properties((p) TSRMLS_CC) : NULL)))
#define ZVAL_IS_NULL(z) (Z_TYPE_P(z) == IS_NULL)
#define ZVAL_IS_UNDEF(z) (Z_TYPE_P(z) == IS_UNDEF)

View file

@ -136,9 +136,6 @@ inline static void * __zend_realloc(void *p, size_t len)
#define perealloc_recoverable_rel(ptr, size, persistent) ((persistent)?__zend_realloc((ptr), (size)):erealloc_recoverable_rel((ptr), (size)))
#define pestrdup_rel(s, persistent) ((persistent)?strdup(s):estrdup_rel(s))
//???#define safe_estrdup(ptr) ((ptr)?(estrdup(ptr)):STR_EMPTY_ALLOC())
//???#define safe_estrndup(ptr, len) ((ptr)?(estrndup((ptr), (len))):STR_EMPTY_ALLOC())
ZEND_API int zend_set_memory_limit(size_t memory_limit TSRMLS_DC);
ZEND_API void start_memory_manager(TSRMLS_D);

View file

@ -585,7 +585,7 @@ ZEND_FUNCTION(each)
return;
}
ZVAL_DEREF_REF(array);
ZVAL_DEREF(array);
target_hash = HASH_OF(array);
if (!target_hash) {
zend_error(E_WARNING,"Variable passed to each() is not an array or object");
@ -609,7 +609,6 @@ ZEND_FUNCTION(each)
/* add value elements */
if (Z_ISREF_P(entry)) {
ZVAL_DUP(&tmp, Z_REFVAL_P(entry));
//??? if (Z_REFCOUNTED(tmp)) Z_SET_REFCOUNT(tmp, 0);
entry = &tmp;
}
zend_hash_index_update(Z_ARRVAL_P(return_value), 1, entry);
@ -1863,14 +1862,14 @@ static int add_extension_info(zval *item, void *arg TSRMLS_DC)
{
zval *name_array = (zval *)arg;
zend_module_entry *module = (zend_module_entry*)Z_PTR_P(item);
add_next_index_string(name_array, module->name, 1);
add_next_index_string(name_array, module->name);
return 0;
}
static int add_zendext_info(zend_extension *ext, void *arg TSRMLS_DC)
{
zval *name_array = (zval *)arg;
add_next_index_string(name_array, ext->name, 1);
add_next_index_string(name_array, ext->name);
return 0;
}
@ -2140,7 +2139,7 @@ ZEND_FUNCTION(debug_print_backtrace)
if (build_filename_arg && include_filename) {
array_init(&arg_array);
add_next_index_string(&arg_array, (char*)include_filename, 1);
add_next_index_string(&arg_array, (char*)include_filename);
}
call_type = NULL;
}
@ -2225,7 +2224,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
if (skip->op_array) {
filename = skip->op_array->filename->val;
lineno = skip->opline->lineno;
add_assoc_string_ex(&stack_frame, "file", sizeof("file")-1, (char*)filename, 1);
add_assoc_string_ex(&stack_frame, "file", sizeof("file")-1, (char*)filename);
add_assoc_long_ex(&stack_frame, "line", sizeof("line")-1, lineno);
/* try to fetch args only if an FCALL was just made - elsewise we're in the middle of a function
@ -2263,7 +2262,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
NULL);
if (function_name) {
add_assoc_string_ex(&stack_frame, "function", sizeof("function")-1, (char*)function_name, 1);
add_assoc_string_ex(&stack_frame, "function", sizeof("function")-1, (char*)function_name);
if (ptr->object) {
if (ptr->function_state.function->common.scope) {
@ -2280,10 +2279,10 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
Z_ADDREF(object);
}
add_assoc_string_ex(&stack_frame, "type", sizeof("type")-1, "->", 1);
add_assoc_string_ex(&stack_frame, "type", sizeof("type")-1, "->");
} else if (ptr->function_state.function->common.scope) {
add_assoc_str_ex(&stack_frame, "class", sizeof("class")-1, STR_COPY(ptr->function_state.function->common.scope->name));
add_assoc_string_ex(&stack_frame, "type", sizeof("type")-1, "::", 1);
add_assoc_string_ex(&stack_frame, "type", sizeof("type")-1, "::");
}
if ((options & DEBUG_BACKTRACE_IGNORE_ARGS) == 0 &&
@ -2337,11 +2336,11 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
if we have called include in the frame above - this is the file we have included.
*/
add_next_index_string(&arg_array, (char*)include_filename, 1);
add_next_index_string(&arg_array, (char*)include_filename);
add_assoc_zval_ex(&stack_frame, "args", sizeof("args")-1, &arg_array);
}
add_assoc_string_ex(&stack_frame, "function", sizeof("function")-1, (char*)function_name, 1);
add_assoc_string_ex(&stack_frame, "function", sizeof("function")-1, (char*)function_name);
}
add_next_index_zval(return_value, &stack_frame);

View file

@ -338,8 +338,8 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp TSRMLS_
}
info_len = zend_spprintf(&info, 0, "%s",
i >= required ? "<optional>" : "<required>");
//??? TODO: avoid reallocation
add_assoc_stringl_ex(&val, name, name_len, info, info_len, 1);
// TODO: avoid reallocation ???
add_assoc_stringl_ex(&val, name, name_len, info, info_len);
efree(info);
efree(name);
arg_info++;

View file

@ -298,7 +298,6 @@ ZEND_API zend_bool zend_is_compiling(TSRMLS_D) /* {{{ */
static zend_uint get_temporary_variable(zend_op_array *op_array) /* {{{ */
{
//??? return (zend_uint)(zend_uintptr_t)EX_VAR_NUM_2(0, (op_array->T)++);
return (zend_uint)op_array->T++;
}
/* }}} */
@ -351,8 +350,6 @@ static inline void zend_insert_literal(zend_op_array *op_array, zval *zv, int li
}
}
ZVAL_COPY_VALUE(&CONSTANT_EX(op_array, literal_position), zv);
//??? Z_SET_REFCOUNT(CONSTANT_EX(op_array, literal_position), 2);
//??? Z_SET_ISREF(CONSTANT_EX(op_array, literal_position));
op_array->literals[literal_position].cache_slot = -1;
}
/* }}} */
@ -1900,7 +1897,6 @@ void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initializ
}
CG(active_op_array)->arg_info = erealloc(CG(active_op_array)->arg_info, sizeof(zend_arg_info)*(CG(active_op_array)->num_args));
cur_arg_info = &CG(active_op_array)->arg_info[CG(active_op_array)->num_args-1];
//??? cur_arg_info->name = zend_new_interned_string(estrndup(Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant)), Z_STRLEN(varname->u.constant) + 1, 1 TSRMLS_CC);
cur_arg_info->name = estrndup(Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant));
cur_arg_info->name_len = Z_STRLEN(varname->u.constant);
cur_arg_info->type_hint = 0;
@ -1941,7 +1937,7 @@ void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initializ
if (IS_INTERNED(Z_STR(class_type->u.constant))) {
Z_TYPE_FLAGS(class_type->u.constant) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
}
//???: for now we have to copy it :(
// TODO: for now we have to copy it ???
#if 1
cur_arg_info->class_name = estrndup(Z_STRVAL(class_type->u.constant), Z_STRLEN(class_type->u.constant));
cur_arg_info->class_name_len = Z_STRLEN(class_type->u.constant);
@ -2583,7 +2579,6 @@ void zend_do_end_function_call(znode *function_name, znode *result, const znode
SET_NODE(opline->op1, function_name);
SET_UNUSED(opline->op2);
opline->op2.num = CG(context).nested_calls;
//??? CALCULATE_LITERAL_HASH(opline->op1.constant);
GET_CACHE_SLOT(opline->op1.constant);
} else {
opline->opcode = ZEND_DO_FCALL_BY_NAME;
@ -3487,7 +3482,6 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{
int use_copy;
ZVAL_DUP(&zv, precv->op2.zv);
//??? INIT_PZVAL(zv);
zval_update_constant_ex(&zv, (void*)1, fptr->common.scope TSRMLS_CC);
if (Z_TYPE(zv) == IS_BOOL) {
if (Z_LVAL(zv)) {
@ -5477,7 +5471,6 @@ void zend_do_declare_property(znode *var_name, const znode *value, zend_uint acc
Z_TYPE_FLAGS(var_name->u.constant) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
}
zend_declare_property_ex(CG(active_class_entry), Z_STR(var_name->u.constant), &property, access_type, comment TSRMLS_CC);
//??? efree(Z_STRVAL(var_name->u.constant));
STR_RELEASE(Z_STR(var_name->u.constant));
}
/* }}} */
@ -5554,7 +5547,6 @@ void zend_do_fetch_property(znode *result, znode *object, const znode *property
break;
}
if (opline_ptr->op2_type == IS_CONST && Z_TYPE(CONSTANT(opline_ptr->op2.constant)) == IS_STRING) {
//??? CALCULATE_LITERAL_HASH(opline_ptr->op2.constant);
GET_POLYMORPHIC_CACHE_SLOT(opline_ptr->op2.constant);
}
GET_NODE(result, opline_ptr->result);
@ -5579,7 +5571,6 @@ void zend_do_fetch_property(znode *result, znode *object, const znode *property
SET_NODE(opline.op1, object);
SET_NODE(opline.op2, property);
if (opline.op2_type == IS_CONST && Z_TYPE(CONSTANT(opline.op2.constant)) == IS_STRING) {
//??? CALCULATE_LITERAL_HASH(opline.op2.constant);
GET_POLYMORPHIC_CACHE_SLOT(opline.op2.constant);
}
GET_NODE(result, opline.result);
@ -5710,7 +5701,6 @@ static int zend_constant_ct_subst(znode *result, zval *const_name, int all_inter
result->op_type = IS_CONST;
result->u.constant = c->value;
zval_copy_ctor(&result->u.constant);
//??? INIT_PZVAL(&result->u.constant);
return 1;
}
return 0;
@ -5738,7 +5728,6 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con
}
zend_do_build_full_name(NULL, constant_container, constant_name, 1 TSRMLS_CC);
*result = *constant_container;
//???
Z_TYPE_INFO(result->u.constant) = IS_CONSTANT_EX;
if (IS_INTERNED(Z_STR(result->u.constant))) {
Z_TYPE_FLAGS(result->u.constant) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
@ -5764,7 +5753,6 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con
SET_NODE(opline->op1, constant_container);
}
SET_NODE(opline->op2, constant_name);
//??? CALCULATE_LITERAL_HASH(opline->op2.constant);
if (opline->op1_type == IS_CONST) {
GET_CACHE_SLOT(opline->op2.constant);
} else {
@ -5793,7 +5781,6 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con
}
*result = *constant_name;
//???
Z_TYPE_INFO(result->u.constant) = IS_CONSTANT_EX;
if (IS_INTERNED(Z_STR(result->u.constant))) {
Z_TYPE_FLAGS(result->u.constant) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
@ -5859,7 +5846,6 @@ void zend_do_shell_exec(znode *result, const znode *cmd TSRMLS_DC) /* {{{ */
opline->result.var = get_temporary_variable(CG(active_op_array));
opline->result_type = IS_VAR;
LITERAL_STR(opline->op1, STR_INIT("shell_exec", sizeof("shell_exec")-1, 0));
//??? CALCULATE_LITERAL_HASH(opline->op1.constant);
opline->op1_type = IS_CONST;
GET_CACHE_SLOT(opline->op1.constant);
opline->extended_value = 1;
@ -5896,8 +5882,6 @@ void zend_do_init_array(znode *result, const znode *expr, const znode *offset, z
if (numeric) {
zval_dtor(&CONSTANT(opline->op2.constant));
ZVAL_LONG(&CONSTANT(opline->op2.constant), index);
} else {
//??? CALCULATE_LITERAL_HASH(opline->op2.constant);
}
}
} else {
@ -5928,8 +5912,6 @@ void zend_do_add_array_element(znode *result, const znode *expr, const znode *of
if (numeric) {
zval_dtor(&CONSTANT(opline->op2.constant));
ZVAL_LONG(&CONSTANT(opline->op2.constant), index);
} else {
//??? CALCULATE_LITERAL_HASH(opline->op2.constant);
}
}
} else {
@ -5947,27 +5929,17 @@ void zend_do_add_static_array_element(znode *result, znode *offset, const znode
if (offset) {
switch (Z_TYPE(offset->u.constant)) {
case IS_CONSTANT:
//??? /* Ugly hack to denote that this value has a constant index */
Z_GC_FLAGS(offset->u.constant) |= IS_STR_CONSTANT;
if (Z_CONST_FLAGS(offset->u.constant) & IS_CONSTANT_UNQUALIFIED) {
Z_GC_FLAGS(offset->u.constant) |= IS_STR_CONSTANT_UNQUALIFIED;
}
//??? Z_TYPE(element) |= IS_CONSTANT_INDEX;
//??? Z_STRVAL(offset->u.constant) = erealloc(Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+3);
//??? Z_STRVAL(offset->u.constant)[Z_STRLEN(offset->u.constant)+1] = Z_TYPE(offset->u.constant);
//??? Z_STRVAL(offset->u.constant)[Z_STRLEN(offset->u.constant)+2] = 0;
zend_symtable_update(Z_ARRVAL(result->u.constant), Z_STR(offset->u.constant), &element);
zval_dtor(&offset->u.constant);
break;
case IS_CONSTANT_AST: {
//??? /* Another ugly hack to store the data about the AST in the array */
zend_string *key;
//??? int len = sizeof(zend_ast *);
//??? Z_TYPE(element) |= IS_CONSTANT_INDEX;
key = STR_INIT((char*)&Z_AST(offset->u.constant), sizeof(zend_ast*), 0);
GC_FLAGS(key) |= IS_STR_AST;
//??? key[len] = Z_TYPE(offset->u.constant);
//??? key[len + 1] = 0;
zend_symtable_update(Z_ARRVAL(result->u.constant), key, &element);
STR_RELEASE(key);
break;
@ -6162,9 +6134,6 @@ void zend_do_fetch_static_variable(znode *varname, const znode *static_assignmen
opline->result_type = IS_VAR;
opline->result.var = get_temporary_variable(CG(active_op_array));
SET_NODE(opline->op1, varname);
//??? if (opline->op1_type == IS_CONST) {
//??? CALCULATE_LITERAL_HASH(opline->op1.constant);
//??? }
SET_UNUSED(opline->op2);
opline->extended_value = ZEND_FETCH_STATIC;
GET_NODE(&result, opline->result);
@ -6200,9 +6169,6 @@ void zend_do_fetch_lexical_variable(znode *varname, zend_bool is_ref TSRMLS_DC)
value.op_type = IS_CONST;
ZVAL_NULL(&value.u.constant);
Z_CONST_FLAGS(value.u.constant) = is_ref ? IS_LEXICAL_REF : IS_LEXICAL_VAR;
//??? Z_SET_REFCOUNT_P(&value.u.constant, 1);
//??? Z_UNSET_ISREF_P(&value.u.constant);
zend_do_fetch_static_variable(varname, &value, is_ref ? ZEND_FETCH_STATIC : ZEND_FETCH_LEXICAL TSRMLS_CC);
}
/* }}} */
@ -6224,9 +6190,6 @@ void zend_do_fetch_global_variable(znode *varname, const znode *static_assignmen
opline->result_type = IS_VAR;
opline->result.var = get_temporary_variable(CG(active_op_array));
SET_NODE(opline->op1, varname);
//??? if (opline->op1_type == IS_CONST) {
//??? CALCULATE_LITERAL_HASH(opline->op1.constant);
//??? }
SET_UNUSED(opline->op2);
opline->extended_value = fetch_type;
GET_NODE(&result, opline->result);
@ -6936,7 +6899,6 @@ int zendlex(znode *zendlval TSRMLS_DC) /* {{{ */
}
again:
//???
Z_TYPE_INFO(zendlval->u.constant) = IS_LONG;
retval = lex_scan(&zendlval->u.constant TSRMLS_CC);
switch (retval) {
@ -6960,7 +6922,6 @@ again:
break;
}
//??? INIT_PZVAL(&zendlval->u.constant);
zendlval->op_type = IS_CONST;
return retval;
}
@ -7078,9 +7039,6 @@ void zend_do_build_namespace_name(znode *result, znode *prefix, znode *name TSRM
}
} else {
result->op_type = IS_CONST;
//??? Z_TYPE(result->u.constant) = IS_STRING;
//??? Z_STRVAL(result->u.constant) = NULL;
//??? Z_STRLEN(result->u.constant) = 0;
ZVAL_EMPTY_STRING(&result->u.constant);
}
/* prefix = result */
@ -7196,7 +7154,6 @@ void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{
name = &tmp;
p = zend_memrchr(Z_STRVAL(ns), '\\', Z_STRLEN(ns));
if (p) {
//??? ZVAL_STRING(name, p+1, 1);
ZVAL_STRING(name, p+1);
} else {
ZVAL_ZVAL(name, &ns, 1, 0);
@ -7274,7 +7231,6 @@ void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_global, int i
name = &tmp;
p = zend_memrchr(Z_STRVAL(ns), '\\', Z_STRLEN(ns));
if (p) {
//??? ZVAL_STRING(name, p+1, 1);
ZVAL_STRING(name, p+1);
} else {
ZVAL_ZVAL(name, &ns, 1, 0);
@ -7456,7 +7412,6 @@ void zend_do_constant_expression(znode *result, zend_ast *ast TSRMLS_DC) /* {{{
{
if (ast->kind == ZEND_CONST) {
ZVAL_COPY_VALUE(&result->u.constant, &ast->u.val);
//???
efree(ast);
} else if (zend_ast_is_ct_constant(ast)) {
zend_ast_evaluate(&result->u.constant, ast, NULL TSRMLS_CC);

View file

@ -226,12 +226,10 @@ typedef struct _zend_property_info {
typedef struct _zend_arg_info {
const char *name;
const char *name; // TODO: convert into zend_string ???
zend_uint name_len;
const char *class_name;
const char *class_name; // TODO: convert into zend_string ???
zend_uint class_name_len;
//??? zend_string *name;
//??? zend_string *class_name;
zend_uchar type_hint;
zend_uchar pass_by_reference;
zend_bool allow_null;
@ -384,7 +382,7 @@ struct _zend_execute_data {
zval old_error_reporting;
zend_bool nested;
zval *return_value;
//???
// TODO: simplify call sequence and remove current_* and call_* ???
zend_class_entry *current_scope;
zend_class_entry *current_called_scope;
zend_object *current_this;

View file

@ -483,7 +483,6 @@ ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC)
#endif
if (!(c->flags & CONST_CS)) {
//??? /* keep in mind that c->name_len already contains the '\0' */
lowercase_name = STR_ALLOC(c->name->len, c->flags & CONST_PERSISTENT);
zend_str_tolower_copy(lowercase_name->val, c->name->val, c->name->len);
lowercase_name = zend_new_interned_string(lowercase_name TSRMLS_CC);
@ -508,7 +507,6 @@ ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC)
/* The internal __COMPILER_HALT_OFFSET__ is prefixed by NULL byte */
if (c->name->val[0] == '\0' && c->name->len > sizeof("\0__COMPILER_HALT_OFFSET__")-1
&& memcmp(name->val, "\0__COMPILER_HALT_OFFSET__", sizeof("\0__COMPILER_HALT_OFFSET__")) == 0) {
//??? name++;
}
zend_error(E_NOTICE,"Constant %s already defined", name->val);
STR_RELEASE(c->name);

View file

@ -448,10 +448,6 @@ static int _build_trace_args(zval *arg TSRMLS_DC, int num_args, va_list args, ze
class_name = zend_get_object_classname(Z_OBJ_P(arg) TSRMLS_CC);
TRACE_APPEND_STRL(class_name->val, class_name->len);
//??? if(!dup) {
//??? efree((char*)class_name);
//??? }
TRACE_APPEND_STR("), ");
break;
}
@ -652,7 +648,7 @@ ZEND_METHOD(exception, __toString)
* the result in uncaught exception handlers without memleaks. */
zend_update_property_string(default_exception_ce, getThis(), "string", sizeof("string")-1, str TSRMLS_CC);
//??? RETURN_STRINGL(str, len, 0);
// TODO: avoid reallocation ???
RETVAL_STRINGL(str, len);
efree(str);
}

View file

@ -675,9 +675,11 @@ static inline void zend_assign_to_object(zval *retval, zval *object_ptr, zval *p
}
Z_DELREF_P(object);
} else {
#endif
zend_error(E_WARNING, "Creating default object from empty value");
//??? }
}
#else
zend_error(E_WARNING, "Creating default object from empty value");
#endif
zval_dtor(object);
object_init(object);
} else {
@ -904,7 +906,6 @@ static inline zval* zend_assign_to_variable(zval *variable_ptr, zval *value TSRM
return variable_ptr;
} else {
if (Z_REFCOUNT_P(value) == 1) {
//??? auto dereferencing
ZVAL_UNREF(value);
ZVAL_COPY(variable_ptr, value);
} else {
@ -925,7 +926,6 @@ assign_simple:
} else if (is_ref != value) {
assign_ref:
if (Z_REFCOUNT_P(value) == 1) {
//??? auto dereferencing
ZVAL_UNREF(value);
ZVAL_COPY(variable_ptr, value);
} else {

View file

@ -27,26 +27,6 @@
#include "zend_operators.h"
#include "zend_variables.h"
//???typedef union _temp_variable {
//??? zval tmp_var;
//??? struct {
//??? zval **ptr_ptr;
//??? zval *ptr;
//??? zend_bool fcall_returned_reference;
//??? } var;
//??? struct {
//??? zval **ptr_ptr; /* shared with var.ptr_ptr */
//??? zval *str;
//??? zend_uint offset;
//??? } str_offset;
//??? struct {
//??? zval **ptr_ptr; /* shared with var.ptr_ptr */
//??? zval *ptr; /* shared with var.ptr */
//??? HashPointer fe_pos;
//??? } fe;
//??? zend_class_entry *class_entry;
//???} temp_variable;
BEGIN_EXTERN_C()
struct _zend_fcall_info;
ZEND_API extern void (*zend_execute_ex)(zend_execute_data *execute_data TSRMLS_DC);
@ -77,12 +57,6 @@ static zend_always_inline void i_zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC
ZEND_ASSERT(zval_ptr != &EG(uninitialized_zval));
_zval_dtor_func_for_ptr(Z_COUNTED_P(zval_ptr) ZEND_FILE_LINE_CC);
} else {
//??? if (Z_REFCOUNT_P(zval_ptr) == 1 && Z_ISREF_P(zval_ptr)) {
/* convert reference to regular value */
//??? zend_reference *ref = Z_REF_P(zval_ptr);
//??? ZVAL_COPY_VALUE(zval_ptr, &ref->val);
//??? efree_rel(ref);
//??? }
GC_ZVAL_CHECK_POSSIBLE_ROOT(zval_ptr);
}
}

View file

@ -465,12 +465,6 @@ ZEND_API void _zval_internal_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC) /* {{{ *
Z_DELREF_P(zval_ptr);
if (Z_REFCOUNT_P(zval_ptr) == 0) {
_zval_internal_dtor_for_ptr(zval_ptr ZEND_FILE_LINE_CC);
//??? } else if (Z_REFCOUNT_P(zval_ptr) == 1) {
//??? if (Z_ISREF_P(zval_ptr)) {
//??? zend_reference *ref = Z_REF_P(zval_ptr);
//??? ZVAL_COPY_VALUE(zval_ptr, Z_REFVAL_P(zval_ptr));
//??? efree(ref);
//??? }
}
}
}
@ -484,20 +478,18 @@ ZEND_API int zend_is_true(zval *op TSRMLS_DC) /* {{{ */
#include "../TSRM/tsrm_strtok_r.h"
#define IS_VISITED_CONSTANT 0x080 //??? IS_CONSTANT_INDEX
#define IS_VISITED_CONSTANT 0x080
#define IS_CONSTANT_VISITED(p) (Z_TYPE_P(p) & IS_VISITED_CONSTANT)
#define Z_REAL_TYPE_P(p) (Z_TYPE_P(p) & ~IS_VISITED_CONSTANT)
#define MARK_CONSTANT_VISITED(p) Z_TYPE_INFO_P(p) |= IS_VISITED_CONSTANT
static void zval_deep_copy(zval *p)
{
zval value;
ZVAL_DUP(&value, p);
//??? Z_TYPE(value) &= ~IS_CONSTANT_INDEX;
//??? zval_copy_ctor(&value);
//??? Z_TYPE(value) = Z_TYPE_P(p);
ZVAL_COPY_VALUE(p, &value);
//??? zval value;
//???
//??? ZVAL_DUP(&value, p);
//??? ZVAL_COPY_VALUE(p, &value);
zval_copy_ctor(p);
}
ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry *scope TSRMLS_DC) /* {{{ */
@ -1200,7 +1192,7 @@ ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *s
CG(interactive) = orig_interactive;
if (Z_TYPE(local_retval) != IS_UNDEF) {
if (retval_ptr) {
COPY_PZVAL_TO_ZVAL(*retval_ptr, &local_retval);
ZVAL_COPY_VALUE(retval_ptr, &local_retval);
} else {
zval_ptr_dtor(&local_retval);
}

View file

@ -159,7 +159,6 @@ ZEND_API void zend_hash_to_packed(HashTable *ht)
{
HANDLE_BLOCK_INTERRUPTIONS();
ht->flags |= HASH_FLAG_PACKED;
//??? pefree(ht->arHash, ht->flags & HASH_FLAG_PERSISTENT);
ht->arData = erealloc(ht->arData, ht->nTableSize * sizeof(Bucket));
ht->arHash = (zend_uint*)&uninitialized_bucket;
HANDLE_UNBLOCK_INTERRUPTIONS();
@ -1034,7 +1033,7 @@ ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_fun
if (setTargetPointer && source->nInternalPointer == idx) {
target->nInternalPointer = INVALID_IDX;
}
//???
/* INDIRECT element may point to UNDEF-ined slots */
data = &p->val;
if (Z_TYPE_P(data) == IS_INDIRECT) {
data = Z_INDIRECT_P(data);
@ -1614,7 +1613,6 @@ ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func,
} else {
if (renumber) {
ht->flags |= HASH_FLAG_PACKED;
//??? pefree(ht->arHash, ht->flags & HASH_FLAG_PERSISTENT);
ht->arData = erealloc(ht->arData, ht->nTableSize * sizeof(Bucket));
ht->arHash = (zend_uint*)&uninitialized_bucket;
} else {

View file

@ -63,17 +63,17 @@
struct _zend_ini_entry {
int module_number;
int modifiable;
char *name;
char *name; // TODO: convert into zend_string ???
uint name_length;
ZEND_INI_MH((*on_modify));
void *mh_arg1;
void *mh_arg2;
void *mh_arg3;
char *value;
char *value; // TODO: convert into zend_string ???
uint value_length;
char *orig_value;
char *orig_value; // TODO: convert into zend_string ???
uint orig_value_length;
int orig_modifiable;
int modified;

View file

@ -56,8 +56,6 @@ static zend_object_handlers iterator_object_handlers = {
ZEND_API void zend_register_iterator_wrapper(TSRMLS_D)
{
INIT_CLASS_ENTRY(zend_iterator_class_entry, "__iterator_wrapper", NULL);
//??? STR_RELEASE(zend_iterator_class_entry.name);
//??? zend_iterator_class_entry.name = STR_INIT("__iterator_wrapper", sizeof("__iterator_wrapper")-1, 0);
}
static void iter_wrapper_dtor(zend_object *object TSRMLS_DC)

View file

@ -201,32 +201,6 @@ ZEND_API void zend_objects_store_del(zend_object *object TSRMLS_DC) /* {{{ */
}
/* }}} */
//???
#if 0
ZEND_API zend_object *zend_objects_store_clone_obj(zval *zobject TSRMLS_DC)
{
zend_object *obj, *new_object;
//??? struct _store_object *obj;
//??? zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
//??? obj = &EG(objects_store).object_buckets[handle].bucket.obj;
//??? if (obj->clone == NULL) {
//??? zend_error(E_CORE_ERROR, "Trying to clone uncloneable object of class %s", Z_OBJCE_P(zobject)->name);
//??? }
obj = Z_OBJ_P(zobject);
new_object = obj->handlers->clone_obj(obj TSRMLS_CC);
obj = &EG(objects_store).object_buckets[handle].bucket.obj;
retval.handle = zend_objects_store_put(new_object, obj->dtor, obj->free_storage, obj->clone TSRMLS_CC);
retval.handlers = Z_OBJ_HT_P(zobject);
EG(objects_store).object_buckets[handle].bucket.obj.handlers = retval.handlers;
return retval;
}
#endif
/* zend_object_store_set_object:
* It is ONLY valid to call this function from within the constructor of an
* overloaded object. Its purpose is to set the object pointer for the object

View file

@ -419,10 +419,8 @@ ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC)
}
if (op_array->arg_info) {
for (i=0; i<op_array->num_args; i++) {
//??? str_efree(op_array->arg_info[i].name);
efree((char*)op_array->arg_info[i].name);
if (op_array->arg_info[i].class_name) {
//??? str_efree(op_array->arg_info[i].class_name);
efree((char*)op_array->arg_info[i].class_name);
}
}

View file

@ -245,7 +245,6 @@ try_again:
(op) = &(holder); \
break; \
case IS_RESOURCE: \
/* ??? delete old resource ??? */ \
ZVAL_LONG(&(holder), Z_RES_HANDLE_P(op)); \
(op) = &(holder); \
break; \
@ -291,7 +290,6 @@ try_again:
ZVAL_LONG(&(holder), Z_LVAL_P(op)); \
break; \
case IS_RESOURCE: \
/* ??? delete old resource ??? */ \
ZVAL_LONG(&holder, Z_RES_HANDLE_P(op)); \
break; \
default: \
@ -590,19 +588,7 @@ ZEND_API void convert_to_boolean(zval *op) /* {{{ */
ZEND_API void _convert_to_cstring(zval *op ZEND_FILE_LINE_DC) /* {{{ */
{
//??? double dval;
//??? switch (Z_TYPE_P(op)) {
//??? case IS_DOUBLE: {
//??? TSRMLS_FETCH();
//??? dval = Z_DVAL_P(op);
//??? Z_STRLEN_P(op) = zend_spprintf((char**)&Z_STRVAL_P(op), 0, "%.*H", (int) EG(precision), dval);
//??? /* %H already handles removing trailing zeros from the fractional part, yay */
//??? break;
//??? }
//??? default:
_convert_to_string(op ZEND_FILE_LINE_CC);
//??? }
//??? Z_TYPE_P(op) = IS_STRING;
_convert_to_string(op ZEND_FILE_LINE_CC);
}
/* }}} */
@ -681,7 +667,6 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */
break;
}
default:
//??? op is set to be IS_STRING below.
zval_dtor(op);
ZVAL_BOOL(op, 0);
break;
@ -1753,9 +1738,12 @@ ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
ZVAL_BOOL(result, Z_DVAL_P(op1) == Z_DVAL_P(op2));
break;
case IS_STRING:
// TODO: interned strings ???
ZVAL_BOOL(result, (Z_STRLEN_P(op1) == Z_STRLEN_P(op2))
&& (!memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1))));
if (Z_STR_P(op1) == Z_STR_P(op2)) {
ZVAL_BOOL(result, 1);
} else {
ZVAL_BOOL(result, (Z_STRLEN_P(op1) == Z_STRLEN_P(op2))
&& (!memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1))));
}
break;
case IS_ARRAY:
ZVAL_BOOL(result, Z_ARRVAL_P(op1) == Z_ARRVAL_P(op2) ||

View file

@ -76,8 +76,6 @@ void zend_interned_strings_dtor(TSRMLS_D)
{
#ifndef ZTS
zend_hash_destroy(&CG(interned_strings));
//??? free(CG(interned_strings).arData);
//??? free(CG(interned_strings).arHash);
#else
free(CG(empty_string));
#endif
@ -110,25 +108,8 @@ static zend_string *zend_new_interned_string_int(zend_string *str TSRMLS_DC)
}
GC_REFCOUNT(str) = 1;
// str->gc.u.v.type = IS_INTERNED_STRING;
GC_FLAGS(str) |= IS_STR_INTERNED;
//??? if (CG(interned_strings_top) + ZEND_MM_ALIGNED_SIZE(sizeof(Bucket) + nKeyLength) >=
//??? CG(interned_strings_end)) {
//??? /* no memory */
//??? return arKey;
//??? }
//??? info = (zend_string_info*) CG(interned_strings_top);
//??? CG(interned_strings_top) += ZEND_MM_ALIGNED_SIZE(sizeof(zend_string_info) + nKeyLength);
//??? memcpy((char*)(info+1), arKey, nKeyLength);
//??? if (free_src) {
//??? efree((void *)arKey);
//??? }
//??? info->nKeyLength = nKeyLength;
//??? info->h = h;
if (CG(interned_strings).nNumUsed >= CG(interned_strings).nTableSize) {
if ((CG(interned_strings).nTableSize << 1) > 0) { /* Let's double the table size */
Bucket *d = (Bucket *) perealloc_recoverable(CG(interned_strings).arData, (CG(interned_strings).nTableSize << 1) * sizeof(Bucket), CG(interned_strings).flags & HASH_FLAG_PERSISTENT);

View file

@ -168,7 +168,7 @@ struct _zend_array {
struct _zend_object {
zend_refcounted gc;
zend_uint handle; //??? may be removed?
zend_uint handle; // TODO: may be removed ???
zend_class_entry *ce;
const zend_object_handlers *handlers;
HashTable *properties;
@ -178,7 +178,7 @@ struct _zend_object {
struct _zend_resource {
zend_refcounted gc;
long handle; //??? may be removed?
long handle; // TODO: may be removed ???
int type;
void *ptr;
};
@ -218,12 +218,8 @@ static inline zend_uchar zval_get_type(const zval* pz) {
return pz->u1.v.type;
}
//???
#if 0
# define Z_TYPE(zval) (zval).u1.v.type
#else
# define Z_TYPE(zval) zval_get_type(&(zval))
#endif
/* we should never set just Z_TYPE, we should set Z_TYPE_INFO */
#define Z_TYPE(zval) zval_get_type(&(zval))
#define Z_TYPE_P(zval_p) Z_TYPE(*(zval_p))
#define Z_TYPE_FLAGS(zval) (zval).u1.v.type_flags

View file

@ -33,7 +33,7 @@ ZEND_API void _zval_dtor_func(zend_refcounted *p ZEND_FILE_LINE_DC)
case IS_STRING:
case IS_CONSTANT: {
zend_string *str = (zend_string*)p;
//??? CHECK_ZVAL_STRING_REL(zvalue);
CHECK_ZVAL_STRING_REL(str);
STR_RELEASE(str);
break;
}
@ -94,7 +94,7 @@ ZEND_API void _zval_dtor_func_for_ptr(zend_refcounted *p ZEND_FILE_LINE_DC)
case IS_STRING:
case IS_CONSTANT: {
zend_string *str = (zend_string*)p;
//??? CHECK_ZVAL_STRING_REL(zvalue);
CHECK_ZVAL_STRING_REL(str);
STR_FREE(str);
break;
}
@ -151,7 +151,7 @@ ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC)
switch (Z_TYPE_P(zvalue)) {
case IS_STRING:
case IS_CONSTANT:
CHECK_ZVAL_STRING_REL(zvalue);
CHECK_ZVAL_STRING_REL(Z_STR_P(zvalue));
STR_RELEASE(Z_STR_P(zvalue));
break;
case IS_ARRAY:
@ -182,7 +182,7 @@ ZEND_API void _zval_internal_dtor_for_ptr(zval *zvalue ZEND_FILE_LINE_DC)
switch (Z_TYPE_P(zvalue)) {
case IS_STRING:
case IS_CONSTANT:
CHECK_ZVAL_STRING_REL(zvalue);
CHECK_ZVAL_STRING_REL(Z_STR_P(zvalue));
STR_FREE(Z_STR_P(zvalue));
break;
case IS_ARRAY:
@ -211,7 +211,6 @@ ZEND_API void _zval_internal_dtor_for_ptr(zval *zvalue ZEND_FILE_LINE_DC)
ZEND_API void zval_add_ref(zval *p)
{
if (Z_REFCOUNTED_P(p)) {
//???: autoconversion from reverence to ordinal value
if (Z_ISREF_P(p) && Z_REFCOUNT_P(p) == 1) {
ZVAL_DUP(p, Z_REFVAL_P(p));
} else {
@ -236,7 +235,7 @@ ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC)
switch (Z_TYPE_P(zvalue)) {
case IS_CONSTANT:
case IS_STRING:
CHECK_ZVAL_STRING_REL(zvalue);
CHECK_ZVAL_STRING_REL(Z_STR_P(zvalue));
Z_STR_P(zvalue) = STR_DUP(Z_STR_P(zvalue), 0);
break;
case IS_ARRAY:

View file

@ -95,7 +95,6 @@ ZEND_API void _zval_internal_ptr_dtor_wrapper(zval *zvalue);
#endif
ZEND_API void zval_add_ref(zval *p);
//??? previously references become regular values when refcount became 1
ZEND_API void zval_add_ref_unref(zval *p);
END_EXTERN_C()

View file

@ -618,7 +618,7 @@ static void php_bz2_error(INTERNAL_FUNCTION_PARAMETERS, int opt)
array_init(return_value);
add_assoc_long (return_value, "errno", errnum);
add_assoc_string(return_value, "errstr", (char*)errstr, 1);
add_assoc_string(return_value, "errstr", (char*)errstr);
break;
}
}

View file

@ -275,14 +275,14 @@ static void _php_cal_info(int cal, zval **ret)
array_init(smonths);
for (i = 1; i <= calendar->num_months; i++) {
add_index_string(months, i, calendar->month_name_long[i], 1);
add_index_string(smonths, i, calendar->month_name_short[i], 1);
add_index_string(months, i, calendar->month_name_long[i]);
add_index_string(smonths, i, calendar->month_name_short[i]);
}
add_assoc_zval(*ret, "months", months);
add_assoc_zval(*ret, "abbrevmonths", smonths);
add_assoc_long(*ret, "maxdaysinmonth", calendar->max_days_in_month);
add_assoc_string(*ret, "calname", calendar->name, 1);
add_assoc_string(*ret, "calsymbol", calendar->symbol, 1);
add_assoc_string(*ret, "calname", calendar->name);
add_assoc_string(*ret, "calsymbol", calendar->symbol);
}
@ -409,7 +409,7 @@ PHP_FUNCTION(cal_from_jd)
calendar->from_jd(jd, &year, &month, &day);
snprintf(date, sizeof(date), "%i/%i/%i", month, day, year);
add_assoc_string(return_value, "date", date, 1);
add_assoc_string(return_value, "date", date);
add_assoc_long(return_value, "month", month);
add_assoc_long(return_value, "day", day);
@ -418,16 +418,16 @@ PHP_FUNCTION(cal_from_jd)
/* day of week */
dow = DayOfWeek(jd);
add_assoc_long(return_value, "dow", dow);
add_assoc_string(return_value, "abbrevdayname", DayNameShort[dow], 1);
add_assoc_string(return_value, "dayname", DayNameLong[dow], 1);
add_assoc_string(return_value, "abbrevdayname", DayNameShort[dow]);
add_assoc_string(return_value, "dayname", DayNameLong[dow]);
/* month name */
if(cal == CAL_JEWISH) {
/* special case for Jewish calendar */
add_assoc_string(return_value, "abbrevmonth", JEWISH_MONTH_NAME(year)[month], 1);
add_assoc_string(return_value, "monthname", JEWISH_MONTH_NAME(year)[month], 1);
add_assoc_string(return_value, "abbrevmonth", JEWISH_MONTH_NAME(year)[month]);
add_assoc_string(return_value, "monthname", JEWISH_MONTH_NAME(year)[month]);
} else {
add_assoc_string(return_value, "abbrevmonth", calendar->month_name_short[month], 1);
add_assoc_string(return_value, "monthname", calendar->month_name_long[month], 1);
add_assoc_string(return_value, "abbrevmonth", calendar->month_name_short[month]);
add_assoc_string(return_value, "monthname", calendar->month_name_long[month]);
}
}
/* }}} */

View file

@ -156,7 +156,7 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
#define CAAL(s, v) add_assoc_long_ex(return_value, s, sizeof(s), (long) v);
#define CAAD(s, v) add_assoc_double_ex(return_value, s, sizeof(s), (double) v);
#define CAAS(s, v) add_assoc_string_ex(return_value, s, sizeof(s), (char *) (v ? v : ""), 1);
#define CAAS(s, v) add_assoc_string_ex(return_value, s, sizeof(s), (char *) (v ? v : ""));
#define CAAZ(s, v) add_assoc_zval_ex(return_value, s, sizeof(s), (zval *) v);
#if defined(PHP_WIN32) || defined(__GNUC__)
@ -1758,7 +1758,7 @@ PHP_FUNCTION(curl_version)
array_init(protocol_list);
while (*p != NULL) {
add_next_index_string(protocol_list, *p, 1);
add_next_index_string(protocol_list, *p);
p++;
}
CAAZ("protocols", protocol_list);
@ -1822,7 +1822,7 @@ static void split_certinfo(char *string, zval *hash)
if(tmp) {
*tmp = '\0';
val = tmp+1;
add_assoc_string(hash, key, val, 1);
add_assoc_string(hash, key, val);
}
s = split+2;
} while(split);
@ -1863,7 +1863,7 @@ static void create_certinfo(struct curl_certinfo *ci, zval *listcode TSRMLS_DC)
split_certinfo(&slist->data[len+1], hash);
add_assoc_zval(certhash, s, hash);
} else {
add_assoc_string(certhash, s, &slist->data[len+1], 1);
add_assoc_string(certhash, s, &slist->data[len+1]);
}
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not extract hash key from certificate info");
@ -3167,7 +3167,7 @@ PHP_FUNCTION(curl_getinfo)
array_init(return_value);
if (curl_easy_getinfo(ch->cp, option, &slist) == CURLE_OK) {
while (slist) {
add_next_index_string(return_value, slist->data, 1);
add_next_index_string(return_value, slist->data);
slist = slist->next;
}
curl_slist_free_all(slist);

View file

@ -1807,8 +1807,8 @@ PHP_FUNCTION(getdate)
add_assoc_long(return_value, "mon", ts->m);
add_assoc_long(return_value, "year", ts->y);
add_assoc_long(return_value, "yday", timelib_day_of_year(ts->y, ts->m, ts->d));
add_assoc_string(return_value, "weekday", php_date_full_day_name(ts->y, ts->m, ts->d), 1);
add_assoc_string(return_value, "month", mon_full_names[ts->m - 1], 1);
add_assoc_string(return_value, "weekday", php_date_full_day_name(ts->y, ts->m, ts->d));
add_assoc_string(return_value, "month", mon_full_names[ts->m - 1]);
add_index_long(return_value, 0, timestamp);
timelib_time_dtor(ts);
@ -2826,14 +2826,14 @@ static void zval_from_error_container(zval *z, timelib_error_container *error) /
add_assoc_long(z, "warning_count", error->warning_count);
array_init(&element);
for (i = 0; i < error->warning_count; i++) {
add_index_string(&element, error->warning_messages[i].position, error->warning_messages[i].message, 1);
add_index_string(&element, error->warning_messages[i].position, error->warning_messages[i].message);
}
add_assoc_zval(z, "warnings", &element);
add_assoc_long(z, "error_count", error->error_count);
array_init(&element);
for (i = 0; i < error->error_count; i++) {
add_index_string(&element, error->error_messages[i].position, error->error_messages[i].message, 1);
add_index_string(&element, error->error_messages[i].position, error->error_messages[i].message);
}
add_assoc_zval(z, "errors", &element);
} /* }}} */
@ -2891,16 +2891,16 @@ void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time *
break;
case TIMELIB_ZONETYPE_ID:
if (parsed_time->tz_abbr) {
add_assoc_string(return_value, "tz_abbr", parsed_time->tz_abbr, 1);
add_assoc_string(return_value, "tz_abbr", parsed_time->tz_abbr);
}
if (parsed_time->tz_info) {
add_assoc_string(return_value, "tz_id", parsed_time->tz_info->name, 1);
add_assoc_string(return_value, "tz_id", parsed_time->tz_info->name);
}
break;
case TIMELIB_ZONETYPE_ABBR:
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(zone, z);
add_assoc_bool(return_value, "is_dst", parsed_time->dst);
add_assoc_string(return_value, "tz_abbr", parsed_time->tz_abbr, 1);
add_assoc_string(return_value, "tz_abbr", parsed_time->tz_abbr);
break;
}
}
@ -3840,7 +3840,7 @@ PHP_FUNCTION(timezone_transitions_get)
add_assoc_str(&element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, timestamp_begin, 0 TSRMLS_CC)); \
add_assoc_long(&element, "offset", tzobj->tzi.tz->type[0].offset); \
add_assoc_bool(&element, "isdst", tzobj->tzi.tz->type[0].isdst); \
add_assoc_string(&element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[0].abbr_idx], 1); \
add_assoc_string(&element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[0].abbr_idx]); \
add_next_index_zval(return_value, &element);
#define add(i,ts) \
@ -3849,7 +3849,7 @@ PHP_FUNCTION(timezone_transitions_get)
add_assoc_str(&element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, ts, 0 TSRMLS_CC)); \
add_assoc_long(&element, "offset", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].offset); \
add_assoc_bool(&element, "isdst", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].isdst); \
add_assoc_string(&element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].abbr_idx], 1); \
add_assoc_string(&element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].abbr_idx]); \
add_next_index_zval(return_value, &element);
#define add_last() add(tzobj->tzi.tz->timecnt - 1, timestamp_begin)
@ -3913,10 +3913,10 @@ PHP_FUNCTION(timezone_location_get)
}
array_init(return_value);
add_assoc_string(return_value, "country_code", tzobj->tzi.tz->location.country_code, 1);
add_assoc_string(return_value, "country_code", tzobj->tzi.tz->location.country_code);
add_assoc_double(return_value, "latitude", tzobj->tzi.tz->location.latitude);
add_assoc_double(return_value, "longitude", tzobj->tzi.tz->location.longitude);
add_assoc_string(return_value, "comments", tzobj->tzi.tz->location.comments, 1);
add_assoc_string(return_value, "comments", tzobj->tzi.tz->location.comments);
}
/* }}} */
@ -4454,10 +4454,10 @@ PHP_FUNCTION(timezone_identifiers_list)
for (i = 0; i < item_count; ++i) {
if (what == PHP_DATE_TIMEZONE_PER_COUNTRY) {
if (tzdb->data[table[i].pos + 5] == option[0] && tzdb->data[table[i].pos + 6] == option[1]) {
add_next_index_string(return_value, table[i].id, 1);
add_next_index_string(return_value, table[i].id);
}
} else if (what == PHP_DATE_TIMEZONE_GROUP_ALL_W_BC || (check_id_allowed(table[i].id, what) && (tzdb->data[table[i].pos + 4] == '\1'))) {
add_next_index_string(return_value, table[i].id, 1);
add_next_index_string(return_value, table[i].id);
}
};
}
@ -4492,7 +4492,7 @@ PHP_FUNCTION(timezone_abbreviations_list)
add_assoc_bool(&element, "dst", entry->type);
add_assoc_long(&element, "offset", entry->gmtoffset);
if (entry->full_tz_name) {
add_assoc_string(&element, "timezone_id", entry->full_tz_name, 1);
add_assoc_string(&element, "timezone_id", entry->full_tz_name);
} else {
add_assoc_null(&element, "timezone_id");
}

View file

@ -1062,11 +1062,11 @@ PHP_FUNCTION(dba_key_split)
}
array_init(return_value);
if (key[0] == '[' && (name = strchr(key, ']')) != NULL) {
add_next_index_stringl(return_value, key+1, name - (key + 1), 1);
add_next_index_stringl(return_value, name+1, key_len - (name - key + 1), 1);
add_next_index_stringl(return_value, key+1, name - (key + 1));
add_next_index_stringl(return_value, name+1, key_len - (name - key + 1));
} else {
add_next_index_stringl(return_value, "", 0, 1);
add_next_index_stringl(return_value, key, key_len, 1);
add_next_index_stringl(return_value, "", 0);
add_next_index_stringl(return_value, key, key_len);
}
}
/* }}} */
@ -1215,9 +1215,12 @@ PHP_FUNCTION(dba_handlers)
for(hptr = handler; hptr->name; hptr++) {
if (full_info) {
add_assoc_string(return_value, hptr->name, hptr->info(hptr, NULL TSRMLS_CC), 0);
// TODO: avoid reallocation ???
char *str = hptr->info(hptr, NULL TSRMLS_CC);
add_assoc_string(return_value, hptr->name, str);
efree(str);
} else {
add_next_index_string(return_value, hptr->name, 1);
add_next_index_string(return_value, hptr->name);
}
}
}
@ -1244,7 +1247,7 @@ PHP_FUNCTION(dba_list)
}
if (Z_TYPE_P(le) == le_db || Z_TYPE_P(le) == le_pdb) {
info = (dba_info *)(le->ptr);
add_index_string(return_value, i, info->path, 1);
add_index_string(return_value, i, info->path);
}
}
}

View file

@ -186,9 +186,9 @@ enumerate_providers_fn (const char * const name,
MAKE_STD_ZVAL(tmp_array);
array_init(tmp_array);
add_assoc_string(tmp_array, "name", (char *)name, 1);
add_assoc_string(tmp_array, "desc", (char *)desc, 1);
add_assoc_string(tmp_array, "file", (char *)file, 1);
add_assoc_string(tmp_array, "name", (char *)name);
add_assoc_string(tmp_array, "desc", (char *)desc);
add_assoc_string(tmp_array, "file", (char *)file);
if (Z_TYPE_P(zdesc)!=IS_ARRAY) {
array_init(zdesc);
@ -207,10 +207,10 @@ describe_dict_fn (const char * const lang,
{
zval *zdesc = (zval *) ud;
array_init(zdesc);
add_assoc_string(zdesc, "lang", (char *)lang, 1);
add_assoc_string(zdesc, "name", (char *)name, 1);
add_assoc_string(zdesc, "desc", (char *)desc, 1);
add_assoc_string(zdesc, "file", (char *)file, 1);
add_assoc_string(zdesc, "lang", (char *)lang);
add_assoc_string(zdesc, "name", (char *)name);
add_assoc_string(zdesc, "desc", (char *)desc);
add_assoc_string(zdesc, "file", (char *)file);
}
/* }}} */
@ -223,10 +223,10 @@ static void php_enchant_list_dicts_fn( const char * const lang_tag,
MAKE_STD_ZVAL(tmp_array);
array_init(tmp_array);
add_assoc_string(tmp_array, "lang_tag", (char *)lang_tag, 1);
add_assoc_string(tmp_array, "provider_name", (char *)provider_name, 1);
add_assoc_string(tmp_array, "provider_desc", (char *)provider_desc, 1);
add_assoc_string(tmp_array, "provider_file", (char *)provider_file, 1);
add_assoc_string(tmp_array, "lang_tag", (char *)lang_tag);
add_assoc_string(tmp_array, "provider_name", (char *)provider_name);
add_assoc_string(tmp_array, "provider_desc", (char *)provider_desc);
add_assoc_string(tmp_array, "provider_file", (char *)provider_file);
if (Z_TYPE_P(zdesc) != IS_ARRAY) {
array_init(zdesc);
@ -749,7 +749,7 @@ PHP_FUNCTION(enchant_dict_quick_check)
if (suggs && n_sugg) {
int i;
for (i = 0; i < n_sugg; i++) {
add_next_index_string(sugg, suggs[i], 1);
add_next_index_string(sugg, suggs[i]);
}
enchant_dict_free_suggestions(pdict->pdict, suggs);
}
@ -805,7 +805,7 @@ PHP_FUNCTION(enchant_dict_suggest)
array_init(return_value);
for (i = 0; i < n_sugg; i++) {
add_next_index_string(return_value, suggs[i], 1);
add_next_index_string(return_value, suggs[i]);
}
enchant_dict_free_suggestions(pdict->pdict, suggs);

View file

@ -352,7 +352,7 @@ static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
match_len = 1;
if (array) {
ZVAL_DEREF_REF(array);
ZVAL_DEREF(array);
}
if (array && err != REG_NOMATCH) {
@ -368,7 +368,7 @@ static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
start = subs[i].rm_so;
end = subs[i].rm_eo;
if (start != -1 && end > 0 && start < string_len && end < string_len && start < end) {
add_index_stringl(array, i, string+start, end-start, 1);
add_index_stringl(array, i, string+start, end-start);
} else {
add_index_bool(array, i, 0);
}
@ -664,7 +664,7 @@ static void php_split(INTERNAL_FUNCTION_PARAMETERS, int icase)
while ((count == -1 || count > 1) && !(err = regexec(&re, strp, 1, subs, 0))) {
if (subs[0].rm_so == 0 && subs[0].rm_eo) {
/* match is at start of string, return empty string */
add_next_index_stringl(return_value, "", 0, 1);
add_next_index_stringl(return_value, "", 0);
/* skip ahead the length of the regex match */
strp += subs[0].rm_eo;
} else if (subs[0].rm_so == 0 && subs[0].rm_eo == 0) {
@ -683,7 +683,7 @@ static void php_split(INTERNAL_FUNCTION_PARAMETERS, int icase)
size = subs[0].rm_so;
/* add it to the array */
add_next_index_stringl(return_value, strp, size, 1);
add_next_index_stringl(return_value, strp, size);
/* point at our new starting point */
strp = strp + subs[0].rm_eo;
@ -708,7 +708,7 @@ static void php_split(INTERNAL_FUNCTION_PARAMETERS, int icase)
/* otherwise we just have one last element to add to the array */
size = endp - strp;
add_next_index_stringl(return_value, strp, size, 1);
add_next_index_stringl(return_value, strp, size);
regfree(&re);
}

View file

@ -1981,9 +1981,9 @@ static void add_assoc_image_info(zval *value, int sub_array, image_info_type *im
case TAG_FMT_SBYTE:
case TAG_FMT_UNDEFINED:
if (!info_value->s) {
add_assoc_stringl(tmpi, name, "", 0, 1);
add_assoc_stringl(tmpi, name, "", 0);
} else {
add_assoc_stringl(tmpi, name, info_value->s, info_data->length, 1);
add_assoc_stringl(tmpi, name, info_value->s, info_data->length);
}
break;
@ -1992,9 +1992,9 @@ static void add_assoc_image_info(zval *value, int sub_array, image_info_type *im
val = "";
}
if (section_index==SECTION_COMMENT) {
add_index_string(tmpi, idx++, val, 1);
add_index_string(tmpi, idx++, val);
} else {
add_assoc_string(tmpi, name, val, 1);
add_assoc_string(tmpi, name, val);
}
break;
@ -2039,9 +2039,9 @@ static void add_assoc_image_info(zval *value, int sub_array, image_info_type *im
case TAG_FMT_URATIONAL:
snprintf(buffer, sizeof(buffer), "%i/%i", info_value->ur.num, info_value->ur.den);
if (l==1) {
add_assoc_string(tmpi, name, buffer, 1);
add_assoc_string(tmpi, name, buffer);
} else {
add_index_string(array, ap, buffer, 1);
add_index_string(array, ap, buffer);
}
break;
@ -2065,9 +2065,9 @@ static void add_assoc_image_info(zval *value, int sub_array, image_info_type *im
case TAG_FMT_SRATIONAL:
snprintf(buffer, sizeof(buffer), "%i/%i", info_value->sr.num, info_value->sr.den);
if (l==1) {
add_assoc_string(tmpi, name, buffer, 1);
add_assoc_string(tmpi, name, buffer);
} else {
add_index_string(array, ap, buffer, 1);
add_index_string(array, ap, buffer);
}
break;

View file

@ -41,7 +41,8 @@ void php_filter_callback(PHP_INPUT_FILTER_PARAM_DECL)
if (status == SUCCESS && retval_ptr != NULL) {
if (retval_ptr != value) {
zval_dtor(value);
COPY_PZVAL_TO_ZVAL(*value, retval_ptr);
ZVAL_COPY_VALUE(value, retval_ptr);
//??? COPY_PZVAL_TO_ZVAL(*value, retval_ptr);
} else {
zval_ptr_dtor(&retval_ptr);
}

View file

@ -896,7 +896,7 @@ PHP_FUNCTION(filter_list)
array_init(return_value);
for (i = 0; i < size; ++i) {
add_next_index_string(return_value, (char *)filter_list[i].name, 1);
add_next_index_string(return_value, (char *)filter_list[i].name);
}
}
/* }}} */

View file

@ -479,7 +479,7 @@ ftp_raw(ftpbuf_t *ftp, const char *cmd, zval *return_value)
}
array_init(return_value);
while (ftp_readline(ftp)) {
add_next_index_string(return_value, ftp->inbuf, 1);
add_next_index_string(return_value, ftp->inbuf);
if (isdigit(ftp->inbuf[0]) && isdigit(ftp->inbuf[1]) && isdigit(ftp->inbuf[2]) && ftp->inbuf[3] == ' ') {
return;
}

View file

@ -673,7 +673,7 @@ PHP_FUNCTION(ftp_nlist)
array_init(return_value);
for (ptr = nlist; *ptr; ptr++) {
add_next_index_string(return_value, *ptr, 1);
add_next_index_string(return_value, *ptr);
}
efree(nlist);
}
@ -702,7 +702,7 @@ PHP_FUNCTION(ftp_rawlist)
array_init(return_value);
for (ptr = llist; *ptr; ptr++) {
add_next_index_string(return_value, *ptr, 1);
add_next_index_string(return_value, *ptr);
}
efree(llist);
}

View file

@ -1361,14 +1361,14 @@ PHP_FUNCTION(gd_info)
array_init(return_value);
add_assoc_string(return_value, "GD Version", PHP_GD_VERSION_STRING, 1);
add_assoc_string(return_value, "GD Version", PHP_GD_VERSION_STRING);
#ifdef ENABLE_GD_TTF
add_assoc_bool(return_value, "FreeType Support", 1);
#if HAVE_LIBFREETYPE
add_assoc_string(return_value, "FreeType Linkage", "with freetype", 1);
add_assoc_string(return_value, "FreeType Linkage", "with freetype");
#else
add_assoc_string(return_value, "FreeType Linkage", "with unknown library", 1);
add_assoc_string(return_value, "FreeType Linkage", "with unknown library");
#endif
#else
add_assoc_bool(return_value, "FreeType Support", 0);

View file

@ -599,7 +599,7 @@ PHP_FUNCTION(hash_algos)
for(zend_hash_internal_pointer_reset_ex(&php_hash_hashtable, &pos);
(type = zend_hash_get_current_key_ex(&php_hash_hashtable, &str, &str_len, &idx, 0, &pos)) != HASH_KEY_NON_EXISTENT;
zend_hash_move_forward_ex(&php_hash_hashtable, &pos)) {
add_next_index_stringl(return_value, str, str_len-1, 1);
add_next_index_stringl(return_value, str, str_len-1);
}
}
/* }}} */

View file

@ -2355,9 +2355,9 @@ PHP_FUNCTION(iconv_mime_decode_headers)
elem = &new_elem;
}
add_next_index_stringl(*elem, header_value, header_value_len, 1);
add_next_index_stringl(*elem, header_value, header_value_len);
} else {
add_assoc_stringl_ex(return_value, header_name, header_name_len, header_value, header_value_len, 1);
add_assoc_stringl_ex(return_value, header_name, header_name_len, header_value, header_value_len);
}
}
encoded_str_len -= next_pos - encoded_str;
@ -2451,9 +2451,9 @@ PHP_FUNCTION(iconv_get_encoding)
if (!strcasecmp("all", type)) {
array_init(return_value);
add_assoc_string(return_value, "input_encoding", ICONVG(input_encoding), 1);
add_assoc_string(return_value, "output_encoding", ICONVG(output_encoding), 1);
add_assoc_string(return_value, "internal_encoding", ICONVG(internal_encoding), 1);
add_assoc_string(return_value, "input_encoding", ICONVG(input_encoding));
add_assoc_string(return_value, "output_encoding", ICONVG(output_encoding));
add_assoc_string(return_value, "internal_encoding", ICONVG(internal_encoding));
} else if (!strcasecmp("input_encoding", type)) {
RETVAL_STRING(ICONVG(input_encoding), 1);
} else if (!strcasecmp("output_encoding", type)) {

View file

@ -793,7 +793,7 @@ void mail_getacl(MAILSTREAM *stream, char *mailbox, ACLLIST *alist)
/* walk through the ACLLIST */
for(; alist; alist = alist->next) {
add_assoc_stringl(IMAPG(imap_acl_list), alist->identifier, alist->rights, strlen(alist->rights), 1);
add_assoc_stringl(IMAPG(imap_acl_list), alist->identifier, alist->rights, strlen(alist->rights));
}
}
/* }}} */
@ -1667,7 +1667,7 @@ PHP_FUNCTION(imap_headers)
}
mail_fetchsubject(t = tmp + strlen(tmp), imap_le_struct->imap_stream, msgno, (long)25);
snprintf(t += strlen(t), sizeof(tmp) - strlen(tmp), " (%ld chars)", cache->rfc822_size);
add_next_index_string(return_value, tmp, 1);
add_next_index_string(return_value, tmp);
}
}
/* }}} */
@ -1862,7 +1862,7 @@ PHP_FUNCTION(imap_list)
array_init(return_value);
cur=IMAPG(imap_folders);
while (cur != NIL) {
add_next_index_string(return_value, cur->LTEXT, 1);
add_next_index_string(return_value, cur->LTEXT);
cur=cur->next;
}
mail_free_stringlist (&IMAPG(imap_folders));
@ -1904,14 +1904,14 @@ PHP_FUNCTION(imap_list_full)
while (cur != NIL) {
MAKE_STD_ZVAL(mboxob);
object_init(mboxob);
add_property_string(mboxob, "name", cur->LTEXT, 1);
add_property_string(mboxob, "name", cur->LTEXT);
add_property_long(mboxob, "attributes", cur->attributes);
#ifdef IMAP41
delim[0] = (char)cur->delimiter;
delim[1] = 0;
add_property_string(mboxob, "delimiter", delim, 1);
add_property_string(mboxob, "delimiter", delim);
#else
add_property_string(mboxob, "delimiter", cur->delimiter, 1);
add_property_string(mboxob, "delimiter", cur->delimiter);
#endif
add_next_index_object(return_value, mboxob TSRMLS_CC);
cur=cur->next;
@ -1947,7 +1947,7 @@ PHP_FUNCTION(imap_listscan)
array_init(return_value);
cur=IMAPG(imap_folders);
while (cur != NIL) {
add_next_index_string(return_value, cur->LTEXT, 1);
add_next_index_string(return_value, cur->LTEXT);
cur=cur->next;
}
mail_free_stringlist (&IMAPG(imap_folders));
@ -1977,9 +1977,9 @@ PHP_FUNCTION(imap_check)
if (imap_le_struct->imap_stream && imap_le_struct->imap_stream->mailbox) {
rfc822_date(date);
object_init(return_value);
add_property_string(return_value, "Date", date, 1);
add_property_string(return_value, "Driver", imap_le_struct->imap_stream->dtb->name, 1);
add_property_string(return_value, "Mailbox", imap_le_struct->imap_stream->mailbox, 1);
add_property_string(return_value, "Date", date);
add_property_string(return_value, "Driver", imap_le_struct->imap_stream->dtb->name);
add_property_string(return_value, "Mailbox", imap_le_struct->imap_stream->mailbox);
add_property_long(return_value, "Nmsgs", imap_le_struct->imap_stream->nmsgs);
add_property_long(return_value, "Recent", imap_le_struct->imap_stream->recent);
} else {
@ -2084,33 +2084,33 @@ PHP_FUNCTION(imap_headerinfo)
/* now run through properties that are only going to be returned
from a server, not text headers */
add_property_string(return_value, "Recent", cache->recent ? (cache->seen ? "R": "N") : " ", 1);
add_property_string(return_value, "Unseen", (cache->recent | cache->seen) ? " " : "U", 1);
add_property_string(return_value, "Flagged", cache->flagged ? "F" : " ", 1);
add_property_string(return_value, "Answered", cache->answered ? "A" : " ", 1);
add_property_string(return_value, "Deleted", cache->deleted ? "D" : " ", 1);
add_property_string(return_value, "Draft", cache->draft ? "X" : " ", 1);
add_property_string(return_value, "Recent", cache->recent ? (cache->seen ? "R": "N") : " ");
add_property_string(return_value, "Unseen", (cache->recent | cache->seen) ? " " : "U");
add_property_string(return_value, "Flagged", cache->flagged ? "F" : " ");
add_property_string(return_value, "Answered", cache->answered ? "A" : " ");
add_property_string(return_value, "Deleted", cache->deleted ? "D" : " ");
add_property_string(return_value, "Draft", cache->draft ? "X" : " ");
snprintf(dummy, sizeof(dummy), "%4ld", cache->msgno);
add_property_string(return_value, "Msgno", dummy, 1);
add_property_string(return_value, "Msgno", dummy);
mail_date(dummy, cache);
add_property_string(return_value, "MailDate", dummy, 1);
add_property_string(return_value, "MailDate", dummy);
snprintf(dummy, sizeof(dummy), "%ld", cache->rfc822_size);
add_property_string(return_value, "Size", dummy, 1);
add_property_string(return_value, "Size", dummy);
add_property_long(return_value, "udate", mail_longdate(cache));
if (en->from && fromlength) {
fulladdress[0] = 0x00;
mail_fetchfrom(fulladdress, imap_le_struct->imap_stream, msgno, fromlength);
add_property_string(return_value, "fetchfrom", fulladdress, 1);
add_property_string(return_value, "fetchfrom", fulladdress);
}
if (en->subject && subjectlength) {
fulladdress[0] = 0x00;
mail_fetchsubject(fulladdress, imap_le_struct->imap_stream, msgno, subjectlength);
add_property_string(return_value, "fetchsubject", fulladdress, 1);
add_property_string(return_value, "fetchsubject", fulladdress);
}
}
/* }}} */
@ -2169,7 +2169,7 @@ PHP_FUNCTION(imap_lsub)
array_init(return_value);
cur=IMAPG(imap_sfolders);
while (cur != NIL) {
add_next_index_string(return_value, cur->LTEXT, 1);
add_next_index_string(return_value, cur->LTEXT);
cur=cur->next;
}
mail_free_stringlist (&IMAPG(imap_sfolders));
@ -2210,14 +2210,14 @@ PHP_FUNCTION(imap_lsub_full)
while (cur != NIL) {
MAKE_STD_ZVAL(mboxob);
object_init(mboxob);
add_property_string(mboxob, "name", cur->LTEXT, 1);
add_property_string(mboxob, "name", cur->LTEXT);
add_property_long(mboxob, "attributes", cur->attributes);
#ifdef IMAP41
delim[0] = (char)cur->delimiter;
delim[1] = 0;
add_property_string(mboxob, "delimiter", delim, 1);
add_property_string(mboxob, "delimiter", delim);
#else
add_property_string(mboxob, "delimiter", cur->delimiter, 1);
add_property_string(mboxob, "delimiter", cur->delimiter);
#endif
add_next_index_object(return_value, mboxob TSRMLS_CC);
cur=cur->next;
@ -2586,9 +2586,9 @@ PHP_FUNCTION(imap_mailboxmsginfo)
add_property_long(return_value, "Nmsgs", imap_le_struct->imap_stream->nmsgs);
add_property_long(return_value, "Size", msize);
rfc822_date(date);
add_property_string(return_value, "Date", date, 1);
add_property_string(return_value, "Driver", imap_le_struct->imap_stream->dtb->name, 1);
add_property_string(return_value, "Mailbox", imap_le_struct->imap_stream->mailbox, 1);
add_property_string(return_value, "Date", date);
add_property_string(return_value, "Driver", imap_le_struct->imap_stream->dtb->name);
add_property_string(return_value, "Mailbox", imap_le_struct->imap_stream->mailbox);
add_property_long(return_value, "Recent", imap_le_struct->imap_stream->recent);
}
/* }}} */
@ -2662,16 +2662,16 @@ PHP_FUNCTION(imap_rfc822_parse_adrlist)
MAKE_STD_ZVAL(tovals);
object_init(tovals);
if (addresstmp->mailbox) {
add_property_string(tovals, "mailbox", addresstmp->mailbox, 1);
add_property_string(tovals, "mailbox", addresstmp->mailbox);
}
if (addresstmp->host) {
add_property_string(tovals, "host", addresstmp->host, 1);
add_property_string(tovals, "host", addresstmp->host);
}
if (addresstmp->personal) {
add_property_string(tovals, "personal", addresstmp->personal, 1);
add_property_string(tovals, "personal", addresstmp->personal);
}
if (addresstmp->adl) {
add_property_string(tovals, "adl", addresstmp->adl, 1);
add_property_string(tovals, "adl", addresstmp->adl);
}
add_next_index_object(return_value, tovals TSRMLS_CC);
} while ((addresstmp = addresstmp->next));
@ -3303,20 +3303,20 @@ PHP_FUNCTION(imap_bodystruct)
if (body->subtype) {
add_property_long(return_value, "ifsubtype", 1);
add_property_string(return_value, "subtype", body->subtype, 1);
add_property_string(return_value, "subtype", body->subtype);
} else {
add_property_long(return_value, "ifsubtype", 0);
}
if (body->description) {
add_property_long(return_value, "ifdescription", 1);
add_property_string(return_value, "description", body->description, 1);
add_property_string(return_value, "description", body->description);
} else {
add_property_long(return_value, "ifdescription", 0);
}
if (body->id) {
add_property_long(return_value, "ifid", 1);
add_property_string(return_value, "id", body->id, 1);
add_property_string(return_value, "id", body->id);
} else {
add_property_long(return_value, "ifid", 0);
}
@ -3330,7 +3330,7 @@ PHP_FUNCTION(imap_bodystruct)
#ifdef IMAP41
if (body->disposition.type) {
add_property_long(return_value, "ifdisposition", 1);
add_property_string(return_value, "disposition", body->disposition.type, 1);
add_property_string(return_value, "disposition", body->disposition.type);
} else {
add_property_long(return_value, "ifdisposition", 0);
}
@ -3343,8 +3343,8 @@ PHP_FUNCTION(imap_bodystruct)
do {
MAKE_STD_ZVAL(dparam);
object_init(dparam);
add_property_string(dparam, "attribute", dpar->attribute, 1);
add_property_string(dparam, "value", dpar->value, 1);
add_property_string(dparam, "attribute", dpar->attribute);
add_property_string(dparam, "value", dpar->value);
add_next_index_object(dparametres, dparam TSRMLS_CC);
} while ((dpar = dpar->next));
add_assoc_object(return_value, "dparameters", dparametres TSRMLS_CC);
@ -3362,10 +3362,10 @@ PHP_FUNCTION(imap_bodystruct)
MAKE_STD_ZVAL(param);
object_init(param);
if (par->attribute) {
add_property_string(param, "attribute", par->attribute, 1);
add_property_string(param, "attribute", par->attribute);
}
if (par->value) {
add_property_string(param, "value", par->value, 1);
add_property_string(param, "value", par->value);
}
add_next_index_object(parametres, param TSRMLS_CC);
@ -3421,33 +3421,37 @@ PHP_FUNCTION(imap_fetch_overview)
MAKE_STD_ZVAL(myoverview);
object_init(myoverview);
if (env->subject) {
add_property_string(myoverview, "subject", env->subject, 1);
add_property_string(myoverview, "subject", env->subject);
}
if (env->from) {
env->from->next=NULL;
address =_php_rfc822_write_address(env->from TSRMLS_CC);
if (address) {
add_property_string(myoverview, "from", address, 0);
// TODO: avoid reallocation ???
add_property_string(myoverview, "from", address);
efree(address);
}
}
if (env->to) {
env->to->next = NULL;
address = _php_rfc822_write_address(env->to TSRMLS_CC);
if (address) {
add_property_string(myoverview, "to", address, 0);
// TODO: avoid reallocation ???
add_property_string(myoverview, "to", address);
efree(address);
}
}
if (env->date) {
add_property_string(myoverview, "date", env->date, 1);
add_property_string(myoverview, "date", env->date);
}
if (env->message_id) {
add_property_string(myoverview, "message_id", env->message_id, 1);
add_property_string(myoverview, "message_id", env->message_id);
}
if (env->references) {
add_property_string(myoverview, "references", env->references, 1);
add_property_string(myoverview, "references", env->references);
}
if (env->in_reply_to) {
add_property_string(myoverview, "in_reply_to", env->in_reply_to, 1);
add_property_string(myoverview, "in_reply_to", env->in_reply_to);
}
add_property_long(myoverview, "size", elt->rfc822_size);
add_property_long(myoverview, "uid", mail_uid(imap_le_struct->imap_stream, i));
@ -4147,7 +4151,7 @@ PHP_FUNCTION(imap_alerts)
cur = IMAPG(imap_alertstack);
while (cur != NIL) {
add_next_index_string(return_value, cur->LTEXT, 1);
add_next_index_string(return_value, cur->LTEXT);
cur = cur->next;
}
mail_free_stringlist(&IMAPG(imap_alertstack));
@ -4174,7 +4178,7 @@ PHP_FUNCTION(imap_errors)
cur = IMAPG(imap_errorstack);
while (cur != NIL) {
add_next_index_string(return_value, cur->LTEXT, 1);
add_next_index_string(return_value, cur->LTEXT);
cur = cur->next;
}
mail_free_errorlist(&IMAPG(imap_errorstack));
@ -4238,8 +4242,8 @@ PHP_FUNCTION(imap_mime_header_decode)
text[charset_token - offset] = 0x00;
MAKE_STD_ZVAL(myobject);
object_init(myobject);
add_property_string(myobject, "charset", "default", 1);
add_property_string(myobject, "text", text, 1);
add_property_string(myobject, "charset", "default");
add_property_string(myobject, "text", text);
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), (void *)&myobject, sizeof(zval *), NULL);
}
if ((encoding_token = (long)php_memnstr(&string[charset_token+2], "?", 1, string+end))) { /* Find token for encoding */
@ -4265,8 +4269,8 @@ PHP_FUNCTION(imap_mime_header_decode)
}
MAKE_STD_ZVAL(myobject);
object_init(myobject);
add_property_string(myobject, "charset", charset, 1);
add_property_string(myobject, "text", decode, 1);
add_property_string(myobject, "charset", charset);
add_property_string(myobject, "text", decode);
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), (void *)&myobject, sizeof(zval *), NULL);
/* only free decode if it was allocated by rfc822_qprint or rfc822_base64 */
@ -4295,8 +4299,8 @@ PHP_FUNCTION(imap_mime_header_decode)
text[end - charset_token] = 0x00;
MAKE_STD_ZVAL(myobject);
object_init(myobject);
add_property_string(myobject, "charset", "default", 1);
add_property_string(myobject, "text", text, 1);
add_property_string(myobject, "charset", "default");
add_property_string(myobject, "text", text);
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), (void *)&myobject, sizeof(zval *), NULL);
offset = end; /* We have reached the end of the string. */
@ -4432,10 +4436,10 @@ static char* _php_imap_parse_address (ADDRESS *addresslist, zval *paddress TSRML
do {
MAKE_STD_ZVAL(tmpvals);
object_init(tmpvals);
if (addresstmp->personal) add_property_string(tmpvals, "personal", addresstmp->personal, 1);
if (addresstmp->adl) add_property_string(tmpvals, "adl", addresstmp->adl, 1);
if (addresstmp->mailbox) add_property_string(tmpvals, "mailbox", addresstmp->mailbox, 1);
if (addresstmp->host) add_property_string(tmpvals, "host", addresstmp->host, 1);
if (addresstmp->personal) add_property_string(tmpvals, "personal", addresstmp->personal);
if (addresstmp->adl) add_property_string(tmpvals, "adl", addresstmp->adl);
if (addresstmp->mailbox) add_property_string(tmpvals, "mailbox", addresstmp->mailbox);
if (addresstmp->host) add_property_string(tmpvals, "host", addresstmp->host);
add_next_index_object(paddress, tmpvals TSRMLS_CC);
} while ((addresstmp = addresstmp->next));
return fulladdress;
@ -4451,23 +4455,25 @@ static void _php_make_header_object(zval *myzvalue, ENVELOPE *en TSRMLS_DC)
object_init(myzvalue);
if (en->remail) add_property_string(myzvalue, "remail", en->remail, 1);
if (en->date) add_property_string(myzvalue, "date", en->date, 1);
if (en->date) add_property_string(myzvalue, "Date", en->date, 1);
if (en->subject) add_property_string(myzvalue, "subject", en->subject, 1);
if (en->subject) add_property_string(myzvalue, "Subject", en->subject, 1);
if (en->in_reply_to) add_property_string(myzvalue, "in_reply_to", en->in_reply_to, 1);
if (en->message_id) add_property_string(myzvalue, "message_id", en->message_id, 1);
if (en->newsgroups) add_property_string(myzvalue, "newsgroups", en->newsgroups, 1);
if (en->followup_to) add_property_string(myzvalue, "followup_to", en->followup_to, 1);
if (en->references) add_property_string(myzvalue, "references", en->references, 1);
if (en->remail) add_property_string(myzvalue, "remail", en->remail);
if (en->date) add_property_string(myzvalue, "date", en->date);
if (en->date) add_property_string(myzvalue, "Date", en->date);
if (en->subject) add_property_string(myzvalue, "subject", en->subject);
if (en->subject) add_property_string(myzvalue, "Subject", en->subject);
if (en->in_reply_to) add_property_string(myzvalue, "in_reply_to", en->in_reply_to);
if (en->message_id) add_property_string(myzvalue, "message_id", en->message_id);
if (en->newsgroups) add_property_string(myzvalue, "newsgroups", en->newsgroups);
if (en->followup_to) add_property_string(myzvalue, "followup_to", en->followup_to);
if (en->references) add_property_string(myzvalue, "references", en->references);
if (en->to) {
MAKE_STD_ZVAL(paddress);
array_init(paddress);
fulladdress = _php_imap_parse_address(en->to, paddress TSRMLS_CC);
if (fulladdress) {
add_property_string(myzvalue, "toaddress", fulladdress, 0);
// TODO: avoid reallocation ???
add_property_string(myzvalue, "toaddress", fulladdress);
efree(fulladdress);
}
add_assoc_object(myzvalue, "to", paddress TSRMLS_CC);
}
@ -4477,7 +4483,9 @@ static void _php_make_header_object(zval *myzvalue, ENVELOPE *en TSRMLS_DC)
array_init(paddress);
fulladdress = _php_imap_parse_address(en->from, paddress TSRMLS_CC);
if (fulladdress) {
add_property_string(myzvalue, "fromaddress", fulladdress, 0);
// TODO: avoid reallocation ???
add_property_string(myzvalue, "fromaddress", fulladdress);
efree(fulladdress);
}
add_assoc_object(myzvalue, "from", paddress TSRMLS_CC);
}
@ -4487,7 +4495,9 @@ static void _php_make_header_object(zval *myzvalue, ENVELOPE *en TSRMLS_DC)
array_init(paddress);
fulladdress = _php_imap_parse_address(en->cc, paddress TSRMLS_CC);
if (fulladdress) {
add_property_string(myzvalue, "ccaddress", fulladdress, 0);
// TODO: avoid reallocation ???
add_property_string(myzvalue, "ccaddress", fulladdress);
efree(fulladdress);
}
add_assoc_object(myzvalue, "cc", paddress TSRMLS_CC);
}
@ -4497,7 +4507,9 @@ static void _php_make_header_object(zval *myzvalue, ENVELOPE *en TSRMLS_DC)
array_init(paddress);
fulladdress = _php_imap_parse_address(en->bcc, paddress TSRMLS_CC);
if (fulladdress) {
add_property_string(myzvalue, "bccaddress", fulladdress, 0);
// TODO: avoid reallocation ???
add_property_string(myzvalue, "bccaddress", fulladdress);
efree(fulladdress);
}
add_assoc_object(myzvalue, "bcc", paddress TSRMLS_CC);
}
@ -4507,7 +4519,9 @@ static void _php_make_header_object(zval *myzvalue, ENVELOPE *en TSRMLS_DC)
array_init(paddress);
fulladdress = _php_imap_parse_address(en->reply_to, paddress TSRMLS_CC);
if (fulladdress) {
add_property_string(myzvalue, "reply_toaddress", fulladdress, 0);
// TODO: avoid reallocation ???
add_property_string(myzvalue, "reply_toaddress", fulladdress);
efree(fulladdress);
}
add_assoc_object(myzvalue, "reply_to", paddress TSRMLS_CC);
}
@ -4517,7 +4531,9 @@ static void _php_make_header_object(zval *myzvalue, ENVELOPE *en TSRMLS_DC)
array_init(paddress);
fulladdress = _php_imap_parse_address(en->sender, paddress TSRMLS_CC);
if (fulladdress) {
add_property_string(myzvalue, "senderaddress", fulladdress, 0);
// TODO: avoid reallocation ???
add_property_string(myzvalue, "senderaddress", fulladdress);
efree(fulladdress);
}
add_assoc_object(myzvalue, "sender", paddress TSRMLS_CC);
}
@ -4527,7 +4543,9 @@ static void _php_make_header_object(zval *myzvalue, ENVELOPE *en TSRMLS_DC)
array_init(paddress);
fulladdress = _php_imap_parse_address(en->return_path, paddress TSRMLS_CC);
if (fulladdress) {
add_property_string(myzvalue, "return_pathaddress", fulladdress, 0);
// TODO: avoid reallocation ???
add_property_string(myzvalue, "return_pathaddress", fulladdress);
efree(fulladdress);
}
add_assoc_object(myzvalue, "return_path", paddress TSRMLS_CC);
}
@ -4552,21 +4570,21 @@ void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC)
if (body->subtype) {
add_property_long(arg, "ifsubtype", 1);
add_property_string(arg, "subtype", body->subtype, 1);
add_property_string(arg, "subtype", body->subtype);
} else {
add_property_long(arg, "ifsubtype", 0);
}
if (body->description) {
add_property_long(arg, "ifdescription", 1);
add_property_string(arg, "description", body->description, 1);
add_property_string(arg, "description", body->description);
} else {
add_property_long(arg, "ifdescription", 0);
}
if (body->id) {
add_property_long(arg, "ifid", 1);
add_property_string(arg, "id", body->id, 1);
add_property_string(arg, "id", body->id);
} else {
add_property_long(arg, "ifid", 0);
}
@ -4582,7 +4600,7 @@ void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC)
#ifdef IMAP41
if (body->disposition.type) {
add_property_long(arg, "ifdisposition", 1);
add_property_string(arg, "disposition", body->disposition.type, 1);
add_property_string(arg, "disposition", body->disposition.type);
} else {
add_property_long(arg, "ifdisposition", 0);
}
@ -4595,8 +4613,8 @@ void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC)
do {
MAKE_STD_ZVAL(dparam);
object_init(dparam);
add_property_string(dparam, "attribute", dpar->attribute, 1);
add_property_string(dparam, "value", dpar->value, 1);
add_property_string(dparam, "attribute", dpar->attribute);
add_property_string(dparam, "value", dpar->value);
add_next_index_object(dparametres, dparam TSRMLS_CC);
} while ((dpar = dpar->next));
add_assoc_object(arg, "dparameters", dparametres TSRMLS_CC);
@ -4614,10 +4632,10 @@ void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC)
MAKE_STD_ZVAL(param);
object_init(param);
if (par->attribute) {
add_property_string(param, "attribute", par->attribute, 1);
add_property_string(param, "attribute", par->attribute);
}
if (par->value) {
add_property_string(param, "value", par->value, 1);
add_property_string(param, "value", par->value);
}
add_next_index_object(parametres, param TSRMLS_CC);

View file

@ -1918,18 +1918,18 @@ static void _php_ibase_field_info(zval *return_value, XSQLVAR *var) /* {{{ */
array_init(return_value);
add_index_stringl(return_value, 0, var->sqlname, var->sqlname_length, 1);
add_assoc_stringl(return_value, "name", var->sqlname, var->sqlname_length, 1);
add_index_stringl(return_value, 0, var->sqlname, var->sqlname_length);
add_assoc_stringl(return_value, "name", var->sqlname, var->sqlname_length);
add_index_stringl(return_value, 1, var->aliasname, var->aliasname_length, 1);
add_assoc_stringl(return_value, "alias", var->aliasname, var->aliasname_length, 1);
add_index_stringl(return_value, 1, var->aliasname, var->aliasname_length);
add_assoc_stringl(return_value, "alias", var->aliasname, var->aliasname_length);
add_index_stringl(return_value, 2, var->relname, var->relname_length, 1);
add_assoc_stringl(return_value, "relation", var->relname, var->relname_length, 1);
add_index_stringl(return_value, 2, var->relname, var->relname_length);
add_assoc_stringl(return_value, "relation", var->relname, var->relname_length);
len = slprintf(buf, 16, "%d", var->sqllen);
add_index_stringl(return_value, 3, buf, len, 1);
add_assoc_stringl(return_value, "length", buf, len, 1);
add_index_stringl(return_value, 3, buf, len);
add_assoc_stringl(return_value, "length", buf, len);
if (var->sqlscale < 0) {
unsigned short precision = 0;
@ -1947,8 +1947,8 @@ static void _php_ibase_field_info(zval *return_value, XSQLVAR *var) /* {{{ */
break;
}
len = slprintf(buf, 16, "NUMERIC(%d,%d)", precision, -var->sqlscale);
add_index_stringl(return_value, 4, s, len, 1);
add_assoc_stringl(return_value, "type", s, len, 1);
add_index_stringl(return_value, 4, s, len);
add_assoc_stringl(return_value, "type", s, len);
} else {
switch (var->sqltype & ~1) {
case SQL_TEXT:
@ -1992,8 +1992,8 @@ static void _php_ibase_field_info(zval *return_value, XSQLVAR *var) /* {{{ */
s = "QUAD";
break;
}
add_index_string(return_value, 4, s, 1);
add_assoc_string(return_value, "type", s, 1);
add_index_string(return_value, 4, s);
add_assoc_string(return_value, "type", s);
}
}
/* }}} */

View file

@ -353,7 +353,7 @@ query_loop:
case isc_spb_dbname:
len = isc_vax_integer(result,2);
add_next_index_stringl(return_value, result +2, len, 1);
add_next_index_stringl(return_value, result +2, len);
result += len+2;
}
} while (*result != isc_info_flag_end);
@ -375,25 +375,25 @@ query_loop:
add_next_index_zval(return_value, user);
len = isc_vax_integer(result,2);
add_assoc_stringl(user, "user_name", result +2, len, 1);
add_assoc_stringl(user, "user_name", result +2, len);
result += len+2;
break;
case isc_spb_sec_firstname:
len = isc_vax_integer(result,2);
add_assoc_stringl(user, "first_name", result +2, len, 1);
add_assoc_stringl(user, "first_name", result +2, len);
result += len+2;
break;
case isc_spb_sec_middlename:
len = isc_vax_integer(result,2);
add_assoc_stringl(user, "middle_name", result +2, len, 1);
add_assoc_stringl(user, "middle_name", result +2, len);
result += len+2;
break;
case isc_spb_sec_lastname:
len = isc_vax_integer(result,2);
add_assoc_stringl(user, "last_name", result +2, len, 1);
add_assoc_stringl(user, "last_name", result +2, len);
result += len+2;
break;

View file

@ -165,7 +165,7 @@ static HashTable *BreakIterator_get_debug_info(zval *object, int *is_temp TSRMLS
}
add_assoc_string_ex(&zv, "type", sizeof("type"),
const_cast<char*>(typeid(*biter).name()), 1);
const_cast<char*>(typeid(*biter).name()));
return Z_ARRVAL(zv);
}

View file

@ -168,7 +168,7 @@ static HashTable *Calendar_get_debug_info(zval *object, int *is_temp TSRMLS_DC)
add_assoc_bool_ex(&zv, "valid", sizeof("valid"), 1);
add_assoc_string_ex(&zv, "type", sizeof("type"),
const_cast<char*>(cal->getType()), 1);
const_cast<char*>(cal->getType()));
{
zval ztz = zval_used_for_init,
@ -191,10 +191,10 @@ static HashTable *Calendar_get_debug_info(zval *object, int *is_temp TSRMLS_DC)
Locale locale = cal->getLocale(ULOC_VALID_LOCALE, uec);
if (U_SUCCESS(uec)) {
add_assoc_string_ex(&zv, "locale", sizeof("locale"),
const_cast<char*>(locale.getName()), 1);
const_cast<char*>(locale.getName()));
} else {
add_assoc_string_ex(&zv, "locale", sizeof("locale"),
const_cast<char*>(u_errorName(uec)), 1);
const_cast<char*>(u_errorName(uec)));
}
}
@ -210,7 +210,7 @@ static HashTable *Calendar_get_debug_info(zval *object, int *is_temp TSRMLS_DC)
if (U_SUCCESS(uec)) {
add_assoc_long(zfields, name, (long)res);
} else {
add_assoc_string(zfields, name, const_cast<char*>(u_errorName(uec)), 1);
add_assoc_string(zfields, name, const_cast<char*>(u_errorName(uec)));
}
}

View file

@ -210,7 +210,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_available_locales)
array_init(return_value);
for (int i = 0; i < count; i++) {
Locale locale = availLocales[i];
add_next_index_string(return_value, locale.getName(), 1);
add_next_index_string(return_value, locale.getName());
}
}

View file

@ -549,7 +549,7 @@ static void php_converter_resolve_callback(zval *zobj,
array_init(&caller);
Z_ADDREF_P(zobj);
add_index_zval(&caller, 0, zobj);
add_index_string(&caller, 1, callback_name, 1);
add_index_string(&caller, 1, callback_name);
if (zend_fcall_info_init(&caller, 0, finfo, fcache, NULL, &errstr TSRMLS_CC) == FAILURE) {
php_converter_throw_failure(objval, U_INTERNAL_PROGRAM_ERROR TSRMLS_CC, "Error setting converter callback: %s", errstr);
}
@ -913,7 +913,7 @@ static PHP_METHOD(UConverter, getAvailable) {
array_init(return_value);
for(i = 0; i < count; i++) {
const char *name = ucnv_getAvailableName(i);
add_next_index_string(return_value, name, 1);
add_next_index_string(return_value, name);
}
}
/* }}} */
@ -952,7 +952,7 @@ static PHP_METHOD(UConverter, getAliases) {
zval_dtor(return_value);
RETURN_NULL();
}
add_next_index_string(return_value, alias, 1);
add_next_index_string(return_value, alias);
}
}
/* }}} */
@ -980,7 +980,7 @@ static PHP_METHOD(UConverter, getStandards) {
zval_dtor(return_value);
RETURN_NULL();
}
add_next_index_string(return_value, name, 1);
add_next_index_string(return_value, name);
}
}
/* }}} */

View file

@ -724,7 +724,9 @@ PHP_FUNCTION( locale_get_keywords )
RETURN_FALSE;
}
add_assoc_stringl( return_value, (char *)kw_key, kw_value , kw_value_len, 0);
// TODO: avoid reallocation ???
add_assoc_stringl( return_value, (char *)kw_key, kw_value , kw_value_len);
efree(kw_value);
} /* end of while */
} /* end of if e!=NULL */
@ -1047,11 +1049,11 @@ static int add_array_entry(const char* loc_name, zval* hash_arr, char* key_name
}
cur_key_name = (char*)ecalloc( 25, 25);
sprintf( cur_key_name , "%s%d", key_name , cnt++);
add_assoc_string( hash_arr, cur_key_name , token ,TRUE );
add_assoc_string( hash_arr, cur_key_name , token);
/* tokenize on the "_" or "-" and stop at singleton if any */
while( (token = php_strtok_r(NULL , DELIMITER , &last_ptr)) && (strlen(token)>1) ){
sprintf( cur_key_name , "%s%d", key_name , cnt++);
add_assoc_string( hash_arr, cur_key_name , token , TRUE );
add_assoc_string( hash_arr, cur_key_name , token);
}
/*
if( strcmp(key_name, LOC_PRIVATE_TAG) == 0 ){
@ -1060,7 +1062,7 @@ static int add_array_entry(const char* loc_name, zval* hash_arr, char* key_name
}
} else {
if( result == 1 ){
add_assoc_string( hash_arr, key_name , key_value , TRUE );
add_assoc_string( hash_arr, key_name , key_value);
cur_result = 1;
}
}
@ -1107,7 +1109,7 @@ PHP_FUNCTION(locale_parse)
grOffset = findOffset( LOC_GRANDFATHERED , loc_name );
if( grOffset >= 0 ){
add_assoc_string( return_value , LOC_GRANDFATHERED_LANG_TAG , estrdup(loc_name) ,FALSE );
add_assoc_string( return_value , LOC_GRANDFATHERED_LANG_TAG , loc_name);
}
else{
/* Not grandfathered */
@ -1164,10 +1166,10 @@ PHP_FUNCTION(locale_get_all_variants)
if( result > 0 && variant){
/* Tokenize on the "_" or "-" */
token = php_strtok_r( variant , DELIMITER , &saved_ptr);
add_next_index_stringl( return_value, token , strlen(token) ,TRUE );
add_next_index_stringl( return_value, token , strlen(token));
/* tokenize on the "_" or "-" and stop at singleton if any */
while( (token = php_strtok_r(NULL , DELIMITER, &saved_ptr)) && (strlen(token)>1) ){
add_next_index_stringl( return_value, token , strlen(token) ,TRUE );
add_next_index_stringl( return_value, token , strlen(token));
}
}
if( variant ){

View file

@ -340,7 +340,7 @@ PHP_FUNCTION( resourcebundle_locales )
array_init( return_value );
while ((entry = uenum_next( icuenum, &entry_len, &icuerror ))) {
add_next_index_stringl( return_value, (char *) entry, entry_len, 1 );
add_next_index_stringl( return_value, (char *) entry, entry_len);
}
uenum_close( icuenum );
}

View file

@ -311,7 +311,9 @@ static HashTable *TimeZone_get_debug_info(zval *object, int *is_temp TSRMLS_DC)
if (U_FAILURE(uec)) {
return Z_ARRVAL(zv);
}
add_assoc_stringl_ex(&zv, "id", sizeof("id"), str, str_len, 0);
// TODO: avoid reallocation ???
add_assoc_stringl_ex(&zv, "id", sizeof("id"), str, str_len);
efree(str);
int32_t rawOffset, dstOffset;
UDate now = Calendar::getNow();

View file

@ -277,7 +277,9 @@ PHP_FUNCTION( transliterator_list_ids )
}
else
{
add_next_index_stringl( return_value, el_char, el_len, 0 );
// TODO: avoid reallocation ???
add_next_index_stringl( return_value, el_char, el_len);
efree(el_char);
}
}
uenum_close( en );

View file

@ -972,13 +972,13 @@ PHP_FUNCTION(ldap_get_entries)
array_init(tmp2);
add_assoc_long(tmp2, "count", num_values);
for (i = 0; i < num_values; i++) {
add_index_stringl(tmp2, i, ldap_value[i]->bv_val, ldap_value[i]->bv_len, 1);
add_index_stringl(tmp2, i, ldap_value[i]->bv_val, ldap_value[i]->bv_len);
}
ldap_value_free_len(ldap_value);
attr_len = strlen(attribute);
zend_hash_update(Z_ARRVAL_P(tmp1), php_strtolower(attribute, attr_len), attr_len+1, (void *) &tmp2, sizeof(zval *), NULL);
add_index_string(tmp1, num_attrib, attribute, 1);
add_index_string(tmp1, num_attrib, attribute);
num_attrib++;
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS
@ -994,7 +994,7 @@ PHP_FUNCTION(ldap_get_entries)
add_assoc_long(tmp1, "count", num_attrib);
dn = ldap_get_dn(ldap, ldap_result_entry);
add_assoc_string(tmp1, "dn", dn, 1);
add_assoc_string(tmp1, "dn", dn);
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS
ldap_memfree(dn);
#else
@ -1111,12 +1111,12 @@ PHP_FUNCTION(ldap_get_attributes)
array_init(tmp);
add_assoc_long(tmp, "count", num_values);
for (i = 0; i < num_values; i++) {
add_index_stringl(tmp, i, ldap_value[i]->bv_val, ldap_value[i]->bv_len, 1);
add_index_stringl(tmp, i, ldap_value[i]->bv_val, ldap_value[i]->bv_len);
}
ldap_value_free_len(ldap_value);
zend_hash_update(Z_ARRVAL_P(return_value), attribute, strlen(attribute)+1, (void *) &tmp, sizeof(zval *), NULL);
add_index_string(return_value, num_attrib, attribute, 1);
add_index_string(return_value, num_attrib, attribute);
num_attrib++;
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS
@ -1161,7 +1161,7 @@ PHP_FUNCTION(ldap_get_values_len)
array_init(return_value);
for (i=0; i<num_values; i++) {
add_next_index_stringl(return_value, ldap_value_len[i]->bv_val, ldap_value_len[i]->bv_len, 1);
add_next_index_stringl(return_value, ldap_value_len[i]->bv_val, ldap_value_len[i]->bv_len);
}
add_assoc_long(return_value, "count", num_values);
@ -1225,7 +1225,7 @@ PHP_FUNCTION(ldap_explode_dn)
add_assoc_long(return_value, "count", count);
for (i = 0; i<count; i++) {
add_index_string(return_value, i, ldap_value[i], 1);
add_index_string(return_value, i, ldap_value[i]);
}
ldap_value_free(ldap_value);
@ -1867,7 +1867,7 @@ PHP_FUNCTION(ldap_parse_result)
if (lreferrals != NULL) {
refp = lreferrals;
while (*refp) {
add_next_index_string(referrals, *refp, 1);
add_next_index_string(referrals, *refp);
refp++;
}
ldap_value_free(lreferrals);
@ -1978,7 +1978,7 @@ PHP_FUNCTION(ldap_parse_reference)
if (lreferrals != NULL) {
refp = lreferrals;
while (*refp) {
add_next_index_string(referrals, *refp, 1);
add_next_index_string(referrals, *refp);
refp++;
}
ldap_value_free(lreferrals);
@ -2345,9 +2345,9 @@ PHP_FUNCTION(ldap_control_paged_result)
/* return a PHP control object */
array_init(return_value);
add_assoc_string(return_value, "oid", ctrl.ldctl_oid, 1);
add_assoc_string(return_value, "oid", ctrl.ldctl_oid);
if (ctrl.ldctl_value.bv_len) {
add_assoc_stringl(return_value, "value", ctrl.ldctl_value.bv_val, ctrl.ldctl_value.bv_len, 1);
add_assoc_stringl(return_value, "value", ctrl.ldctl_value.bv_val, ctrl.ldctl_value.bv_len);
}
if (ctrl.ldctl_iscritical) {
add_assoc_bool(return_value, "iscritical", ctrl.ldctl_iscritical);

View file

@ -589,7 +589,7 @@ static xmlParserInputPtr _php_libxml_external_entity_loader(const char *URL,
add_assoc_null_ex(ctxzv, #memb, sizeof(#memb) - 1); \
} else { \
add_assoc_string_ex(ctxzv, #memb, sizeof(#memb - 1), \
(char *)context->memb, 1); \
(char *)context->memb); \
}
ADD_NULL_OR_STRING_KEY(directory)
@ -982,14 +982,14 @@ static PHP_FUNCTION(libxml_get_last_error)
add_property_long(return_value, "code", error->code);
add_property_long(return_value, "column", error->int2);
if (error->message) {
add_property_string(return_value, "message", error->message, 1);
add_property_string(return_value, "message", error->message);
} else {
add_property_stringl(return_value, "message", "", 0, 1);
add_property_stringl(return_value, "message", "", 0);
}
if (error->file) {
add_property_string(return_value, "file", error->file, 1);
add_property_string(return_value, "file", error->file);
} else {
add_property_stringl(return_value, "file", "", 0, 1);
add_property_stringl(return_value, "file", "", 0);
}
add_property_long(return_value, "line", error->line);
} else {
@ -1021,14 +1021,14 @@ static PHP_FUNCTION(libxml_get_errors)
add_property_long(&z_error, "code", error->code);
add_property_long(&z_error, "column", error->int2);
if (error->message) {
add_property_string(&z_error, "message", error->message, 1);
add_property_string(&z_error, "message", error->message);
} else {
add_property_stringl(&z_error, "message", "", 0, 1);
add_property_stringl(&z_error, "message", "", 0);
}
if (error->file) {
add_property_string(&z_error, "file", error->file, 1);
add_property_string(&z_error, "file", error->file);
} else {
add_property_stringl(&z_error, "file", "", 0, 1);
add_property_stringl(&z_error, "file", "", 0);
}
add_property_long(&z_error, "line", error->line);
add_next_index_zval(return_value, &z_error);

View file

@ -1804,7 +1804,7 @@ PHP_FUNCTION(mb_http_input)
size_t i;
array_init(return_value);
for (i = 0; i < n; i++) {
add_next_index_string(return_value, (*entry)->name, 1);
add_next_index_string(return_value, (*entry)->name);
entry++;
}
retname = 0;
@ -1902,7 +1902,7 @@ PHP_FUNCTION(mb_detect_order)
const mbfl_encoding **entry = MBSTRG(current_detect_order_list);
array_init(return_value);
for (i = 0; i < n; i++) {
add_next_index_string(return_value, (*entry)->name, 1);
add_next_index_string(return_value, (*entry)->name);
entry++;
}
} else {
@ -3300,7 +3300,7 @@ PHP_FUNCTION(mb_list_encodings)
i = 0;
encodings = mbfl_get_supported_encodings();
while ((encoding = encodings[i++]) != NULL) {
add_next_index_string(return_value, (char *) encoding->name, 1);
add_next_index_string(return_value, (char *) encoding->name);
}
}
/* }}} */
@ -3327,7 +3327,7 @@ PHP_FUNCTION(mb_encoding_aliases)
if (encoding->aliases != NULL) {
const char **alias;
for (alias = *encoding->aliases; *alias; ++alias) {
add_next_index_string(return_value, (char *)*alias, 1);
add_next_index_string(return_value, (char *)*alias);
}
}
}
@ -4334,16 +4334,16 @@ PHP_FUNCTION(mb_get_info)
if (!typ || !strcasecmp("all", typ)) {
array_init(return_value);
if (MBSTRG(current_internal_encoding)) {
add_assoc_string(return_value, "internal_encoding", (char *)MBSTRG(current_internal_encoding)->name, 1);
add_assoc_string(return_value, "internal_encoding", (char *)MBSTRG(current_internal_encoding)->name);
}
if (MBSTRG(http_input_identify)) {
add_assoc_string(return_value, "http_input", (char *)MBSTRG(http_input_identify)->name, 1);
add_assoc_string(return_value, "http_input", (char *)MBSTRG(http_input_identify)->name);
}
if (MBSTRG(current_http_output_encoding)) {
add_assoc_string(return_value, "http_output", (char *)MBSTRG(current_http_output_encoding)->name, 1);
add_assoc_string(return_value, "http_output", (char *)MBSTRG(current_http_output_encoding)->name);
}
if ((name = (char *)zend_ini_string("mbstring.http_output_conv_mimetypes", sizeof("mbstring.http_output_conv_mimetypes") - 1, 0)) != NULL) {
add_assoc_string(return_value, "http_output_conv_mimetypes", name, 1);
add_assoc_string(return_value, "http_output_conv_mimetypes", name);
}
add_assoc_long(return_value, "func_overload", MBSTRG(func_overload));
if (MBSTRG(func_overload)){
@ -4351,33 +4351,33 @@ PHP_FUNCTION(mb_get_info)
array_init(&row1);
while (over_func->type > 0) {
if ((MBSTRG(func_overload) & over_func->type) == over_func->type ) {
add_assoc_string(&row1, over_func->orig_func, over_func->ovld_func, 1);
add_assoc_string(&row1, over_func->orig_func, over_func->ovld_func);
}
over_func++;
}
add_assoc_zval(return_value, "func_overload_list", &row1);
} else {
add_assoc_string(return_value, "func_overload_list", "no overload", 1);
add_assoc_string(return_value, "func_overload_list", "no overload");
}
if (lang != NULL) {
if ((name = (char *)mbfl_no_encoding2name(lang->mail_charset)) != NULL) {
add_assoc_string(return_value, "mail_charset", name, 1);
add_assoc_string(return_value, "mail_charset", name);
}
if ((name = (char *)mbfl_no_encoding2name(lang->mail_header_encoding)) != NULL) {
add_assoc_string(return_value, "mail_header_encoding", name, 1);
add_assoc_string(return_value, "mail_header_encoding", name);
}
if ((name = (char *)mbfl_no_encoding2name(lang->mail_body_encoding)) != NULL) {
add_assoc_string(return_value, "mail_body_encoding", name, 1);
add_assoc_string(return_value, "mail_body_encoding", name);
}
}
add_assoc_long(return_value, "illegal_chars", MBSTRG(illegalchars));
if (MBSTRG(encoding_translation)) {
add_assoc_string(return_value, "encoding_translation", "On", 1);
add_assoc_string(return_value, "encoding_translation", "On");
} else {
add_assoc_string(return_value, "encoding_translation", "Off", 1);
add_assoc_string(return_value, "encoding_translation", "Off");
}
if ((name = (char *)mbfl_no_language2name(MBSTRG(language))) != NULL) {
add_assoc_string(return_value, "language", name, 1);
add_assoc_string(return_value, "language", name);
}
n = MBSTRG(current_detect_order_list_size);
entry = MBSTRG(current_detect_order_list);
@ -4385,24 +4385,24 @@ PHP_FUNCTION(mb_get_info)
size_t i;
array_init(&row2);
for (i = 0; i < n; i++) {
add_next_index_string(&row2, (*entry)->name, 1);
add_next_index_string(&row2, (*entry)->name);
entry++;
}
add_assoc_zval(return_value, "detect_order", &row2);
}
if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
add_assoc_string(return_value, "substitute_character", "none", 1);
add_assoc_string(return_value, "substitute_character", "none");
} else if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG) {
add_assoc_string(return_value, "substitute_character", "long", 1);
add_assoc_string(return_value, "substitute_character", "long");
} else if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) {
add_assoc_string(return_value, "substitute_character", "entity", 1);
add_assoc_string(return_value, "substitute_character", "entity");
} else {
add_assoc_long(return_value, "substitute_character", MBSTRG(current_filter_illegal_substchar));
}
if (MBSTRG(strict_detection)) {
add_assoc_string(return_value, "strict_detection", "On", 1);
add_assoc_string(return_value, "strict_detection", "On");
} else {
add_assoc_string(return_value, "strict_detection", "Off", 1);
add_assoc_string(return_value, "strict_detection", "Off");
}
} else if (!strcasecmp("internal_encoding", typ)) {
if (MBSTRG(current_internal_encoding)) {
@ -4428,7 +4428,7 @@ PHP_FUNCTION(mb_get_info)
array_init(return_value);
while (over_func->type > 0) {
if ((MBSTRG(func_overload) & over_func->type) == over_func->type ) {
add_assoc_string(return_value, over_func->orig_func, over_func->ovld_func, 1);
add_assoc_string(return_value, over_func->orig_func, over_func->ovld_func);
}
over_func++;
}
@ -4466,7 +4466,7 @@ PHP_FUNCTION(mb_get_info)
size_t i;
array_init(return_value);
for (i = 0; i < n; i++) {
add_next_index_string(return_value, (*entry)->name, 1);
add_next_index_string(return_value, (*entry)->name);
entry++;
}
}

View file

@ -749,7 +749,7 @@ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase)
beg = regs->beg[i];
end = regs->end[i];
if (beg >= 0 && beg < end && end <= string_len) {
add_index_stringl(array, i, (char *)&str[beg], end - beg, 1);
add_index_stringl(array, i, (char *)&str[beg], end - beg);
} else {
add_index_bool(array, i, 0);
}
@ -959,7 +959,7 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp
array_init(&subpats);
for (i = 0; i < regs->num_regs; i++) {
add_next_index_stringl(&subpats, string + regs->beg[i], regs->end[i] - regs->beg[i], 1);
add_next_index_stringl(&subpats, string + regs->beg[i], regs->end[i] - regs->beg[i]);
}
ZVAL_COPY_VALUE(&args[0], &subpats);
@ -1092,7 +1092,7 @@ PHP_FUNCTION(mb_split)
/* add it to the array */
if ((pos - (OnigUChar *)string) < end) {
if (beg < string_len && beg >= (chunk_pos - (OnigUChar *)string)) {
add_next_index_stringl(return_value, (char *)chunk_pos, ((OnigUChar *)(string + beg) - chunk_pos), 1);
add_next_index_stringl(return_value, (char *)chunk_pos, ((OnigUChar *)(string + beg) - chunk_pos));
--count;
} else {
err = -2;
@ -1120,9 +1120,9 @@ PHP_FUNCTION(mb_split)
/* otherwise we just have one last element to add to the array */
n = ((OnigUChar *)(string + string_len) - chunk_pos);
if (n > 0) {
add_next_index_stringl(return_value, (char *)chunk_pos, n, 1);
add_next_index_stringl(return_value, (char *)chunk_pos, n);
} else {
add_next_index_stringl(return_value, "", 0, 1);
add_next_index_stringl(return_value, "", 0);
}
}
/* }}} */
@ -1256,7 +1256,7 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode)
beg = MBREX(search_regs)->beg[i];
end = MBREX(search_regs)->end[i];
if (beg >= 0 && beg <= end && end <= len) {
add_index_stringl(return_value, i, (char *)&str[beg], end - beg, 1);
add_index_stringl(return_value, i, (char *)&str[beg], end - beg);
} else {
add_index_bool(return_value, i, 0);
}
@ -1375,7 +1375,7 @@ PHP_FUNCTION(mb_ereg_search_getregs)
beg = MBREX(search_regs)->beg[i];
end = MBREX(search_regs)->end[i];
if (beg >= 0 && beg <= end && end <= len) {
add_index_stringl(return_value, i, (char *)&str[beg], end - beg, 1);
add_index_stringl(return_value, i, (char *)&str[beg], end - beg);
} else {
add_index_bool(return_value, i, 0);
}

View file

@ -1004,7 +1004,7 @@ PHP_FUNCTION(mcrypt_list_algorithms)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "No algorithms found in module dir");
}
for (i = 0; i < count; i++) {
add_index_string(return_value, i, modules[i], 1);
add_index_string(return_value, i, modules[i]);
}
mcrypt_free_p(modules, count);
}
@ -1031,7 +1031,7 @@ PHP_FUNCTION(mcrypt_list_modes)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "No modes found in module dir");
}
for (i = 0; i < count; i++) {
add_index_string(return_value, i, modules[i], 1);
add_index_string(return_value, i, modules[i]);
}
mcrypt_free_p(modules, count);
}

View file

@ -1538,11 +1538,11 @@ static void php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
data_len = Z_STRLEN(result->data[result->cur_row][i]);
if (result_type & MSSQL_NUM) {
add_index_stringl(return_value, i, data, data_len, 1);
add_index_stringl(return_value, i, data, data_len);
}
if (result_type & MSSQL_ASSOC) {
add_assoc_stringl(return_value, result->fields[i].name, data, data_len, 1);
add_assoc_stringl(return_value, result->fields[i].name, data, data_len);
}
}
else if (Z_TYPE(result->data[result->cur_row][i]) == IS_LONG) {
@ -1718,11 +1718,11 @@ PHP_FUNCTION(mssql_fetch_field)
object_init(return_value);
add_property_string(return_value, "name",result->fields[field_offset].name, 1);
add_property_string(return_value, "name",result->fields[field_offset].name);
add_property_long(return_value, "max_length",result->fields[field_offset].max_length);
add_property_string(return_value, "column_source",result->fields[field_offset].column_source, 1);
add_property_string(return_value, "column_source",result->fields[field_offset].column_source);
add_property_long(return_value, "numeric", result->fields[field_offset].numeric);
add_property_string(return_value, "type", php_mssql_get_field_name(Z_TYPE(result->fields[field_offset])), 1);
add_property_string(return_value, "type", php_mssql_get_field_name(Z_TYPE(result->fields[field_offset])));
}
/* }}} */

View file

@ -2426,9 +2426,9 @@ PHP_FUNCTION(mysql_fetch_field)
}
object_init(return_value);
add_property_string(return_value, "name", (mysql_field->name?mysql_field->name:""), 1);
add_property_string(return_value, "table", (mysql_field->table?mysql_field->table:""), 1);
add_property_string(return_value, "def", (mysql_field->def?mysql_field->def:""), 1);
add_property_string(return_value, "name", (mysql_field->name?mysql_field->name:""));
add_property_string(return_value, "table", (mysql_field->table?mysql_field->table:""));
add_property_string(return_value, "def", (mysql_field->def?mysql_field->def:""));
add_property_long(return_value, "max_length", mysql_field->max_length);
add_property_long(return_value, "not_null", IS_NOT_NULL(mysql_field->flags)?1:0);
add_property_long(return_value, "primary_key", IS_PRI_KEY(mysql_field->flags)?1:0);
@ -2436,7 +2436,7 @@ PHP_FUNCTION(mysql_fetch_field)
add_property_long(return_value, "unique_key", (mysql_field->flags&UNIQUE_KEY_FLAG?1:0));
add_property_long(return_value, "numeric", IS_NUM(mysql_field->type)?1:0);
add_property_long(return_value, "blob", IS_BLOB(mysql_field->flags)?1:0);
add_property_string(return_value, "type", php_mysql_get_field_name(mysql_field->type), 1);
add_property_string(return_value, "type", php_mysql_get_field_name(mysql_field->type));
add_property_long(return_value, "unsigned", (mysql_field->flags&UNSIGNED_FLAG?1:0));
add_property_long(return_value, "zerofill", (mysql_field->flags&ZEROFILL_FLAG?1:0));
}

View file

@ -1127,18 +1127,18 @@ PHP_FUNCTION(mysqli_stmt_fetch)
/* {{{ php_add_field_properties */
static void php_add_field_properties(zval *value, const MYSQL_FIELD *field TSRMLS_DC)
{
add_property_string(value, "name",(field->name ? field->name : ""), 1);
add_property_string(value, "orgname",(field->org_name ? field->org_name : ""), 1);
add_property_string(value, "table",(field->table ? field->table : ""), 1);
add_property_string(value, "orgtable",(field->org_table ? field->org_table : ""), 1);
add_property_string(value, "def",(field->def ? field->def : ""), 1);
add_property_string(value, "db",(field->db ? field->db : ""), 1);
add_property_string(value, "name",(field->name ? field->name : ""));
add_property_string(value, "orgname",(field->org_name ? field->org_name : ""));
add_property_string(value, "table",(field->table ? field->table : ""));
add_property_string(value, "orgtable",(field->org_table ? field->org_table : ""));
add_property_string(value, "def",(field->def ? field->def : ""));
add_property_string(value, "db",(field->db ? field->db : ""));
/* FIXME: manually set the catalog to "def" due to bug in
* libmysqlclient which does not initialize field->catalog
* and in addition, the catalog is always be "def"
*/
add_property_string(value, "catalog", "def", 1);
add_property_string(value, "catalog", "def");
add_property_long(value, "max_length", field->max_length);
add_property_long(value, "length", field->length);

View file

@ -440,8 +440,8 @@ PHP_FUNCTION(mysqli_error_list)
MAKE_STD_ZVAL(single_error);
array_init(single_error);
add_assoc_long_ex(single_error, "errno", sizeof("errno"), message->error_no);
add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), message->sqlstate, 1);
add_assoc_string_ex(single_error, "error", sizeof("error"), message->error, 1);
add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), message->sqlstate);
add_assoc_string_ex(single_error, "error", sizeof("error"), message->error);
add_next_index_zval(return_value, single_error);
}
}
@ -451,8 +451,8 @@ PHP_FUNCTION(mysqli_error_list)
MAKE_STD_ZVAL(single_error);
array_init(single_error);
add_assoc_long_ex(single_error, "errno", sizeof("errno"), mysql_errno(mysql->mysql));
add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), mysql_sqlstate(mysql->mysql), 1);
add_assoc_string_ex(single_error, "error", sizeof("error"), mysql_error(mysql->mysql), 1);
add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), mysql_sqlstate(mysql->mysql));
add_assoc_string_ex(single_error, "error", sizeof("error"), mysql_error(mysql->mysql));
add_next_index_zval(return_value, single_error);
}
#endif
@ -484,8 +484,8 @@ PHP_FUNCTION(mysqli_stmt_error_list)
MAKE_STD_ZVAL(single_error);
array_init(single_error);
add_assoc_long_ex(single_error, "errno", sizeof("errno"), message->error_no);
add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), message->sqlstate, 1);
add_assoc_string_ex(single_error, "error", sizeof("error"), message->error, 1);
add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), message->sqlstate);
add_assoc_string_ex(single_error, "error", sizeof("error"), message->error);
add_next_index_zval(return_value, single_error);
}
}
@ -495,8 +495,8 @@ PHP_FUNCTION(mysqli_stmt_error_list)
MAKE_STD_ZVAL(single_error);
array_init(single_error);
add_assoc_long_ex(single_error, "errno", sizeof("errno"), mysql_stmt_errno(stmt->stmt));
add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), mysql_stmt_sqlstate(stmt->stmt), 1);
add_assoc_string_ex(single_error, "error", sizeof("error"), mysql_stmt_error(stmt->stmt), 1);
add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), mysql_stmt_sqlstate(stmt->stmt));
add_assoc_string_ex(single_error, "error", sizeof("error"), mysql_stmt_error(stmt->stmt));
add_next_index_zval(return_value, single_error);
}
#endif
@ -1034,14 +1034,14 @@ PHP_FUNCTION(mysqli_get_charset)
#endif
object_init(return_value);
add_property_string(return_value, "charset", (name) ? (char *)name : "", 1);
add_property_string(return_value, "collation",(collation) ? (char *)collation : "", 1);
add_property_string(return_value, "dir", (dir) ? (char *)dir : "", 1);
add_property_string(return_value, "charset", (name) ? (char *)name : "");
add_property_string(return_value, "collation",(collation) ? (char *)collation : "");
add_property_string(return_value, "dir", (dir) ? (char *)dir : "");
add_property_long(return_value, "min_length", minlength);
add_property_long(return_value, "max_length", maxlength);
add_property_long(return_value, "number", number);
add_property_long(return_value, "state", state);
add_property_string(return_value, "comment", (comment) ? (char *)comment : "", 1);
add_property_string(return_value, "comment", (comment) ? (char *)comment : "");
}
/* }}} */
#endif

View file

@ -216,8 +216,8 @@ static int link_error_list_read(mysqli_object *obj, zval **retval TSRMLS_DC)
MAKE_STD_ZVAL(single_error);
array_init(single_error);
add_assoc_long_ex(single_error, "errno", sizeof("errno"), message->error_no);
add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), message->sqlstate, 1);
add_assoc_string_ex(single_error, "error", sizeof("error"), message->error, 1);
add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), message->sqlstate);
add_assoc_string_ex(single_error, "error", sizeof("error"), message->error);
add_next_index_zval(*retval, single_error);
}
}
@ -227,8 +227,8 @@ static int link_error_list_read(mysqli_object *obj, zval **retval TSRMLS_DC)
MAKE_STD_ZVAL(single_error);
array_init(single_error);
add_assoc_long_ex(single_error, "errno", sizeof("errno"), mysql_errno(mysql->mysql));
add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), mysql_sqlstate(mysql->mysql), 1);
add_assoc_string_ex(single_error, "error", sizeof("error"), mysql_error(mysql->mysql), 1);
add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), mysql_sqlstate(mysql->mysql));
add_assoc_string_ex(single_error, "error", sizeof("error"), mysql_error(mysql->mysql));
add_next_index_zval(*retval, single_error);
}
#endif
@ -413,8 +413,8 @@ static int stmt_error_list_read(mysqli_object *obj, zval **retval TSRMLS_DC)
MAKE_STD_ZVAL(single_error);
array_init(single_error);
add_assoc_long_ex(single_error, "errno", sizeof("errno"), message->error_no);
add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), message->sqlstate, 1);
add_assoc_string_ex(single_error, "error", sizeof("error"), message->error, 1);
add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), message->sqlstate);
add_assoc_string_ex(single_error, "error", sizeof("error"), message->error);
add_next_index_zval(*retval, single_error);
}
}
@ -424,8 +424,8 @@ static int stmt_error_list_read(mysqli_object *obj, zval **retval TSRMLS_DC)
MAKE_STD_ZVAL(single_error);
array_init(single_error);
add_assoc_long_ex(single_error, "errno", sizeof("errno"), mysql_stmt_errno(stmt->stmt));
add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), mysql_stmt_sqlstate(stmt->stmt), 1);
add_assoc_string_ex(single_error, "error", sizeof("error"), mysql_stmt_error(stmt->stmt), 1);
add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), mysql_stmt_sqlstate(stmt->stmt));
add_assoc_string_ex(single_error, "error", sizeof("error"), mysql_stmt_error(stmt->stmt));
add_next_index_zval(*retval, single_error);
}
#endif

View file

@ -206,7 +206,7 @@ mysqlnd_fill_stats_hash(const MYSQLND_STATS * const stats, const MYSQLND_STRING
char tmp[25];
sprintf((char *)&tmp, MYSQLND_LLU_SPEC, stats->values[i]);
add_assoc_string_ex(return_value, names[i].s, names[i].l + 1, tmp, 1);
add_assoc_string_ex(return_value, names[i].s, names[i].l + 1, tmp);
}
}
/* }}} */

View file

@ -1660,9 +1660,11 @@ go_out:
if (errcode) {
array_init(return_value);
add_assoc_long(return_value, "code", errcode);
add_assoc_string(return_value, "message", (char*) errbuf, 0);
// TODO: avoid reallocation ???
add_assoc_string(return_value, "message", (char*) errbuf);
efree(errbuf);
add_assoc_long(return_value, "offset", error_offset);
add_assoc_string(return_value, "sqltext", sqltext ? (char *) sqltext : "", 1);
add_assoc_string(return_value, "sqltext", sqltext ? (char *) sqltext : "");
} else {
RETURN_FALSE;
}

View file

@ -1048,7 +1048,7 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC)
add_next_index_null(bind->zval);
} else {
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
add_next_index_stringl(bind->zval, (char *)buff, buff_len, 1);
add_next_index_stringl(bind->zval, (char *)buff, buff_len);
}
}
}
@ -1068,7 +1068,7 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC)
ZVAL_STRINGL(*entry, (char *)(((text *)bind->array.elements)+i*bind->array.max_length), curr_element_length, 1);
zend_hash_move_forward(hash);
} else {
add_next_index_stringl(bind->zval, (char *)(((text *)bind->array.elements)+i*bind->array.max_length), curr_element_length, 1);
add_next_index_stringl(bind->zval, (char *)(((text *)bind->array.elements)+i*bind->array.max_length), curr_element_length);
}
}
break;

View file

@ -1553,8 +1553,8 @@ PHP_FUNCTION(odbc_data_source)
array_init(return_value);
add_assoc_string_ex(return_value, "server", sizeof("server"), server_name, 1);
add_assoc_string_ex(return_value, "description", sizeof("description"), desc, 1);
add_assoc_string_ex(return_value, "server", sizeof("server"), server_name);
add_assoc_string_ex(return_value, "description", sizeof("description"), desc);
}
/* }}} */

View file

@ -517,7 +517,7 @@ static int accelerator_get_scripts(zval *return_value TSRMLS_DC)
str = asctime(ta);
len = strlen(str);
if (len > 0 && str[len - 1] == '\n') len--;
add_assoc_stringl(&persistent_script_report, "last_used", str, len, 1);
add_assoc_stringl(&persistent_script_report, "last_used", str, len);
add_assoc_long(&persistent_script_report, "last_used_timestamp", script->dynamic_members.last_used);
if (ZCG(accel_directives).validate_timestamps) {
add_assoc_long(&persistent_script_report, "timestamp", (long)script->timestamp);
@ -597,7 +597,7 @@ static ZEND_FUNCTION(opcache_get_status)
static int add_blacklist_path(zend_blacklist_entry *p, zval *return_value TSRMLS_DC)
{
add_next_index_stringl(return_value, p->path, p->path_length, 1);
add_next_index_stringl(return_value, p->path, p->path_length);
return 0;
}
@ -639,10 +639,10 @@ static ZEND_FUNCTION(opcache_get_configuration)
add_assoc_long(&directives, "opcache.consistency_checks", ZCG(accel_directives).consistency_checks);
add_assoc_long(&directives, "opcache.force_restart_timeout", ZCG(accel_directives).force_restart_timeout);
add_assoc_long(&directives, "opcache.revalidate_freq", ZCG(accel_directives).revalidate_freq);
add_assoc_string(&directives, "opcache.preferred_memory_model", STRING_NOT_NULL(ZCG(accel_directives).memory_model), 1);
add_assoc_string(&directives, "opcache.blacklist_filename", STRING_NOT_NULL(ZCG(accel_directives).user_blacklist_filename), 1);
add_assoc_string(&directives, "opcache.preferred_memory_model", STRING_NOT_NULL(ZCG(accel_directives).memory_model));
add_assoc_string(&directives, "opcache.blacklist_filename", STRING_NOT_NULL(ZCG(accel_directives).user_blacklist_filename));
add_assoc_long(&directives, "opcache.max_file_size", ZCG(accel_directives).max_file_size);
add_assoc_string(&directives, "opcache.error_log", STRING_NOT_NULL(ZCG(accel_directives).error_log), 1);
add_assoc_string(&directives, "opcache.error_log", STRING_NOT_NULL(ZCG(accel_directives).error_log));
add_assoc_bool(&directives, "opcache.protect_memory", ZCG(accel_directives).protect_memory);
add_assoc_bool(&directives, "opcache.save_comments", ZCG(accel_directives).save_comments);
@ -655,8 +655,8 @@ static ZEND_FUNCTION(opcache_get_configuration)
/*version */
array_init(&version);
add_assoc_string(&version, "version", ACCELERATOR_VERSION, 1);
add_assoc_string(&version, "opcache_product_name", ACCELERATOR_PRODUCT_NAME, 1);
add_assoc_string(&version, "version", ACCELERATOR_VERSION);
add_assoc_string(&version, "opcache_product_name", ACCELERATOR_PRODUCT_NAME);
add_assoc_zval(return_value, "version", &version);
/* blacklist */

View file

@ -648,16 +648,16 @@ static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int s
if (zend_hash_find(Z_ARRVAL_P(subitem), sname, strlen(sname)+1, (void**)&data) == SUCCESS) {
if (Z_TYPE_PP(data) == IS_ARRAY) {
subentries = *data;
add_next_index_stringl(subentries, (char *)to_add, to_add_len, 1);
add_next_index_stringl(subentries, (char *)to_add, to_add_len);
} else if (Z_TYPE_PP(data) == IS_STRING) {
MAKE_STD_ZVAL(subentries);
array_init(subentries);
add_next_index_stringl(subentries, Z_STRVAL_PP(data), Z_STRLEN_PP(data), 1);
add_next_index_stringl(subentries, (char *)to_add, to_add_len, 1);
add_next_index_stringl(subentries, Z_STRVAL_PP(data), Z_STRLEN_PP(data));
add_next_index_stringl(subentries, (char *)to_add, to_add_len);
zend_hash_update(Z_ARRVAL_P(subitem), sname, strlen(sname)+1, &subentries, sizeof(zval*), NULL);
}
} else {
add_assoc_stringl(subitem, sname, (char *)to_add, to_add_len, 1);
add_assoc_stringl(subitem, sname, (char *)to_add, to_add_len);
}
}
}
@ -669,7 +669,7 @@ static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int s
static void add_assoc_asn1_string(zval * val, char * key, ASN1_STRING * str) /* {{{ */
{
add_assoc_stringl(val, key, (char *)str->data, str->length, 1);
add_assoc_stringl(val, key, (char *)str->data, str->length);
}
/* }}} */
@ -1932,7 +1932,7 @@ PHP_FUNCTION(openssl_x509_parse)
array_init(return_value);
if (cert->name) {
add_assoc_string(return_value, "name", cert->name, 1);
add_assoc_string(return_value, "name", cert->name);
}
/* add_assoc_bool(return_value, "valid", cert->valid); */
@ -1941,13 +1941,13 @@ PHP_FUNCTION(openssl_x509_parse)
{
char buf[32];
snprintf(buf, sizeof(buf), "%08lx", X509_subject_name_hash(cert));
add_assoc_string(return_value, "hash", buf, 1);
add_assoc_string(return_value, "hash", buf);
}
add_assoc_name_entry(return_value, "issuer", X509_get_issuer_name(cert), useshortnames TSRMLS_CC);
add_assoc_long(return_value, "version", X509_get_version(cert));
add_assoc_string(return_value, "serialNumber", i2s_ASN1_INTEGER(NULL, X509_get_serialNumber(cert)), 1);
add_assoc_string(return_value, "serialNumber", i2s_ASN1_INTEGER(NULL, X509_get_serialNumber(cert)));
add_assoc_asn1_string(return_value, "validFrom", X509_get_notBefore(cert));
add_assoc_asn1_string(return_value, "validTo", X509_get_notAfter(cert));
@ -1957,12 +1957,12 @@ PHP_FUNCTION(openssl_x509_parse)
tmpstr = (char *)X509_alias_get0(cert, NULL);
if (tmpstr) {
add_assoc_string(return_value, "alias", tmpstr, 1);
add_assoc_string(return_value, "alias", tmpstr);
}
/*
add_assoc_long(return_value, "signaturetypeLONG", X509_get_signature_type(cert));
add_assoc_string(return_value, "signaturetype", OBJ_nid2sn(X509_get_signature_type(cert)), 1);
add_assoc_string(return_value, "signaturetypeLN", OBJ_nid2ln(X509_get_signature_type(cert)), 1);
add_assoc_string(return_value, "signaturetype", OBJ_nid2sn(X509_get_signature_type(cert)));
add_assoc_string(return_value, "signaturetypeLN", OBJ_nid2ln(X509_get_signature_type(cert)));
*/
MAKE_STD_ZVAL(subitem);
array_init(subitem);
@ -1988,7 +1988,7 @@ PHP_FUNCTION(openssl_x509_parse)
add_index_bool(subsub, 1, purpset);
pname = useshortnames ? X509_PURPOSE_get0_sname(purp) : X509_PURPOSE_get0_name(purp);
add_index_string(subsub, 2, pname, 1);
add_index_string(subsub, 2, pname);
/* NOTE: if purpset > 1 then it's a warning - we should mention it ? */
@ -2014,7 +2014,7 @@ PHP_FUNCTION(openssl_x509_parse)
if (nid == NID_subject_alt_name) {
if (openssl_x509v3_subjectAltName(bio_out, extension) == 0) {
BIO_get_mem_ptr(bio_out, &bio_buf);
add_assoc_stringl(subitem, extname, bio_buf->data, bio_buf->length, 1);
add_assoc_stringl(subitem, extname, bio_buf->data, bio_buf->length);
} else {
zval_dtor(return_value);
if (certresource == -1 && cert) {
@ -2026,7 +2026,7 @@ PHP_FUNCTION(openssl_x509_parse)
}
else if (X509V3_EXT_print(bio_out, extension, 0, 0)) {
BIO_get_mem_ptr(bio_out, &bio_buf);
add_assoc_stringl(subitem, extname, bio_buf->data, bio_buf->length, 1);
add_assoc_stringl(subitem, extname, bio_buf->data, bio_buf->length);
} else {
add_assoc_asn1_string(subitem, extname, X509_EXTENSION_get_data(extension));
}
@ -3468,7 +3468,9 @@ static int php_openssl_is_private_key(EVP_PKEY* pkey TSRMLS_DC)
char *str = emalloc(len + 1); \
BN_bn2bin(pkey->pkey._type->_name, (unsigned char*)str); \
str[len] = 0; \
add_assoc_stringl(_type, #_name, str, len, 0); \
/* TODO: avoid reallocation ??? */ \
add_assoc_stringl(_type, #_name, str, len); \
efree(str); \
} \
} while (0)
@ -3792,7 +3794,7 @@ PHP_FUNCTION(openssl_pkey_get_details)
array_init(return_value);
add_assoc_long(return_value, "bits", EVP_PKEY_bits(pkey));
add_assoc_stringl(return_value, "key", pbio, pbio_len, 1);
add_assoc_stringl(return_value, "key", pbio, pbio_len);
/*TODO: Use the real values once the openssl constants are used
* See the enum at the top of this file
*/
@ -4828,7 +4830,8 @@ PHP_FUNCTION(openssl_seal)
array_init(ekeys);
for (i=0; i<nkeys; i++) {
eks[i][eksl[i]] = '\0';
add_next_index_stringl(ekeys, erealloc(eks[i], eksl[i] + 1), eksl[i], 0);
add_next_index_stringl(ekeys, eks[i], eksl[i]);
efree(eks[i]);
eks[i] = NULL;
}
#if 0
@ -5243,14 +5246,14 @@ SSL *php_SSL_new_from_context(SSL_CTX *ctx, php_stream *stream TSRMLS_DC) /* {{{
static void openssl_add_method_or_alias(const OBJ_NAME *name, void *arg) /* {{{ */
{
add_next_index_string((zval*)arg, (char*)name->name, 1);
add_next_index_string((zval*)arg, (char*)name->name);
}
/* }}} */
static void openssl_add_method(const OBJ_NAME *name, void *arg) /* {{{ */
{
if (name->alias == 0) {
add_next_index_string((zval*)arg, (char*)name->name, 1);
add_next_index_string((zval*)arg, (char*)name->name);
}
}
/* }}} */

View file

@ -507,7 +507,7 @@ static inline void add_offset_pair(zval *result, char *str, int len, int offset,
array_init(&match_pair);
/* Add (match, offset) to the return value */
add_next_index_stringl(&match_pair, str, len, 1);
add_next_index_stringl(&match_pair, str, len);
add_next_index_long(&match_pair, offset);
if (name) {
@ -540,7 +540,7 @@ static void php_do_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) /* {{{ *
}
if (subpats) {
ZVAL_DEREF_REF(subpats);
ZVAL_DEREF(subpats);
}
php_pcre_match_impl(pce, subject, subject_len, return_value, subpats,
global, ZEND_NUM_ARGS() >= 4, flags, start_offset TSRMLS_CC);
@ -682,7 +682,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
offsets[(i<<1)+1] - offsets[i<<1], offsets[i<<1], NULL);
} else {
add_next_index_stringl(&match_sets[i], (char *)stringlist[i],
offsets[(i<<1)+1] - offsets[i<<1], 1);
offsets[(i<<1)+1] - offsets[i<<1]);
}
}
/*
@ -692,7 +692,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
*/
if (count < num_subpats) {
for (; i < num_subpats; i++) {
add_next_index_string(&match_sets[i], "", 1);
add_next_index_string(&match_sets[i], "");
}
}
} else {
@ -707,10 +707,10 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
} else {
if (subpat_names[i]) {
add_assoc_stringl(&result_set, subpat_names[i], (char *)stringlist[i],
offsets[(i<<1)+1] - offsets[i<<1], 1);
offsets[(i<<1)+1] - offsets[i<<1]);
}
add_next_index_stringl(&result_set, (char *)stringlist[i],
offsets[(i<<1)+1] - offsets[i<<1], 1);
offsets[(i<<1)+1] - offsets[i<<1]);
}
}
/* And add it to the output array */
@ -726,10 +726,10 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
} else {
if (subpat_names[i]) {
add_assoc_stringl(subpats, subpat_names[i], (char *)stringlist[i],
offsets[(i<<1)+1] - offsets[i<<1], 1);
offsets[(i<<1)+1] - offsets[i<<1]);
}
add_next_index_stringl(subpats, (char *)stringlist[i],
offsets[(i<<1)+1] - offsets[i<<1], 1);
offsets[(i<<1)+1] - offsets[i<<1]);
}
}
}
@ -853,9 +853,9 @@ static int preg_do_repl_func(zval *function, char *subject, int *offsets, char *
array_init(&args[0]);
for (i = 0; i < count; i++) {
if (subpat_names[i]) {
add_assoc_stringl(&args[0], subpat_names[i], &subject[offsets[i<<1]] , offsets[(i<<1)+1] - offsets[i<<1], 1);
add_assoc_stringl(&args[0], subpat_names[i], &subject[offsets[i<<1]] , offsets[(i<<1)+1] - offsets[i<<1]);
}
add_next_index_stringl(&args[0], &subject[offsets[i<<1]], offsets[(i<<1)+1] - offsets[i<<1], 1);
add_next_index_stringl(&args[0], &subject[offsets[i<<1]], offsets[(i<<1)+1] - offsets[i<<1]);
}
if (call_user_function_ex(EG(function_table), NULL, function, &retval, 1, args, 0, NULL TSRMLS_CC) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
@ -1403,7 +1403,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl
}
}
if (ZEND_NUM_ARGS() > 4) {
ZVAL_DEREF_REF(zcount);
ZVAL_DEREF(zcount);
zval_dtor(zcount);
ZVAL_LONG(zcount, replace_count);
}
@ -1541,7 +1541,7 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec
} else {
/* Add the piece to the return value */
add_next_index_stringl(return_value, last_match,
&subject[offsets[0]]-last_match, 1);
&subject[offsets[0]]-last_match);
}
/* One less left to do */
@ -1563,7 +1563,7 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec
} else {
add_next_index_stringl(return_value,
&subject[offsets[i<<1]],
match_len, 1);
match_len);
}
}
}
@ -1622,7 +1622,7 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec
add_offset_pair(return_value, &subject[start_offset], subject_len - start_offset, start_offset, NULL);
} else {
/* Add the last piece to the return value */
add_next_index_stringl(return_value, last_match, subject + subject_len - last_match, 1);
add_next_index_stringl(return_value, last_match, subject + subject_len - last_match);
}
}

View file

@ -111,7 +111,7 @@ PHP_FUNCTION(pdo_drivers)
zend_hash_internal_pointer_reset_ex(&pdo_driver_hash, &pos);
while (SUCCESS == zend_hash_get_current_data_ex(&pdo_driver_hash, (void**)&pdriver, &pos)) {
add_next_index_stringl(return_value, (char*)(*pdriver)->driver_name, (*pdriver)->driver_name_len, 1);
add_next_index_stringl(return_value, (char*)(*pdriver)->driver_name, (*pdriver)->driver_name_len);
zend_hash_move_forward_ex(&pdo_driver_hash, &pos);
}
}

View file

@ -86,7 +86,7 @@ void pdo_raise_impl_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *sqlstate
MAKE_STD_ZVAL(info);
array_init(info);
add_next_index_string(info, *pdo_err, 1);
add_next_index_string(info, *pdo_err);
add_next_index_long(info, 0);
zend_update_property(pdo_ex, ex, "errorInfo", sizeof("errorInfo")-1, info TSRMLS_CC);
@ -128,7 +128,7 @@ PDO_API void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt TSRMLS_DC) /* {{{
MAKE_STD_ZVAL(info);
array_init(info);
add_next_index_string(info, *pdo_err, 1);
add_next_index_string(info, *pdo_err);
if (dbh->methods->fetch_err(dbh, stmt, info TSRMLS_CC)) {
zval **item;
@ -919,7 +919,7 @@ static PHP_METHOD(PDO, getAttribute)
case PDO_ATTR_STATEMENT_CLASS:
array_init(return_value);
add_next_index_string(return_value, dbh->def_stmt_ce->name, 1);
add_next_index_string(return_value, dbh->def_stmt_ce->name);
if (dbh->def_stmt_ctor_args) {
Z_ADDREF_P(dbh->def_stmt_ctor_args);
add_next_index_zval(return_value, dbh->def_stmt_ctor_args);
@ -1055,9 +1055,9 @@ static PHP_METHOD(PDO, errorInfo)
array_init(return_value);
if (dbh->query_stmt) {
add_next_index_string(return_value, dbh->query_stmt->error_code, 1);
add_next_index_string(return_value, dbh->query_stmt->error_code);
} else {
add_next_index_string(return_value, dbh->error_code, 1);
add_next_index_string(return_value, dbh->error_code);
}
if (dbh->methods->fetch_err) {
@ -1220,7 +1220,7 @@ static PHP_METHOD(PDO, getAvailableDrivers)
zend_hash_internal_pointer_reset_ex(&pdo_driver_hash, &pos);
while (SUCCESS == zend_hash_get_current_data_ex(&pdo_driver_hash, (void**)&pdriver, &pos)) {
add_next_index_stringl(return_value, (char*)(*pdriver)->driver_name, (*pdriver)->driver_name_len, 1);
add_next_index_stringl(return_value, (char*)(*pdriver)->driver_name, (*pdriver)->driver_name_len);
zend_hash_move_forward_ex(&pdo_driver_hash, &pos);
}
}

View file

@ -1718,7 +1718,7 @@ static PHP_METHOD(PDOStatement, errorInfo)
}
array_init(return_value);
add_next_index_string(return_value, stmt->error_code, 1);
add_next_index_string(return_value, stmt->error_code);
if (stmt->dbh->methods->fetch_err) {
stmt->dbh->methods->fetch_err(stmt->dbh, stmt, return_value TSRMLS_CC);
@ -1861,7 +1861,7 @@ static PHP_METHOD(PDOStatement, getColumnMeta)
/* add stock items */
col = &stmt->columns[colno];
add_assoc_string(return_value, "name", col->name, 1);
add_assoc_string(return_value, "name", col->name);
add_assoc_long(return_value, "len", col->maxlen); /* FIXME: unsigned ? */
add_assoc_long(return_value, "precision", col->precision);
if (col->param_type != PDO_PARAM_ZVAL) {

View file

@ -61,11 +61,13 @@ static int dblib_fetch_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info TSRMLS
msg, einfo->dberr, einfo->severity, stmt ? stmt->active_query_string : "");
add_next_index_long(info, einfo->dberr);
add_next_index_string(info, message, 0);
// TODO: avoid reallocation ???
add_next_index_string(info, message);
efree(message);
add_next_index_long(info, einfo->oserr);
add_next_index_long(info, einfo->severity);
if (einfo->oserrstr) {
add_next_index_string(info, einfo->oserrstr, 1);
add_next_index_string(info, einfo->oserrstr);
}
return 1;

View file

@ -306,8 +306,8 @@ static int pdo_dblib_stmt_get_column_meta(pdo_stmt_t *stmt, long colno, zval *re
add_assoc_long(return_value, "max_length", dbcollen(H->link, colno+1) );
add_assoc_long(return_value, "precision", (int) dbtypeinfo->precision );
add_assoc_long(return_value, "scale", (int) dbtypeinfo->scale );
add_assoc_string(return_value, "column_source", dbcolsource(H->link, colno+1), 1);
add_assoc_string(return_value, "native_type", pdo_dblib_get_field_name(dbcoltype(H->link, colno+1)), 1);
add_assoc_string(return_value, "column_source", dbcolsource(H->link, colno+1));
add_assoc_string(return_value, "native_type", pdo_dblib_get_field_name(dbcoltype(H->link, colno+1)));
add_assoc_long(return_value, "native_type_id", dbcoltype(H->link, colno+1));
add_assoc_long(return_value, "native_usertype_id", dbcolutype(H->link, colno+1));

View file

@ -618,10 +618,10 @@ static int pdo_firebird_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval
i += l;
strcpy(&buf[i++], " ");
}
add_next_index_string(info, buf, 1);
add_next_index_string(info, buf);
} else if (H->last_app_error) {
add_next_index_long(info, -999);
add_next_index_string(info, const_cast(H->last_app_error),1);
add_next_index_string(info, const_cast(H->last_app_error));
}
return 1;
}

View file

@ -130,7 +130,7 @@ static int pdo_mysql_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *in
if (einfo->errcode) {
add_next_index_long(info, einfo->errcode);
add_next_index_string(info, einfo->errmsg, 1);
add_next_index_string(info, einfo->errmsg);
}
PDO_DBG_RETURN(1);

View file

@ -827,26 +827,26 @@ static int pdo_mysql_stmt_col_meta(pdo_stmt_t *stmt, long colno, zval *return_va
F = S->fields + colno;
if (F->def) {
add_assoc_string(return_value, "mysql:def", F->def, 1);
add_assoc_string(return_value, "mysql:def", F->def);
}
if (IS_NOT_NULL(F->flags)) {
add_next_index_string(flags, "not_null", 1);
add_next_index_string(flags, "not_null");
}
if (IS_PRI_KEY(F->flags)) {
add_next_index_string(flags, "primary_key", 1);
add_next_index_string(flags, "primary_key");
}
if (F->flags & MULTIPLE_KEY_FLAG) {
add_next_index_string(flags, "multiple_key", 1);
add_next_index_string(flags, "multiple_key");
}
if (F->flags & UNIQUE_KEY_FLAG) {
add_next_index_string(flags, "unique_key", 1);
add_next_index_string(flags, "unique_key");
}
if (IS_BLOB(F->flags)) {
add_next_index_string(flags, "blob", 1);
add_next_index_string(flags, "blob");
}
str = type_to_name_native(F->type);
if (str) {
add_assoc_string(return_value, "native_type", str, 1);
add_assoc_string(return_value, "native_type", str);
}
#ifdef PDO_USE_MYSQLND
@ -869,7 +869,7 @@ static int pdo_mysql_stmt_col_meta(pdo_stmt_t *stmt, long colno, zval *return_va
#endif
add_assoc_zval(return_value, "flags", flags);
add_assoc_string(return_value, "table", (char *) (F->table?F->table:""), 1);
add_assoc_string(return_value, "table", (char *) (F->table?F->table:""));
PDO_DBG_RETURN(SUCCESS);
} /* }}} */

View file

@ -50,7 +50,7 @@ static int pdo_oci_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info
if (einfo->errcode) {
add_next_index_long(info, einfo->errcode);
add_next_index_string(info, einfo->errmsg, 1);
add_next_index_string(info, einfo->errmsg);
}
return 1;

View file

@ -49,8 +49,10 @@ static int pdo_odbc_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *inf
einfo->file, einfo->line);
add_next_index_long(info, einfo->last_error);
add_next_index_string(info, message, 0);
add_next_index_string(info, einfo->last_state, 1);
// TODO: avoid reallocation ???
add_next_index_string(info, message);
efree(message);
add_next_index_string(info, einfo->last_state);
return 1;
}

View file

@ -114,7 +114,7 @@ static int pdo_pgsql_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *in
if (einfo->errcode) {
add_next_index_long(info, einfo->errcode);
add_next_index_string(info, einfo->errmsg, 1);
add_next_index_string(info, einfo->errmsg);
}
return 1;
@ -874,7 +874,7 @@ static PHP_METHOD(PDO, pgsqlCopyToArray)
if (ret == -1) {
break; /* copy done */
} else if (ret > 0) {
add_next_index_stringl(return_value, csv, ret, 1);
add_next_index_stringl(return_value, csv, ret);
PQfreemem(csv);
} else {
pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, NULL);
@ -1061,11 +1061,11 @@ static PHP_METHOD(PDO, pgsqlGetNotify)
array_init(return_value);
if (result_type == PDO_FETCH_NUM || result_type == PDO_FETCH_BOTH) {
add_index_string(return_value, 0, pgsql_notify->relname, 1);
add_index_string(return_value, 0, pgsql_notify->relname);
add_index_long(return_value, 1, pgsql_notify->be_pid);
}
if (result_type == PDO_FETCH_ASSOC || result_type == PDO_FETCH_BOTH) {
add_assoc_string(return_value, "message", pgsql_notify->relname, 1);
add_assoc_string(return_value, "message", pgsql_notify->relname);
add_assoc_long(return_value, "pid", pgsql_notify->be_pid);
}

View file

@ -605,7 +605,7 @@ static int pgsql_stmt_get_column_meta(pdo_stmt_t *stmt, long colno, zval *return
goto done;
}
add_assoc_string(return_value, "native_type", PQgetvalue(res, 0, 0), 1);
add_assoc_string(return_value, "native_type", PQgetvalue(res, 0, 0));
done:
PQclear(res);
return 1;

View file

@ -93,7 +93,7 @@ static int pdo_sqlite_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *i
if (einfo->errcode) {
add_next_index_long(info, einfo->errcode);
add_next_index_string(info, einfo->errmsg, 1);
add_next_index_string(info, einfo->errmsg);
}
return 1;

View file

@ -296,33 +296,33 @@ static int pdo_sqlite_stmt_col_meta(pdo_stmt_t *stmt, long colno, zval *return_v
switch (sqlite3_column_type(S->stmt, colno)) {
case SQLITE_NULL:
add_assoc_string(return_value, "native_type", "null", 1);
add_assoc_string(return_value, "native_type", "null");
break;
case SQLITE_FLOAT:
add_assoc_string(return_value, "native_type", "double", 1);
add_assoc_string(return_value, "native_type", "double");
break;
case SQLITE_BLOB:
add_next_index_string(flags, "blob", 1);
add_next_index_string(flags, "blob");
case SQLITE_TEXT:
add_assoc_string(return_value, "native_type", "string", 1);
add_assoc_string(return_value, "native_type", "string");
break;
case SQLITE_INTEGER:
add_assoc_string(return_value, "native_type", "integer", 1);
add_assoc_string(return_value, "native_type", "integer");
break;
}
str = sqlite3_column_decltype(S->stmt, colno);
if (str) {
add_assoc_string(return_value, "sqlite:decl_type", (char *)str, 1);
add_assoc_string(return_value, "sqlite:decl_type", (char *)str);
}
#ifdef SQLITE_ENABLE_COLUMN_METADATA
str = sqlite3_column_table_name(S->stmt, colno);
if (str) {
add_assoc_string(return_value, "table", (char *)str, 1);
add_assoc_string(return_value, "table", (char *)str);
}
#endif

View file

@ -1509,34 +1509,34 @@ static void php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type
break;
case PHP_PG_VERSION:
array_init(return_value);
add_assoc_string(return_value, "client", PG_VERSION, 1);
add_assoc_string(return_value, "client", PG_VERSION);
#if HAVE_PQPROTOCOLVERSION
add_assoc_long(return_value, "protocol", PQprotocolVersion(pgsql));
#if HAVE_PQPARAMETERSTATUS
if (PQprotocolVersion(pgsql) >= 3) {
/* 8.0 or grater supports protorol version 3 */
char *tmp;
add_assoc_string(return_value, "server", (char*)PQparameterStatus(pgsql, "server_version"), 1);
add_assoc_string(return_value, "server", (char*)PQparameterStatus(pgsql, "server_version"));
tmp = (char*)PQparameterStatus(pgsql, "server_encoding");
add_assoc_string(return_value, "server_encoding", tmp, 1);
add_assoc_string(return_value, "server_encoding", tmp);
tmp = (char*)PQparameterStatus(pgsql, "client_encoding");
add_assoc_string(return_value, "client_encoding", tmp, 1);
add_assoc_string(return_value, "client_encoding", tmp);
tmp = (char*)PQparameterStatus(pgsql, "is_superuser");
add_assoc_string(return_value, "is_superuser", tmp, 1);
add_assoc_string(return_value, "is_superuser", tmp);
tmp = (char*)PQparameterStatus(pgsql, "session_authorization");
add_assoc_string(return_value, "session_authorization", tmp, 1);
add_assoc_string(return_value, "session_authorization", tmp);
tmp = (char*)PQparameterStatus(pgsql, "DateStyle");
add_assoc_string(return_value, "DateStyle", tmp, 1);
add_assoc_string(return_value, "DateStyle", tmp);
tmp = (char*)PQparameterStatus(pgsql, "IntervalStyle");
add_assoc_string(return_value, "IntervalStyle", tmp ? tmp : "", 1);
add_assoc_string(return_value, "IntervalStyle", tmp ? tmp : "");
tmp = (char*)PQparameterStatus(pgsql, "TimeZone");
add_assoc_string(return_value, "TimeZone", tmp ? tmp : "", 1);
add_assoc_string(return_value, "TimeZone", tmp ? tmp : "");
tmp = (char*)PQparameterStatus(pgsql, "integer_datetimes");
add_assoc_string(return_value, "integer_datetimes", tmp ? tmp : "", 1);
add_assoc_string(return_value, "integer_datetimes", tmp ? tmp : "");
tmp = (char*)PQparameterStatus(pgsql, "standard_conforming_strings");
add_assoc_string(return_value, "standard_conforming_strings", tmp ? tmp : "", 1);
add_assoc_string(return_value, "standard_conforming_strings", tmp ? tmp : "");
tmp = (char*)PQparameterStatus(pgsql, "application_name");
add_assoc_string(return_value, "application_name", tmp ? tmp : "", 1);
add_assoc_string(return_value, "application_name", tmp ? tmp : "");
}
#endif
#endif
@ -2628,22 +2628,15 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type,
} else {
char *element = PQgetvalue(pgsql_result, pgsql_row, i);
if (element) {
char *data;
int data_len;
int should_copy=0;
const uint element_len = strlen(element);
data = safe_estrndup(element, element_len);
data_len = element_len;
if (result_type & PGSQL_NUM) {
add_index_stringl(return_value, i, data, data_len, should_copy);
should_copy=1;
add_index_stringl(return_value, i, element, element_len);
}
if (result_type & PGSQL_ASSOC) {
field_name = PQfname(pgsql_result, i);
add_assoc_stringl(return_value, field_name, data, data_len, should_copy);
add_assoc_stringl(return_value, field_name, element, element_len);
}
}
}
@ -2812,7 +2805,7 @@ PHP_FUNCTION(pg_fetch_all_columns)
if (PQgetisnull(pgsql_result, pg_row, colno)) {
add_next_index_null(return_value);
} else {
add_next_index_string(return_value, PQgetvalue(pgsql_result, pg_row, colno), 1);
add_next_index_string(return_value, PQgetvalue(pgsql_result, pg_row, colno));
}
}
}
@ -3975,7 +3968,7 @@ PHP_FUNCTION(pg_copy_to)
RETURN_FALSE;
break;
default:
add_next_index_string(return_value, csv, 1);
add_next_index_string(return_value, csv);
PQfreemem(csv);
break;
}
@ -4008,7 +4001,7 @@ PHP_FUNCTION(pg_copy_to)
case EOF:
copydone = 1;
case 0:
add_next_index_string(return_value, csv, 1);
add_next_index_string(return_value, csv);
efree(csv);
csv = (char *)NULL;
break;
@ -5128,7 +5121,7 @@ PHP_FUNCTION(pg_get_notify)
}
array_init(return_value);
if (result_type & PGSQL_NUM) {
add_index_string(return_value, 0, pgsql_notify->relname, 1);
add_index_string(return_value, 0, pgsql_notify->relname);
add_index_long(return_value, 1, pgsql_notify->be_pid);
#if HAVE_PQPROTOCOLVERSION && HAVE_PQPARAMETERSTATUS
if (PQprotocolVersion(pgsql) >= 3 && atof(PQparameterStatus(pgsql, "server_version")) >= 9.0) {
@ -5136,12 +5129,12 @@ PHP_FUNCTION(pg_get_notify)
if (atof(PG_VERSION) >= 9.0) {
#endif
#if HAVE_PQPARAMETERSTATUS
add_index_string(return_value, 2, pgsql_notify->extra, 1);
add_index_string(return_value, 2, pgsql_notify->extra);
#endif
}
}
if (result_type & PGSQL_ASSOC) {
add_assoc_string(return_value, "message", pgsql_notify->relname, 1);
add_assoc_string(return_value, "message", pgsql_notify->relname);
add_assoc_long(return_value, "pid", pgsql_notify->be_pid);
#if HAVE_PQPROTOCOLVERSION && HAVE_PQPARAMETERSTATUS
if (PQprotocolVersion(pgsql) >= 3 && atof(PQparameterStatus(pgsql, "server_version")) >= 9.0) {
@ -5149,7 +5142,7 @@ PHP_FUNCTION(pg_get_notify)
if (atof(PG_VERSION) >= 9.0) {
#endif
#if HAVE_PQPARAMETERSTATUS
add_assoc_string(return_value, "payload", pgsql_notify->extra, 1);
add_assoc_string(return_value, "payload", pgsql_notify->extra);
#endif
}
}
@ -5248,7 +5241,7 @@ PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, z
MAKE_STD_ZVAL(elem);
array_init(elem);
add_assoc_long(elem, "num", atoi(PQgetvalue(pg_result,i,1)));
add_assoc_string(elem, "type", PQgetvalue(pg_result,i,2), 1);
add_assoc_string(elem, "type", PQgetvalue(pg_result,i,2));
add_assoc_long(elem, "len", atoi(PQgetvalue(pg_result,i,3)));
if (!strcmp(PQgetvalue(pg_result,i,4), "t")) {
add_assoc_bool(elem, "not null", 1);
@ -6664,15 +6657,10 @@ PHP_PGSQL_API int php_pgsql_result2array(PGresult *pg_result, zval *ret_array TS
} else {
char *element = PQgetvalue(pg_result, pg_row, i);
if (element) {
char *data;
size_t data_len;
const size_t element_len = strlen(element);
data = safe_estrndup(element, element_len);
data_len = element_len;
field_name = PQfname(pg_result, i);
add_assoc_stringl(row, field_name, data, data_len, 0);
add_assoc_stringl(row, field_name, element, element_len);
}
}
}

View file

@ -1278,17 +1278,17 @@ PHP_METHOD(Phar, getSupportedSignatures)
array_init(return_value);
add_next_index_stringl(return_value, "MD5", 3, 1);
add_next_index_stringl(return_value, "SHA-1", 5, 1);
add_next_index_stringl(return_value, "MD5", 3);
add_next_index_stringl(return_value, "SHA-1", 5);
#ifdef PHAR_HASH_OK
add_next_index_stringl(return_value, "SHA-256", 7, 1);
add_next_index_stringl(return_value, "SHA-512", 7, 1);
add_next_index_stringl(return_value, "SHA-256", 7);
add_next_index_stringl(return_value, "SHA-512", 7);
#endif
#if PHAR_HAVE_OPENSSL
add_next_index_stringl(return_value, "OpenSSL", 7, 1);
add_next_index_stringl(return_value, "OpenSSL", 7);
#else
if (zend_hash_exists(&module_registry, "openssl", sizeof("openssl"))) {
add_next_index_stringl(return_value, "OpenSSL", 7, 1);
add_next_index_stringl(return_value, "OpenSSL", 7);
}
#endif
}
@ -1307,11 +1307,11 @@ PHP_METHOD(Phar, getSupportedCompression)
phar_request_initialize(TSRMLS_C);
if (PHAR_G(has_zlib)) {
add_next_index_stringl(return_value, "GZ", 2, 1);
add_next_index_stringl(return_value, "GZ", 2);
}
if (PHAR_G(has_bz2)) {
add_next_index_stringl(return_value, "BZIP2", 5, 1);
add_next_index_stringl(return_value, "BZIP2", 5);
}
}
/* }}} */
@ -1716,7 +1716,9 @@ after_open_fp:
php_stream_close(fp);
}
add_assoc_string(p_obj->ret, str_key, opened, 0);
// TODO: avoid reallocation ???
add_assoc_string(p_obj->ret, str_key, opened);
efree(opened);
if (save) {
efree(save);
@ -3085,26 +3087,28 @@ PHP_METHOD(Phar, getSignature)
int unknown_len;
array_init(return_value);
add_assoc_stringl(return_value, "hash", phar_obj->arc.archive->signature, phar_obj->arc.archive->sig_len, 1);
add_assoc_stringl(return_value, "hash", phar_obj->arc.archive->signature, phar_obj->arc.archive->sig_len);
switch(phar_obj->arc.archive->sig_flags) {
case PHAR_SIG_MD5:
add_assoc_stringl(return_value, "hash_type", "MD5", 3, 1);
add_assoc_stringl(return_value, "hash_type", "MD5", 3);
break;
case PHAR_SIG_SHA1:
add_assoc_stringl(return_value, "hash_type", "SHA-1", 5, 1);
add_assoc_stringl(return_value, "hash_type", "SHA-1", 5);
break;
case PHAR_SIG_SHA256:
add_assoc_stringl(return_value, "hash_type", "SHA-256", 7, 1);
add_assoc_stringl(return_value, "hash_type", "SHA-256", 7);
break;
case PHAR_SIG_SHA512:
add_assoc_stringl(return_value, "hash_type", "SHA-512", 7, 1);
add_assoc_stringl(return_value, "hash_type", "SHA-512", 7);
break;
case PHAR_SIG_OPENSSL:
add_assoc_stringl(return_value, "hash_type", "OpenSSL", 7, 1);
add_assoc_stringl(return_value, "hash_type", "OpenSSL", 7);
break;
default:
unknown_len = spprintf(&unknown, 0, "Unknown (%u)", phar_obj->arc.archive->sig_flags);
add_assoc_stringl(return_value, "hash_type", unknown, unknown_len, 0);
// TODO: avoid reallocation ???
add_assoc_stringl(return_value, "hash_type", unknown, unknown_len);
efree(unknown);
break;
}
} else {

View file

@ -626,14 +626,14 @@ PHP_FUNCTION(posix_uname)
array_init(return_value);
add_assoc_string(return_value, "sysname", u.sysname, 1);
add_assoc_string(return_value, "nodename", u.nodename, 1);
add_assoc_string(return_value, "release", u.release, 1);
add_assoc_string(return_value, "version", u.version, 1);
add_assoc_string(return_value, "machine", u.machine, 1);
add_assoc_string(return_value, "sysname", u.sysname);
add_assoc_string(return_value, "nodename", u.nodename);
add_assoc_string(return_value, "release", u.release);
add_assoc_string(return_value, "version", u.version);
add_assoc_string(return_value, "machine", u.machine);
#if defined(_GNU_SOURCE) && !defined(DARWIN) && defined(HAVE_UTSNAME_DOMAINNAME)
add_assoc_string(return_value, "domainname", u.domainname, 1);
add_assoc_string(return_value, "domainname", u.domainname);
#endif
}
/* }}} */
@ -925,10 +925,10 @@ int php_posix_group_to_array(struct group *g, zval *array_group) /* {{{ */
MAKE_STD_ZVAL(array_members);
array_init(array_members);
add_assoc_string(array_group, "name", g->gr_name, 1);
add_assoc_string(array_group, "passwd", g->gr_passwd, 1);
add_assoc_string(array_group, "name", g->gr_name);
add_assoc_string(array_group, "passwd", g->gr_passwd);
for (count=0; g->gr_mem[count] != NULL; count++) {
add_next_index_string(array_members, g->gr_mem[count], 1);
add_next_index_string(array_members, g->gr_mem[count]);
}
zend_hash_update(Z_ARRVAL_P(array_group), "members", sizeof("members"), (void*)&array_members, sizeof(zval*), NULL);
add_assoc_long(array_group, "gid", g->gr_gid);
@ -1094,13 +1094,13 @@ int php_posix_passwd_to_array(struct passwd *pw, zval *return_value) /* {{{ */
if (NULL == return_value || Z_TYPE_P(return_value) != IS_ARRAY)
return 0;
add_assoc_string(return_value, "name", pw->pw_name, 1);
add_assoc_string(return_value, "passwd", pw->pw_passwd, 1);
add_assoc_string(return_value, "name", pw->pw_name);
add_assoc_string(return_value, "passwd", pw->pw_passwd);
add_assoc_long (return_value, "uid", pw->pw_uid);
add_assoc_long (return_value, "gid", pw->pw_gid);
add_assoc_string(return_value, "gecos", pw->pw_gecos, 1);
add_assoc_string(return_value, "dir", pw->pw_dir, 1);
add_assoc_string(return_value, "shell", pw->pw_shell, 1);
add_assoc_string(return_value, "gecos", pw->pw_gecos);
add_assoc_string(return_value, "dir", pw->pw_dir);
add_assoc_string(return_value, "shell", pw->pw_shell);
return 1;
}
/* }}} */
@ -1227,13 +1227,13 @@ static int posix_addlimit(int limit, char *name, zval *return_value TSRMLS_DC) {
}
if (rl.rlim_cur == RLIM_INFINITY) {
add_assoc_stringl(return_value, soft, UNLIMITED_STRING, sizeof(UNLIMITED_STRING)-1, 1);
add_assoc_stringl(return_value, soft, UNLIMITED_STRING, sizeof(UNLIMITED_STRING)-1);
} else {
add_assoc_long(return_value, soft, rl.rlim_cur);
}
if (rl.rlim_max == RLIM_INFINITY) {
add_assoc_stringl(return_value, hard, UNLIMITED_STRING, sizeof(UNLIMITED_STRING)-1, 1);
add_assoc_stringl(return_value, hard, UNLIMITED_STRING, sizeof(UNLIMITED_STRING)-1);
} else {
add_assoc_long(return_value, hard, rl.rlim_max);
}

View file

@ -534,7 +534,7 @@ static PHP_FUNCTION(pspell_suggest)
if (wl) {
PspellStringEmulation *els = pspell_word_list_elements(wl);
while ((sug = pspell_string_emulation_next(els)) != 0) {
add_next_index_string(return_value,(char *)sug,1);
add_next_index_string(return_value,(char *)sug);
}
delete_pspell_string_emulation(els);
} else {

View file

@ -247,21 +247,21 @@ PHP_FUNCTION(readline_info)
if (!what) {
array_init(return_value);
add_assoc_string(return_value,"line_buffer",SAFE_STRING(rl_line_buffer),1);
add_assoc_string(return_value,"line_buffer",SAFE_STRING(rl_line_buffer));
add_assoc_long(return_value,"point",rl_point);
add_assoc_long(return_value,"end",rl_end);
#ifdef HAVE_LIBREADLINE
add_assoc_long(return_value,"mark",rl_mark);
add_assoc_long(return_value,"done",rl_done);
add_assoc_long(return_value,"pending_input",rl_pending_input);
add_assoc_string(return_value,"prompt",SAFE_STRING(rl_prompt),1);
add_assoc_string(return_value,"terminal_name",(char *)SAFE_STRING(rl_terminal_name),1);
add_assoc_string(return_value,"prompt",SAFE_STRING(rl_prompt));
add_assoc_string(return_value,"terminal_name",(char *)SAFE_STRING(rl_terminal_name));
#endif
#if HAVE_ERASE_EMPTY_LINE
add_assoc_long(return_value,"erase_empty_line",rl_erase_empty_line);
#endif
add_assoc_string(return_value,"library_version",(char *)SAFE_STRING(rl_library_version),1);
add_assoc_string(return_value,"readline_name",(char *)SAFE_STRING(rl_readline_name),1);
add_assoc_string(return_value,"library_version",(char *)SAFE_STRING(rl_library_version));
add_assoc_string(return_value,"readline_name",(char *)SAFE_STRING(rl_readline_name));
add_assoc_long(return_value,"attempted_completion_over",rl_attempted_completion_over);
} else {
if (!strcasecmp(what,"line_buffer")) {
@ -383,7 +383,7 @@ PHP_FUNCTION(readline_list_history)
if (history) {
int i;
for (i = 0; history[i]; i++) {
add_next_index_string(return_value,history[i]->line,1);
add_next_index_string(return_value,history[i]->line);
}
}
}

View file

@ -1440,7 +1440,7 @@ static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *c
}
if (return_output) {
COPY_PZVAL_TO_ZVAL(*return_value, &retval);
ZVAL_COPY_VALUE(return_value, &retval);
} else {
zval_ptr_dtor(&retval);
}
@ -1529,7 +1529,7 @@ ZEND_METHOD(reflection, export)
}
if (return_output) {
COPY_PZVAL_TO_ZVAL(*return_value, &retval);
ZVAL_COPY_VALUE(return_value, &retval);
} else {
/* No need for _r variant, return of __toString should always be a string */
zend_print_zval(&retval, 0);
@ -1552,30 +1552,30 @@ ZEND_METHOD(reflection, getModifierNames)
array_init(return_value);
if (modifiers & (ZEND_ACC_ABSTRACT | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) {
add_next_index_stringl(return_value, "abstract", sizeof("abstract")-1, 1);
add_next_index_stringl(return_value, "abstract", sizeof("abstract")-1);
}
if (modifiers & (ZEND_ACC_FINAL | ZEND_ACC_FINAL_CLASS)) {
add_next_index_stringl(return_value, "final", sizeof("final")-1, 1);
add_next_index_stringl(return_value, "final", sizeof("final")-1);
}
if (modifiers & ZEND_ACC_IMPLICIT_PUBLIC) {
add_next_index_stringl(return_value, "public", sizeof("public")-1, 1);
add_next_index_stringl(return_value, "public", sizeof("public")-1);
}
/* These are mutually exclusive */
switch (modifiers & ZEND_ACC_PPP_MASK) {
case ZEND_ACC_PUBLIC:
add_next_index_stringl(return_value, "public", sizeof("public")-1, 1);
add_next_index_stringl(return_value, "public", sizeof("public")-1);
break;
case ZEND_ACC_PRIVATE:
add_next_index_stringl(return_value, "private", sizeof("private")-1, 1);
add_next_index_stringl(return_value, "private", sizeof("private")-1);
break;
case ZEND_ACC_PROTECTED:
add_next_index_stringl(return_value, "protected", sizeof("protected")-1, 1);
add_next_index_stringl(return_value, "protected", sizeof("protected")-1);
break;
}
if (modifiers & ZEND_ACC_STATIC) {
add_next_index_stringl(return_value, "static", sizeof("static")-1, 1);
add_next_index_stringl(return_value, "static", sizeof("static")-1);
}
}
/* }}} */
@ -1928,7 +1928,7 @@ ZEND_METHOD(reflection_function, invoke)
}
if (Z_TYPE(retval) != IS_UNDEF) {
COPY_PZVAL_TO_ZVAL(*return_value, &retval);
ZVAL_COPY_VALUE(return_value, &retval);
}
}
/* }}} */
@ -1994,7 +1994,7 @@ ZEND_METHOD(reflection_function, invokeArgs)
}
if (Z_TYPE(retval) != IS_UNDEF) {
COPY_PZVAL_TO_ZVAL(*return_value, &retval);
ZVAL_COPY_VALUE(return_value, &retval);
}
}
/* }}} */
@ -2902,7 +2902,7 @@ ZEND_METHOD(reflection_method, invoke)
}
if (Z_TYPE(retval) != IS_UNDEF) {
COPY_PZVAL_TO_ZVAL(*return_value, &retval);
ZVAL_COPY_VALUE(return_value, &retval);
}
}
/* }}} */
@ -3017,7 +3017,7 @@ ZEND_METHOD(reflection_method, invokeArgs)
}
if (Z_TYPE(retval) != IS_UNDEF) {
COPY_PZVAL_TO_ZVAL(*return_value, &retval);
ZVAL_COPY_VALUE(return_value, &retval);
}
}
/* }}} */
@ -5292,7 +5292,7 @@ static int _addinientry(zval *el TSRMLS_DC, int num_args, va_list args, zend_has
if (number == ini_entry->module_number) {
if (ini_entry->value) {
add_assoc_stringl(retval, ini_entry->name, ini_entry->value, ini_entry->value_length, 1);
add_assoc_stringl(retval, ini_entry->name, ini_entry->value, ini_entry->value_length);
} else {
add_assoc_null(retval, ini_entry->name);
}

View file

@ -154,7 +154,7 @@ PHPAPI void php_add_session_var(zend_string *name TSRMLS_DC) /* {{{ */
zval empty_var;
ZVAL_NULL(&empty_var);
ZEND_SET_SYMBOL_WITH_LENGTH(Z_ARRVAL_P(Z_REFVAL(PS(http_session_vars))), name->val, name->len, &empty_var, 1, 0);
zend_hash_update(Z_ARRVAL_P(Z_REFVAL(PS(http_session_vars))), name, &empty_var);
}
}
/* }}} */
@ -183,7 +183,6 @@ static void php_session_track_init(TSRMLS_D) /* {{{ */
zend_string *var_name = STR_INIT("_SESSION", sizeof("_SESSION") - 1, 0);
/* Unconditionally destroy existing array -- possible dirty data */
zend_delete_global_variable(var_name TSRMLS_CC);
STR_RELEASE(var_name);
if (!ZVAL_IS_UNDEF(&PS(http_session_vars))) {
zval_ptr_dtor(&PS(http_session_vars));
@ -191,8 +190,9 @@ static void php_session_track_init(TSRMLS_D) /* {{{ */
array_init(&session_vars);
ZVAL_NEW_REF(&PS(http_session_vars), &session_vars);
ZEND_SET_GLOBAL_VAR_WITH_LENGTH("_SESSION", sizeof("_SESSION") - 1, &PS(http_session_vars), 2, 1);
Z_ADDREF_P(&PS(http_session_vars));
zend_hash_update_ind(&EG(symbol_table).ht, var_name, &PS(http_session_vars));
STR_RELEASE(var_name);
}
/* }}} */
@ -844,6 +844,7 @@ PS_SERIALIZER_DECODE_FUNC(php_serialize) /* {{{ */
const char *endptr = val + vallen;
zval session_vars;
php_unserialize_data_t var_hash;
zend_string *var_name = STR_INIT("_SESSION", sizeof("_SESSION") - 1, 0);
ZVAL_NULL(&session_vars);
PHP_VAR_UNSERIALIZE_INIT(var_hash);
@ -856,7 +857,9 @@ PS_SERIALIZER_DECODE_FUNC(php_serialize) /* {{{ */
array_init(&session_vars);
}
ZVAL_NEW_REF(&PS(http_session_vars), &session_vars);
ZEND_SET_GLOBAL_VAR_WITH_LENGTH("_SESSION", sizeof("_SESSION") - 1, &PS(http_session_vars), 2, 1);
Z_ADDREF_P(&PS(http_session_vars));
zend_hash_update_ind(&EG(symbol_table).ht, var_name, &PS(http_session_vars));
STR_RELEASE(var_name);
return SUCCESS;
}
/* }}} */
@ -1648,8 +1651,8 @@ static PHP_FUNCTION(session_get_cookie_params)
array_init(return_value);
add_assoc_long(return_value, "lifetime", PS(cookie_lifetime));
add_assoc_string(return_value, "path", PS(cookie_path), 1);
add_assoc_string(return_value, "domain", PS(cookie_domain), 1);
add_assoc_string(return_value, "path", PS(cookie_path));
add_assoc_string(return_value, "domain", PS(cookie_domain));
add_assoc_bool(return_value, "secure", PS(cookie_secure));
add_assoc_bool(return_value, "httponly", PS(cookie_httponly));
}
@ -2650,7 +2653,8 @@ static void php_session_rfc1867_update(php_session_rfc1867_progress *progress, i
PS(session_status) = php_session_active;
IF_SESSION_VARS() {
progress->cancel_upload |= php_check_cancel_upload(progress TSRMLS_CC);
ZEND_SET_SYMBOL_WITH_LENGTH(Z_ARRVAL_P(Z_REFVAL(PS(http_session_vars))), progress->key.s->val, progress->key.s->len, &progress->data, 2, 0);
if (Z_REFCOUNTED(progress->data)) Z_ADDREF(progress->data);
zend_hash_update(Z_ARRVAL_P(Z_REFVAL(PS(http_session_vars))), progress->key.s, &progress->data);
}
php_session_flush(TSRMLS_C);
} /* }}} */
@ -2761,8 +2765,8 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo
array_init(&progress->current_file);
/* Each uploaded file has its own array. Trying to make it close to $_FILES entries. */
add_assoc_string_ex(&progress->current_file, "field_name", sizeof("field_name") - 1, data->name, 1);
add_assoc_string_ex(&progress->current_file, "name", sizeof("name") - 1, *data->filename, 1);
add_assoc_string_ex(&progress->current_file, "field_name", sizeof("field_name") - 1, data->name);
add_assoc_string_ex(&progress->current_file, "name", sizeof("name") - 1, *data->filename);
add_assoc_null_ex(&progress->current_file, "tmp_name", sizeof("tmp_name") - 1);
add_assoc_long_ex(&progress->current_file, "error", sizeof("error") - 1, 0);
@ -2799,7 +2803,7 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo
}
if (data->temp_filename) {
add_assoc_string_ex(&progress->current_file, "tmp_name", sizeof("tmp_name") - 1, data->temp_filename, 1);
add_assoc_string_ex(&progress->current_file, "tmp_name", sizeof("tmp_name") - 1, data->temp_filename);
}
add_assoc_long_ex(&progress->current_file, "error", sizeof("error") - 1, data->cancel_upload);

View file

@ -1417,7 +1417,7 @@ static inline void sxe_add_namespace_name(zval *return_value, xmlNsPtr ns) /* {{
{
char *prefix = SXE_NS_PREFIX(ns);
if (zend_hash_str_exists(Z_ARRVAL_P(return_value), prefix, strlen(prefix)) == 0) {
add_assoc_string(return_value, prefix, (char*)ns->href, 1);
add_assoc_string(return_value, prefix, (char*)ns->href);
}
}
/* }}} */

View file

@ -2962,9 +2962,9 @@ static zval *guess_zval_convert(encodeTypePtr type, xmlNodePtr data TSRMLS_DC)
add_property_zval(soapvar, "enc_value", ret);
parse_namespace(type_name, &cptype, &ns);
nsptr = xmlSearchNs(data->doc, data, BAD_CAST(ns));
add_property_string(soapvar, "enc_stype", cptype, 1);
add_property_string(soapvar, "enc_stype", cptype);
if (nsptr) {
add_property_string(soapvar, "enc_ns", (char*)nsptr->href, 1);
add_property_string(soapvar, "enc_ns", (char*)nsptr->href);
}
efree(cptype);
if (ns) {efree(ns);}

View file

@ -849,7 +849,7 @@ try_again:
smart_str_0(&soap_headers);
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS &&
Z_LVAL_PP(trace) > 0) {
add_property_stringl(this_ptr, "__last_request_headers", soap_headers.c, soap_headers.len, 1);
add_property_stringl(this_ptr, "__last_request_headers", soap_headers.c, soap_headers.len);
}
smart_str_appendl(&soap_headers, request, request_size);
smart_str_0(&soap_headers);
@ -894,7 +894,7 @@ try_again:
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS &&
Z_LVAL_PP(trace) > 0) {
add_property_stringl(this_ptr, "__last_response_headers", http_headers, http_header_size, 1);
add_property_stringl(this_ptr, "__last_response_headers", http_headers, http_header_size);
}
/* Check to see what HTTP status was sent */
@ -970,7 +970,7 @@ try_again:
ALLOC_INIT_ZVAL(zcookie);
array_init(zcookie);
add_index_stringl(zcookie, 0, eqpos + 1, cookie_len, 1);
add_index_stringl(zcookie, 0, eqpos + 1, cookie_len);
if (sempos != NULL) {
char *options = cookie + cookie_len+1;
@ -979,10 +979,10 @@ try_again:
sempos = strstr(options, ";");
if (strstr(options,"path=") == options) {
eqpos = options + sizeof("path=")-1;
add_index_stringl(zcookie, 1, eqpos, sempos?(sempos-eqpos):strlen(eqpos), 1);
add_index_stringl(zcookie, 1, eqpos, sempos?(sempos-eqpos):strlen(eqpos));
} else if (strstr(options,"domain=") == options) {
eqpos = options + sizeof("domain=")-1;
add_index_stringl(zcookie, 2, eqpos, sempos?(sempos-eqpos):strlen(eqpos), 1);
add_index_stringl(zcookie, 2, eqpos, sempos?(sempos-eqpos):strlen(eqpos));
} else if (strstr(options,"secure") == options) {
add_index_bool(zcookie, 3, 1);
}
@ -997,11 +997,11 @@ try_again:
char *t = phpurl->path?phpurl->path:"/";
char *c = strrchr(t, '/');
if (c) {
add_index_stringl(zcookie, 1, t, c-t, 1);
add_index_stringl(zcookie, 1, t, c-t);
}
}
if (!zend_hash_index_exists(Z_ARRVAL_P(zcookie), 2)) {
add_index_string(zcookie, 2, phpurl->host, 1);
add_index_string(zcookie, 2, phpurl->host);
}
add_assoc_zval_ex(*cookies, name.c, name.len+1, zcookie);
@ -1173,7 +1173,7 @@ try_again:
ALLOC_INIT_ZVAL(digest);
array_init(digest);
}
add_assoc_string(digest, name, val ,1);
add_assoc_string(digest, name, val);
}
}

View file

@ -792,7 +792,7 @@ PHP_METHOD(SoapParam, SoapParam)
return;
}
add_property_stringl(this_ptr, "param_name", name, name_length, 1);
add_property_stringl(this_ptr, "param_name", name, name_length);
add_property_zval(this_ptr, "param_data", data);
}
/* }}} */
@ -819,8 +819,8 @@ PHP_METHOD(SoapHeader, SoapHeader)
return;
}
add_property_stringl(this_ptr, "namespace", ns, ns_len, 1);
add_property_stringl(this_ptr, "name", name, name_len, 1);
add_property_stringl(this_ptr, "namespace", ns, ns_len);
add_property_stringl(this_ptr, "name", name, name_len);
if (data) {
add_property_zval(this_ptr, "data", data);
}
@ -832,7 +832,7 @@ PHP_METHOD(SoapHeader, SoapHeader)
Z_LVAL_P(actor) == SOAP_ACTOR_UNLIMATERECEIVER)) {
add_property_long(this_ptr, "actor", Z_LVAL_P(actor));
} else if (Z_TYPE_P(actor) == IS_STRING && Z_STRLEN_P(actor) > 0) {
add_property_stringl(this_ptr, "actor", Z_STRVAL_P(actor), Z_STRLEN_P(actor), 1);
add_property_stringl(this_ptr, "actor", Z_STRVAL_P(actor), Z_STRLEN_P(actor));
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid actor");
}
@ -964,16 +964,16 @@ PHP_METHOD(SoapVar, SoapVar)
}
if (stype && stype_len > 0) {
add_property_stringl(this_ptr, "enc_stype", stype, stype_len, 1);
add_property_stringl(this_ptr, "enc_stype", stype, stype_len);
}
if (ns && ns_len > 0) {
add_property_stringl(this_ptr, "enc_ns", ns, ns_len, 1);
add_property_stringl(this_ptr, "enc_ns", ns, ns_len);
}
if (name && name_len > 0) {
add_property_stringl(this_ptr, "enc_name", name, name_len, 1);
add_property_stringl(this_ptr, "enc_name", name, name_len);
}
if (namens && namens_len > 0) {
add_property_stringl(this_ptr, "enc_namens", namens, namens_len, 1);
add_property_stringl(this_ptr, "enc_namens", namens, namens_len);
}
}
/* }}} */
@ -1357,7 +1357,7 @@ PHP_METHOD(SoapServer, getFunctions)
zend_hash_internal_pointer_reset_ex(service->soap_functions.ft, &pos);
while (zend_hash_get_current_data_ex(service->soap_functions.ft, (void **)&name, &pos) != FAILURE) {
add_next_index_string(return_value, Z_STRVAL_PP(name), 1);
add_next_index_string(return_value, Z_STRVAL_PP(name));
zend_hash_move_forward_ex(service->soap_functions.ft, &pos);
}
}
@ -1367,7 +1367,7 @@ PHP_METHOD(SoapServer, getFunctions)
zend_hash_internal_pointer_reset_ex(ft, &pos);
while (zend_hash_get_current_data_ex(ft, (void **)&f, &pos) != FAILURE) {
if ((service->type != SOAP_OBJECT && service->type != SOAP_CLASS) || (f->common.fn_flags & ZEND_ACC_PUBLIC)) {
add_next_index_string(return_value, f->common.function_name, 1);
add_next_index_string(return_value, f->common.function_name);
}
zend_hash_move_forward_ex(ft, &pos);
}
@ -2344,7 +2344,7 @@ PHP_METHOD(SoapClient, SoapClient)
/* Fetching non-WSDL mode options */
if (zend_hash_find(ht, "uri", sizeof("uri"), (void**)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_STRING) {
add_property_stringl(this_ptr, "uri", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
add_property_stringl(this_ptr, "uri", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
} else {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "'uri' option is required in nonWSDL mode");
}
@ -2370,7 +2370,7 @@ PHP_METHOD(SoapClient, SoapClient)
if (zend_hash_find(ht, "location", sizeof("location"), (void**)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_STRING) {
add_property_stringl(this_ptr, "location", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
add_property_stringl(this_ptr, "location", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
} else if (Z_TYPE_P(wsdl) == IS_NULL) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "'location' option is required in nonWSDL mode");
}
@ -2383,10 +2383,10 @@ PHP_METHOD(SoapClient, SoapClient)
}
if (zend_hash_find(ht, "login", sizeof("login"), (void**)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_STRING) {
add_property_stringl(this_ptr, "_login", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
add_property_stringl(this_ptr, "_login", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
if (zend_hash_find(ht, "password", sizeof("password"), (void**)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_STRING) {
add_property_stringl(this_ptr, "_password", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
add_property_stringl(this_ptr, "_password", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
}
if (zend_hash_find(ht, "authentication", sizeof("authentication"), (void**)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_LONG &&
@ -2396,17 +2396,17 @@ PHP_METHOD(SoapClient, SoapClient)
}
if (zend_hash_find(ht, "proxy_host", sizeof("proxy_host"), (void**)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_STRING) {
add_property_stringl(this_ptr, "_proxy_host", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
add_property_stringl(this_ptr, "_proxy_host", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
if (zend_hash_find(ht, "proxy_port", sizeof("proxy_port"), (void**)&tmp) == SUCCESS) {
convert_to_long(*tmp);
add_property_long(this_ptr, "_proxy_port", Z_LVAL_PP(tmp));
}
if (zend_hash_find(ht, "proxy_login", sizeof("proxy_login"), (void**)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_STRING) {
add_property_stringl(this_ptr, "_proxy_login", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
add_property_stringl(this_ptr, "_proxy_login", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
if (zend_hash_find(ht, "proxy_password", sizeof("proxy_password"), (void**)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_STRING) {
add_property_stringl(this_ptr, "_proxy_password", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
add_property_stringl(this_ptr, "_proxy_password", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
}
}
}
@ -2451,7 +2451,7 @@ PHP_METHOD(SoapClient, SoapClient)
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid 'encoding' option - '%s'", Z_STRVAL_PP(tmp));
} else {
xmlCharEncCloseFunc(encoding);
add_property_stringl(this_ptr, "_encoding", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
add_property_stringl(this_ptr, "_encoding", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
}
}
if (zend_hash_find(ht, "classmap", sizeof("classmap"), (void**)&tmp) == SUCCESS &&
@ -2494,7 +2494,7 @@ PHP_METHOD(SoapClient, SoapClient)
if (zend_hash_find(ht, "user_agent", sizeof("user_agent"), (void**)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_STRING) {
add_property_stringl(this_ptr, "_user_agent", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
add_property_stringl(this_ptr, "_user_agent", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
}
if (zend_hash_find(ht, "keep_alive", sizeof("keep_alive"), (void**)&tmp) == SUCCESS &&
@ -2559,7 +2559,7 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS &&
Z_LVAL_PP(trace) > 0) {
add_property_stringl(this_ptr, "__last_request", buf, buf_size, 1);
add_property_stringl(this_ptr, "__last_request", buf, buf_size);
}
INIT_ZVAL(func);
@ -2594,7 +2594,7 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act
ret = FALSE;
} else if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS &&
Z_LVAL_PP(trace) > 0) {
add_property_stringl(this_ptr, "__last_response", Z_STRVAL_P(response), Z_STRLEN_P(response), 1);
add_property_stringl(this_ptr, "__last_response", Z_STRVAL_P(response), Z_STRLEN_P(response));
}
zval_ptr_dtor(&params[4]);
zval_ptr_dtor(&params[3]);
@ -2968,7 +2968,7 @@ PHP_METHOD(SoapClient, __getFunctions)
zend_hash_internal_pointer_reset_ex(&sdl->functions, &pos);
while (zend_hash_get_current_data_ex(&sdl->functions, (void **)&function, &pos) != FAILURE) {
function_to_string((*function), &buf);
add_next_index_stringl(return_value, buf.c, buf.len, 1);
add_next_index_stringl(return_value, buf.c, buf.len);
smart_str_free(&buf);
zend_hash_move_forward_ex(&sdl->functions, &pos);
}
@ -2999,7 +2999,7 @@ PHP_METHOD(SoapClient, __getTypes)
zend_hash_internal_pointer_reset_ex(sdl->types, &pos);
while (zend_hash_get_current_data_ex(sdl->types, (void **)&type, &pos) != FAILURE) {
type_to_string((*type), &buf, 0);
add_next_index_stringl(return_value, buf.c, buf.len, 1);
add_next_index_stringl(return_value, buf.c, buf.len);
smart_str_free(&buf);
zend_hash_move_forward_ex(sdl->types, &pos);
}
@ -3145,7 +3145,7 @@ PHP_METHOD(SoapClient, __setCookie)
ALLOC_INIT_ZVAL(zcookie);
array_init(zcookie);
add_index_stringl(zcookie, 0, val, val_len, 1);
add_index_stringl(zcookie, 0, val, val_len);
add_assoc_zval_ex(*cookies, name, name_len+1, zcookie);
}
}
@ -3213,7 +3213,7 @@ PHP_METHOD(SoapClient, __setLocation)
}
if (location && location_len) {
add_property_stringl(this_ptr, "location", location, location_len, 1);
add_property_stringl(this_ptr, "location", location, location_len);
} else {
zend_hash_del(Z_OBJPROP_P(this_ptr), "location", sizeof("location"));
}
@ -3244,50 +3244,50 @@ static void set_soap_fault(zval *obj, char *fault_code_ns, char *fault_code, cha
object_init_ex(obj, soap_fault_class_entry);
}
add_property_string(obj, "faultstring", fault_string ? fault_string : "", 1);
add_property_string(obj, "faultstring", fault_string ? fault_string : "");
zend_update_property_string(zend_exception_get_default(TSRMLS_C), obj, "message", sizeof("message")-1, (fault_string ? fault_string : "") TSRMLS_CC);
if (fault_code != NULL) {
int soap_version = SOAP_GLOBAL(soap_version);
if (fault_code_ns) {
add_property_string(obj, "faultcode", fault_code, 1);
add_property_string(obj, "faultcodens", fault_code_ns, 1);
add_property_string(obj, "faultcode", fault_code);
add_property_string(obj, "faultcodens", fault_code_ns);
} else {
if (soap_version == SOAP_1_1) {
add_property_string(obj, "faultcode", fault_code, 1);
add_property_string(obj, "faultcode", fault_code);
if (strcmp(fault_code,"Client") == 0 ||
strcmp(fault_code,"Server") == 0 ||
strcmp(fault_code,"VersionMismatch") == 0 ||
strcmp(fault_code,"MustUnderstand") == 0) {
add_property_string(obj, "faultcodens", SOAP_1_1_ENV_NAMESPACE, 1);
add_property_string(obj, "faultcodens", SOAP_1_1_ENV_NAMESPACE);
}
} else if (soap_version == SOAP_1_2) {
if (strcmp(fault_code,"Client") == 0) {
add_property_string(obj, "faultcode", "Sender", 1);
add_property_string(obj, "faultcodens", SOAP_1_2_ENV_NAMESPACE, 1);
add_property_string(obj, "faultcode", "Sender");
add_property_string(obj, "faultcodens", SOAP_1_2_ENV_NAMESPACE);
} else if (strcmp(fault_code,"Server") == 0) {
add_property_string(obj, "faultcode", "Receiver", 1);
add_property_string(obj, "faultcodens", SOAP_1_2_ENV_NAMESPACE, 1);
add_property_string(obj, "faultcode", "Receiver");
add_property_string(obj, "faultcodens", SOAP_1_2_ENV_NAMESPACE);
} else if (strcmp(fault_code,"VersionMismatch") == 0 ||
strcmp(fault_code,"MustUnderstand") == 0 ||
strcmp(fault_code,"DataEncodingUnknown") == 0) {
add_property_string(obj, "faultcode", fault_code, 1);
add_property_string(obj, "faultcodens", SOAP_1_2_ENV_NAMESPACE, 1);
add_property_string(obj, "faultcode", fault_code);
add_property_string(obj, "faultcodens", SOAP_1_2_ENV_NAMESPACE);
} else {
add_property_string(obj, "faultcode", fault_code, 1);
add_property_string(obj, "faultcode", fault_code);
}
}
}
}
if (fault_actor != NULL) {
add_property_string(obj, "faultactor", fault_actor, 1);
add_property_string(obj, "faultactor", fault_actor);
}
if (fault_detail != NULL) {
add_property_zval(obj, "detail", fault_detail);
}
if (name != NULL) {
add_property_string(obj, "_name", name, 1);
add_property_string(obj, "_name", name);
}
}

View file

@ -721,7 +721,7 @@ PHP_FUNCTION(spl_autoload_functions)
if (!EG(autoload_func)) {
if ((fptr = zend_hash_str_find_ptr(EG(function_table), ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME) - 1))) {
array_init(return_value);
add_next_index_stringl(return_value, ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME)-1, 1);
add_next_index_stringl(return_value, ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME)-1);
return;
}
RETURN_FALSE;

View file

@ -1475,7 +1475,7 @@ static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int fnam
efree(Z_REF(tmp));
}
if (!ZVAL_IS_UNDEF(&retval)) {
COPY_PZVAL_TO_ZVAL(*return_value, &retval);
ZVAL_COPY_VALUE(return_value, &retval);
}
} /* }}} */

View file

@ -2679,8 +2679,8 @@ SPL_METHOD(SplFileObject, getCsvControl)
enclosure[0] = intern->u.file.enclosure;
enclosure[1] = '\0';
add_next_index_string(return_value, delimiter, 1);
add_next_index_string(return_value, enclosure, 1);
add_next_index_string(return_value, delimiter);
add_next_index_string(return_value, enclosure);
}
/* }}} */

View file

@ -240,7 +240,7 @@ PHP_METHOD(sqlite3, version)
array_init(return_value);
add_assoc_string(return_value, "versionString", (char*)sqlite3_libversion(), 1);
add_assoc_string(return_value, "versionString", (char*)sqlite3_libversion());
add_assoc_long(return_value, "versionNumber", sqlite3_libversion_number());
return;

View file

@ -1688,7 +1688,7 @@ PHP_FUNCTION(range)
goto err;
}
for (; ch >= *high; ch -= (unsigned int)lstep) {
add_next_index_stringl(return_value, (const char *)&ch, 1, 1);
add_next_index_stringl(return_value, (const char *)&ch, 1);
if (((signed int)ch - lstep) < 0) {
break;
}
@ -1701,13 +1701,13 @@ PHP_FUNCTION(range)
goto err;
}
for (; ch <= *high; ch += (unsigned int)lstep) {
add_next_index_stringl(return_value, (const char *)&ch, 1, 1);
add_next_index_stringl(return_value, (const char *)&ch, 1);
if (((signed int)ch + lstep) > 255) {
break;
}
}
} else {
add_next_index_stringl(return_value, (const char *)low, 1, 1);
add_next_index_stringl(return_value, (const char *)low, 1);
}
} else if (Z_TYPE_P(zlow) == IS_DOUBLE || Z_TYPE_P(zhigh) == IS_DOUBLE || is_step_double) {

View file

@ -4766,8 +4766,8 @@ PHP_FUNCTION(error_get_last)
if (PG(last_error_message)) {
array_init(return_value);
add_assoc_long_ex(return_value, "type", sizeof("type")-1, PG(last_error_type));
add_assoc_string_ex(return_value, "message", sizeof("message")-1, PG(last_error_message), 1);
add_assoc_string_ex(return_value, "file", sizeof("file")-1, PG(last_error_file)?PG(last_error_file):"-", 1 );
add_assoc_string_ex(return_value, "message", sizeof("message")-1, PG(last_error_message));
add_assoc_string_ex(return_value, "file", sizeof("file")-1, PG(last_error_file)?PG(last_error_file):"-");
add_assoc_long_ex(return_value, "line", sizeof("line")-1, PG(last_error_lineno));
}
}
@ -4788,7 +4788,7 @@ PHP_FUNCTION(call_user_func)
fci.retval = &retval;
if (zend_call_function(&fci, &fci_cache TSRMLS_CC) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
COPY_PZVAL_TO_ZVAL(*return_value, &retval);
ZVAL_COPY_VALUE(return_value, &retval);
}
}
/* }}} */
@ -4809,7 +4809,7 @@ PHP_FUNCTION(call_user_func_array)
fci.retval = &retval;
if (zend_call_function(&fci, &fci_cache TSRMLS_CC) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
COPY_PZVAL_TO_ZVAL(*return_value, &retval);
ZVAL_COPY_VALUE(return_value, &retval);
}
zend_fcall_info_args_clear(&fci, 1);
@ -4842,7 +4842,7 @@ PHP_FUNCTION(call_user_method)
if (call_user_function_ex(EG(function_table), object, callback, &retval, n_params, params, 0, NULL TSRMLS_CC) == SUCCESS) {
if (Z_TYPE(retval) != IS_UNDEF) {
COPY_PZVAL_TO_ZVAL(*return_value, &retval);
ZVAL_COPY_VALUE(return_value, &retval);
}
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %s()", Z_STRVAL_P(callback));
@ -4888,7 +4888,7 @@ PHP_FUNCTION(call_user_method_array)
if (call_user_function_ex(EG(function_table), object, callback, &retval, num_elems, method_args, 0, NULL TSRMLS_CC) == SUCCESS) {
if (Z_TYPE(retval) != IS_UNDEF) {
COPY_PZVAL_TO_ZVAL(*return_value, &retval);
ZVAL_COPY_VALUE(return_value, &retval);
}
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %s()", Z_STRVAL_P(callback));
@ -4922,7 +4922,7 @@ PHP_FUNCTION(forward_static_call)
}
if (zend_call_function(&fci, &fci_cache TSRMLS_CC) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
COPY_PZVAL_TO_ZVAL(*return_value, &retval);
ZVAL_COPY_VALUE(return_value, &retval);
}
}
/* }}} */
@ -4948,7 +4948,7 @@ PHP_FUNCTION(forward_static_call_array)
}
if (zend_call_function(&fci, &fci_cache TSRMLS_CC) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
COPY_PZVAL_TO_ZVAL(*return_value, &retval);
ZVAL_COPY_VALUE(return_value, &retval);
}
zend_fcall_info_args_clear(&fci, 1);
@ -5359,15 +5359,15 @@ static int php_ini_get_option(zval *zv TSRMLS_DC, int num_args, va_list args, ze
array_init(&option);
if (ini_entry->orig_value) {
add_assoc_stringl(&option, "global_value", ini_entry->orig_value, ini_entry->orig_value_length, 1);
add_assoc_stringl(&option, "global_value", ini_entry->orig_value, ini_entry->orig_value_length);
} else if (ini_entry->value) {
add_assoc_stringl(&option, "global_value", ini_entry->value, ini_entry->value_length, 1);
add_assoc_stringl(&option, "global_value", ini_entry->value, ini_entry->value_length);
} else {
add_assoc_null(&option, "global_value");
}
if (ini_entry->value) {
add_assoc_stringl(&option, "local_value", ini_entry->value, ini_entry->value_length, 1);
add_assoc_stringl(&option, "local_value", ini_entry->value, ini_entry->value_length);
} else {
add_assoc_null(&option, "local_value");
}
@ -5377,7 +5377,7 @@ static int php_ini_get_option(zval *zv TSRMLS_DC, int num_args, va_list args, ze
add_assoc_zval_ex(ini_array, ini_entry->name, ini_entry->name_length, &option);
} else {
if (ini_entry->value) {
add_assoc_stringl(ini_array, ini_entry->name, ini_entry->value, ini_entry->value_length, 1);
add_assoc_stringl(ini_array, ini_entry->name, ini_entry->value, ini_entry->value_length);
} else {
add_assoc_null(ini_array, ini_entry->name);
}

View file

@ -112,7 +112,7 @@ PHP_FUNCTION(strptime)
add_assoc_long(return_value, "tm_year", parsed_time.tm_year);
add_assoc_long(return_value, "tm_wday", parsed_time.tm_wday);
add_assoc_long(return_value, "tm_yday", parsed_time.tm_yday);
add_assoc_string(return_value, "unparsed", unparsed_part, 1);
add_assoc_string(return_value, "unparsed", unparsed_part);
}
/* }}} */

View file

@ -237,7 +237,7 @@ static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject)
if (createobject) {
object_init_ex(return_value, dir_class_entry_ptr);
add_property_stringl(return_value, "path", dirname, dir_len, 1);
add_property_stringl(return_value, "path", dirname, dir_len);
add_property_resource(return_value, "handle", dirp->res);
php_stream_auto_cleanup(dirp); /* so we don't get warnings under debug */
} else {
@ -534,7 +534,7 @@ no_results:
continue;
}
}
add_next_index_string(return_value, globbuf.gl_pathv[n]+cwd_skip, 1);
add_next_index_string(return_value, globbuf.gl_pathv[n]+cwd_skip);
}
globfree(&globbuf);

Some files were not shown because too many files have changed in this diff Show more