diff options
author | Felipe Pena <felipe@php.net> | 2010-11-14 18:40:08 +0000 |
---|---|---|
committer | Felipe Pena <felipe@php.net> | 2010-11-14 18:40:08 +0000 |
commit | 8192f0f771b28fade7d2b7b56dcab2c36a111f22 (patch) | |
tree | ab9a62c28b9c7eb85629cb6821546c88719ffff7 /ext | |
parent | 5f31c445095089154d32282a28c1b7920cac6579 (diff) | |
download | php-git-8192f0f771b28fade7d2b7b56dcab2c36a111f22.tar.gz |
- Added missing void arg checks
Diffstat (limited to 'ext')
-rwxr-xr-x | ext/spl/php_spl.c | 15 | ||||
-rwxr-xr-x | ext/spl/spl_array.c | 48 | ||||
-rwxr-xr-x | ext/spl/spl_directory.c | 137 | ||||
-rw-r--r-- | ext/spl/spl_dllist.c | 24 | ||||
-rw-r--r-- | ext/spl/spl_heap.c | 23 | ||||
-rwxr-xr-x | ext/spl/spl_iterators.c | 231 | ||||
-rwxr-xr-x | ext/spl/spl_observer.c | 58 | ||||
-rw-r--r-- | ext/spl/tests/arrayObject_count_basic1.phpt | 8 | ||||
-rw-r--r-- | ext/spl/tests/fileobject_005.phpt | 6 |
9 files changed, 533 insertions, 17 deletions
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index e7733c1e39..34f63fbcb1 100755 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -339,14 +339,13 @@ PHP_FUNCTION(spl_autoload) Register and return default file extensions for spl_autoload */ PHP_FUNCTION(spl_autoload_extensions) { - char *file_exts; + char *file_exts = NULL; int file_exts_len; - if (ZEND_NUM_ARGS() > 0) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &file_exts, &file_exts_len) == FAILURE) { - return; - } - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &file_exts, &file_exts_len) == FAILURE) { + return; + } + if (file_exts) { if (SPL_G(autoload_extensions)) { efree(SPL_G(autoload_extensions)); } @@ -676,6 +675,10 @@ PHP_FUNCTION(spl_autoload_functions) HashPosition function_pos; autoload_func_info *alfi; + if (zend_parse_parameters_none() == FAILURE) { + return; + } + if (!EG(autoload_func)) { if (zend_hash_find(EG(function_table), ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME), (void **) &fptr) == SUCCESS) { array_init(return_value); diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index 81ec0e092a..22b105b09e 100755 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -1136,6 +1136,10 @@ SPL_METHOD(Array, getIteratorClass) { zval *object = getThis(); spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } RETURN_STRING(intern->ce_get_iterator->name, 1); } @@ -1148,6 +1152,10 @@ SPL_METHOD(Array, getFlags) zval *object = getThis(); spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); + if (zend_parse_parameters_none() == FAILURE) { + return; + } + RETURN_LONG(intern->ar_flags & ~SPL_ARRAY_INT_MASK); } /* }}} */ @@ -1195,6 +1203,10 @@ SPL_METHOD(Array, getIterator) spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); spl_array_object *iterator; HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } if (!aht) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and is no longer an array"); @@ -1214,6 +1226,10 @@ SPL_METHOD(Array, rewind) { zval *object = getThis(); spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } spl_array_rewind(intern TSRMLS_CC); } @@ -1309,6 +1325,10 @@ SPL_METHOD(Array, count) { long count; spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } spl_array_object_count_elements_helper(intern, &count TSRMLS_CC); @@ -1392,6 +1412,10 @@ SPL_METHOD(Array, current) spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); zval **entry; HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } if (!aht) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and is no longer an array"); @@ -1414,6 +1438,10 @@ SPL_METHOD(Array, current) Return current array key */ SPL_METHOD(Array, key) { + if (zend_parse_parameters_none() == FAILURE) { + return; + } + spl_array_iterator_key(getThis(), return_value TSRMLS_CC); } /* }}} */ @@ -1456,6 +1484,10 @@ SPL_METHOD(Array, next) spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); + if (zend_parse_parameters_none() == FAILURE) { + return; + } + if (!aht) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and is no longer an array"); return; @@ -1473,6 +1505,10 @@ SPL_METHOD(Array, valid) spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); + if (zend_parse_parameters_none() == FAILURE) { + return; + } + if (!aht) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and is no longer an array"); return; @@ -1495,6 +1531,10 @@ SPL_METHOD(Array, hasChildren) spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); + if (zend_parse_parameters_none() == FAILURE) { + return; + } + if (!aht) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and is no longer an array"); RETURN_FALSE; @@ -1520,6 +1560,10 @@ SPL_METHOD(Array, getChildren) zval *object = getThis(), **entry, *flags; spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } if (!aht) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and is no longer an array"); @@ -1562,6 +1606,10 @@ SPL_METHOD(Array, serialize) php_serialize_data_t var_hash; smart_str buf = {0}; zval *flags; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } if (!aht) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and is no longer an array"); diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index e80d52323c..cacb11f180 100755 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -677,6 +677,10 @@ SPL_METHOD(DirectoryIterator, __construct) SPL_METHOD(DirectoryIterator, rewind) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } intern->u.dir.index = 0; if (intern->u.dir.dirp) { @@ -691,6 +695,10 @@ SPL_METHOD(DirectoryIterator, rewind) SPL_METHOD(DirectoryIterator, key) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } if (intern->u.dir.dirp) { RETURN_LONG(intern->u.dir.index); @@ -704,6 +712,9 @@ SPL_METHOD(DirectoryIterator, key) Return this (needed for Iterator interface) */ SPL_METHOD(DirectoryIterator, current) { + if (zend_parse_parameters_none() == FAILURE) { + return; + } RETURN_ZVAL(getThis(), 1, 0); } /* }}} */ @@ -714,6 +725,10 @@ SPL_METHOD(DirectoryIterator, next) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); int skip_dots = SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_SKIPDOTS); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } intern->u.dir.index++; do { @@ -768,6 +783,10 @@ SPL_METHOD(DirectoryIterator, seek) SPL_METHOD(DirectoryIterator, valid) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } RETURN_BOOL(intern->u.dir.entry.d_name[0] != '\0'); } @@ -780,6 +799,10 @@ SPL_METHOD(SplFileInfo, getPath) spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); char *path; int path_len; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } path = spl_filesystem_object_get_path(intern, &path_len TSRMLS_CC); RETURN_STRINGL(path, path_len, 1); @@ -792,6 +815,10 @@ SPL_METHOD(SplFileInfo, getFilename) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); int path_len; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } spl_filesystem_object_get_path(intern, &path_len TSRMLS_CC); @@ -808,6 +835,10 @@ SPL_METHOD(SplFileInfo, getFilename) SPL_METHOD(DirectoryIterator, getFilename) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } RETURN_STRING(intern->u.dir.entry.d_name, 1); } @@ -868,6 +899,10 @@ SPL_METHOD(SplFileInfo, getPathname) spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); char *path; int path_len; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } path = spl_filesystem_object_get_pathname(intern, &path_len TSRMLS_CC); if (path != NULL) { RETURN_STRINGL(path, path_len, 1); @@ -882,6 +917,10 @@ SPL_METHOD(SplFileInfo, getPathname) SPL_METHOD(FilesystemIterator, key) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } if (SPL_FILE_DIR_KEY(intern, SPL_FILE_DIR_KEY_AS_FILENAME)) { RETURN_STRING(intern->u.dir.entry.d_name, 1); @@ -897,6 +936,10 @@ SPL_METHOD(FilesystemIterator, key) SPL_METHOD(FilesystemIterator, current) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } if (SPL_FILE_DIR_CURRENT(intern, SPL_FILE_DIR_CURRENT_AS_PATHNAME)) { spl_filesystem_object_get_file_name(intern TSRMLS_CC); @@ -916,6 +959,10 @@ SPL_METHOD(FilesystemIterator, current) SPL_METHOD(DirectoryIterator, isDot) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } RETURN_BOOL(spl_filesystem_is_dot(intern->u.dir.entry.d_name)); } @@ -960,6 +1007,9 @@ SPL_METHOD(SplFileInfo, func_name) \ { \ spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); \ zend_error_handling error_handling; \ + if (zend_parse_parameters_none() == FAILURE) { \ + return; \ + } \ \ zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, &error_handling TSRMLS_CC);\ spl_filesystem_object_get_file_name(intern TSRMLS_CC); \ @@ -1051,6 +1101,10 @@ SPL_METHOD(SplFileInfo, getLinkTarget) int ret; char buff[MAXPATHLEN]; zend_error_handling error_handling; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, &error_handling TSRMLS_CC); @@ -1095,6 +1149,10 @@ SPL_METHOD(SplFileInfo, getRealPath) char buff[MAXPATHLEN]; char *filename; zend_error_handling error_handling; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, &error_handling TSRMLS_CC); @@ -1228,6 +1286,10 @@ SPL_METHOD(FilesystemIterator, rewind) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + if (zend_parse_parameters_none() == FAILURE) { + return; + } + intern->u.dir.index = 0; if (intern->u.dir.dirp) { php_stream_rewinddir(intern->u.dir.dirp); @@ -1243,6 +1305,10 @@ SPL_METHOD(FilesystemIterator, rewind) SPL_METHOD(FilesystemIterator, getFlags) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } RETURN_LONG(intern->flags & (SPL_FILE_DIR_KEY_MODE_MASK | SPL_FILE_DIR_CURRENT_MODE_MASK | SPL_FILE_DIR_OTHERS_MASK)); } /* }}} */ @@ -1254,7 +1320,9 @@ SPL_METHOD(FilesystemIterator, setFlags) spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); long flags; - zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &flags); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &flags) == FAILURE) { + return; + } intern->flags &= ~(SPL_FILE_DIR_KEY_MODE_MASK|SPL_FILE_DIR_CURRENT_MODE_MASK|SPL_FILE_DIR_OTHERS_MASK); intern->flags |= ((SPL_FILE_DIR_KEY_MODE_MASK|SPL_FILE_DIR_CURRENT_MODE_MASK|SPL_FILE_DIR_OTHERS_MASK) & flags); @@ -1266,13 +1334,13 @@ SPL_METHOD(RecursiveDirectoryIterator, hasChildren) { zend_bool allow_links = 0; spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &allow_links) == FAILURE) { + return; + } if (spl_filesystem_is_invalid_or_dot(intern->u.dir.entry.d_name)) { RETURN_FALSE; } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &allow_links) == FAILURE) { - return; - } spl_filesystem_object_get_file_name(intern TSRMLS_CC); if (!allow_links && !(intern->flags & SPL_FILE_DIR_FOLLOW_SYMLINKS)) { php_stat(intern->file_name, intern->file_name_len, FS_IS_LINK, return_value TSRMLS_CC); @@ -1294,6 +1362,10 @@ SPL_METHOD(RecursiveDirectoryIterator, getChildren) spl_filesystem_object *subdir; char slash = SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_UNIXPATHS) ? '/' : DEFAULT_SLASH; + if (zend_parse_parameters_none() == FAILURE) { + return; + } + spl_filesystem_object_get_file_name(intern TSRMLS_CC); if (SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_CURRENT_AS_PATHNAME)) { @@ -1326,6 +1398,10 @@ SPL_METHOD(RecursiveDirectoryIterator, getChildren) SPL_METHOD(RecursiveDirectoryIterator, getSubPath) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } if (intern->u.dir.sub_path) { RETURN_STRINGL(intern->u.dir.sub_path, intern->u.dir.sub_path_len, 1); @@ -1343,6 +1419,10 @@ SPL_METHOD(RecursiveDirectoryIterator, getSubPathname) char *sub_name; int len; char slash = SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_UNIXPATHS) ? '/' : DEFAULT_SLASH; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } if (intern->u.dir.sub_path) { len = spprintf(&sub_name, 0, "%s%c%s", intern->u.dir.sub_path, slash, intern->u.dir.entry.d_name); @@ -1374,6 +1454,10 @@ SPL_METHOD(GlobIterator, __construct) SPL_METHOD(GlobIterator, count) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } if (php_stream_is(intern->u.dir.dirp ,&php_glob_stream_ops)) { RETURN_LONG(php_glob_stream_get_count(intern->u.dir.dirp, NULL)); @@ -2118,6 +2202,10 @@ SPL_METHOD(SplTempFileObject, __construct) SPL_METHOD(SplFileObject, rewind) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } spl_filesystem_file_rewind(getThis(), intern TSRMLS_CC); } /* }}} */ @@ -2127,6 +2215,10 @@ SPL_METHOD(SplFileObject, rewind) SPL_METHOD(SplFileObject, eof) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } RETURN_BOOL(php_stream_eof(intern->u.file.stream)); } /* }}} */ @@ -2136,6 +2228,10 @@ SPL_METHOD(SplFileObject, eof) SPL_METHOD(SplFileObject, valid) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } if (SPL_HAS_FLAG(intern->flags, SPL_FILE_OBJECT_READ_AHEAD)) { RETURN_BOOL(intern->u.file.current_line || intern->u.file.current_zval); @@ -2149,6 +2245,10 @@ SPL_METHOD(SplFileObject, valid) SPL_METHOD(SplFileObject, fgets) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } if (spl_filesystem_file_read(intern, 0 TSRMLS_CC) == FAILURE) { RETURN_FALSE; @@ -2161,6 +2261,10 @@ SPL_METHOD(SplFileObject, fgets) SPL_METHOD(SplFileObject, current) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } if (!intern->u.file.current_line && !intern->u.file.current_zval) { spl_filesystem_file_read_line(getThis(), intern, 1 TSRMLS_CC); @@ -2178,6 +2282,10 @@ SPL_METHOD(SplFileObject, current) SPL_METHOD(SplFileObject, key) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } /* Do not read the next line to support correct counting with fgetc() if (!intern->current_line) { @@ -2191,6 +2299,10 @@ SPL_METHOD(SplFileObject, key) SPL_METHOD(SplFileObject, next) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } spl_filesystem_file_free_line(intern TSRMLS_CC); if (SPL_HAS_FLAG(intern->flags, SPL_FILE_OBJECT_READ_AHEAD)) { @@ -2214,6 +2326,10 @@ SPL_METHOD(SplFileObject, getFlags) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + if (zend_parse_parameters_none() == FAILURE) { + return; + } + RETURN_LONG(intern->flags & SPL_FILE_OBJECT_MASK); } /* }}} */ @@ -2242,6 +2358,10 @@ SPL_METHOD(SplFileObject, setMaxLineLen) SPL_METHOD(SplFileObject, getMaxLineLen) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } RETURN_LONG((long)intern->u.file.max_line_len); } /* }}} */ @@ -2250,6 +2370,10 @@ SPL_METHOD(SplFileObject, getMaxLineLen) Return false */ SPL_METHOD(SplFileObject, hasChildren) { + if (zend_parse_parameters_none() == FAILURE) { + return; + } + RETURN_FALSE; } /* }}} */ @@ -2257,6 +2381,9 @@ SPL_METHOD(SplFileObject, hasChildren) Read NULL */ SPL_METHOD(SplFileObject, getChildren) { + if (zend_parse_parameters_none() == FAILURE) { + return; + } /* return NULL */ } /* }}} */ diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c index d3b0b38b91..d35e20adf7 100644 --- a/ext/spl/spl_dllist.c +++ b/ext/spl/spl_dllist.c @@ -1045,6 +1045,10 @@ static void spl_dllist_it_move_forward(zend_object_iterator *iter TSRMLS_DC) /* SPL_METHOD(SplDoublyLinkedList, key) { spl_dllist_object *intern = (spl_dllist_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } RETURN_LONG(intern->traverse_position); } @@ -1055,6 +1059,10 @@ SPL_METHOD(SplDoublyLinkedList, key) SPL_METHOD(SplDoublyLinkedList, prev) { spl_dllist_object *intern = (spl_dllist_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } spl_dllist_it_helper_move_forward(&intern->traverse_pointer, &intern->traverse_position, intern->llist, intern->flags ^ SPL_DLLIST_IT_LIFO TSRMLS_CC); } @@ -1065,6 +1073,10 @@ SPL_METHOD(SplDoublyLinkedList, prev) SPL_METHOD(SplDoublyLinkedList, next) { spl_dllist_object *intern = (spl_dllist_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } spl_dllist_it_helper_move_forward(&intern->traverse_pointer, &intern->traverse_position, intern->llist, intern->flags TSRMLS_CC); } @@ -1075,6 +1087,10 @@ SPL_METHOD(SplDoublyLinkedList, next) SPL_METHOD(SplDoublyLinkedList, valid) { spl_dllist_object *intern = (spl_dllist_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } RETURN_BOOL(intern->traverse_pointer != NULL); } @@ -1085,6 +1101,10 @@ SPL_METHOD(SplDoublyLinkedList, valid) SPL_METHOD(SplDoublyLinkedList, rewind) { spl_dllist_object *intern = (spl_dllist_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } spl_dllist_it_helper_rewind(&intern->traverse_pointer, &intern->traverse_position, intern->llist, intern->flags TSRMLS_CC); } @@ -1096,6 +1116,10 @@ SPL_METHOD(SplDoublyLinkedList, current) { spl_dllist_object *intern = (spl_dllist_object*)zend_object_store_get_object(getThis() TSRMLS_CC); spl_ptr_llist_element *element = intern->traverse_pointer; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } if (element == NULL || element->data == NULL) { RETURN_NULL(); diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c index 45ec68096a..d2fffd45a5 100644 --- a/ext/spl/spl_heap.c +++ b/ext/spl/spl_heap.c @@ -985,6 +985,10 @@ SPL_METHOD(SplHeap, key) { spl_heap_object *intern = (spl_heap_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + if (zend_parse_parameters_none() == FAILURE) { + return; + } + RETURN_LONG(intern->heap->count - 1); } /* }}} */ @@ -995,6 +999,10 @@ SPL_METHOD(SplHeap, next) { spl_heap_object *intern = (spl_heap_object*)zend_object_store_get_object(getThis() TSRMLS_CC); spl_ptr_heap_element elem = spl_ptr_heap_delete_top(intern->heap, getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } if (elem != NULL) { zval_ptr_dtor((zval **)&elem); @@ -1007,6 +1015,10 @@ SPL_METHOD(SplHeap, next) SPL_METHOD(SplHeap, valid) { spl_heap_object *intern = (spl_heap_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } RETURN_BOOL(intern->heap->count != 0); } @@ -1016,6 +1028,9 @@ SPL_METHOD(SplHeap, valid) Rewind the datastructure back to the start */ SPL_METHOD(SplHeap, rewind) { + if (zend_parse_parameters_none() == FAILURE) { + return; + } /* do nothing, the iterator always points to the top element */ } /* }}} */ @@ -1026,6 +1041,10 @@ SPL_METHOD(SplHeap, current) { spl_heap_object *intern = (spl_heap_object*)zend_object_store_get_object(getThis() TSRMLS_CC); zval *element = (zval *)intern->heap->elements[0]; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } if (!intern->heap->count || !element) { RETURN_NULL(); @@ -1041,6 +1060,10 @@ SPL_METHOD(SplPriorityQueue, current) { spl_heap_object *intern = (spl_heap_object*)zend_object_store_get_object(getThis() TSRMLS_CC); zval **element = (zval **)&intern->heap->elements[0]; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } if (!intern->heap->count || !*element) { RETURN_NULL(); diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index 7904662697..c33ea4187d 100755 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -562,6 +562,10 @@ SPL_METHOD(RecursiveIteratorIterator, __construct) SPL_METHOD(RecursiveIteratorIterator, rewind) { spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } spl_recursive_it_rewind_ex(object, getThis() TSRMLS_CC); } /* }}} */ @@ -571,6 +575,10 @@ SPL_METHOD(RecursiveIteratorIterator, rewind) SPL_METHOD(RecursiveIteratorIterator, valid) { spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } RETURN_BOOL(spl_recursive_it_valid_ex(object, getThis() TSRMLS_CC) == SUCCESS); } /* }}} */ @@ -581,6 +589,10 @@ SPL_METHOD(RecursiveIteratorIterator, key) { spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); zend_object_iterator *iterator = object->iterators[object->level].iterator; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } if (iterator->funcs->get_current_key) { char *str_key; @@ -609,6 +621,10 @@ SPL_METHOD(RecursiveIteratorIterator, current) spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); zend_object_iterator *iterator = object->iterators[object->level].iterator; zval **data; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } iterator->funcs->get_current_data(iterator, &data TSRMLS_CC); if (data && *data) { @@ -621,6 +637,10 @@ SPL_METHOD(RecursiveIteratorIterator, current) SPL_METHOD(RecursiveIteratorIterator, next) { spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } spl_recursive_it_move_forward_ex(object, getThis() TSRMLS_CC); } /* }}} */ @@ -631,6 +651,10 @@ SPL_METHOD(RecursiveIteratorIterator, getDepth) { spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + if (zend_parse_parameters_none() == FAILURE) { + return; + } + RETURN_LONG(object->level); } /* }}} */ @@ -657,6 +681,10 @@ SPL_METHOD(RecursiveIteratorIterator, getInnerIterator) spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); long level = object->level; + if (zend_parse_parameters_none() == FAILURE) { + return; + } + RETURN_ZVAL(object->iterators[level].zobject, 1, 0); } /* }}} */ @@ -664,6 +692,9 @@ SPL_METHOD(RecursiveIteratorIterator, getInnerIterator) Called when iteration begins (after first rewind() call) */ SPL_METHOD(RecursiveIteratorIterator, beginIteration) { + if (zend_parse_parameters_none() == FAILURE) { + return; + } /* nothing to do */ } /* }}} */ @@ -671,6 +702,9 @@ SPL_METHOD(RecursiveIteratorIterator, beginIteration) Called when iteration ends (when valid() first returns false */ SPL_METHOD(RecursiveIteratorIterator, endIteration) { + if (zend_parse_parameters_none() == FAILURE) { + return; + } /* nothing to do */ } /* }}} */ @@ -681,6 +715,10 @@ SPL_METHOD(RecursiveIteratorIterator, callHasChildren) spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); zend_class_entry *ce = object->iterators[object->level].ce; zval *retval, *zobject; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } zobject = object->iterators[object->level].zobject; if (!zobject) { @@ -702,6 +740,10 @@ SPL_METHOD(RecursiveIteratorIterator, callGetChildren) spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); zend_class_entry *ce = object->iterators[object->level].ce; zval *retval, *zobject; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } zobject = object->iterators[object->level].zobject; if (!zobject) { @@ -718,6 +760,9 @@ SPL_METHOD(RecursiveIteratorIterator, callGetChildren) Called when recursing one level down */ SPL_METHOD(RecursiveIteratorIterator, beginChildren) { + if (zend_parse_parameters_none() == FAILURE) { + return; + } /* nothing to do */ } /* }}} */ @@ -725,6 +770,9 @@ SPL_METHOD(RecursiveIteratorIterator, beginChildren) Called when end recursing one level */ SPL_METHOD(RecursiveIteratorIterator, endChildren) { + if (zend_parse_parameters_none() == FAILURE) { + return; + } /* nothing to do */ } /* }}} */ @@ -732,6 +780,9 @@ SPL_METHOD(RecursiveIteratorIterator, endChildren) Called when the next element is available */ SPL_METHOD(RecursiveIteratorIterator, nextElement) { + if (zend_parse_parameters_none() == FAILURE) { + return; + } /* nothing to do */ } /* }}} */ @@ -758,6 +809,10 @@ SPL_METHOD(RecursiveIteratorIterator, getMaxDepth) { spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + if (zend_parse_parameters_none() == FAILURE) { + return; + } + if (object->max_depth == -1) { RETURN_FALSE; } else { @@ -972,7 +1027,7 @@ SPL_METHOD(RecursiveTreeIterator, __construct) spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, spl_ce_RecursiveTreeIterator, zend_ce_iterator, RIT_RecursiveTreeIterator); } /* }}} */ -/* {{{ proto void RecursiveTreeIterator::setPrefixPart() throws OutOfRangeException +/* {{{ proto void RecursiveTreeIterator::setPrefixPart(int part, string prefix) throws OutOfRangeException Sets prefix parts as used in getPrefix() */ SPL_METHOD(RecursiveTreeIterator, setPrefixPart) { @@ -999,6 +1054,9 @@ SPL_METHOD(RecursiveTreeIterator, getPrefix) { spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + if (zend_parse_parameters_none() == FAILURE) { + return; + } spl_recursive_tree_iterator_get_prefix(object, return_value TSRMLS_CC); } /* }}} */ @@ -1008,6 +1066,10 @@ SPL_METHOD(RecursiveTreeIterator, getEntry) { spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + if (zend_parse_parameters_none() == FAILURE) { + return; + } + spl_recursive_tree_iterator_get_entry(object, return_value TSRMLS_CC); } /* }}} */ @@ -1017,6 +1079,10 @@ SPL_METHOD(RecursiveTreeIterator, getPostfix) { spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + if (zend_parse_parameters_none() == FAILURE) { + return; + } + spl_recursive_tree_iterator_get_postfix(object, return_value TSRMLS_CC); } /* }}} */ @@ -1028,6 +1094,10 @@ SPL_METHOD(RecursiveTreeIterator, current) zval prefix, entry, postfix; char *str, *ptr; size_t str_len; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } if (object->flags & RTIT_BYPASS_CURRENT) { zend_object_iterator *iterator = object->iterators[object->level].iterator; @@ -1073,6 +1143,10 @@ SPL_METHOD(RecursiveTreeIterator, key) zval prefix, key, postfix, key_copy; char *str, *ptr; size_t str_len; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } if (iterator->funcs->get_current_key) { char *str_key; @@ -1439,6 +1513,10 @@ SPL_METHOD(dual_it, getInnerIterator) spl_dual_it_object *intern; intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } if (intern->inner.zobject) { RETVAL_ZVAL(intern->inner.zobject, 1, 0); @@ -1539,6 +1617,11 @@ SPL_METHOD(dual_it, rewind) spl_dual_it_object *intern; intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + spl_dual_it_rewind(intern TSRMLS_CC); spl_dual_it_fetch(intern, 1 TSRMLS_CC); } /* }}} */ @@ -1552,6 +1635,10 @@ SPL_METHOD(dual_it, valid) { spl_dual_it_object *intern; + if (zend_parse_parameters_none() == FAILURE) { + return; + } + intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); RETURN_BOOL(intern->current.data); @@ -1569,6 +1656,10 @@ SPL_METHOD(dual_it, key) { spl_dual_it_object *intern; + if (zend_parse_parameters_none() == FAILURE) { + return; + } + intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); if (intern->current.data) { @@ -1592,6 +1683,10 @@ SPL_METHOD(dual_it, key) SPL_METHOD(dual_it, current) { spl_dual_it_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); @@ -1609,6 +1704,10 @@ SPL_METHOD(dual_it, current) SPL_METHOD(dual_it, next) { spl_dual_it_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); @@ -1654,6 +1753,10 @@ static inline void spl_filter_it_next(zval *zthis, spl_dual_it_object *intern TS SPL_METHOD(FilterIterator, rewind) { spl_dual_it_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); spl_filter_it_rewind(getThis(), intern TSRMLS_CC); @@ -1664,6 +1767,10 @@ SPL_METHOD(FilterIterator, rewind) SPL_METHOD(FilterIterator, next) { spl_dual_it_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); spl_filter_it_next(getThis(), intern TSRMLS_CC); @@ -1682,6 +1789,10 @@ SPL_METHOD(RecursiveFilterIterator, hasChildren) { spl_dual_it_object *intern; zval *retval; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); @@ -1699,6 +1810,10 @@ SPL_METHOD(RecursiveFilterIterator, getChildren) { spl_dual_it_object *intern; zval *retval; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); @@ -1735,6 +1850,10 @@ SPL_METHOD(RegexIterator, accept) int subject_len, use_copy, count = 0, result_len; zval subject_copy, zcount, *replacement; + if (zend_parse_parameters_none() == FAILURE) { + return; + } + if (intern->current.data == NULL) { RETURN_FALSE; } @@ -1828,6 +1947,10 @@ SPL_METHOD(RegexIterator, getMode) { spl_dual_it_object *intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + if (zend_parse_parameters_none() == FAILURE) { + return; + } + RETURN_LONG(intern->u.regex.mode); } /* }}} */ @@ -1856,6 +1979,10 @@ SPL_METHOD(RegexIterator, getFlags) { spl_dual_it_object *intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + if (zend_parse_parameters_none() == FAILURE) { + return; + } + RETURN_LONG(intern->u.regex.flags); } /* }}} */ @@ -1878,6 +2005,10 @@ SPL_METHOD(RegexIterator, setFlags) SPL_METHOD(RegexIterator, getPregFlags) { spl_dual_it_object *intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } if (intern->u.regex.use_flags) { RETURN_LONG(intern->u.regex.preg_flags); @@ -1914,6 +2045,10 @@ SPL_METHOD(RecursiveRegexIterator, getChildren) { spl_dual_it_object *intern; zval *retval, *regex; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); @@ -2354,6 +2489,10 @@ SPL_METHOD(CachingIterator, __construct) SPL_METHOD(CachingIterator, rewind) { spl_dual_it_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); @@ -2365,6 +2504,10 @@ SPL_METHOD(CachingIterator, rewind) SPL_METHOD(CachingIterator, valid) { spl_dual_it_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); @@ -2376,6 +2519,10 @@ SPL_METHOD(CachingIterator, valid) SPL_METHOD(CachingIterator, next) { spl_dual_it_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); @@ -2387,6 +2534,10 @@ SPL_METHOD(CachingIterator, next) SPL_METHOD(CachingIterator, hasNext) { spl_dual_it_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); @@ -2531,6 +2682,10 @@ SPL_METHOD(CachingIterator, getCache) { spl_dual_it_object *intern; + if (zend_parse_parameters_none() == FAILURE) { + return; + } + intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); if (!(intern->u.caching.flags & CIT_FULL_CACHE)) { @@ -2548,6 +2703,10 @@ SPL_METHOD(CachingIterator, getFlags) { spl_dual_it_object *intern; + if (zend_parse_parameters_none() == FAILURE) { + return; + } + intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); RETURN_LONG(intern->u.caching.flags); @@ -2593,6 +2752,10 @@ SPL_METHOD(CachingIterator, count) { spl_dual_it_object *intern; + if (zend_parse_parameters_none() == FAILURE) { + return; + } + intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); if (!(intern->u.caching.flags & CIT_FULL_CACHE)) { @@ -2656,6 +2819,10 @@ SPL_METHOD(RecursiveCachingIterator, hasChildren) { spl_dual_it_object *intern; + if (zend_parse_parameters_none() == FAILURE) { + return; + } + intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); RETURN_BOOL(intern->u.caching.zchildren); @@ -2666,6 +2833,10 @@ SPL_METHOD(RecursiveCachingIterator, hasChildren) SPL_METHOD(RecursiveCachingIterator, getChildren) { spl_dual_it_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); @@ -2721,6 +2892,9 @@ SPL_METHOD(NoRewindIterator, __construct) Prevent a call to inner iterators rewind() */ SPL_METHOD(NoRewindIterator, rewind) { + if (zend_parse_parameters_none() == FAILURE) { + return; + } /* nothing to do */ } /* }}} */ @@ -2729,6 +2903,10 @@ SPL_METHOD(NoRewindIterator, rewind) SPL_METHOD(NoRewindIterator, valid) { spl_dual_it_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); RETURN_BOOL(intern->inner.iterator->funcs->valid(intern->inner.iterator TSRMLS_CC) == SUCCESS); @@ -2739,6 +2917,10 @@ SPL_METHOD(NoRewindIterator, valid) SPL_METHOD(NoRewindIterator, key) { spl_dual_it_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); @@ -2767,6 +2949,10 @@ SPL_METHOD(NoRewindIterator, current) { spl_dual_it_object *intern; zval **data; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); intern->inner.iterator->funcs->get_current_data(intern->inner.iterator, &data TSRMLS_CC); @@ -2780,6 +2966,10 @@ SPL_METHOD(NoRewindIterator, current) SPL_METHOD(NoRewindIterator, next) { spl_dual_it_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); intern->inner.iterator->funcs->move_forward(intern->inner.iterator TSRMLS_CC); @@ -2812,6 +3002,10 @@ SPL_METHOD(InfiniteIterator, __construct) SPL_METHOD(InfiniteIterator, next) { spl_dual_it_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); @@ -2836,12 +3030,18 @@ static const zend_function_entry spl_funcs_InfiniteIterator[] = { Does nothing */ SPL_METHOD(EmptyIterator, rewind) { + if (zend_parse_parameters_none() == FAILURE) { + return; + } } /* }}} */ /* {{{ proto false EmptyIterator::valid() Return false */ SPL_METHOD(EmptyIterator, valid) { + if (zend_parse_parameters_none() == FAILURE) { + return; + } RETURN_FALSE; } /* }}} */ @@ -2849,6 +3049,9 @@ SPL_METHOD(EmptyIterator, valid) Throws exception BadMethodCallException */ SPL_METHOD(EmptyIterator, key) { + if (zend_parse_parameters_none() == FAILURE) { + return; + } zend_throw_exception(spl_ce_BadMethodCallException, "Accessing the key of an EmptyIterator", 0 TSRMLS_CC); } /* }}} */ @@ -2856,6 +3059,9 @@ SPL_METHOD(EmptyIterator, key) Throws exception BadMethodCallException */ SPL_METHOD(EmptyIterator, current) { + if (zend_parse_parameters_none() == FAILURE) { + return; + } zend_throw_exception(spl_ce_BadMethodCallException, "Accessing the value of an EmptyIterator", 0 TSRMLS_CC); } /* }}} */ @@ -2863,6 +3069,9 @@ SPL_METHOD(EmptyIterator, current) Does nothing */ SPL_METHOD(EmptyIterator, next) { + if (zend_parse_parameters_none() == FAILURE) { + return; + } } /* }}} */ static const zend_function_entry spl_funcs_EmptyIterator[] = { @@ -2962,6 +3171,10 @@ SPL_METHOD(AppendIterator, append) SPL_METHOD(AppendIterator, rewind) { spl_dual_it_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); @@ -2977,6 +3190,10 @@ SPL_METHOD(AppendIterator, valid) { spl_dual_it_object *intern; + if (zend_parse_parameters_none() == FAILURE) { + return; + } + intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); RETURN_BOOL(intern->current.data); @@ -2987,6 +3204,10 @@ SPL_METHOD(AppendIterator, valid) SPL_METHOD(AppendIterator, next) { spl_dual_it_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); @@ -2998,6 +3219,10 @@ SPL_METHOD(AppendIterator, next) SPL_METHOD(AppendIterator, getIteratorIndex) { spl_dual_it_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); @@ -3010,6 +3235,10 @@ SPL_METHOD(AppendIterator, getIteratorIndex) SPL_METHOD(AppendIterator, getArrayIterator) { spl_dual_it_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c index 255d7816d2..ca45315271 100755 --- a/ext/spl/spl_observer.c +++ b/ext/spl/spl_observer.c @@ -599,6 +599,10 @@ SPL_METHOD(SplObjectStorage, count) { spl_SplObjectStorage *intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC); + if (zend_parse_parameters_none() == FAILURE) { + return; + } + RETURN_LONG(zend_hash_num_elements(&intern->storage)); } /* }}} */ @@ -608,6 +612,10 @@ SPL_METHOD(SplObjectStorage, rewind) { spl_SplObjectStorage *intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC); + if (zend_parse_parameters_none() == FAILURE) { + return; + } + zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos); intern->index = 0; } /* }}} */ @@ -618,6 +626,10 @@ SPL_METHOD(SplObjectStorage, valid) { spl_SplObjectStorage *intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC); + if (zend_parse_parameters_none() == FAILURE) { + return; + } + RETURN_BOOL(zend_hash_has_more_elements_ex(&intern->storage, &intern->pos) == SUCCESS); } /* }}} */ @@ -627,6 +639,10 @@ SPL_METHOD(SplObjectStorage, key) { spl_SplObjectStorage *intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC); + if (zend_parse_parameters_none() == FAILURE) { + return; + } + RETURN_LONG(intern->index); } /* }}} */ @@ -637,6 +653,10 @@ SPL_METHOD(SplObjectStorage, current) spl_SplObjectStorageElement *element; spl_SplObjectStorage *intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC); + if (zend_parse_parameters_none() == FAILURE) { + return; + } + if (zend_hash_get_current_data_ex(&intern->storage, (void**)&element, &intern->pos) == FAILURE) { return; } @@ -649,6 +669,10 @@ SPL_METHOD(SplObjectStorage, getInfo) { spl_SplObjectStorageElement *element; spl_SplObjectStorage *intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } if (zend_hash_get_current_data_ex(&intern->storage, (void**)&element, &intern->pos) == FAILURE) { return; @@ -682,6 +706,10 @@ SPL_METHOD(SplObjectStorage, next) { spl_SplObjectStorage *intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC); + if (zend_parse_parameters_none() == FAILURE) { + return; + } + zend_hash_move_forward_ex(&intern->storage, &intern->pos); intern->index++; } /* }}} */ @@ -698,8 +726,12 @@ SPL_METHOD(SplObjectStorage, serialize) php_serialize_data_t var_hash; smart_str buf = {0}; - PHP_VAR_SERIALIZE_INIT(var_hash); + if (zend_parse_parameters_none() == FAILURE) { + return; + } + PHP_VAR_SERIALIZE_INIT(var_hash); + /* storage */ smart_str_appendl(&buf, "x:", 2); MAKE_STD_ZVAL(flags); @@ -966,6 +998,10 @@ SPL_METHOD(MultipleIterator, __construct) SPL_METHOD(MultipleIterator, getFlags) { spl_SplObjectStorage *intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } RETURN_LONG(intern->flags); } /* }}} */ @@ -1029,6 +1065,10 @@ SPL_METHOD(MultipleIterator, rewind) zval *it; intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos); while (zend_hash_get_current_data_ex(&intern->storage, (void**)&element, &intern->pos) == SUCCESS && !EG(exception)) { @@ -1048,6 +1088,10 @@ SPL_METHOD(MultipleIterator, next) zval *it; intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos); while (zend_hash_get_current_data_ex(&intern->storage, (void**)&element, &intern->pos) == SUCCESS && !EG(exception)) { @@ -1068,6 +1112,10 @@ SPL_METHOD(MultipleIterator, valid) long expect, valid; intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } if (!zend_hash_num_elements(&intern->storage)) { RETURN_FALSE; @@ -1172,6 +1220,10 @@ SPL_METHOD(MultipleIterator, current) { spl_SplObjectStorage *intern; intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } spl_multiple_iterator_get_all(intern, SPL_MULTIPLE_ITERATOR_GET_ALL_CURRENT, return_value TSRMLS_CC); } @@ -1183,6 +1235,10 @@ SPL_METHOD(MultipleIterator, key) { spl_SplObjectStorage *intern; intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } spl_multiple_iterator_get_all(intern, SPL_MULTIPLE_ITERATOR_GET_ALL_KEY, return_value TSRMLS_CC); } diff --git a/ext/spl/tests/arrayObject_count_basic1.phpt b/ext/spl/tests/arrayObject_count_basic1.phpt index 1a3b84d509..a003c2cf67 100644 --- a/ext/spl/tests/arrayObject_count_basic1.phpt +++ b/ext/spl/tests/arrayObject_count_basic1.phpt @@ -67,7 +67,9 @@ int(99) int(2) int(99) int(1) -int(1) + +Warning: ArrayObject::count() expects exactly 0 parameters, 1 given in %s on line %d +NULL ==ArrayIterator== int(99) int(0) @@ -77,4 +79,6 @@ int(99) int(2) int(99) int(1) -int(1)
\ No newline at end of file + +Warning: ArrayIterator::count() expects exactly 0 parameters, 1 given in %s on line %d +NULL
\ No newline at end of file diff --git a/ext/spl/tests/fileobject_005.phpt b/ext/spl/tests/fileobject_005.phpt index b3882e940f..fa9e6db173 100644 --- a/ext/spl/tests/fileobject_005.phpt +++ b/ext/spl/tests/fileobject_005.phpt @@ -33,8 +33,10 @@ unlink($path); ?> --EXPECTF-- bool(true) -string(4) "blah" + +Warning: SplFileObject::fgets() expects exactly 0 parameters, 1 given in %s on line %d +NULL Warning: SplFileObject::ftruncate() expects exactly 1 parameter, 0 given in %s on line %d NULL -==DONE== +==DONE==
\ No newline at end of file |