summaryrefslogtreecommitdiff
path: root/ext/spl
diff options
context:
space:
mode:
Diffstat (limited to 'ext/spl')
-rw-r--r--ext/spl/internal/recursivecachingiterator.inc2
-rw-r--r--ext/spl/php_spl.c16
-rw-r--r--ext/spl/php_spl.h7
-rwxr-xr-xext/spl/spl.php2
-rw-r--r--ext/spl/spl_array.c116
-rw-r--r--ext/spl/spl_array.h2
-rw-r--r--ext/spl/spl_directory.c105
-rw-r--r--ext/spl/spl_directory.h2
-rw-r--r--ext/spl/spl_dllist.c17
-rw-r--r--ext/spl/spl_dllist.h2
-rw-r--r--ext/spl/spl_engine.c2
-rw-r--r--ext/spl/spl_engine.h2
-rw-r--r--ext/spl/spl_exceptions.c2
-rw-r--r--ext/spl/spl_exceptions.h2
-rw-r--r--ext/spl/spl_fixedarray.c16
-rw-r--r--ext/spl/spl_fixedarray.h2
-rw-r--r--ext/spl/spl_functions.c2
-rw-r--r--ext/spl/spl_functions.h2
-rw-r--r--ext/spl/spl_heap.c16
-rw-r--r--ext/spl/spl_heap.h2
-rw-r--r--ext/spl/spl_iterators.c110
-rw-r--r--ext/spl/spl_iterators.h2
-rw-r--r--ext/spl/spl_observer.c32
-rw-r--r--ext/spl/spl_observer.h2
-rw-r--r--ext/spl/tests/ArrayObject_unserialize_empty_string.phpt9
-rw-r--r--ext/spl/tests/DirectoryIterator_getBasename_basic_test.phpt4
-rw-r--r--ext/spl/tests/DirectoryIterator_getBasename_pass_array.phpt4
-rw-r--r--ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt4
-rw-r--r--ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt4
-rw-r--r--ext/spl/tests/SplFileObject_fgetcsv_basic.phpt6
-rw-r--r--ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt6
-rw-r--r--ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt6
-rw-r--r--ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt6
-rw-r--r--ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt6
-rw-r--r--ext/spl/tests/SplFileObject_fgetcsv_escape_basic.phpt6
-rw-r--r--ext/spl/tests/SplFileObject_fgetcsv_escape_default.phpt6
-rw-r--r--ext/spl/tests/SplFileObject_fgetcsv_escape_error.phpt6
-rw-r--r--ext/spl/tests/SplFileObject_fputcsv_002.phpt4
-rw-r--r--ext/spl/tests/SplFileObject_fputcsv_error.phpt4
-rw-r--r--ext/spl/tests/SplFixedArray_fromarray_param_multiarray.phpt2
-rw-r--r--ext/spl/tests/SplObjectStorage_unserialize_bad.phpt2
-rw-r--r--ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter3.phpt6
-rw-r--r--ext/spl/tests/bug51532.phpt2
-rw-r--r--ext/spl/tests/bug53071.phpt2
-rw-r--r--ext/spl/tests/bug54281.phpt6
-rw-r--r--ext/spl/tests/bug64782.phpt2
-rw-r--r--ext/spl/tests/bug66834.phpt158
-rw-r--r--ext/spl/tests/bug67582.phpt24
-rw-r--r--ext/spl/tests/bug69737.phpt2
-rw-r--r--ext/spl/tests/bug69970.phpt45
-rw-r--r--ext/spl/tests/bug70290.phpt9
-rw-r--r--ext/spl/tests/bug70303.phpt12
-rw-r--r--ext/spl/tests/bug70561.phpt23
-rw-r--r--ext/spl/tests/bug70852.phpt17
-rw-r--r--ext/spl/tests/bug71204.phpt16
-rw-r--r--ext/spl/tests/dit_006.phpt14
-rw-r--r--ext/spl/tests/unserialize.phpt43
57 files changed, 732 insertions, 199 deletions
diff --git a/ext/spl/internal/recursivecachingiterator.inc b/ext/spl/internal/recursivecachingiterator.inc
index 0676d435f2..cd5d3e31f5 100644
--- a/ext/spl/internal/recursivecachingiterator.inc
+++ b/ext/spl/internal/recursivecachingiterator.inc
@@ -80,7 +80,7 @@ class RecursiveCachingIterator extends CachingIterator implements RecursiveItera
/** @return whether the current element has children
* @note The check whether the Iterator for the children can be created was
* already executed. Hence when flag CATCH_GET_CHILD was given in
- * constructor this fucntion returns false so that getChildren does
+ * constructor this function returns false so that getChildren does
* not try to access those children.
*/
function hasChildren()
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index 6b886b7ef3..0f302787be 100644
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2015 The PHP Group |
+ | Copyright (c) 1997-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -358,7 +358,7 @@ PHP_FUNCTION(spl_autoload)
* The "scope" is determined by an opcode, if it is ZEND_FETCH_CLASS we know function was called indirectly by
* the Zend engine.
*/
- if (active_opline->opcode != ZEND_FETCH_CLASS) {
+ if (EG(opline_ptr) && active_opline->opcode != ZEND_FETCH_CLASS) {
zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Class %s could not be loaded", class_name);
} else {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Class %s could not be loaded", class_name);
@@ -669,10 +669,14 @@ PHP_FUNCTION(spl_autoload_unregister)
if (SPL_G(autoload_functions)) {
if (func_name_len == sizeof("spl_autoload_call")-1 && !strcmp(lc_name, "spl_autoload_call")) {
/* remove all */
- zend_hash_destroy(SPL_G(autoload_functions));
- FREE_HASHTABLE(SPL_G(autoload_functions));
- SPL_G(autoload_functions) = NULL;
- EG(autoload_func) = NULL;
+ if (!SPL_G(autoload_running)) {
+ zend_hash_destroy(SPL_G(autoload_functions));
+ FREE_HASHTABLE(SPL_G(autoload_functions));
+ SPL_G(autoload_functions) = NULL;
+ EG(autoload_func) = NULL;
+ } else {
+ zend_hash_clean(SPL_G(autoload_functions));
+ }
success = SUCCESS;
} else {
/* remove specific */
diff --git a/ext/spl/php_spl.h b/ext/spl/php_spl.h
index 8a4f4962ca..b4e3211304 100644
--- a/ext/spl/php_spl.h
+++ b/ext/spl/php_spl.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2015 The PHP Group |
+ | Copyright (c) 1997-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -20,11 +20,6 @@
#define PHP_SPL_H
#include "php.h"
-#if defined(PHP_WIN32)
-# include "win32/php_stdint.h"
-#elif defined(HAVE_STDINT_H)
-# include <stdint.h>
-#endif
#include <stdarg.h>
#if 0
diff --git a/ext/spl/spl.php b/ext/spl/spl.php
index c276f1f2ee..ff9d1b6bbe 100755
--- a/ext/spl/spl.php
+++ b/ext/spl/spl.php
@@ -958,7 +958,7 @@ class SplFileInfo
*
* @param mode open mode
* @param use_include_path whether to search include paths (don't use)
- * @param context resource context to pased to open function
+ * @param context resource context to passed to open function
* @throw RuntimeException if file cannot be opened (e.g. insufficient
* access rights).
* @return The opened file as a SplFileObject instance
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 5cb7d34c6f..42a8e7aa44 100644
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2015 The PHP Group |
+ | Copyright (c) 1997-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -303,6 +303,8 @@ static zval **spl_array_get_dimension_ptr_ptr(int check_inherited, zval *object,
{
spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
zval **retval;
+ char *key;
+ uint len;
long index;
HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
@@ -315,29 +317,33 @@ static zval **spl_array_get_dimension_ptr_ptr(int check_inherited, zval *object,
return &EG(error_zval_ptr);;
}
- switch(Z_TYPE_P(offset)) {
- case IS_NULL:
- Z_STRVAL_P(offset) = "";
- Z_STRLEN_P(offset) = 0;
+ switch (Z_TYPE_P(offset)) {
case IS_STRING:
- if (zend_symtable_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) &retval) == FAILURE) {
+ key = Z_STRVAL_P(offset);
+ len = Z_STRLEN_P(offset) + 1;
+string_offest:
+ if (zend_symtable_find(ht, key, len, (void **) &retval) == FAILURE) {
switch (type) {
case BP_VAR_R:
- zend_error(E_NOTICE, "Undefined index: %s", Z_STRVAL_P(offset));
+ zend_error(E_NOTICE, "Undefined index: %s", key);
case BP_VAR_UNSET:
case BP_VAR_IS:
retval = &EG(uninitialized_zval_ptr);
break;
case BP_VAR_RW:
- zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(offset));
+ zend_error(E_NOTICE,"Undefined index: %s", key);
case BP_VAR_W: {
zval *value;
ALLOC_INIT_ZVAL(value);
- zend_symtable_update(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void**)&value, sizeof(void*), (void **)&retval);
+ zend_symtable_update(ht, key, len, (void**)&value, sizeof(void*), (void **)&retval);
}
}
}
return retval;
+ case IS_NULL:
+ key = "";
+ len = 1;
+ goto string_offest;
case IS_RESOURCE:
zend_error(E_STRICT, "Resource ID#%ld used as offset, casting to integer (%ld)", Z_LVAL_P(offset), Z_LVAL_P(offset));
case IS_DOUBLE:
@@ -593,65 +599,74 @@ static int spl_array_has_dimension_ex(int check_inherited, zval *object, zval *o
{
spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
long index;
- zval *rv, **tmp;
+ zval *rv, *value = NULL, **tmp;
if (check_inherited && intern->fptr_offset_has) {
- SEPARATE_ARG_IF_REF(offset);
- zend_call_method_with_1_params(&object, Z_OBJCE_P(object), &intern->fptr_offset_has, "offsetExists", &rv, offset);
- zval_ptr_dtor(&offset);
+ zval *offset_tmp = offset;
+ SEPARATE_ARG_IF_REF(offset_tmp);
+ zend_call_method_with_1_params(&object, Z_OBJCE_P(object), &intern->fptr_offset_has, "offsetExists", &rv, offset_tmp);
+ zval_ptr_dtor(&offset_tmp);
+
if (rv && zend_is_true(rv)) {
zval_ptr_dtor(&rv);
- return 1;
- }
- if (rv) {
- zval_ptr_dtor(&rv);
+ if (check_empty != 1) {
+ return 1;
+ } else if (intern->fptr_offset_get) {
+ value = spl_array_read_dimension_ex(1, object, offset, BP_VAR_R TSRMLS_CC);
+ }
+ } else {
+ if (rv) {
+ zval_ptr_dtor(&rv);
+ }
+ return 0;
}
- return 0;
}
- switch(Z_TYPE_P(offset)) {
- case IS_STRING:
- {
- HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
+ if (!value) {
+ HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
+
+ switch(Z_TYPE_P(offset)) {
+ case IS_STRING:
if (zend_symtable_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) &tmp) != FAILURE) {
- switch (check_empty) {
- case 0:
- return Z_TYPE_PP(tmp) != IS_NULL;
- case 2:
- return 1;
- default:
- return zend_is_true(*tmp);
+ if (check_empty == 2) {
+ return 1;
}
+ } else {
+ return 0;
}
- }
- return 0;
- case IS_DOUBLE:
- case IS_RESOURCE:
- case IS_BOOL:
- case IS_LONG:
- {
- HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
+ break;
+
+ case IS_DOUBLE:
+ case IS_RESOURCE:
+ case IS_BOOL:
+ case IS_LONG:
if (offset->type == IS_DOUBLE) {
index = (long)Z_DVAL_P(offset);
} else {
index = Z_LVAL_P(offset);
}
if (zend_hash_index_find(ht, index, (void **)&tmp) != FAILURE) {
- switch (check_empty) {
- case 0:
- return Z_TYPE_PP(tmp) != IS_NULL;
- case 2:
- return 1;
- default:
- return zend_is_true(*tmp);
+ if (check_empty == 2) {
+ return 1;
}
+ } else {
+ return 0;
}
+ break;
+
+ default:
+ zend_error(E_WARNING, "Illegal offset type");
return 0;
- }
- default:
- zend_error(E_WARNING, "Illegal offset type");
+ }
+
+ if (check_empty && check_inherited && intern->fptr_offset_get) {
+ value = spl_array_read_dimension_ex(1, object, offset, BP_VAR_R TSRMLS_CC);
+ } else {
+ value = *tmp;
+ }
}
- return 0;
+
+ return check_empty ? zend_is_true(value) : Z_TYPE_P(value) != IS_NULL;
} /* }}} */
static int spl_array_has_dimension(zval *object, zval *offset, int check_empty TSRMLS_DC) /* {{{ */
@@ -1751,7 +1766,6 @@ SPL_METHOD(Array, unserialize)
}
if (buf_len == 0) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Empty serialized string cannot be empty");
return;
}
@@ -1844,8 +1858,8 @@ outexcept:
} /* }}} */
-/* {{{ arginfo and function tbale */
-ZEND_BEGIN_ARG_INFO(arginfo_array___construct, 0)
+/* {{{ arginfo and function table */
+ZEND_BEGIN_ARG_INFO_EX(arginfo_array___construct, 0, 0, 0)
ZEND_ARG_INFO(0, array)
ZEND_END_ARG_INFO()
diff --git a/ext/spl/spl_array.h b/ext/spl/spl_array.h
index 6735d92363..ae43437cf0 100644
--- a/ext/spl/spl_array.h
+++ b/ext/spl/spl_array.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2015 The PHP Group |
+ | Copyright (c) 1997-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index 7718fe42d7..73a2d70acc 100644
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2015 The PHP Group |
+ | Copyright (c) 1997-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -845,7 +845,8 @@ SPL_METHOD(DirectoryIterator, seek)
retval = NULL;
}
if (!valid) {
- break;
+ zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Seek position %ld is out of range", pos);
+ return;
}
zend_call_method_with_0_params(&this_ptr, Z_OBJCE_P(getThis()), &intern->u.dir.func_next, "next", &retval);
if (retval) {
@@ -1616,7 +1617,7 @@ SPL_METHOD(GlobIterator, count)
return;
}
- if (php_stream_is(intern->u.dir.dirp ,&php_glob_stream_ops)) {
+ if (intern->u.dir.dirp && php_stream_is(intern->u.dir.dirp ,&php_glob_stream_ops)) {
RETURN_LONG(php_glob_stream_get_count(intern->u.dir.dirp, NULL));
} else {
/* should not happen */
@@ -2100,7 +2101,7 @@ static int spl_filesystem_file_call(spl_filesystem_object *intern, zend_function
zend_fcall_info fci;
zend_fcall_info_cache fcic;
zval z_fname;
- zval * zresource_ptr = &intern->u.file.zresource, *retval;
+ zval * zresource_ptr = &intern->u.file.zresource, *retval = NULL;
int result;
int num_args = pass_num_args + (arg2 ? 2 : 1);
@@ -2133,8 +2134,8 @@ static int spl_filesystem_file_call(spl_filesystem_object *intern, zend_function
fcic.object_ptr = NULL;
result = zend_call_function(&fci, &fcic TSRMLS_CC);
-
- if (result == FAILURE) {
+
+ if (result == FAILURE || retval == NULL) {
RETVAL_FALSE;
} else {
ZVAL_ZVAL(return_value, retval, 1, 1);
@@ -2267,6 +2268,10 @@ static int spl_filesystem_file_read_line(zval * this_ptr, spl_filesystem_object
static void spl_filesystem_file_rewind(zval * this_ptr, spl_filesystem_object *intern TSRMLS_DC) /* {{{ */
{
+ if(!intern->u.file.stream) {
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized");
+ return;
+ }
if (-1 == php_stream_rewind(intern->u.file.stream)) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Cannot rewind file %s", intern->file_name);
} else {
@@ -2399,6 +2404,11 @@ SPL_METHOD(SplFileObject, eof)
return;
}
+ if(!intern->u.file.stream) {
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized");
+ return;
+ }
+
RETURN_BOOL(php_stream_eof(intern->u.file.stream));
} /* }}} */
@@ -2415,6 +2425,9 @@ SPL_METHOD(SplFileObject, valid)
if (SPL_HAS_FLAG(intern->flags, SPL_FILE_OBJECT_READ_AHEAD)) {
RETURN_BOOL(intern->u.file.current_line || intern->u.file.current_zval);
} else {
+ if(!intern->u.file.stream) {
+ RETURN_FALSE;
+ }
RETVAL_BOOL(!php_stream_eof(intern->u.file.stream));
}
} /* }}} */
@@ -2429,6 +2442,11 @@ SPL_METHOD(SplFileObject, fgets)
return;
}
+ if(!intern->u.file.stream) {
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized");
+ return;
+ }
+
if (spl_filesystem_file_read(intern, 0 TSRMLS_CC) == FAILURE) {
RETURN_FALSE;
}
@@ -2445,6 +2463,11 @@ SPL_METHOD(SplFileObject, current)
return;
}
+ if(!intern->u.file.stream) {
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized");
+ return;
+ }
+
if (!intern->u.file.current_line && !intern->u.file.current_zval) {
spl_filesystem_file_read_line(getThis(), intern, 1 TSRMLS_CC);
}
@@ -2587,6 +2610,12 @@ SPL_METHOD(SplFileObject, fgetcsv)
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(!intern->u.file.stream) {
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized");
+ return;
+ }
+
switch(ZEND_NUM_ARGS())
{
case 3:
@@ -2735,6 +2764,11 @@ SPL_METHOD(SplFileObject, fflush)
{
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
+ if(!intern->u.file.stream) {
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized");
+ return;
+ }
+
RETURN_BOOL(!php_stream_flush(intern->u.file.stream));
} /* }}} */
@@ -2742,8 +2776,15 @@ SPL_METHOD(SplFileObject, fflush)
Return current file position */
SPL_METHOD(SplFileObject, ftell)
{
- spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- long ret = php_stream_tell(intern->u.file.stream);
+ spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
+ long ret;
+
+ if(!intern->u.file.stream) {
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized");
+ return;
+ }
+
+ ret = php_stream_tell(intern->u.file.stream);
if (ret == -1) {
RETURN_FALSE;
@@ -2763,6 +2804,11 @@ SPL_METHOD(SplFileObject, fseek)
return;
}
+ if(!intern->u.file.stream) {
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized");
+ return;
+ }
+
spl_filesystem_file_free_line(intern TSRMLS_CC);
RETURN_LONG(php_stream_seek(intern->u.file.stream, pos, whence));
} /* }}} */
@@ -2775,6 +2821,11 @@ SPL_METHOD(SplFileObject, fgetc)
char buf[2];
int result;
+ if(!intern->u.file.stream) {
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized");
+ return;
+ }
+
spl_filesystem_file_free_line(intern TSRMLS_CC);
result = php_stream_getc(intern->u.file.stream);
@@ -2800,6 +2851,11 @@ SPL_METHOD(SplFileObject, fgetss)
zval *arg2 = NULL;
MAKE_STD_ZVAL(arg2);
+ if(!intern->u.file.stream) {
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized");
+ return;
+ }
+
if (intern->u.file.max_line_len > 0) {
ZVAL_LONG(arg2, intern->u.file.max_line_len);
} else {
@@ -2820,6 +2876,11 @@ SPL_METHOD(SplFileObject, fpassthru)
{
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
+ if(!intern->u.file.stream) {
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized");
+ return;
+ }
+
RETURN_LONG(php_stream_passthru(intern->u.file.stream));
} /* }}} */
@@ -2829,6 +2890,11 @@ SPL_METHOD(SplFileObject, fscanf)
{
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
+ if(!intern->u.file.stream) {
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized");
+ return;
+ }
+
spl_filesystem_file_free_line(intern TSRMLS_CC);
intern->u.file.current_line_num++;
@@ -2849,6 +2915,11 @@ SPL_METHOD(SplFileObject, fwrite)
return;
}
+ if(!intern->u.file.stream) {
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized");
+ return;
+ }
+
if (ZEND_NUM_ARGS() > 1) {
str_len = MAX(0, MIN(length, str_len));
}
@@ -2868,6 +2939,11 @@ SPL_METHOD(SplFileObject, fread)
return;
}
+ if(!intern->u.file.stream) {
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized");
+ return;
+ }
+
if (length <= 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0");
RETURN_FALSE;
@@ -2901,6 +2977,11 @@ SPL_METHOD(SplFileObject, ftruncate)
return;
}
+ if(!intern->u.file.stream) {
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized");
+ return;
+ }
+
if (!php_stream_truncate_supported(intern->u.file.stream)) {
zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Can't truncate file %s", intern->file_name);
RETURN_FALSE;
@@ -2919,6 +3000,11 @@ SPL_METHOD(SplFileObject, seek)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &line_pos) == FAILURE) {
return;
}
+ if(!intern->u.file.stream) {
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized");
+ return;
+ }
+
if (line_pos < 0) {
zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Can't seek file %s to negative line %ld", intern->file_name, line_pos);
RETURN_FALSE;
@@ -2976,8 +3062,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fgetss, 0, 0, 0)
ZEND_ARG_INFO(0, allowable_tags)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fscanf, 1, 0, 1)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fscanf, 0, 0, 1)
ZEND_ARG_INFO(0, format)
+ ZEND_ARG_VARIADIC_INFO(1, vars)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fwrite, 0, 0, 1)
diff --git a/ext/spl/spl_directory.h b/ext/spl/spl_directory.h
index b84d720dad..06272ac629 100644
--- a/ext/spl/spl_directory.h
+++ b/ext/spl/spl_directory.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2015 The PHP Group |
+ | Copyright (c) 1997-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c
index 2f2cf2826e..987fff987a 100644
--- a/ext/spl/spl_dllist.c
+++ b/ext/spl/spl_dllist.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2015 The PHP Group |
+ | Copyright (c) 1997-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -601,7 +601,7 @@ SPL_METHOD(SplDoublyLinkedList, pop)
zval *value;
spl_dllist_object *intern;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -624,7 +624,7 @@ SPL_METHOD(SplDoublyLinkedList, shift)
zval *value;
spl_dllist_object *intern;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -647,7 +647,7 @@ SPL_METHOD(SplDoublyLinkedList, top)
zval *value;
spl_dllist_object *intern;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -670,7 +670,7 @@ SPL_METHOD(SplDoublyLinkedList, bottom)
zval *value;
spl_dllist_object *intern;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -693,7 +693,7 @@ SPL_METHOD(SplDoublyLinkedList, count)
long count;
spl_dllist_object *intern = (spl_dllist_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -708,7 +708,7 @@ SPL_METHOD(SplDoublyLinkedList, isEmpty)
{
long count;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -748,7 +748,7 @@ SPL_METHOD(SplDoublyLinkedList, getIteratorMode)
{
spl_dllist_object *intern;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -1195,7 +1195,6 @@ SPL_METHOD(SplDoublyLinkedList, unserialize)
}
if (buf_len == 0) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Serialized string cannot be empty");
return;
}
diff --git a/ext/spl/spl_dllist.h b/ext/spl/spl_dllist.h
index 97000d9d63..d916618b6a 100644
--- a/ext/spl/spl_dllist.h
+++ b/ext/spl/spl_dllist.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2015 The PHP Group |
+ | Copyright (c) 1997-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/spl/spl_engine.c b/ext/spl/spl_engine.c
index 8796dd56af..e4a6354a1b 100644
--- a/ext/spl/spl_engine.c
+++ b/ext/spl/spl_engine.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2015 The PHP Group |
+ | Copyright (c) 1997-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/spl/spl_engine.h b/ext/spl/spl_engine.h
index 294c71dc30..8d9af82623 100644
--- a/ext/spl/spl_engine.h
+++ b/ext/spl/spl_engine.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2015 The PHP Group |
+ | Copyright (c) 1997-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/spl/spl_exceptions.c b/ext/spl/spl_exceptions.c
index 915b70d3c5..bb9627729b 100644
--- a/ext/spl/spl_exceptions.c
+++ b/ext/spl/spl_exceptions.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2015 The PHP Group |
+ | Copyright (c) 1997-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/spl/spl_exceptions.h b/ext/spl/spl_exceptions.h
index 2f6dc1e0ee..f64f6c54d0 100644
--- a/ext/spl/spl_exceptions.h
+++ b/ext/spl/spl_exceptions.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2015 The PHP Group |
+ | Copyright (c) 1997-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c
index ff909b168d..8ce2ac5de9 100644
--- a/ext/spl/spl_fixedarray.c
+++ b/ext/spl/spl_fixedarray.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2015 The PHP Group |
+ | Copyright (c) 1997-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -583,7 +583,7 @@ SPL_METHOD(SplFixedArray, __construct)
spl_fixedarray_object *intern;
long size = 0;
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &size)) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &size) == FAILURE) {
return;
}
@@ -613,7 +613,7 @@ SPL_METHOD(SplFixedArray, __wakeup)
HashTable *intern_ht = zend_std_get_properties(getThis() TSRMLS_CC);
zval **data;
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "")) {
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -643,7 +643,7 @@ SPL_METHOD(SplFixedArray, count)
zval *object = getThis();
spl_fixedarray_object *intern;
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "")) {
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -661,7 +661,7 @@ SPL_METHOD(SplFixedArray, toArray)
{
spl_fixedarray_object *intern;
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "")) {
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -693,7 +693,7 @@ SPL_METHOD(SplFixedArray, fromArray)
int num;
zend_bool save_indexes = 1;
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|b", &data, &save_indexes)) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|b", &data, &save_indexes) == FAILURE) {
return;
}
@@ -777,7 +777,7 @@ SPL_METHOD(SplFixedArray, getSize)
zval *object = getThis();
spl_fixedarray_object *intern;
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "")) {
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -797,7 +797,7 @@ SPL_METHOD(SplFixedArray, setSize)
spl_fixedarray_object *intern;
long size;
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &size)) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &size) == FAILURE) {
return;
}
diff --git a/ext/spl/spl_fixedarray.h b/ext/spl/spl_fixedarray.h
index 1b537d43a9..8b655b72b6 100644
--- a/ext/spl/spl_fixedarray.h
+++ b/ext/spl/spl_fixedarray.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2015 The PHP Group |
+ | Copyright (c) 1997-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/spl/spl_functions.c b/ext/spl/spl_functions.c
index 199b196bbc..77e407b9ad 100644
--- a/ext/spl/spl_functions.c
+++ b/ext/spl/spl_functions.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2015 The PHP Group |
+ | Copyright (c) 1997-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/spl/spl_functions.h b/ext/spl/spl_functions.h
index af26de8eba..3e759cd20f 100644
--- a/ext/spl/spl_functions.h
+++ b/ext/spl/spl_functions.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2015 The PHP Group |
+ | Copyright (c) 1997-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c
index fad237932b..bac9828033 100644
--- a/ext/spl/spl_heap.c
+++ b/ext/spl/spl_heap.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2015 The PHP Group |
+ | Copyright (c) 1997-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -588,7 +588,7 @@ SPL_METHOD(SplHeap, count)
long count;
spl_heap_object *intern = (spl_heap_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -603,7 +603,7 @@ SPL_METHOD(SplHeap, isEmpty)
{
spl_heap_object *intern = (spl_heap_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -644,7 +644,7 @@ SPL_METHOD(SplHeap, extract)
zval *value;
spl_heap_object *intern;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -706,7 +706,7 @@ SPL_METHOD(SplPriorityQueue, extract)
zval *value, *value_out, **value_out_pp;
spl_heap_object *intern;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -749,7 +749,7 @@ SPL_METHOD(SplPriorityQueue, top)
zval *value, **value_out;
spl_heap_object *intern;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -803,7 +803,7 @@ SPL_METHOD(SplHeap, recoverFromCorruption)
{
spl_heap_object *intern;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -836,7 +836,7 @@ SPL_METHOD(SplHeap, top)
zval *value;
spl_heap_object *intern;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
diff --git a/ext/spl/spl_heap.h b/ext/spl/spl_heap.h
index 2315243f1e..4416a978c6 100644
--- a/ext/spl/spl_heap.h
+++ b/ext/spl/spl_heap.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2015 The PHP Group |
+ | Copyright (c) 1997-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index dec2866969..c6181d922d 100644
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2015 The PHP Group |
+ | Copyright (c) 1997-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -139,6 +139,19 @@ static zend_object_handlers spl_handlers_dual_it;
(var) = it; \
} while (0)
+#define SPL_FETCH_SUB_ELEMENT(var, object, element) \
+ do { \
+ if(!(object)->iterators) { \
+ zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, \
+ "The object is in an invalid state as the parent constructor was not called"); \
+ return; \
+ } \
+ (var) = (object)->iterators[(object)->level].element; \
+ } while (0)
+
+#define SPL_FETCH_SUB_ITERATOR(var, object) SPL_FETCH_SUB_ELEMENT(var, object, iterator)
+
+
static void spl_recursive_it_dtor(zend_object_iterator *_iter TSRMLS_DC)
{
spl_recursive_it_iterator *iter = (spl_recursive_it_iterator*)_iter;
@@ -161,7 +174,10 @@ static int spl_recursive_it_valid_ex(spl_recursive_it_object *object, zval *zthi
{
zend_object_iterator *sub_iter;
int level = object->level;
-
+
+ if(!object->iterators) {
+ return FAILURE;
+ }
while (level >=0) {
sub_iter = object->iterators[level].iterator;
if (sub_iter->funcs->valid(sub_iter TSRMLS_CC) == SUCCESS) {
@@ -212,6 +228,8 @@ static void spl_recursive_it_move_forward_ex(spl_recursive_it_object *object, zv
zend_object_iterator *sub_iter;
int has_children;
+ SPL_FETCH_SUB_ITERATOR(iterator, object);
+
while (!EG(exception)) {
next_step:
iterator = object->iterators[object->level].iterator;
@@ -362,9 +380,11 @@ next_step:
}
}
}
- iterator->funcs->dtor(iterator TSRMLS_CC);
- zval_ptr_dtor(&object->iterators[object->level].zobject);
- object->level--;
+ if (object->level > 0) {
+ iterator->funcs->dtor(iterator TSRMLS_CC);
+ zval_ptr_dtor(&object->iterators[object->level].zobject);
+ object->level--;
+ }
} else {
return; /* done completeley */
}
@@ -375,9 +395,7 @@ static void spl_recursive_it_rewind_ex(spl_recursive_it_object *object, zval *zt
{
zend_object_iterator *sub_iter;
- if (!object->iterators) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "The %s instance wasn't initialized properly", Z_OBJCE_P(zthis)->name);
- }
+ SPL_FETCH_SUB_ITERATOR(sub_iter, object);
while (object->level) {
sub_iter = object->iterators[object->level].iterator;
@@ -597,7 +615,7 @@ 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;
}
@@ -610,12 +628,14 @@ SPL_METHOD(RecursiveIteratorIterator, valid)
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;
-
+ zend_object_iterator *iterator;
+
if (zend_parse_parameters_none() == FAILURE) {
return;
}
+ SPL_FETCH_SUB_ITERATOR(iterator, object);
+
if (iterator->funcs->get_current_key) {
iterator->funcs->get_current_key(iterator, return_value TSRMLS_CC);
} else {
@@ -628,13 +648,15 @@ SPL_METHOD(RecursiveIteratorIterator, key)
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;
+ zend_object_iterator *iterator;
zval **data;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
+ SPL_FETCH_SUB_ITERATOR(iterator, object);
+
iterator->funcs->get_current_data(iterator, &data TSRMLS_CC);
if (data && *data) {
RETURN_ZVAL(*data, 1, 0);
@@ -673,6 +695,7 @@ SPL_METHOD(RecursiveIteratorIterator, getSubIterator)
{
spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
long level = object->level;
+ zval *zobject;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &level) == FAILURE) {
return;
@@ -680,6 +703,13 @@ SPL_METHOD(RecursiveIteratorIterator, getSubIterator)
if (level < 0 || level > object->level) {
RETURN_NULL();
}
+
+ if(!object->iterators) {
+ zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC,
+ "The object is in an invalid state as the parent constructor was not called");
+ return;
+ }
+
RETURN_ZVAL(object->iterators[level].zobject, 1, 0);
} /* }}} */
@@ -688,13 +718,15 @@ SPL_METHOD(RecursiveIteratorIterator, getSubIterator)
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;
+ zval *zobject;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
-
- RETURN_ZVAL(object->iterators[level].zobject, 1, 0);
+
+ SPL_FETCH_SUB_ELEMENT(zobject, object, zobject);
+
+ RETURN_ZVAL(zobject, 1, 0);
} /* }}} */
/* {{{ proto RecursiveIterator RecursiveIteratorIterator::beginIteration()
@@ -722,13 +754,19 @@ SPL_METHOD(RecursiveIteratorIterator, endIteration)
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;
+ zend_class_entry *ce;
zval *retval, *zobject;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
+ if (!object->iterators) {
+ RETURN_NULL();
+ }
+
+ SPL_FETCH_SUB_ELEMENT(ce, object, ce);
+
zobject = object->iterators[object->level].zobject;
if (!zobject) {
RETURN_FALSE;
@@ -747,13 +785,15 @@ SPL_METHOD(RecursiveIteratorIterator, callHasChildren)
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;
+ zend_class_entry *ce;
zval *retval, *zobject;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
+ SPL_FETCH_SUB_ELEMENT(ce, object, ce);
+
zobject = object->iterators[object->level].zobject;
if (!zobject) {
return;
@@ -1072,6 +1112,13 @@ SPL_METHOD(RecursiveTreeIterator, getPrefix)
if (zend_parse_parameters_none() == FAILURE) {
return;
}
+
+ if(!object->iterators) {
+ zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC,
+ "The object is in an invalid state as the parent constructor was not called");
+ return;
+ }
+
spl_recursive_tree_iterator_get_prefix(object, return_value TSRMLS_CC);
} /* }}} */
@@ -1100,6 +1147,12 @@ SPL_METHOD(RecursiveTreeIterator, getEntry)
if (zend_parse_parameters_none() == FAILURE) {
return;
}
+
+ if(!object->iterators) {
+ zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC,
+ "The object is in an invalid state as the parent constructor was not called");
+ return;
+ }
spl_recursive_tree_iterator_get_entry(object, return_value TSRMLS_CC);
} /* }}} */
@@ -1113,6 +1166,12 @@ SPL_METHOD(RecursiveTreeIterator, getPostfix)
if (zend_parse_parameters_none() == FAILURE) {
return;
}
+
+ if(!object->iterators) {
+ zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC,
+ "The object is in an invalid state as the parent constructor was not called");
+ return;
+ }
spl_recursive_tree_iterator_get_postfix(object, return_value TSRMLS_CC);
} /* }}} */
@@ -1130,10 +1189,17 @@ SPL_METHOD(RecursiveTreeIterator, current)
return;
}
+ if(!object->iterators) {
+ zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC,
+ "The object is in an invalid state as the parent constructor was not called");
+ return;
+ }
+
if (object->flags & RTIT_BYPASS_CURRENT) {
- zend_object_iterator *iterator = object->iterators[object->level].iterator;
+ zend_object_iterator *iterator;
zval **data;
+ SPL_FETCH_SUB_ITERATOR(iterator, object);
iterator->funcs->get_current_data(iterator, &data TSRMLS_CC);
if (data && *data) {
RETURN_ZVAL(*data, 1, 0);
@@ -1177,7 +1243,7 @@ SPL_METHOD(RecursiveTreeIterator, current)
SPL_METHOD(RecursiveTreeIterator, 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;
+ zend_object_iterator *iterator;
zval prefix, key, postfix, key_copy;
char *str, *ptr;
size_t str_len;
@@ -1186,6 +1252,8 @@ SPL_METHOD(RecursiveTreeIterator, key)
return;
}
+ SPL_FETCH_SUB_ITERATOR(iterator, object);
+
if (iterator->funcs->get_current_key) {
iterator->funcs->get_current_key(iterator, &key TSRMLS_CC);
} else {
@@ -1899,7 +1967,7 @@ SPL_METHOD(RecursiveCallbackFilterIterator, getChildren)
return;
}
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
+ SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &retval);
if (!EG(exception) && retval) {
@@ -2062,7 +2130,7 @@ SPL_METHOD(RegexIterator, accept)
}
if (use_copy) {
- efree(subject);
+ str_efree(subject);
}
} /* }}} */
diff --git a/ext/spl/spl_iterators.h b/ext/spl/spl_iterators.h
index ec5581502b..e19823297f 100644
--- a/ext/spl/spl_iterators.h
+++ b/ext/spl/spl_iterators.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2015 The PHP Group |
+ | Copyright (c) 1997-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c
index cfe0479652..fb0b29fccd 100644
--- a/ext/spl/spl_observer.c
+++ b/ext/spl/spl_observer.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2015 The PHP Group |
+ | Copyright (c) 1997-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -26,6 +26,7 @@
#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
+#include "ext/standard/php_array.h"
#include "ext/standard/php_var.h"
#include "ext/standard/php_smart_str.h"
#include "zend_interfaces.h"
@@ -274,11 +275,6 @@ static zend_object_value spl_object_storage_new_ex(zend_class_entry *class_type,
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) spl_SplOjectStorage_free_storage, NULL TSRMLS_CC);
retval.handlers = &spl_handler_SplObjectStorage;
- if (orig) {
- spl_SplObjectStorage *other = (spl_SplObjectStorage*)zend_object_store_get_object(orig TSRMLS_CC);
- spl_object_storage_addall(intern, orig, other TSRMLS_CC);
- }
-
while (parent) {
if (parent == spl_ce_SplObjectStorage) {
if (class_type != spl_ce_SplObjectStorage) {
@@ -293,6 +289,11 @@ static zend_object_value spl_object_storage_new_ex(zend_class_entry *class_type,
parent = parent->parent;
}
+ if (orig) {
+ spl_SplObjectStorage *other = (spl_SplObjectStorage*)zend_object_store_get_object(orig TSRMLS_CC);
+ spl_object_storage_addall(intern, orig, other TSRMLS_CC);
+ }
+
return retval;
}
/* }}} */
@@ -610,8 +611,24 @@ SPL_METHOD(SplObjectStorage, contains)
SPL_METHOD(SplObjectStorage, count)
{
spl_SplObjectStorage *intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC);
+ long mode = COUNT_NORMAL;
- if (zend_parse_parameters_none() == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &mode) == FAILURE) {
+ return;
+ }
+
+ if (mode == COUNT_RECURSIVE) {
+ long ret = zend_hash_num_elements(&intern->storage);
+ HashPosition position;
+ zval *element;
+
+ for (zend_hash_internal_pointer_reset_ex(&intern->storage, &position);
+ zend_hash_get_current_data_ex(&intern->storage, (void**) &element, &position) == SUCCESS;
+ zend_hash_move_forward_ex(&intern->storage, &position)) {
+ ret += php_count_recursive(element, mode TSRMLS_CC);
+ }
+
+ RETURN_LONG(ret);
return;
}
@@ -804,7 +821,6 @@ SPL_METHOD(SplObjectStorage, unserialize)
}
if (buf_len == 0) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Empty serialized string cannot be empty");
return;
}
diff --git a/ext/spl/spl_observer.h b/ext/spl/spl_observer.h
index 4eed238264..d6adeefb41 100644
--- a/ext/spl/spl_observer.h
+++ b/ext/spl/spl_observer.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2015 The PHP Group |
+ | Copyright (c) 1997-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/spl/tests/ArrayObject_unserialize_empty_string.phpt b/ext/spl/tests/ArrayObject_unserialize_empty_string.phpt
index 75d8a41321..4c446c82b9 100644
--- a/ext/spl/tests/ArrayObject_unserialize_empty_string.phpt
+++ b/ext/spl/tests/ArrayObject_unserialize_empty_string.phpt
@@ -1,5 +1,5 @@
--TEST--
-ArrayObject: test that you cannot unserialize a empty string
+ArrayObject: test that you can unserialize a empty string
--CREDITS--
Havard Eide <nucleuz@gmail.com>
#PHPTestFest2009 Norway 2009-06-09 \o/
@@ -8,9 +8,6 @@ Havard Eide <nucleuz@gmail.com>
$a = new ArrayObject(array());
$a->unserialize("");
?>
+Done
--EXPECTF--
-Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Empty serialized string cannot be empty' in %s.php:%d
-Stack trace:
-#0 %s(%d): ArrayObject->unserialize('')
-#1 {main}
- thrown in %s.php on line %d
+Done
diff --git a/ext/spl/tests/DirectoryIterator_getBasename_basic_test.phpt b/ext/spl/tests/DirectoryIterator_getBasename_basic_test.phpt
index ed1f473be9..d4f22f68a1 100644
--- a/ext/spl/tests/DirectoryIterator_getBasename_basic_test.phpt
+++ b/ext/spl/tests/DirectoryIterator_getBasename_basic_test.phpt
@@ -4,7 +4,7 @@ DirectoryIterator::getBasename() - Basic Test
PHPNW Testfest 2009 - Adrian Hardy
--FILE--
<?php
- $targetDir = __DIR__.DIRECTORY_SEPARATOR.md5('directoryIterator::getbasename');
+ $targetDir = __DIR__.DIRECTORY_SEPARATOR.md5('directoryIterator::getbasename1');
mkdir($targetDir);
touch($targetDir.DIRECTORY_SEPARATOR.'getBasename_test.txt');
$dir = new DirectoryIterator($targetDir.DIRECTORY_SEPARATOR);
@@ -15,7 +15,7 @@ PHPNW Testfest 2009 - Adrian Hardy
?>
--CLEAN--
<?php
- $targetDir = __DIR__.DIRECTORY_SEPARATOR.md5('directoryIterator::getbasename');
+ $targetDir = __DIR__.DIRECTORY_SEPARATOR.md5('directoryIterator::getbasename1');
unlink($targetDir.DIRECTORY_SEPARATOR.'getBasename_test.txt');
rmdir($targetDir);
?>
diff --git a/ext/spl/tests/DirectoryIterator_getBasename_pass_array.phpt b/ext/spl/tests/DirectoryIterator_getBasename_pass_array.phpt
index b2df8a55c9..ef13520237 100644
--- a/ext/spl/tests/DirectoryIterator_getBasename_pass_array.phpt
+++ b/ext/spl/tests/DirectoryIterator_getBasename_pass_array.phpt
@@ -4,7 +4,7 @@ DirectoryIterator::getBasename() - Pass unexpected array
PHPNW Testfest 2009 - Adrian Hardy
--FILE--
<?php
- $targetDir = __DIR__.DIRECTORY_SEPARATOR.md5('directoryIterator::getbasename');
+ $targetDir = __DIR__.DIRECTORY_SEPARATOR.md5('directoryIterator::getbasename2');
mkdir($targetDir);
touch($targetDir.DIRECTORY_SEPARATOR.'getBasename_test.txt');
$dir = new DirectoryIterator($targetDir.DIRECTORY_SEPARATOR);
@@ -15,7 +15,7 @@ PHPNW Testfest 2009 - Adrian Hardy
?>
--CLEAN--
<?php
- $targetDir = __DIR__.DIRECTORY_SEPARATOR.md5('directoryIterator::getbasename');
+ $targetDir = __DIR__.DIRECTORY_SEPARATOR.md5('directoryIterator::getbasename2');
unlink($targetDir.DIRECTORY_SEPARATOR.'getBasename_test.txt');
rmdir($targetDir);
?>
diff --git a/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt b/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt
index f0b2b0182c..f6bc266cb1 100644
--- a/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt
+++ b/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt
@@ -5,7 +5,7 @@ Pawel Krynicki <pawel [dot] krynicki [at] xsolve [dot] pl>
#testfest AmsterdamPHP 2012-06-23
--FILE--
<?php
-$depth0 = "depth0";
+$depth0 = "depth01";
$depth1 = 'depth1';
$depth2 = 'depth2';
$targetDir = __DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . $depth1 . DIRECTORY_SEPARATOR . $depth2;
@@ -38,7 +38,7 @@ function rrmdir($dir) {
rmdir($dir);
}
-$targetDir = __DIR__.DIRECTORY_SEPARATOR . "depth0";
+$targetDir = __DIR__.DIRECTORY_SEPARATOR . "depth01";
rrmdir($targetDir);
?>
diff --git a/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt b/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt
index 7b12672e14..6527d84bfe 100644
--- a/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt
+++ b/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt
@@ -5,7 +5,7 @@ Pawel Krynicki <pawel [dot] krynicki [at] xsolve [dot] pl>
#testfest AmsterdamPHP 2012-06-23
--FILE--
<?php
-$depth0 = "depth0";
+$depth0 = "depth02";
$depth1 = "depth1";
$depth2 = "depth2";
$targetDir = __DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . $depth1 . DIRECTORY_SEPARATOR . $depth2;
@@ -41,7 +41,7 @@ function rrmdir($dir) {
rmdir($dir);
}
-$targetDir = __DIR__ . DIRECTORY_SEPARATOR . "depth0";
+$targetDir = __DIR__ . DIRECTORY_SEPARATOR . "depth02";
rrmdir($targetDir);
?>
--EXPECTF--
diff --git a/ext/spl/tests/SplFileObject_fgetcsv_basic.phpt b/ext/spl/tests/SplFileObject_fgetcsv_basic.phpt
index abfe5f235f..84b5403698 100644
--- a/ext/spl/tests/SplFileObject_fgetcsv_basic.phpt
+++ b/ext/spl/tests/SplFileObject_fgetcsv_basic.phpt
@@ -2,7 +2,7 @@
SplFileObject::fgetcsv default path
--FILE--
<?php
-$fp = fopen('SplFileObject__fgetcsv.csv', 'w+');
+$fp = fopen('SplFileObject__fgetcsv1.csv', 'w+');
fputcsv($fp, array(
'field1',
'field2',
@@ -11,12 +11,12 @@ fputcsv($fp, array(
));
fclose($fp);
-$fo = new SplFileObject('SplFileObject__fgetcsv.csv');
+$fo = new SplFileObject('SplFileObject__fgetcsv1.csv');
var_dump($fo->fgetcsv());
?>
--CLEAN--
<?php
-unlink('SplFileObject__fgetcsv.csv');
+unlink('SplFileObject__fgetcsv1.csv');
?>
--EXPECTF--
array(4) {
diff --git a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt
index 4402d6ca4c..a8125a0257 100644
--- a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt
+++ b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt
@@ -2,7 +2,7 @@
SplFileObject::fgetcsv with alternative delimiter
--FILE--
<?php
-$fp = fopen('SplFileObject__fgetcsv.csv', 'w+');
+$fp = fopen('SplFileObject__fgetcsv2.csv', 'w+');
fputcsv($fp, array(
'field1',
'field2',
@@ -11,12 +11,12 @@ fputcsv($fp, array(
), '|');
fclose($fp);
-$fo = new SplFileObject('SplFileObject__fgetcsv.csv');
+$fo = new SplFileObject('SplFileObject__fgetcsv2.csv');
var_dump($fo->fgetcsv('|'));
?>
--CLEAN--
<?php
-unlink('SplFileObject__fgetcsv.csv');
+unlink('SplFileObject__fgetcsv2.csv');
?>
--EXPECTF--
array(4) {
diff --git a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt
index 64d6514a29..169ded7dc3 100644
--- a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt
+++ b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt
@@ -2,7 +2,7 @@
SplFileObject::fgetcsv with alternative delimiter
--FILE--
<?php
-$fp = fopen('SplFileObject__fgetcsv.csv', 'w+');
+$fp = fopen('SplFileObject__fgetcsv3.csv', 'w+');
fputcsv($fp, array(
'field1',
'field2',
@@ -11,12 +11,12 @@ fputcsv($fp, array(
), '|');
fclose($fp);
-$fo = new SplFileObject('SplFileObject__fgetcsv.csv');
+$fo = new SplFileObject('SplFileObject__fgetcsv3.csv');
var_dump($fo->fgetcsv('invalid'));
?>
--CLEAN--
<?php
-unlink('SplFileObject__fgetcsv.csv');
+unlink('SplFileObject__fgetcsv3.csv');
?>
--EXPECTF--
Warning: SplFileObject::fgetcsv(): delimiter must be a character in %s on line %d
diff --git a/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt b/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt
index efbb5fb685..efe765cbf8 100644
--- a/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt
+++ b/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt
@@ -2,7 +2,7 @@
SplFileObject::fgetcsv with alternative delimiter
--FILE--
<?php
-$fp = fopen('SplFileObject__fgetcsv.csv', 'w+');
+$fp = fopen('SplFileObject__fgetcsv4.csv', 'w+');
fputcsv($fp, array(
'field1',
'field2',
@@ -11,12 +11,12 @@ fputcsv($fp, array(
), ',', '"');
fclose($fp);
-$fo = new SplFileObject('SplFileObject__fgetcsv.csv');
+$fo = new SplFileObject('SplFileObject__fgetcsv4.csv');
var_dump($fo->fgetcsv(',', '"'));
?>
--CLEAN--
<?php
-unlink('SplFileObject__fgetcsv.csv');
+unlink('SplFileObject__fgetcsv4.csv');
?>
--EXPECTF--
array(4) {
diff --git a/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt b/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt
index 7487b8353c..f8c14f0e35 100644
--- a/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt
+++ b/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt
@@ -2,7 +2,7 @@
SplFileObject::fgetcsv with alternative delimiter
--FILE--
<?php
-$fp = fopen('SplFileObject__fgetcsv.csv', 'w+');
+$fp = fopen('SplFileObject__fgetcsv5.csv', 'w+');
fputcsv($fp, array(
'field1',
'field2',
@@ -11,12 +11,12 @@ fputcsv($fp, array(
), ',', '"');
fclose($fp);
-$fo = new SplFileObject('SplFileObject__fgetcsv.csv');
+$fo = new SplFileObject('SplFileObject__fgetcsv5.csv');
var_dump($fo->fgetcsv(',', 'invalid'));
?>
--CLEAN--
<?php
-unlink('SplFileObject__fgetcsv.csv');
+unlink('SplFileObject__fgetcsv5.csv');
?>
--EXPECTF--
Warning: SplFileObject::fgetcsv(): enclosure must be a character in %s on line %d
diff --git a/ext/spl/tests/SplFileObject_fgetcsv_escape_basic.phpt b/ext/spl/tests/SplFileObject_fgetcsv_escape_basic.phpt
index 1a94532b2b..960f36d63f 100644
--- a/ext/spl/tests/SplFileObject_fgetcsv_escape_basic.phpt
+++ b/ext/spl/tests/SplFileObject_fgetcsv_escape_basic.phpt
@@ -2,16 +2,16 @@
SplFileObject::fgetcsv with alternative delimiter
--FILE--
<?php
-$fp = fopen('SplFileObject__fgetcsv.csv', 'w+');
+$fp = fopen('SplFileObject__fgetcsv6.csv', 'w+');
fwrite($fp, '"aaa","b""bb","ccc"');
fclose($fp);
-$fo = new SplFileObject('SplFileObject__fgetcsv.csv');
+$fo = new SplFileObject('SplFileObject__fgetcsv6.csv');
var_dump($fo->fgetcsv(',', '"', '"'));
?>
--CLEAN--
<?php
-unlink('SplFileObject__fgetcsv.csv');
+unlink('SplFileObject__fgetcsv6.csv');
?>
--EXPECTF--
array(3) {
diff --git a/ext/spl/tests/SplFileObject_fgetcsv_escape_default.phpt b/ext/spl/tests/SplFileObject_fgetcsv_escape_default.phpt
index c628ac043d..69089636c1 100644
--- a/ext/spl/tests/SplFileObject_fgetcsv_escape_default.phpt
+++ b/ext/spl/tests/SplFileObject_fgetcsv_escape_default.phpt
@@ -2,16 +2,16 @@
SplFileObject::fgetcsv with default escape character
--FILE--
<?php
-$fp = fopen('SplFileObject__fgetcsv.csv', 'w+');
+$fp = fopen('SplFileObject__fgetcsv7.csv', 'w+');
fwrite($fp, '"aa\"","bb","\"c"');
fclose($fp);
-$fo = new SplFileObject('SplFileObject__fgetcsv.csv');
+$fo = new SplFileObject('SplFileObject__fgetcsv7.csv');
var_dump($fo->fgetcsv());
?>
--CLEAN--
<?php
-unlink('SplFileObject__fgetcsv.csv');
+unlink('SplFileObject__fgetcsv7.csv');
?>
--EXPECTF--
array(3) {
diff --git a/ext/spl/tests/SplFileObject_fgetcsv_escape_error.phpt b/ext/spl/tests/SplFileObject_fgetcsv_escape_error.phpt
index fd90103bfa..b49bcdd13c 100644
--- a/ext/spl/tests/SplFileObject_fgetcsv_escape_error.phpt
+++ b/ext/spl/tests/SplFileObject_fgetcsv_escape_error.phpt
@@ -2,16 +2,16 @@
SplFileObject::fgetcsv with alternative delimiter
--FILE--
<?php
-$fp = fopen('SplFileObject__fgetcsv.csv', 'w+');
+$fp = fopen('SplFileObject__fgetcsv8.csv', 'w+');
fwrite($fp, '"aaa","b""bb","ccc"');
fclose($fp);
-$fo = new SplFileObject('SplFileObject__fgetcsv.csv');
+$fo = new SplFileObject('SplFileObject__fgetcsv8.csv');
var_dump($fo->fgetcsv(',', '"', 'invalid'));
?>
--CLEAN--
<?php
-unlink('SplFileObject__fgetcsv.csv');
+unlink('SplFileObject__fgetcsv8.csv');
?>
--EXPECTF--
Warning: SplFileObject::fgetcsv(): escape must be a character in %s on line %d
diff --git a/ext/spl/tests/SplFileObject_fputcsv_002.phpt b/ext/spl/tests/SplFileObject_fputcsv_002.phpt
index db174931f7..fdd4112ee6 100644
--- a/ext/spl/tests/SplFileObject_fputcsv_002.phpt
+++ b/ext/spl/tests/SplFileObject_fputcsv_002.phpt
@@ -2,7 +2,7 @@
SplFileObject::fputcsv(): Checking data after calling the function
--FILE--
<?php
-$fo = new SplFileObject(__DIR__ . '/SplFileObject_fputcsv.csv', 'w');
+$fo = new SplFileObject(__DIR__ . '/SplFileObject_fputcsv1.csv', 'w');
$data = array(1, 2, 'foo', 'haha', array(4, 5, 6), 1.3, null);
@@ -12,7 +12,7 @@ var_dump($data);
?>
--CLEAN--
<?php
-$file = __DIR__ . '/SplFileObject_fputcsv.csv';
+$file = __DIR__ . '/SplFileObject_fputcsv1.csv';
unlink($file);
?>
--EXPECTF--
diff --git a/ext/spl/tests/SplFileObject_fputcsv_error.phpt b/ext/spl/tests/SplFileObject_fputcsv_error.phpt
index 3de88c4c0c..4763455907 100644
--- a/ext/spl/tests/SplFileObject_fputcsv_error.phpt
+++ b/ext/spl/tests/SplFileObject_fputcsv_error.phpt
@@ -2,7 +2,7 @@
SplFileObject::fputcsv(): error conditions
--FILE--
<?php
-$fo = new SplFileObject(__DIR__ . '/SplFileObject_fputcsv.csv', 'w');
+$fo = new SplFileObject(__DIR__ . '/SplFileObject_fputcsv2.csv', 'w');
echo "*** Testing error conditions ***\n";
// zero argument
@@ -20,7 +20,7 @@ var_dump( $fo->fputcsv($fields, $delim, $enclosure, $escape, $fo) );
echo "Done\n";
--CLEAN--
<?php
-$file = __DIR__ . '/SplFileObject_fputcsv.csv';
+$file = __DIR__ . '/SplFileObject_fputcsv2.csv';
unlink($file);
?>
--EXPECTF--
diff --git a/ext/spl/tests/SplFixedArray_fromarray_param_multiarray.phpt b/ext/spl/tests/SplFixedArray_fromarray_param_multiarray.phpt
index f57fe78fb8..659f61c80d 100644
--- a/ext/spl/tests/SplFixedArray_fromarray_param_multiarray.phpt
+++ b/ext/spl/tests/SplFixedArray_fromarray_param_multiarray.phpt
@@ -1,5 +1,5 @@
--TEST--
-Tries to create a SplFixedArray using the fromArray() function and a multi dimentional array.
+Tries to create a SplFixedArray using the fromArray() function and a multi dimensional array.
--CREDITS--
Philip Norton philipnorton42@gmail.com
--FILE--
diff --git a/ext/spl/tests/SplObjectStorage_unserialize_bad.phpt b/ext/spl/tests/SplObjectStorage_unserialize_bad.phpt
index 8f0676de3b..a5678eab40 100644
--- a/ext/spl/tests/SplObjectStorage_unserialize_bad.phpt
+++ b/ext/spl/tests/SplObjectStorage_unserialize_bad.phpt
@@ -44,5 +44,5 @@ object(SplObjectStorage)#2 (1) {
}
}
}
-Error at offset 79 of 78 bytes
+Error at offset 78 of 78 bytes
DONE
diff --git a/ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter3.phpt b/ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter3.phpt
index 4c2dd75e14..617f85e63c 100644
--- a/ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter3.phpt
+++ b/ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter3.phpt
@@ -1,5 +1,5 @@
--TEST--
-Check that SplObjectStorage::unserialize throws exception when NULL passed
+Check that SplObjectStorage::unserialize doesn't throws exception when NULL passed
--CREDITS--
PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
--FILE--
@@ -14,6 +14,6 @@ try {
}
?>
+Done
--EXPECTF--
-Empty serialized string cannot be empty
-
+Done
diff --git a/ext/spl/tests/bug51532.phpt b/ext/spl/tests/bug51532.phpt
index 3a0722b2af..26eaa8f82f 100644
--- a/ext/spl/tests/bug51532.phpt
+++ b/ext/spl/tests/bug51532.phpt
@@ -4,7 +4,7 @@ SPL: Allow valid extension of SplFileObject::fscanf
<?php
class A extends SplFileObject {
- public function fscanf($format) {
+ public function fscanf($format, &...$vars) {
}
}
diff --git a/ext/spl/tests/bug53071.phpt b/ext/spl/tests/bug53071.phpt
index 20b929222c..a2983ed2b2 100644
--- a/ext/spl/tests/bug53071.phpt
+++ b/ext/spl/tests/bug53071.phpt
@@ -12,7 +12,7 @@ function LimitedScope()
$myA = new myClass();
$myB = new SplObjectStorage();
$myC = new myClass();
- $myC->member = $myA; // myC has a referece to myA
+ $myC->member = $myA; // myC has a reference to myA
$myB->Attach($myC); // myB attaches myC
$myA->member = $myB; // myA has myB, comleting the cycle
}
diff --git a/ext/spl/tests/bug54281.phpt b/ext/spl/tests/bug54281.phpt
index d42d9e585d..9a19a59ad8 100644
--- a/ext/spl/tests/bug54281.phpt
+++ b/ext/spl/tests/bug54281.phpt
@@ -12,4 +12,8 @@ foreach($it as $k=>$v) { }
?>
--EXPECTF--
-Fatal error: RecursiveIteratorIterator::rewind(): The RecursiveArrayIteratorIterator instance wasn't initialized properly in %s on line %d
+Fatal error: Uncaught exception 'LogicException' with message 'The object is in an invalid state as the parent constructor was not called' in %s:%d
+Stack trace:
+#0 %s%ebug54281.php(8): RecursiveIteratorIterator->rewind()
+#1 {main}
+ thrown in %s%ebug54281.php on line 8
diff --git a/ext/spl/tests/bug64782.phpt b/ext/spl/tests/bug64782.phpt
index ac5d08d7d1..ffe8a30b26 100644
--- a/ext/spl/tests/bug64782.phpt
+++ b/ext/spl/tests/bug64782.phpt
@@ -9,7 +9,7 @@ var_dump(new SplFileObject(__FILE__, "r", false, null));
--EXPECTF--
object(SplFileObject)#1 (%d) {
["pathName":"SplFileInfo":private]=>
- string(%d) "%s/bug64782.php"
+ string(%d) "%sbug64782.php"
["fileName":"SplFileInfo":private]=>
string(12) "bug64782.php"
["openMode":"SplFileObject":private]=>
diff --git a/ext/spl/tests/bug66834.phpt b/ext/spl/tests/bug66834.phpt
new file mode 100644
index 0000000000..66686c771a
--- /dev/null
+++ b/ext/spl/tests/bug66834.phpt
@@ -0,0 +1,158 @@
+--TEST--
+SPL: Bug #66834
+--FILE--
+<?php
+
+// overrides both offsetExists and offsetGet
+class ArrayObjectBoth extends ArrayObject
+{
+ public function offsetExists($offset) {
+ var_dump('Called: '.__METHOD__);
+ return parent::offsetExists($offset);
+ }
+
+ public function offsetGet($offset) {
+ var_dump('Called: '.__METHOD__);
+ return parent::offsetGet($offset);
+ }
+}
+
+// overrides only offsetExists
+class ArrayObjectExists extends ArrayObject
+{
+ public function offsetExists($offset) {
+ var_dump('Called: '.__METHOD__);
+ return parent::offsetExists($offset);
+ }
+}
+
+// overrides only offsetGet
+class ArrayObjectGet extends ArrayObject
+{
+ public function offsetGet($offset) {
+ var_dump('Called: '.__METHOD__);
+ return parent::offsetGet($offset);
+ }
+}
+
+// overrides only offsetGet and offsetSet
+class ArrayObjectGetSet extends ArrayObject
+{
+ public function offsetGet($offset)
+ {
+ return parent::offsetGet(str_rot13($offset));
+ }
+
+ public function offsetSet($offset, $value)
+ {
+ return parent::offsetSet(str_rot13($offset), $value);
+ }
+}
+
+$values = ['foo' => '', 'bar' => null, 'baz' => 42];
+
+echo "==== class with offsetExists() and offsetGet() ====\n";
+$object = new ArrayObjectBoth($values);
+var_dump($object->offsetExists('foo'), isset($object['foo']), empty($object['foo']));
+var_dump($object->offsetExists('bar'), isset($object['bar']), empty($object['bar']));
+var_dump($object->offsetexists('baz'), isset($object['baz']), empty($object['baz']));
+var_dump($object->offsetexists('qux'), isset($object['qux']), empty($object['qux']));
+
+echo "==== class with offsetExists() ====\n";
+$object = new ArrayObjectExists($values);
+var_dump($object->offsetExists('foo'), isset($object['foo']), empty($object['foo']));
+var_dump($object->offsetExists('bar'), isset($object['bar']), empty($object['bar']));
+var_dump($object->offsetexists('baz'), isset($object['baz']), empty($object['baz']));
+var_dump($object->offsetexists('qux'), isset($object['qux']), empty($object['qux']));
+
+echo "==== class with offsetGet() ====\n";
+$object = new ArrayObjectGet($values);
+var_dump($object->offsetExists('foo'), isset($object['foo']), empty($object['foo']));
+var_dump($object->offsetExists('bar'), isset($object['bar']), empty($object['bar']));
+var_dump($object->offsetexists('baz'), isset($object['baz']), empty($object['baz']));
+var_dump($object->offsetexists('qux'), isset($object['qux']), empty($object['qux']));
+
+echo "==== class with offsetGet() and offsetSet() ====\n";
+$object = new ArrayObjectGetSet;
+$object['foo'] = 42;
+var_dump($object->offsetExists('foo'), $object->offsetExists('sbb'), isset($object['foo']), isset($object['sbb']), empty($object['sbb']));
+
+?>
+--EXPECTF--
+==== class with offsetExists() and offsetGet() ====
+string(37) "Called: ArrayObjectBoth::offsetExists"
+string(37) "Called: ArrayObjectBoth::offsetExists"
+string(37) "Called: ArrayObjectBoth::offsetExists"
+string(34) "Called: ArrayObjectBoth::offsetGet"
+bool(true)
+bool(true)
+bool(true)
+string(37) "Called: ArrayObjectBoth::offsetExists"
+string(37) "Called: ArrayObjectBoth::offsetExists"
+string(37) "Called: ArrayObjectBoth::offsetExists"
+string(34) "Called: ArrayObjectBoth::offsetGet"
+bool(true)
+bool(true)
+bool(true)
+string(37) "Called: ArrayObjectBoth::offsetExists"
+string(37) "Called: ArrayObjectBoth::offsetExists"
+string(37) "Called: ArrayObjectBoth::offsetExists"
+string(34) "Called: ArrayObjectBoth::offsetGet"
+bool(true)
+bool(true)
+bool(false)
+string(37) "Called: ArrayObjectBoth::offsetExists"
+string(37) "Called: ArrayObjectBoth::offsetExists"
+string(37) "Called: ArrayObjectBoth::offsetExists"
+bool(false)
+bool(false)
+bool(true)
+==== class with offsetExists() ====
+string(39) "Called: ArrayObjectExists::offsetExists"
+string(39) "Called: ArrayObjectExists::offsetExists"
+string(39) "Called: ArrayObjectExists::offsetExists"
+bool(true)
+bool(true)
+bool(true)
+string(39) "Called: ArrayObjectExists::offsetExists"
+string(39) "Called: ArrayObjectExists::offsetExists"
+string(39) "Called: ArrayObjectExists::offsetExists"
+bool(true)
+bool(true)
+bool(true)
+string(39) "Called: ArrayObjectExists::offsetExists"
+string(39) "Called: ArrayObjectExists::offsetExists"
+string(39) "Called: ArrayObjectExists::offsetExists"
+bool(true)
+bool(true)
+bool(false)
+string(39) "Called: ArrayObjectExists::offsetExists"
+string(39) "Called: ArrayObjectExists::offsetExists"
+string(39) "Called: ArrayObjectExists::offsetExists"
+bool(false)
+bool(false)
+bool(true)
+==== class with offsetGet() ====
+string(33) "Called: ArrayObjectGet::offsetGet"
+bool(true)
+bool(true)
+bool(true)
+string(33) "Called: ArrayObjectGet::offsetGet"
+bool(true)
+bool(false)
+bool(true)
+string(33) "Called: ArrayObjectGet::offsetGet"
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+==== class with offsetGet() and offsetSet() ====
+
+Notice: Undefined index: foo in %s on line %d
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+bool(true)
diff --git a/ext/spl/tests/bug67582.phpt b/ext/spl/tests/bug67582.phpt
new file mode 100644
index 0000000000..b22f615034
--- /dev/null
+++ b/ext/spl/tests/bug67582.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Bug #67582: Cloned SplObjectStorage with overwritten getHash fails offsetExists()
+--FILE--
+<?php
+
+class MyObjectStorage extends SplObjectStorage {
+ // Overwrite getHash() with just some (working) test-method
+ public function getHash($object) { return get_class($object); }
+}
+
+class TestObject {}
+
+$list = new MyObjectStorage();
+$list->attach(new TestObject());
+
+foreach($list as $x) var_dump($list->offsetExists($x));
+
+$list2 = clone $list;
+foreach($list2 as $x) var_dump($list2->offsetExists($x));
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
diff --git a/ext/spl/tests/bug69737.phpt b/ext/spl/tests/bug69737.phpt
index d39ce3d4a8..d954fa0830 100644
--- a/ext/spl/tests/bug69737.phpt
+++ b/ext/spl/tests/bug69737.phpt
@@ -13,4 +13,4 @@ $h->insert(6);
?>
===DONE===
--EXPECTF--
-Fatal error: Call to undefined method SplMinHeap::notexist() in %s/bug69737.php on line %d
+Fatal error: Call to undefined method SplMinHeap::notexist() in %s%ebug69737.php on line %d
diff --git a/ext/spl/tests/bug69970.phpt b/ext/spl/tests/bug69970.phpt
new file mode 100644
index 0000000000..a488037b8c
--- /dev/null
+++ b/ext/spl/tests/bug69970.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Bug #69970 (Use-after-free vulnerability in spl_recursive_it_move_forward_ex())
+--FILE--
+<?php
+
+$count = 10;
+
+class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator {
+ function rewind() {
+ echo "dummy\n";
+ }
+ function endChildren() {
+ global $count;
+ echo $this->getDepth();
+ if (--$count > 0) {
+ // Trigger use-after-free
+ parent::rewind();
+ }
+ }
+}
+$arr = array("a", array("ba", array("bba", "bbb")));
+$obj = new RecursiveArrayIterator($arr);
+$rit = new RecursiveArrayIteratorIterator($obj);
+
+foreach ($rit as $k => $v) {
+ echo ($rit->getDepth()) . "$k=>$v\n";
+}
+?>
+--EXPECT--
+dummy
+00=>a
+00=>a
+10=>ba
+20=>bba
+21=>bbb
+21010=>ba
+20=>bba
+21=>bbb
+21010=>ba
+20=>bba
+21=>bbb
+21010=>ba
+20=>bba
+21=>bbb
+21
diff --git a/ext/spl/tests/bug70290.phpt b/ext/spl/tests/bug70290.phpt
new file mode 100644
index 0000000000..0fd83c2d75
--- /dev/null
+++ b/ext/spl/tests/bug70290.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Bug #70290 (Null pointer deref (segfault) in spl_autoload via ob_start)
+--INI--
+display_errors=2
+--FILE--
+<?php ob_start("spl_autoload"); ?> 1
+--EXPECT--
+Fatal error: Unknown: Class 1
+ could not be loaded in Unknown on line 0
diff --git a/ext/spl/tests/bug70303.phpt b/ext/spl/tests/bug70303.phpt
new file mode 100644
index 0000000000..059c370058
--- /dev/null
+++ b/ext/spl/tests/bug70303.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #70303 (Incorrect constructor reflection for ArrayObject)
+--FILE--
+<?php
+$f = new ReflectionClass('ArrayObject');
+$c = $f->getConstructor();
+$params = $c->getParameters();
+$param = $params[0];
+var_dump($param->isOptional());
+?>
+--EXPECT--
+bool(true)
diff --git a/ext/spl/tests/bug70561.phpt b/ext/spl/tests/bug70561.phpt
new file mode 100644
index 0000000000..c6c229ad89
--- /dev/null
+++ b/ext/spl/tests/bug70561.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Bug #70561 (DirectoryIterator::seek should throw OutOfBoundsException)
+--FILE--
+<?php
+$di = new DirectoryIterator(__DIR__ . '/..');
+
+$cnt = 0;
+$di->rewind();
+while ($di->valid()) {
+ $cnt++;
+ $di->next();
+}
+
+try {
+ $di->seek($cnt+1);
+} catch (OutOfBoundsException $ex) {
+ echo $ex->getMessage() . PHP_EOL;
+}
+echo "Is valid? " . (int) $di->valid() . PHP_EOL;
+?>
+--EXPECTF--
+Seek position %d is out of range
+Is valid? 0
diff --git a/ext/spl/tests/bug70852.phpt b/ext/spl/tests/bug70852.phpt
new file mode 100644
index 0000000000..2b23ce4e09
--- /dev/null
+++ b/ext/spl/tests/bug70852.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #70852 Segfault getting NULL offset of an ArrayObject
+--FILE--
+<?php
+$y = new ArrayObject();
+
+var_dump($y[NULL]);
+var_dump($y[NULL]++);
+?>
+===DONE===
+--EXPECTF--
+Notice: Undefined index: in %s on line %d
+NULL
+
+Notice: Undefined index: in %s on line %d
+NULL
+===DONE===
diff --git a/ext/spl/tests/bug71204.phpt b/ext/spl/tests/bug71204.phpt
new file mode 100644
index 0000000000..01a9f3bcaf
--- /dev/null
+++ b/ext/spl/tests/bug71204.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #71204 (segfault if clean spl_autoload_funcs while autoloading )
+--FILE--
+<?php
+
+spl_autoload_register(function ($name) {
+ spl_autoload_unregister("spl_autoload_call");
+});
+
+spl_autoload_register(function ($name) {
+});
+
+new A();
+?>
+--EXPECTF--
+Fatal error: Cannot destroy active lambda function in %sbug71204.php on line %d
diff --git a/ext/spl/tests/dit_006.phpt b/ext/spl/tests/dit_006.phpt
index 1e627a20e0..ed1ceffc05 100644
--- a/ext/spl/tests/dit_006.phpt
+++ b/ext/spl/tests/dit_006.phpt
@@ -2,7 +2,7 @@
SPL: DirectoryIterator and seek
--FILE--
<?php
-$di = new DirectoryIterator(__DIR__);
+$di = new DirectoryIterator(__DIR__."/..");
$di->seek(2);
$n = 0;
@@ -30,11 +30,12 @@ while ($di->valid()) {
echo "Without seek we get $o\n";
-$p = 0;
-$di->seek($o+1);
-while ($di->valid()) {
- $p++;
- $di->next();
+try {
+ $p = 0;
+ $di->seek($o+1);
+ $p = 1;
+} catch (\OutOfBoundsException $ex) {
+ echo $ex->getMessage() . PHP_EOL;
}
var_dump($n !== $m, $m === $o, $p === 0);
@@ -44,6 +45,7 @@ var_dump($n !== $m, $m === $o, $p === 0);
With seek(2) we get %d
With seek(0) we get %d
Without seek we get %d
+Seek position %d is out of range
bool(true)
bool(true)
bool(true)
diff --git a/ext/spl/tests/unserialize.phpt b/ext/spl/tests/unserialize.phpt
new file mode 100644
index 0000000000..3232b79678
--- /dev/null
+++ b/ext/spl/tests/unserialize.phpt
@@ -0,0 +1,43 @@
+--TEST--
+SPL: unserialize with no data (for PHPUnit)
+--FILE--
+<?php
+
+$types = array('SplDoublyLinkedList', 'SplObjectStorage', 'ArrayObject');
+
+foreach ($types as $type) {
+ // serialize an empty new object
+ $exp = serialize(new $type());
+ // hack to instanciate an object without constructor
+ $str = sprintf('C:%d:"%s":0:{}', strlen($type), $type);
+ $obj = unserialize($str);
+ var_dump($obj);
+ // serialize result
+ $out = serialize($obj);
+ // both should match
+ var_dump($exp === $out);
+}
+?>
+===DONE===
+--EXPECTF--
+object(SplDoublyLinkedList)#%d (2) {
+ ["flags":"SplDoublyLinkedList":private]=>
+ int(0)
+ ["dllist":"SplDoublyLinkedList":private]=>
+ array(0) {
+ }
+}
+bool(true)
+object(SplObjectStorage)#%d (1) {
+ ["storage":"SplObjectStorage":private]=>
+ array(0) {
+ }
+}
+bool(true)
+object(ArrayObject)#%d (1) {
+ ["storage":"ArrayObject":private]=>
+ array(0) {
+ }
+}
+bool(true)
+===DONE===