Browse Source

huge fix to spl and more

pull/407/head
Anatol Belski 13 years ago
parent
commit
a9b623aa0b
  1. 2
      Zend/zend_string.h
  2. 11
      ext/spl/php_spl.c
  3. 2
      ext/spl/spl_array.c
  4. 62
      ext/spl/spl_directory.c
  5. 10
      ext/spl/spl_directory.h
  6. 4
      ext/spl/spl_dllist.c
  7. 2
      ext/spl/spl_functions.h
  8. 35
      ext/spl/spl_iterators.c
  9. 2
      ext/spl/spl_iterators.h
  10. 22
      ext/spl/spl_observer.c
  11. 4
      main/streams/glob_wrapper.c
  12. 4
      main/streams/php_stream_glob_wrapper.h

2
Zend/zend_string.h

@ -24,7 +24,7 @@
#include "zend.h"
BEGIN_EXTERN_C()
ZEND_API extern const char *(*zend_new_interned_string)(const char *str, int len, int free_src TSRMLS_DC);
ZEND_API extern const char *(*zend_new_interned_string)(const char *str, zend_str_size_int len, int free_src TSRMLS_DC);
ZEND_API extern void (*zend_interned_strings_snapshot)(TSRMLS_D);
ZEND_API extern void (*zend_interned_strings_restore)(TSRMLS_D);

11
ext/spl/php_spl.c

@ -316,13 +316,14 @@ static int spl_autoload(const char *class_name, const char * lc_name, int class_
PHP_FUNCTION(spl_autoload)
{
char *class_name, *lc_name, *file_exts = SPL_G(autoload_extensions);
int class_name_len, file_exts_len = SPL_G(autoload_extensions_len), found = 0;
zend_str_size_int class_name_len, file_exts_len = SPL_G(autoload_extensions_len);
int found = 0;
char *copy, *pos1, *pos2;
zval **original_return_value = EG(return_value_ptr_ptr);
zend_op **original_opline_ptr = EG(opline_ptr);
zend_op_array *original_active_op_array = EG(active_op_array);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &class_name, &class_name_len, &file_exts, &file_exts_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|S", &class_name, &class_name_len, &file_exts, &file_exts_len) == FAILURE) {
RETURN_FALSE;
}
@ -371,9 +372,9 @@ PHP_FUNCTION(spl_autoload)
PHP_FUNCTION(spl_autoload_extensions)
{
char *file_exts = NULL;
int file_exts_len;
zend_str_size_int file_exts_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &file_exts, &file_exts_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &file_exts, &file_exts_len) == FAILURE) {
return;
}
if (file_exts) {
@ -413,7 +414,7 @@ static void autoload_func_info_dtor(autoload_func_info *alfi)
PHP_FUNCTION(spl_autoload_call)
{
zval *class_name, *retval = NULL;
int class_name_len;
zend_str_size_int class_name_len;
char *func_name, *lc_name;
zend_str_size_uint func_name_len;
ulong dummy;

2
ext/spl/spl_array.c

@ -1430,7 +1430,7 @@ SPL_METHOD(Array, count)
RETURN_LONG(count);
} /* }}} */
static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int fname_len, int use_arg) /* {{{ */
static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, zend_str_size_int fname_len, int use_arg) /* {{{ */
{
spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);

62
ext/spl/spl_directory.c

