diff options
| author | Ondřej Surý <ondrej@sury.org> | 2010-03-09 11:57:54 +0100 |
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2010-03-09 11:57:54 +0100 |
| commit | 855a09f4eded707941180c9d90acd17c25e29447 (patch) | |
| tree | a40947efaa9876f31b6ee3956c3f3775768143bb /ext/spl | |
| parent | c852c28a88fccf6e34a2cb091fdfa72bce2b59c7 (diff) | |
| download | php-upstream/5.3.2.tar.gz | |
Imported Upstream version 5.3.2upstream/5.3.2
Diffstat (limited to 'ext/spl')
32 files changed, 341 insertions, 58 deletions
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index 1945f982e..8a7d6f32e 100755 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_spl.c 283179 2009-06-30 17:14:37Z cseiler $ */ +/* $Id: php_spl.c 293036 2010-01-03 09:23:27Z sebastian $ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/spl/php_spl.h b/ext/spl/php_spl.h index 8412b4cbd..353923a46 100755 --- a/ext/spl/php_spl.h +++ b/ext/spl/php_spl.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 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_array.c b/ext/spl/spl_array.c index 2a2e2f355..db3de0486 100755 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_array.c 287266 2009-08-13 22:07:05Z colder $ */ +/* $Id: spl_array.c 293036 2010-01-03 09:23:27Z sebastian $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -700,6 +700,7 @@ static HashTable* spl_array_get_debug_info(zval *obj, int *is_temp TSRMLS_DC) /* } if (intern->debug_info->nApplyCount == 0) { + zend_hash_clean(intern->debug_info); zend_hash_copy(intern->debug_info, intern->std.properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); storage = intern->array; diff --git a/ext/spl/spl_array.h b/ext/spl/spl_array.h index 9590ca6ed..be11a51ab 100755 --- a/ext/spl/spl_array.h +++ b/ext/spl/spl_array.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_array.h 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: spl_array.h 293036 2010-01-03 09:23:27Z sebastian $ */ #ifndef SPL_ARRAY_H #define SPL_ARRAY_H diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 860c6728b..5606062a7 100755 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_directory.c 284648 2009-07-23 14:42:46Z jani $ */ +/* $Id: spl_directory.c 293036 2010-01-03 09:23:27Z sebastian $ */ #ifdef HAVE_CONFIG_H # include "config.h" diff --git a/ext/spl/spl_directory.h b/ext/spl/spl_directory.h index 549cff657..404390eda 100755 --- a/ext/spl/spl_directory.h +++ b/ext/spl/spl_directory.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_directory.h 283689 2009-07-08 03:06:59Z iliaa $ */ +/* $Id: spl_directory.h 293036 2010-01-03 09:23:27Z sebastian $ */ #ifndef SPL_DIRECTORY_H #define SPL_DIRECTORY_H diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c index 2caf9cce4..505e92d7d 100644 --- a/ext/spl/spl_dllist.c +++ b/ext/spl/spl_dllist.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_dllist.c 287266 2009-08-13 22:07:05Z colder $ */ +/* $Id: spl_dllist.c 293036 2010-01-03 09:23:27Z sebastian $ */ #ifdef HAVE_CONFIG_H # include "config.h" diff --git a/ext/spl/spl_dllist.h b/ext/spl/spl_dllist.h index e5b6cb798..52b029c4e 100644 --- a/ext/spl/spl_dllist.h +++ b/ext/spl/spl_dllist.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_dllist.h 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: spl_dllist.h 294892 2010-02-11 17:24:43Z johannes $ */ #ifndef SPL_DLLIST_H #define SPL_DLLIST_H @@ -24,9 +24,9 @@ #include "php.h" #include "php_spl.h" -PHPAPI zend_class_entry *spl_ce_SplDoublyLinkedList; -PHPAPI zend_class_entry *spl_ce_SplQueue; -PHPAPI zend_class_entry *spl_ce_SplStack; +extern PHPAPI zend_class_entry *spl_ce_SplDoublyLinkedList; +extern PHPAPI zend_class_entry *spl_ce_SplQueue; +extern PHPAPI zend_class_entry *spl_ce_SplStack; PHP_MINIT_FUNCTION(spl_dllist); diff --git a/ext/spl/spl_engine.c b/ext/spl/spl_engine.c index 2eb0a4e06..e8edf6aaf 100755 --- a/ext/spl/spl_engine.c +++ b/ext/spl/spl_engine.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 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 bb62cb363..7baea3ae4 100755 --- a/ext/spl/spl_engine.h +++ b/ext/spl/spl_engine.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_engine.h 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: spl_engine.h 293036 2010-01-03 09:23:27Z sebastian $ */ #ifndef SPL_ENGINE_H #define SPL_ENGINE_H diff --git a/ext/spl/spl_exceptions.c b/ext/spl/spl_exceptions.c index 3a0904dff..b761be7c5 100755 --- a/ext/spl/spl_exceptions.c +++ b/ext/spl/spl_exceptions.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_exceptions.c 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: spl_exceptions.c 293036 2010-01-03 09:23:27Z sebastian $ */ #ifdef HAVE_CONFIG_H # include "config.h" diff --git a/ext/spl/spl_exceptions.h b/ext/spl/spl_exceptions.h index 1eabcdf46..20416d5c7 100755 --- a/ext/spl/spl_exceptions.h +++ b/ext/spl/spl_exceptions.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_exceptions.h 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: spl_exceptions.h 293036 2010-01-03 09:23:27Z sebastian $ */ #ifndef SPL_EXCEPTIONS_H #define SPL_EXCEPTIONS_H diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c index 5c192c811..b7bc2464b 100644 --- a/ext/spl/spl_fixedarray.c +++ b/ext/spl/spl_fixedarray.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 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 | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_fixedarray.c 283486 2009-07-04 20:31:27Z felipe $ */ +/* $Id: spl_fixedarray.c 293036 2010-01-03 09:23:27Z sebastian $ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/spl/spl_fixedarray.h b/ext/spl/spl_fixedarray.h index 0dfd9eb5c..83e796acc 100644 --- a/ext/spl/spl_fixedarray.h +++ b/ext/spl/spl_fixedarray.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 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 | @@ -17,12 +17,12 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_fixedarray.h 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: spl_fixedarray.h 294892 2010-02-11 17:24:43Z johannes $ */ #ifndef SPL_FIXEDARRAY_H #define SPL_FIXEDARRAY_H -PHPAPI zend_class_entry *spl_ce_SplFixedArray; +extern PHPAPI zend_class_entry *spl_ce_SplFixedArray; PHP_MINIT_FUNCTION(spl_fixedarray); diff --git a/ext/spl/spl_functions.c b/ext/spl/spl_functions.c index 8279aeeec..177a131cc 100755 --- a/ext/spl/spl_functions.c +++ b/ext/spl/spl_functions.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_functions.c 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: spl_functions.c 293036 2010-01-03 09:23:27Z sebastian $ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/spl/spl_functions.h b/ext/spl/spl_functions.h index c992f48c4..6cfb8bf08 100755 --- a/ext/spl/spl_functions.h +++ b/ext/spl/spl_functions.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_functions.h 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: spl_functions.h 293036 2010-01-03 09:23:27Z sebastian $ */ #ifndef PHP_FUNCTIONS_H #define PHP_FUNCTIONS_H diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c index 550b9efce..d06337733 100644 --- a/ext/spl/spl_heap.c +++ b/ext/spl/spl_heap.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_heap.c 287266 2009-08-13 22:07:05Z colder $ */ +/* $Id: spl_heap.c 293036 2010-01-03 09:23:27Z sebastian $ */ #ifdef HAVE_CONFIG_H # include "config.h" diff --git a/ext/spl/spl_heap.h b/ext/spl/spl_heap.h index cd9d36ab4..0cc707d60 100644 --- a/ext/spl/spl_heap.h +++ b/ext/spl/spl_heap.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_heap.h 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: spl_heap.h 294892 2010-02-11 17:24:43Z johannes $ */ #ifndef SPL_HEAP_H #define SPL_HEAP_H @@ -24,11 +24,11 @@ #include "php.h" #include "php_spl.h" -PHPAPI zend_class_entry *spl_ce_SplHeap; -PHPAPI zend_class_entry *spl_ce_SplMinHeap; -PHPAPI zend_class_entry *spl_ce_SplMaxHeap; +extern PHPAPI zend_class_entry *spl_ce_SplHeap; +extern PHPAPI zend_class_entry *spl_ce_SplMinHeap; +extern PHPAPI zend_class_entry *spl_ce_SplMaxHeap; -PHPAPI zend_class_entry *spl_ce_SplPriorityQueue; +extern PHPAPI zend_class_entry *spl_ce_SplPriorityQueue; PHP_MINIT_FUNCTION(spl_heap); diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index d498890bc..daf228496 100755 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_iterators.c 283486 2009-07-04 20:31:27Z felipe $ */ +/* $Id: spl_iterators.c 293036 2010-01-03 09:23:27Z sebastian $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -1166,7 +1166,7 @@ static union _zend_function *spl_dual_it_get_method(zval **object_ptr, char *met intern = (spl_dual_it_object*)zend_object_store_get_object(*object_ptr TSRMLS_CC); function_handler = std_object_handlers.get_method(object_ptr, method, method_len TSRMLS_CC); - if (!function_handler) { + if (!function_handler && intern->inner.ce) { if (zend_hash_find(&intern->inner.ce->function_table, method, method_len+1, (void **) &function_handler) == FAILURE) { if (Z_OBJ_HT_P(intern->inner.zobject)->get_method) { *object_ptr = intern->inner.zobject; @@ -1332,7 +1332,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z return NULL; } if (!retval || Z_TYPE_P(retval) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(retval), zend_ce_traversable TSRMLS_CC)) { - zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "%s::getIterator() must return an object that implememnts Traversable", ce->name); + zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "%s::getIterator() must return an object that implements Traversable", ce->name); zend_restore_error_handling(&error_handling TSRMLS_CC); return NULL; } @@ -2077,7 +2077,7 @@ static inline void spl_limit_it_seek(spl_dual_it_object *intern, long pos TSRMLS return; } if (pos >= intern->u.limit.offset + intern->u.limit.count && intern->u.limit.count != -1) { - zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Cannot seek to %ld which is behind offest %ld plus count %ld", pos, intern->u.limit.offset, intern->u.limit.count); + zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Cannot seek to %ld which is behind offset %ld plus count %ld", pos, intern->u.limit.offset, intern->u.limit.count); return; } if (instanceof_function(intern->inner.ce, spl_ce_SeekableIterator TSRMLS_CC)) { @@ -2382,10 +2382,8 @@ SPL_METHOD(CachingIterator, __toString) return; } } else if (intern->u.caching.flags & CIT_TOSTRING_USE_CURRENT) { - *return_value = *intern->current.data; - zval_copy_ctor(return_value); + MAKE_COPY_ZVAL(&intern->current.data, return_value); convert_to_string(return_value); - INIT_PZVAL(return_value); return; } if (intern->u.caching.zstr) { diff --git a/ext/spl/spl_iterators.h b/ext/spl/spl_iterators.h index d252d71b5..4464e0940 100755 --- a/ext/spl/spl_iterators.h +++ b/ext/spl/spl_iterators.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_iterators.h 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: spl_iterators.h 293036 2010-01-03 09:23:27Z sebastian $ */ #ifndef SPL_ITERATORS_H #define SPL_ITERATORS_H diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c index 3100ead59..75855ada4 100755 --- a/ext/spl/spl_observer.c +++ b/ext/spl/spl_observer.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is SplSubject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_observer.c 287266 2009-08-13 22:07:05Z colder $ */ +/* $Id: spl_observer.c 293036 2010-01-03 09:23:27Z sebastian $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -622,7 +622,7 @@ SPL_METHOD(SplObjectStorage, unserialize) ++p; ALLOC_INIT_ZVAL(pcount); - if (!php_var_unserialize(&pcount, &p, s + buf_len, &var_hash TSRMLS_CC) || Z_TYPE_P(pcount) != IS_LONG) { + if (!php_var_unserialize(&pcount, &p, s + buf_len, NULL TSRMLS_CC) || Z_TYPE_P(pcount) != IS_LONG) { zval_ptr_dtor(&pcount); goto outexcept; } diff --git a/ext/spl/spl_observer.h b/ext/spl/spl_observer.h index 0edb338c5..cbe25d674 100755 --- a/ext/spl/spl_observer.h +++ b/ext/spl/spl_observer.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_observer.h 272370 2008-12-31 11:15:49Z sebastian $ */ +/* $Id: spl_observer.h 293036 2010-01-03 09:23:27Z sebastian $ */ #ifndef SPL_OBSERVER_H #define SPL_OBSERVER_H diff --git a/ext/spl/tests/bug49263.phpt b/ext/spl/tests/bug49263.phpt new file mode 100644 index 000000000..14d0950f1 --- /dev/null +++ b/ext/spl/tests/bug49263.phpt @@ -0,0 +1,54 @@ +--TEST-- +SPL: SplObjectStorage serialization references +--SKIPIF-- +<?php if (!extension_loaded("spl")) print "skip"; ?> +--FILE-- +<?php +$o1 = new stdClass; +$o2 = new stdClass; + +$s = new splObjectStorage(); + +$s->attach($o1, array('prev' => 2, 'next' => $o2)); +$s->attach($o2, array('prev' => $o1)); + +$ss = serialize($s); +unset($s,$o1,$o2); +echo $ss."\n"; +var_dump(unserialize($ss)); +?> +===DONE=== +--EXPECTF-- +C:16:"SplObjectStorage":113:{x:i:2;O:8:"stdClass":0:{},a:2:{s:4:"prev";i:2;s:4:"next";O:8:"stdClass":0:{}};r:4;,a:1:{s:4:"prev";r:1;};m:a:0:{}} +object(SplObjectStorage)#2 (1) { + ["storage":"SplObjectStorage":private]=> + array(2) { + ["%s"]=> + array(2) { + ["obj"]=> + object(stdClass)#1 (0) { + } + ["inf"]=> + array(2) { + ["prev"]=> + int(2) + ["next"]=> + object(stdClass)#3 (0) { + } + } + } + ["%s"]=> + array(2) { + ["obj"]=> + object(stdClass)#3 (0) { + } + ["inf"]=> + array(1) { + ["prev"]=> + object(stdClass)#1 (0) { + } + } + } + } +} +===DONE=== diff --git a/ext/spl/tests/bug49972.phpt b/ext/spl/tests/bug49972.phpt new file mode 100755 index 000000000..843c2519b --- /dev/null +++ b/ext/spl/tests/bug49972.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #49972 (AppendIterator undefined function crash) +--FILE-- +<?php + +$iterator = new AppendIterator(); +$iterator->undefined(); + +?> +--EXPECTF-- +Fatal error: Call to undefined method AppendIterator::undefined() in %s on line %d diff --git a/ext/spl/tests/iterator_032.phpt b/ext/spl/tests/iterator_032.phpt index 8b1d97e18..84eb8e61f 100755 --- a/ext/spl/tests/iterator_032.phpt +++ b/ext/spl/tests/iterator_032.phpt @@ -45,6 +45,6 @@ int(1) int(2) Cannot seek to 0 which is below the offset 1 int(3) -Cannot seek to 3 which is behind offest 1 plus count 2 +Cannot seek to 3 which is behind offset 1 plus count 2 bool(false) ===DONE=== diff --git a/ext/spl/tests/iterator_069.phpt b/ext/spl/tests/iterator_069.phpt new file mode 100644 index 000000000..e9b3177ed --- /dev/null +++ b/ext/spl/tests/iterator_069.phpt @@ -0,0 +1,17 @@ +--TEST--
+SPL: RecursiveIteratorIterator cannot be used with foreach by reference
+--FILE--
+<?php
+
+$arr = array(array(1,2));
+$arrOb = new ArrayObject($arr);
+
+$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
+
+$recItIt = new RecursiveIteratorIterator($recArrIt);
+
+foreach ($recItIt as &$val) echo "$val\n";
+
+?>
+--EXPECTF--
+Fatal error: An iterator cannot be used with foreach by reference in %s on line %d
diff --git a/ext/spl/tests/iterator_070.phpt b/ext/spl/tests/iterator_070.phpt new file mode 100644 index 000000000..c45f08ec4 --- /dev/null +++ b/ext/spl/tests/iterator_070.phpt @@ -0,0 +1,20 @@ +--TEST--
+SPL: RecursiveIteratorIterator - Ensure that non-overriden methods execute problem free.
+--FILE--
+<?php
+
+$array = array();
+$recArrIt = new RecursiveArrayIterator($array);
+
+$recItIt = new RecursiveIteratorIterator($recArrIt);
+
+var_dump($recItIt->beginIteration());
+var_dump($recItIt->endIteration());
+var_dump($recItIt->nextElement());
+
+?>
+
+--EXPECTF--
+NULL
+NULL
+NULL
\ No newline at end of file diff --git a/ext/spl/tests/iterator_071.phpt b/ext/spl/tests/iterator_071.phpt new file mode 100644 index 000000000..21ec7980a --- /dev/null +++ b/ext/spl/tests/iterator_071.phpt @@ -0,0 +1,32 @@ +--TEST--
+SPL: RecursiveIteratorIterator - Test where the case is RS_SELF and mode is CHILD_FIRST
+--FILE--
+<?php
+
+$arr = array(array(1,2),2);
+$arrOb = new ArrayObject($arr);
+
+$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
+
+class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
+
+ function nextelement() {
+ echo __METHOD__."\n";
+ }
+}
+
+
+$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::CHILD_FIRST);
+
+foreach ($recItIt as $key => $val) echo "$key\n";
+
+?>
+--EXPECTF--
+MyRecursiveIteratorIterator::nextelement
+0
+MyRecursiveIteratorIterator::nextelement
+1
+MyRecursiveIteratorIterator::nextelement
+0
+MyRecursiveIteratorIterator::nextelement
+1
\ No newline at end of file diff --git a/ext/spl/tests/recursiveIteratorIterator_beginchildren_error.phpt b/ext/spl/tests/recursiveIteratorIterator_beginchildren_error.phpt new file mode 100644 index 000000000..f5430725d --- /dev/null +++ b/ext/spl/tests/recursiveIteratorIterator_beginchildren_error.phpt @@ -0,0 +1,36 @@ +--TEST--
+SPL: RecursiveIteratorIterator - Exception thrown in beginchildren which should be handled in next()
+--FILE--
+<?php
+
+$arr = array(array(1,2),2);
+$arrOb = new ArrayObject($arr);
+
+$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
+
+class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
+
+ function beginchildren() {
+ throw new Exception;
+ }
+}
+
+
+$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
+
+var_dump($recItIt->next());
+
+$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
+
+var_dump($recItIt2->next());
+
+?>
+--EXPECTF--
+NULL
+
+Fatal error: Uncaught exception 'Exception' in %s
+Stack trace:
+#0 [internal function]: MyRecursiveIteratorIterator->beginchildren()
+#1 %s: RecursiveIteratorIterator->next()
+#2 {main}
+ thrown in %s on line %d
diff --git a/ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt b/ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt new file mode 100644 index 000000000..88f03fbd8 --- /dev/null +++ b/ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt @@ -0,0 +1,36 @@ +--TEST--
+SPL: RecursiveIteratorIterator - Exception thrown in callHasChildren which should be handled in next()
+--FILE--
+<?php
+
+$arr = array(1,2);
+$arrOb = new ArrayObject($arr);
+
+$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
+
+class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
+
+ function callHasChildren() {
+ throw new Exception;
+ }
+}
+
+
+$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
+
+var_dump($recItIt->next());
+
+$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
+
+var_dump($recItIt2->next());
+
+?>
+--EXPECTF--
+NULL
+
+Fatal error: Uncaught exception 'Exception' in %s
+Stack trace:
+#0 [internal function]: MyRecursiveIteratorIterator->callHasChildren()
+#1 %s: RecursiveIteratorIterator->next()
+#2 {main}
+ thrown in %s on line %d
diff --git a/ext/spl/tests/recursiveIteratorIterator_endchildren_error.phpt b/ext/spl/tests/recursiveIteratorIterator_endchildren_error.phpt new file mode 100644 index 000000000..e25d3edc8 --- /dev/null +++ b/ext/spl/tests/recursiveIteratorIterator_endchildren_error.phpt @@ -0,0 +1,42 @@ +--TEST--
+SPL: RecursiveIteratorIterator - Exception thrown in endchildren which should be handled in next()
+--FILE--
+<?php
+
+$arr = array(array(1,2));
+$arrOb = new ArrayObject($arr);
+
+$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
+
+class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
+
+ function endchildren() {
+ throw new Exception;
+ }
+}
+
+
+$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
+
+foreach ($recItIt as $val) echo "$val\n";
+
+$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
+
+echo "===NEXT LOOP===\n";
+
+foreach ($recItIt2 as $val) echo "$val\n";
+
+?>
+--EXPECTF--
+1
+2
+===NEXT LOOP===
+1
+2
+
+Fatal error: Uncaught exception 'Exception' in %s
+Stack trace:
+#0 [internal function]: MyRecursiveIteratorIterator->endchildren()
+#1 %s: RecursiveIteratorIterator->next()
+#2 {main}
+ thrown in %s on line %d
diff --git a/ext/spl/tests/recursiveIteratorIterator_nextelement_error.phpt b/ext/spl/tests/recursiveIteratorIterator_nextelement_error.phpt new file mode 100644 index 000000000..3a91ed5b2 --- /dev/null +++ b/ext/spl/tests/recursiveIteratorIterator_nextelement_error.phpt @@ -0,0 +1,36 @@ +--TEST--
+SPL: RecursiveIteratorIterator - Exception thrown in nextelement which should be handled in next()
+--FILE--
+<?php
+
+$arr = array(1,2);
+$arrOb = new ArrayObject($arr);
+
+$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
+
+class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
+
+ function nextelement() {
+ throw new Exception;
+ }
+}
+
+
+$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
+
+var_dump($recItIt->next());
+
+$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
+
+var_dump($recItIt->next());
+
+?>
+--EXPECTF--
+NULL
+
+Fatal error: Uncaught exception 'Exception' in %s
+Stack trace:
+#0 [internal function]: MyRecursiveIteratorIterator->nextelement()
+#1 %s: RecursiveIteratorIterator->next()
+#2 {main}
+ thrown in %s on line %d
|