@ -383,7 +383,7 @@ static zend_object_value spl_filesystem_object_clone(zval *zobject TSRMLS_DC)
}
/* }}} */
void spl_filesystem_info_set_filename(spl_filesystem_object *intern, char *path, int len, int use_copy TSRMLS_DC) /* {{{ */
void spl_filesystem_info_set_filename(spl_filesystem_object *intern, char *path, zend_str_size_int len, int use_copy TSRMLS_DC) /* {{{ */
{
char *p1, *p2;
@ -417,7 +417,7 @@ void spl_filesystem_info_set_filename(spl_filesystem_object *intern, char *path,
intern->_path = estrndup(path, intern->_path_len);
} /* }}} */
static spl_filesystem_object * spl_filesystem_object_create_info(spl_filesystem_object *source, char *file_path, int file_path_len, int use_copy, zend_class_entry *ce, zval *return_value TSRMLS_DC) /* {{{ */
static spl_filesystem_object * spl_filesystem_object_create_info(spl_filesystem_object *source, char *file_path, zend_str_size_int file_path_len, int use_copy, zend_class_entry *ce, zval *return_value TSRMLS_DC) /* {{{ */
{
spl_filesystem_object *intern;
zval *arg1;
@ -531,7 +531,7 @@ static spl_filesystem_object * spl_filesystem_object_create_type(int ht, spl_fil
intern->u.file.open_mode = "r";
intern->u.file.open_mode_len = 1;
if (ht && zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sbr",
if (ht && zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|Sbr",
&intern->u.file.open_mode, &intern->u.file.open_mode_len,
&use_include_path, &intern->u.file.zcontext) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
@ -565,7 +565,7 @@ static int spl_filesystem_is_invalid_or_dot(const char * d_name) /* {{{ */
}
/* }}} */
static char *spl_filesystem_object_get_pathname(spl_filesystem_object *intern, int *len TSRMLS_DC) { /* {{{ */
static char *spl_filesystem_object_get_pathname(spl_filesystem_object *intern, zend_str_size_int *len TSRMLS_DC) { /* {{{ */
switch (intern->type) {
case SPL_FS_INFO:
case SPL_FS_FILE:
@ -659,7 +659,7 @@ static HashTable* spl_filesystem_object_get_debug_info(zval *obj, int *is_temp T
}
/* }}} */
zend_function *spl_filesystem_object_get_method_check(zval **object_ptr, char *method, int method_len, const struct _zend_literal *key TSRMLS_DC) /* {{{ */
zend_function *spl_filesystem_object_get_method_check(zval **object_ptr, char *method, zend_str_size_int method_len, const struct _zend_literal *key TSRMLS_DC) /* {{{ */
{
spl_filesystem_object *fsobj = zend_object_store_get_object(*object_ptr TSRMLS_CC);
@ -680,7 +680,8 @@ void spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, long ctor_fla
{
spl_filesystem_object *intern;
char *path;
int parsed, len;
int parsed;
zend_str_size_int len;
long flags;
zend_error_handling error_handling;
@ -688,10 +689,10 @@ void spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, long ctor_fla
if (SPL_HAS_FLAG(ctor_flags, DIT_CTOR_FLAGS)) {
flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO;
parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &path, &len, &flags);
parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &path, &len, &flags);
} else {
flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_SELF;
parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &path, &len);
parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &path, &len);
}
if (SPL_HAS_FLAG(ctor_flags, SPL_FILE_DIR_SKIPDOTS)) {
flags |= SPL_FILE_DIR_SKIPDOTS;
@ -869,7 +870,7 @@ SPL_METHOD(SplFileInfo, getPath)
{
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
char *path;
int path_len;
zend_str_size_int path_len;
if (zend_parse_parameters_none() == FAILURE) {
return;
@ -885,7 +886,7 @@ SPL_METHOD(SplFileInfo, getPath)
SPL_METHOD(SplFileInfo, getFilename)
{
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
int path_len;
zend_str_size_int path_len;
if (zend_parse_parameters_none() == FAILURE) {
return;
@ -923,7 +924,7 @@ SPL_METHOD(SplFileInfo, getExtension)
char *fname = NULL;
const char *p;
size_t flen;
int path_len, idx;
zend_str_size_int path_len, idx;
if (zend_parse_parameters_none() == FAILURE) {
return;
@ -964,7 +965,7 @@ SPL_METHOD(DirectoryIterator, getExtension)
char *fname = NULL;
const char *p;
size_t flen;
int idx;
zend_str_size_int idx;
if (zend_parse_parameters_none() == FAILURE) {
return;
@ -994,9 +995,9 @@ SPL_METHOD(SplFileInfo, getBasename)
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
char *fname, *suffix = 0;
size_t flen;
int slen = 0, path_len;
zend_str_size_int slen = 0, path_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &suffix, &slen) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &suffix, &slen) == FAILURE) {
return;
}
@ -1022,10 +1023,10 @@ SPL_METHOD(DirectoryIterator, getBasename)
{
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
char *suffix = 0, *fname;
int slen = 0;
zend_str_size_int slen = 0;
size_t flen;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &suffix, &slen) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &suffix, &slen) == FAILURE) {
return;
}
@ -1041,7 +1042,7 @@ SPL_METHOD(SplFileInfo, getPathname)
{
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
char *path;
int path_len;
zend_str_size_int path_len;
if (zend_parse_parameters_none() == FAILURE) {
return;
@ -1124,12 +1125,12 @@ SPL_METHOD(SplFileInfo, __construct)
{
spl_filesystem_object *intern;
char *path;
int len;
zend_str_size_int len;
zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, &error_handling TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &path, &len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &path, &len) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
@ -1401,7 +1402,7 @@ SPL_METHOD(SplFileInfo, getPathInfo)
zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|C", &ce) == SUCCESS) {
int path_len;
zend_str_size_int path_len;
char *path = spl_filesystem_object_get_pathname(intern, &path_len TSRMLS_CC);
if (path) {
char *dpath = estrndup(path, path_len);
@ -2282,7 +2283,7 @@ SPL_METHOD(SplFileObject, __construct)
zend_bool use_include_path = 0;
char *p1, *p2;
char *tmp_path;
int tmp_path_len;
zend_str_size_int tmp_path_len;
zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, &error_handling TSRMLS_CC);
@ -2290,7 +2291,7 @@ SPL_METHOD(SplFileObject, __construct)
intern->u.file.open_mode = NULL;
intern->u.file.open_mode_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|sbr",
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|Sbr",
&intern->file_name, &intern->file_name_len,
&intern->u.file.open_mode, &intern->u.file.open_mode_len,
&use_include_path, &intern->u.file.zcontext) == FAILURE) {
@ -2580,9 +2581,9 @@ SPL_METHOD(SplFileObject, fgetcsv)
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
char delimiter = intern->u.file.delimiter, enclosure = intern->u.file.enclosure, escape = intern->u.file.escape;
char *delim = NULL, *enclo = NULL, *esc = NULL;
int d_len = 0, e_len = 0, esc_len = 0;
zend_str_size_int d_len = 0, e_len = 0, esc_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sss", &delim, &d_len, &enclo, &e_len, &esc, &esc_len) == SUCCESS) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|SSS", &delim, &d_len, &enclo, &e_len, &esc, &esc_len) == SUCCESS) {
switch(ZEND_NUM_ARGS())
{
case 3:
@ -2621,10 +2622,11 @@ SPL_METHOD(SplFileObject, fputcsv)
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
char delimiter = intern->u.file.delimiter, enclosure = intern->u.file.enclosure, escape = intern->u.file.escape;
char *delim = NULL, *enclo = NULL;
int d_len = 0, e_len = 0, ret;
zend_str_size_int d_len = 0, e_len = 0;
int ret;
zval *fields = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|ss", &fields, &delim, &d_len, &enclo, &e_len) == SUCCESS) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|SS", &fields, &delim, &d_len, &enclo, &e_len) == SUCCESS) {
switch(ZEND_NUM_ARGS())
{
case 3:
@ -2658,9 +2660,9 @@ SPL_METHOD(SplFileObject, setCsvControl)
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
char delimiter = ',', enclosure = '"', escape='\\';
char *delim = NULL, *enclo = NULL, *esc = NULL;
int d_len = 0, e_len = 0, esc_len = 0;
zend_str_size_int d_len = 0, e_len = 0, esc_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sss", &delim, &d_len, &enclo, &e_len, &esc, &esc_len) == SUCCESS) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|SSS", &delim, &d_len, &enclo, &e_len, &esc, &esc_len) == SUCCESS) {
switch(ZEND_NUM_ARGS())
{
case 3:
@ -2831,10 +2833,10 @@ SPL_METHOD(SplFileObject, fwrite)
{
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
char *str;
int str_len;
zend_str_size_int str_len;
long length = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &length) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &str, &str_len, &length) == FAILURE) {
return;
}

10
ext/spl/spl_directory.h

@ -45,7 +45,7 @@ typedef struct _spl_filesystem_object spl_filesystem_object;
typedef void (*spl_foreign_dtor_t)(spl_filesystem_object *object TSRMLS_DC);
typedef void (*spl_foreign_clone_t)(spl_filesystem_object *src, spl_filesystem_object *dst TSRMLS_DC);
PHPAPI char* spl_filesystem_object_get_path(spl_filesystem_object *intern, int *len TSRMLS_DC);
PHPAPI char* spl_filesystem_object_get_path(spl_filesystem_object *intern, zend_str_size_int *len TSRMLS_DC);
typedef struct _spl_other_handler {
spl_foreign_dtor_t dtor;
@ -64,10 +64,10 @@ struct _spl_filesystem_object {
void *oth;
spl_other_handler *oth_handler;
char *_path;
int _path_len;
zend_str_size_int _path_len;
char *orig_path;
char *file_name;
int file_name_len;
zend_str_size_int file_name_len;
SPL_FS_OBJ_TYPE type;
long flags;
zend_class_entry *file_class;
@ -77,7 +77,7 @@ struct _spl_filesystem_object {
php_stream *dirp;
php_stream_dirent entry;
char *sub_path;
int sub_path_len;
zend_str_size_int sub_path_len;
int index;
int is_recursive;
zend_function *func_rewind;
@ -89,7 +89,7 @@ struct _spl_filesystem_object {
php_stream_context *context;
zval *zcontext;
char *open_mode;
int open_mode_len;
size_t open_mode_len;
zval *current_zval;
char *current_line;
size_t current_line_len;

4
ext/spl/spl_dllist.c

@ -1183,11 +1183,11 @@ SPL_METHOD(SplDoublyLinkedList, unserialize)
spl_dllist_object *intern = (spl_dllist_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
zval *flags, *elem;
char *buf;
int buf_len;
zend_str_size_int buf_len;
const unsigned char *p, *s;
php_unserialize_data_t var_hash;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buf, &buf_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &buf, &buf_len) == FAILURE) {
return;
}

2
ext/spl/spl_functions.h

@ -66,7 +66,7 @@ void spl_add_traits(zval * list, zend_class_entry * pce, int allow, int ce_flags
int spl_add_classes(zend_class_entry *pce, zval *list, int sub, int allow, int ce_flags TSRMLS_DC);
/* caller must efree(return) */
char * spl_gen_private_prop_name(zend_class_entry *ce, char *prop_name, int prop_len, int *name_len TSRMLS_DC);
char * spl_gen_private_prop_name(zend_class_entry *ce, char *prop_name, zend_str_size_int prop_len, zend_str_size_int *name_len TSRMLS_DC);
#define SPL_ME(class_name, function_name, arg_info, flags) \
PHP_ME( spl_ ## class_name, function_name, arg_info, flags)

35
ext/spl/spl_iterators.c

@ -828,7 +828,7 @@ SPL_METHOD(RecursiveIteratorIterator, getMaxDepth)
}
} /* }}} */
static union _zend_function *spl_recursive_it_get_method(zval **object_ptr, char *method, int method_len, const zend_literal *key TSRMLS_DC)
static union _zend_function *spl_recursive_it_get_method(zval **object_ptr, char *method, zend_str_size_int method_len, const zend_literal *key TSRMLS_DC)
{
union _zend_function *function_handler;
spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(*object_ptr TSRMLS_CC);
@ -1042,9 +1042,9 @@ SPL_METHOD(RecursiveTreeIterator, setPrefixPart)
spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
long part;
char* prefix;
int prefix_len;
zend_str_size_int prefix_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &part, &prefix, &prefix_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lS", &part, &prefix, &prefix_len) == FAILURE) {
return;
}
if (0 > part || part > 5) {
@ -1255,7 +1255,7 @@ static int spl_dual_it_gets_implemented(zend_class_entry *interface, zend_class_
}
#endif
static union _zend_function *spl_dual_it_get_method(zval **object_ptr, char *method, int method_len, const zend_literal *key TSRMLS_DC)
static union _zend_function *spl_dual_it_get_method(zval **object_ptr, char *method, zend_str_size_int method_len, const zend_literal *key TSRMLS_DC)
{
union _zend_function *function_handler;
spl_dual_it_object *intern;
@ -1402,9 +1402,9 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
case DIT_IteratorIterator: {
zend_class_entry **pce_cast;
char * class_name = NULL;
int class_name_len = 0;
zend_str_size_int class_name_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|s", &zobject, ce_inner, &class_name, &class_name_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|S", &zobject, ce_inner, &class_name, &class_name_len) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return NULL;
}
@ -1452,13 +1452,13 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
case DIT_RegexIterator:
case DIT_RecursiveRegexIterator: {
char *regex;
int regex_len;
zend_str_size_int regex_len;
long mode = REGIT_MODE_MATCH;
intern->u.regex.use_flags = ZEND_NUM_ARGS() >= 5;
intern->u.regex.flags = 0;
intern->u.regex.preg_flags = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os|lll", &zobject, ce_inner, &regex, &regex_len, &mode, &intern->u.regex.flags, &intern->u.regex.preg_flags) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OS|lll", &zobject, ce_inner, &regex, &regex_len, &mode, &intern->u.regex.flags, &intern->u.regex.preg_flags) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return NULL;
}
@ -1944,7 +1944,8 @@ SPL_METHOD(RegexIterator, accept)
{
spl_dual_it_object *intern;
char *subject, *result;
int subject_len, use_copy, count = 0, result_len;
zend_str_size_int subject_len;
int use_copy, count = 0, result_len;
zval *subject_ptr, subject_copy, zcount, *replacement, tmp_replacement;
if (zend_parse_parameters_none() == FAILURE) {
@ -2739,7 +2740,7 @@ SPL_METHOD(CachingIterator, offsetSet)
{
spl_dual_it_object *intern;
char *arKey;
uint nKeyLength;
zend_str_size_uint nKeyLength;
zval *value;
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
@ -2749,7 +2750,7 @@ SPL_METHOD(CachingIterator, offsetSet)
return;
}
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &arKey, &nKeyLength, &value) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz", &arKey, &nKeyLength, &value) == FAILURE) {
return;
}
@ -2764,7 +2765,7 @@ SPL_METHOD(CachingIterator, offsetGet)
{
spl_dual_it_object *intern;
char *arKey;
uint nKeyLength;
zend_str_size_uint nKeyLength;
zval **value;
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
@ -2774,7 +2775,7 @@ SPL_METHOD(CachingIterator, offsetGet)
return;
}
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arKey, &nKeyLength) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &arKey, &nKeyLength) == FAILURE) {
return;
}
@ -2793,7 +2794,7 @@ SPL_METHOD(CachingIterator, offsetUnset)
{
spl_dual_it_object *intern;
char *arKey;
uint nKeyLength;
zend_str_size_uint nKeyLength;
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
@ -2802,7 +2803,7 @@ SPL_METHOD(CachingIterator, offsetUnset)
return;
}
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arKey, &nKeyLength) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &arKey, &nKeyLength) == FAILURE) {
return;
}
@ -2816,7 +2817,7 @@ SPL_METHOD(CachingIterator, offsetExists)
{
spl_dual_it_object *intern;
char *arKey;
uint nKeyLength;
zend_str_size_uint nKeyLength;
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
@ -2825,7 +2826,7 @@ SPL_METHOD(CachingIterator, offsetExists)
return;
}
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arKey, &nKeyLength) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &arKey, &nKeyLength) == FAILURE) {
return;
}

2
ext/spl/spl_iterators.h

@ -160,7 +160,7 @@ typedef struct _spl_dual_it_object {
long preg_flags;
pcre_cache_entry *pce;
char *regex;
uint regex_len;
zend_str_size_uint regex_len;
} regex;
#endif
_spl_cbfilter_it_intern *cbfilter;

22
ext/spl/spl_observer.c

@ -110,13 +110,13 @@ void spl_SplOjectStorage_free_storage(void *object TSRMLS_DC) /* {{{ */
efree(object);
} /* }}} */
static char *spl_object_storage_get_hash(spl_SplObjectStorage *intern, zval *this, zval *obj, int *hash_len_ptr TSRMLS_DC) {
static char *spl_object_storage_get_hash(spl_SplObjectStorage *intern, zval *this, zval *obj, zend_str_size_int *hash_len_ptr TSRMLS_DC) {
if (intern->fptr_get_hash) {
zval *rv;
zend_call_method_with_1_params(&this, intern->std.ce, &intern->fptr_get_hash, "getHash", &rv, obj);
if (rv) {
if (Z_TYPE_P(rv) == IS_STRING) {
int hash_len = Z_STRSIZE_P(rv);
zend_str_size_int hash_len = Z_STRSIZE_P(rv);
char *hash = emalloc((hash_len+1)*sizeof(char));
strncpy(hash, Z_STRVAL_P(rv), hash_len);
hash[hash_len] = 0;
@ -183,7 +183,7 @@ static void spl_object_storage_dtor(spl_SplObjectStorageElement *element) /* {{{
zval_ptr_dtor(&element->inf);
} /* }}} */
spl_SplObjectStorageElement* spl_object_storage_get(spl_SplObjectStorage *intern, char *hash, int hash_len TSRMLS_DC) /* {{{ */
spl_SplObjectStorageElement* spl_object_storage_get(spl_SplObjectStorage *intern, char *hash, zend_str_size_int hash_len TSRMLS_DC) /* {{{ */
{
spl_SplObjectStorageElement *element;
if (zend_hash_find(&intern->storage, hash, hash_len, (void**)&element) == SUCCESS) {
@ -197,7 +197,7 @@ void spl_object_storage_attach(spl_SplObjectStorage *intern, zval *this, zval *o
{
spl_SplObjectStorageElement *pelement, element;
int hash_len;
zend_str_size_int hash_len;
char *hash = spl_object_storage_get_hash(intern, this, obj, &hash_len TSRMLS_CC);
if (!hash) {
return;
@ -225,7 +225,8 @@ void spl_object_storage_attach(spl_SplObjectStorage *intern, zval *this, zval *o
int spl_object_storage_detach(spl_SplObjectStorage *intern, zval *this, zval *obj TSRMLS_DC) /* {{{ */
{
int hash_len, ret = FAILURE;
zend_str_size_int hash_len;
int ret = FAILURE;
char *hash = spl_object_storage_get_hash(intern, this, obj, &hash_len TSRMLS_CC);
if (!hash) {
return ret;
@ -438,7 +439,8 @@ static zend_object_value spl_SplObjectStorage_new(zend_class_entry *class_type T
int spl_object_storage_contains(spl_SplObjectStorage *intern, zval *this, zval *obj TSRMLS_DC) /* {{{ */
{
int hash_len, found;
zend_str_size_int hash_len;
int found;
char *hash = spl_object_storage_get_hash(intern, this, obj, &hash_len TSRMLS_CC);
if (!hash) {
return 0;
@ -505,7 +507,7 @@ SPL_METHOD(SplObjectStorage, offsetGet)
spl_SplObjectStorageElement *element;
spl_SplObjectStorage *intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC);
char *hash;
int hash_len;
zend_str_size_int hash_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &obj) == FAILURE) {
return;
@ -803,13 +805,13 @@ SPL_METHOD(SplObjectStorage, unserialize)
spl_SplObjectStorage *intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC);
char *buf;
int buf_len;
zend_str_size_int buf_len;
const unsigned char *p, *s;
php_unserialize_data_t var_hash;
zval *pentry, *pmembers, *pcount = NULL, *pinf;
long count;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buf, &buf_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &buf, &buf_len) == FAILURE) {
return;
}
@ -838,7 +840,7 @@ SPL_METHOD(SplObjectStorage, unserialize)
while(count-- > 0) {
spl_SplObjectStorageElement *pelement;
char *hash;
int hash_len;
zend_str_size_int hash_len;
if (*p != ';') {
goto outexcept;

4
main/streams/glob_wrapper.c

@ -47,7 +47,7 @@ typedef struct {
size_t pattern_len;
} glob_s_t;
PHPAPI char* _php_glob_stream_get_path(php_stream *stream, int copy, int *plen STREAMS_DC TSRMLS_DC) /* {{{ */
PHPAPI char* _php_glob_stream_get_path(php_stream *stream, int copy, zend_str_size_int *plen STREAMS_DC TSRMLS_DC) /* {{{ */
{
glob_s_t *pglob = (glob_s_t *)stream->abstract;
@ -69,7 +69,7 @@ PHPAPI char* _php_glob_stream_get_path(php_stream *stream, int copy, int *plen S
}
/* }}} */
PHPAPI char* _php_glob_stream_get_pattern(php_stream *stream, int copy, int *plen STREAMS_DC TSRMLS_DC) /* {{{ */
PHPAPI char* _php_glob_stream_get_pattern(php_stream *stream, int copy, zend_str_size_int *plen STREAMS_DC TSRMLS_DC) /* {{{ */
{
glob_s_t *pglob = (glob_s_t *)stream->abstract;

4
main/streams/php_stream_glob_wrapper.h

@ -23,10 +23,10 @@ PHPAPI extern php_stream_ops php_glob_stream_ops;
BEGIN_EXTERN_C()
PHPAPI char* _php_glob_stream_get_path(php_stream *stream, int copy, int *plen STREAMS_DC TSRMLS_DC);
PHPAPI char* _php_glob_stream_get_path(php_stream *stream, int copy, zend_str_size_int *plen STREAMS_DC TSRMLS_DC);
#define php_glob_stream_get_path(stream, copy, plen) _php_glob_stream_get_path((stream), (copy), (plen) STREAMS_CC TSRMLS_CC)
PHPAPI char* _php_glob_stream_get_pattern(php_stream *stream, int copy, int *plen STREAMS_DC TSRMLS_DC);
PHPAPI char* _php_glob_stream_get_pattern(php_stream *stream, int copy, zend_str_size_int *plen STREAMS_DC TSRMLS_DC);
#define php_glob_stream_get_pattern(stream, copy, plen) _php_glob_stream_get_pattern((stream), (copy), (plen) STREAMS_CC TSRMLS_CC)
PHPAPI int _php_glob_stream_get_count(php_stream *stream, int *pflags STREAMS_DC TSRMLS_DC);

Loading…
Cancel
Save