]> granicus.if.org Git - php/commitdiff
Cleanup
authorMarcus Boerger <helly@php.net>
Wed, 26 Nov 2003 23:28:35 +0000 (23:28 +0000)
committerMarcus Boerger <helly@php.net>
Wed, 26 Nov 2003 23:28:35 +0000 (23:28 +0000)
15 files changed:
ext/spl/php_spl.c
ext/spl/php_spl.h
ext/spl/spl_array.c
ext/spl/spl_engine.h
ext/spl/tests/array_access_001.phpt [deleted file]
ext/spl/tests/array_access_002.phpt [deleted file]
ext/spl/tests/array_iterator.phpt
ext/spl/tests/array_object.phpt [moved from ext/spl/tests/array.phpt with 77% similarity]
ext/spl/tests/array_read.phpt [deleted file]
ext/spl/tests/foreach.phpt [deleted file]
ext/spl/tests/foreach_break.phpt [deleted file]
ext/spl/tests/foreach_continue.phpt [deleted file]
ext/spl/tests/foreach_non_spl.phpt [deleted file]
ext/spl/tests/forward.phpt [deleted file]
ext/spl/tests/sequence.phpt [deleted file]

index 3ed11067cd72011e3b8c2762913d247d4ca42820..0f8ca2da6273d99103d35c639eb4dc2372b588d5 100755 (executable)
@@ -62,11 +62,6 @@ zend_module_entry spl_module_entry = {
 };
 /* }}} */
 
-zend_class_entry *spl_ce_recursive_it;
-zend_class_entry *spl_ce_recursive_it_it;
-zend_class_entry *spl_ce_array_read;
-zend_class_entry *spl_ce_array_access;
-
 /* {{{ spl_functions_none
  */
 function_entry spl_functions_none[] = {
@@ -117,22 +112,6 @@ PHP_MSHUTDOWN_FUNCTION(spl)
 {                      
        SPL_DEBUG(fprintf(stderr, "%s\n", "Shutting down SPL");)
 
-#ifdef SPL_FOREACH
-       ZEND_EXECUTE_HOOK_RESTORE(ZEND_FE_RESET);
-       ZEND_EXECUTE_HOOK_RESTORE(ZEND_FE_FETCH);
-       ZEND_EXECUTE_HOOK_RESTORE(ZEND_SWITCH_FREE);
-#endif
-
-#if defined(SPL_ARRAY_READ) | defined(SPL_ARRAY_WRITE)
-       ZEND_EXECUTE_HOOK_RESTORE(ZEND_FETCH_DIM_R);
-       ZEND_EXECUTE_HOOK_RESTORE(ZEND_FETCH_DIM_W);
-       ZEND_EXECUTE_HOOK_RESTORE(ZEND_FETCH_DIM_RW); 
-#endif
-
-#ifdef SPL_ARRAY_WRITE
-       ZEND_EXECUTE_HOOK_RESTORE(ZEND_ASSIGN_DIM);
-#endif /* SPL_ARRAY_WRITE */
-
        return SUCCESS;
 }
 /* }}} */
@@ -141,30 +120,8 @@ PHP_MSHUTDOWN_FUNCTION(spl)
  */
 PHP_MINFO_FUNCTION(spl)
 {
-#ifdef SPL_FOREACH
-       char *foreach = "beta";
-#else /* SPL_ARRAY_WRITE */
-       char *foreach = "beta, not hooked";
-#endif
-#ifdef SPL_ARRAY_READ
-       char *array_read = "beta";
-#else /* SPL_ARRAY_WRITE */
-       char *array_read = "beta, not hooked";
-#endif
-#ifdef SPL_ARRAY_WRITE
-       char *array_write = "beta";
-#else /* SPL_ARRAY_WRITE */
-       char *array_write = "beta, not hooked";
-#endif /* SPL_ARRAY_WRITE */
-
        php_info_print_table_start();
        php_info_print_table_header(2, "SPL support",        "enabled");
-       php_info_print_table_row(2,    "iterator",           foreach);
-       php_info_print_table_row(2,    "forward",            foreach);
-       php_info_print_table_row(2,    "sequence",           foreach);
-       php_info_print_table_row(2,    "assoc",              foreach);
-       php_info_print_table_row(2,    "ArrayRead",         array_read);
-       php_info_print_table_row(2,    "ArrayAccess",       array_write);
        php_info_print_table_end();
 }
 /* }}} */
index 474da85c010940d03db2ae7cd2dfe9eb1a20df2e..b2fd7709cb4dfdb53b1bfb46c8964c06b383c457 100755 (executable)
@@ -42,37 +42,8 @@ PHP_RINIT_FUNCTION(spl);
 PHP_RSHUTDOWN_FUNCTION(spl);
 PHP_MINFO_FUNCTION(spl);
 
-#define ZEND_EXECUTE_HOOK_PTR(name) \
-       opcode_handler_t handler_ ## name
-
-#define ZEND_EXECUTE_HOOK(name) \
-       spl_globals->handler_ ## name = zend_opcode_handlers[name]; \
-       zend_opcode_handlers[name] = spl_handler_ ## name
-
-#define ZEND_EXECUTE_HOOK_RESTORE(name) \
-       zend_opcode_handlers[name] = SPL_G(handler_ ## name)
-
-#define ZEND_EXECUTE_HOOK_ORIGINAL(name) \
-       return SPL_G(handler_ ## name)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU)
-
-#define ZEND_EXECUTE_HOOK_FUNCTION(name) \
-       int spl_handler_ ## name(ZEND_OPCODE_HANDLER_ARGS)
 
 ZEND_BEGIN_MODULE_GLOBALS(spl)
-#ifdef SPL_FOREACH
-       ZEND_EXECUTE_HOOK_PTR(ZEND_FE_RESET);
-       ZEND_EXECUTE_HOOK_PTR(ZEND_FE_FETCH);
-       ZEND_EXECUTE_HOOK_PTR(ZEND_SWITCH_FREE);
-#endif
-#if defined(SPL_ARRAY_READ) | defined(SPL_ARRAY_WRITE)
-       ZEND_EXECUTE_HOOK_PTR(ZEND_FETCH_DIM_R);
-       ZEND_EXECUTE_HOOK_PTR(ZEND_FETCH_DIM_W);
-       ZEND_EXECUTE_HOOK_PTR(ZEND_FETCH_DIM_RW);
-#endif
-#ifdef SPL_ARRAY_WRITE
-       ZEND_EXECUTE_HOOK_PTR(ZEND_ASSIGN_DIM);
-       ZEND_EXECUTE_HOOK_PTR(ZEND_UNSET_DIM_OBJ);
-#endif
 ZEND_END_MODULE_GLOBALS(spl)
 
 #ifdef ZTS
index 9ae571c47700b06fae6703ac11ebaceab9c66628..42b9252aea4d478513a17d6e2c4c75e8080cb5b4 100755 (executable)
@@ -303,8 +303,8 @@ PHP_MINIT_FUNCTION(spl_array)
 }
 /* }}} */
 
-/* {{{ proto void spl_array::__construct(array|object ar = array())
-       proto void spl_array_it::__construct(array|object ar = array())
+/* {{{ proto void ArrayObject::__construct(array|object ar = array())
+       proto void ArrayIterator::__construct(array|object ar = array())
  Cronstructs a new array iterator from a path. */
 SPL_METHOD(Array, __construct)
 {
@@ -338,7 +338,7 @@ SPL_METHOD(Array, __construct)
 }
 /* }}} */
 
-/* {{{ proto spl_array_it|NULL ArrayObject::getIterator()
+/* {{{ proto ArrayIterator ArrayObject::getIterator()
    Create a new iterator from a ArrayObject instance */
 SPL_METHOD(Array, getIterator)
 {
@@ -381,7 +381,7 @@ ZEND_API int spl_hash_pos_exists(spl_array_object * intern TSRMLS_DC)
 }
 /* }}} */
 
-/* {{{ proto void spl_array_it::rewind()
+/* {{{ proto void ArrayIterator::rewind()
    Rewind array back to the start */
 SPL_METHOD(Array, rewind)
 {
@@ -398,7 +398,7 @@ SPL_METHOD(Array, rewind)
 }
 /* }}} */
 
-/* {{{ proto mixed|false spl_array_it::current()
+/* {{{ proto mixed|false ArrayIterator::current()
    Return current array entry */
 SPL_METHOD(Array, current)
 {
@@ -425,7 +425,7 @@ SPL_METHOD(Array, current)
 }
 /* }}} */
 
-/* {{{ proto mixed|false spl_array_it::key()
+/* {{{ proto mixed|false ArrayIterator::key()
    Return current array key */
 SPL_METHOD(Array, key)
 {
@@ -459,7 +459,7 @@ SPL_METHOD(Array, key)
 }
 /* }}} */
 
-/* {{{ proto void spl_array_it::next()
+/* {{{ proto void ArrayIterator::next()
    Move to next entry */
 SPL_METHOD(Array, next)
 {
@@ -480,7 +480,7 @@ SPL_METHOD(Array, next)
 }
 /* }}} */
 
-/* {{{ proto bool spl_array_it::hasMore()
+/* {{{ proto bool ArrayIterator::hasMore()
    Check whether array contains more entries */
 SPL_METHOD(Array, hasMore)
 {
index a753a9339e01cd44542a20a7c40084e1460581b8..40e887e6b03be3b47ab2183454c7bd015b601841 100755 (executable)
@@ -33,15 +33,6 @@ static inline zend_class_entry *spl_get_class_entry(zval *obj TSRMLS_DC)
 }
 /* }}} */
 
-#define spl_call_method_0(obj, obj_ce, fn_proxy, function_name, fname_len, retval) \
-       spl_call_method(obj, obj_ce, fn_proxy, function_name, fname_len, retval, 0, NULL, NULL TSRMLS_CC)
-
-#define spl_call_method_1(obj, obj_ce, fn_proxy, function_name, fname_len, retval, arg1) \
-       spl_call_method(obj, obj_ce, fn_proxy, function_name, fname_len, retval, 1, arg1, NULL TSRMLS_CC)
-
-#define spl_call_method_2(obj, obj_ce, fn_proxy, function_name, fname_len, retval, arg1, arg2) \
-       spl_call_method(obj, obj_ce, fn_proxy, function_name, fname_len, retval, 2, arg1, arg2 TSRMLS_CC)
-
 void spl_instantiate(zend_class_entry *pce, zval **object, int alloc TSRMLS_DC);
 int spl_instantiate_arg_ex1(zend_class_entry *pce, zval **retval, int alloc, zval *arg1 TSRMLS_DC);
 int spl_instantiate_arg_ex2(zend_class_entry *pce, zval **retval, int alloc, zval *arg1, zval *arg2 TSRMLS_DC);
diff --git a/ext/spl/tests/array_access_001.phpt b/ext/spl/tests/array_access_001.phpt
deleted file mode 100755 (executable)
index 2c81204..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
---TEST--
-SPL: array_access
---SKIPIF--
-<?php
-       if (!extension_loaded("spl")) die("skip");
-       if (!in_array("ArrayAccess", spl_classes())) die("skip spl_array_access not present");
-?>
---FILE--
-<?php
-class c implements ArrayAccess {
-
-       public $a = array('1st', 1, 2=>'3rd', '4th'=>4);
-       function exists($index) {
-               echo __METHOD__ . "($index)\n";
-               return array_key_exists($index, $this->a);
-       }
-       function get($index) {
-               echo __METHOD__ . "($index)\n";
-               return $this->a[$index];
-       }
-       function set($index, $newval) {
-               echo __METHOD__ . "($index,$newval)\n";
-               return $this->a[$index] = $newval;
-       }
-       function del($index) {
-               echo __METHOD__ . "($index)\n";
-               unset($this->a[$index]);
-       }
-}
-
-$obj = new c();
-
-var_dump($obj->a);
-
-var_dump($obj[0]);
-var_dump($obj[1]);
-var_dump($obj[2]);
-var_dump($obj['4th']);
-var_dump($obj['5th']);
-var_dump($obj[6]);
-
-echo "WRITE 1\n";
-$obj[1] = 'Changed 1';
-var_dump($obj[1]);
-echo "WRITE 2\n";
-$obj['4th'] = 'Changed 4th';
-var_dump($obj['4th']);
-echo "WRITE 3\n";
-$obj['5th'] = 'Added 5th';
-var_dump($obj['5th']);
-echo "WRITE 4\n";
-$obj[6] = 'Added 6';
-var_dump($obj[6]);
-
-var_dump($obj[0]);
-var_dump($obj[2]);
-
-$x = $obj[6] = 'changed 6';
-var_dump($obj[6]);
-var_dump($x);
-
-echo "===unset===\n";
-var_dump($obj->a);
-unset($obj[2]);
-unset($obj['4th']);
-unset($obj[7]);
-unset($obj['8th']);
-var_dump($obj->a);
-
-print "Done\n";
-?>
---EXPECTF--
-array(4) {
-  [0]=>
-  string(3) "1st"
-  [1]=>
-  int(1)
-  [2]=>
-  string(3) "3rd"
-  ["4th"]=>
-  int(4)
-}
-c::exists(0)
-c::get(0)
-string(3) "1st"
-c::exists(1)
-c::get(1)
-int(1)
-c::exists(2)
-c::get(2)
-string(3) "3rd"
-c::exists(4th)
-c::get(4th)
-int(4)
-c::exists(5th)
-
-Notice: Undefined index:  5th in %sarray_access_001.php on line %d
-NULL
-c::exists(6)
-
-Notice: Undefined index:  6 in %sarray_access_001.php on line %d
-NULL
-WRITE 1
-c::set(1,Changed 1)
-c::exists(1)
-c::get(1)
-string(9) "Changed 1"
-WRITE 2
-c::set(4th,Changed 4th)
-c::exists(4th)
-c::get(4th)
-string(11) "Changed 4th"
-WRITE 3
-c::set(5th,Added 5th)
-c::exists(5th)
-c::get(5th)
-string(9) "Added 5th"
-WRITE 4
-c::set(6,Added 6)
-c::exists(6)
-c::get(6)
-string(7) "Added 6"
-c::exists(0)
-c::get(0)
-string(3) "1st"
-c::exists(2)
-c::get(2)
-string(3) "3rd"
-c::set(6,changed 6)
-c::exists(6)
-c::get(6)
-string(9) "changed 6"
-string(9) "changed 6"
-===unset===
-array(6) {
-  [0]=>
-  string(3) "1st"
-  [1]=>
-  string(9) "Changed 1"
-  [2]=>
-  string(3) "3rd"
-  ["4th"]=>
-  string(11) "Changed 4th"
-  ["5th"]=>
-  string(9) "Added 5th"
-  [6]=>
-  string(9) "changed 6"
-}
-c::del(2)
-c::del(4th)
-c::del(7)
-c::del(8th)
-array(4) {
-  [0]=>
-  string(3) "1st"
-  [1]=>
-  string(9) "Changed 1"
-  ["5th"]=>
-  string(9) "Added 5th"
-  [6]=>
-  string(9) "changed 6"
-}
-Done
diff --git a/ext/spl/tests/array_access_002.phpt b/ext/spl/tests/array_access_002.phpt
deleted file mode 100755 (executable)
index 133e6f3..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
---TEST--
-SPL: array_access without return in set()
---SKIPIF--
-<?php
-       if (!extension_loaded("spl")) die("skip");
-       if (!in_array("spl_array_access", spl_classes())) die("skip spl_array_access not present");
-?>
---FILE--
-<?php
-class c implements spl_array_access {
-
-       public $a = array('1st', 1, 2=>'3rd', '4th'=>4);
-
-       function exists($index) {
-               echo __METHOD__ . "($index)\n";
-               return array_key_exists($index, $this->a);
-       }
-       function get($index) {
-               echo __METHOD__ . "($index)\n";
-               return $this->a[$index];
-       }
-       function set($index, $newval) {
-               echo __METHOD__ . "($index,$newval)\n";
-               /* return */ $this->a[$index] = $newval;
-       }
-       function del($index) {
-               echo __METHOD__ . "($index)\n";
-               unset($this->a[$index]);
-       }
-}
-
-$obj = new c();
-
-var_dump($obj->a);
-
-var_dump($obj[0]);
-var_dump($obj[1]);
-var_dump($obj[2]);
-var_dump($obj['4th']);
-var_dump($obj['5th']);
-var_dump($obj[6]);
-
-echo "WRITE 1\n";
-$obj[1] = 'Changed 1';
-var_dump($obj[1]);
-echo "WRITE 2\n";
-$obj['4th'] = 'Changed 4th';
-var_dump($obj['4th']);
-echo "WRITE 3\n";
-$obj['5th'] = 'Added 5th';
-var_dump($obj['5th']);
-echo "WRITE 4\n";
-$obj[6] = 'Added 6';
-var_dump($obj[6]);
-
-var_dump($obj[0]);
-var_dump($obj[2]);
-
-$x = $obj[6] = 'changed 6';
-var_dump($obj[6]);
-var_dump($x);
-
-print "Done\n";
-?>
---EXPECTF--
-array(4) {
-  [0]=>
-  string(3) "1st"
-  [1]=>
-  int(1)
-  [2]=>
-  string(3) "3rd"
-  ["4th"]=>
-  int(4)
-}
-c::exists(0)
-c::get(0)
-string(3) "1st"
-c::exists(1)
-c::get(1)
-int(1)
-c::exists(2)
-c::get(2)
-string(3) "3rd"
-c::exists(4th)
-c::get(4th)
-int(4)
-c::exists(5th)
-
-Notice: Undefined index:  5th in %sarray_access_002.php on line %d
-NULL
-c::exists(6)
-
-Notice: Undefined index:  6 in %sarray_access_002.php on line %d
-NULL
-WRITE 1
-c::set(1,Changed 1)
-
-Warning: Method c::set() did not return a value, using input value in %sarray_access_002.php on line %d
-c::exists(1)
-c::get(1)
-string(9) "Changed 1"
-WRITE 2
-c::set(4th,Changed 4th)
-
-Warning: Method c::set() did not return a value, using input value in %sarray_access_002.php on line %d
-c::exists(4th)
-c::get(4th)
-string(11) "Changed 4th"
-WRITE 3
-c::set(5th,Added 5th)
-
-Warning: Method c::set() did not return a value, using input value in %sarray_access_002.php on line %d
-c::exists(5th)
-c::get(5th)
-string(9) "Added 5th"
-WRITE 4
-c::set(6,Added 6)
-
-Warning: Method c::set() did not return a value, using input value in %sarray_access_002.php on line %d
-c::exists(6)
-c::get(6)
-string(7) "Added 6"
-c::exists(0)
-c::get(0)
-string(3) "1st"
-c::exists(2)
-c::get(2)
-string(3) "3rd"
-c::set(6,changed 6)
-
-Warning: Method c::set() did not return a value, using input value in %sarray_access_002.php on line %d
-c::exists(6)
-c::get(6)
-string(9) "changed 6"
-string(9) "changed 6"
-Done
index 751e623d1cb642ccdfd7b80f6b79b5fb26281e9f..ef5a79819d791e9522b006e5f2df0b614488a8d1 100755 (executable)
@@ -1,5 +1,5 @@
 --TEST--
-SPL: spl_array_iterator
+SPL: ArrayIterator
 --SKIPIF--
 <?php if (!extension_loaded("spl")) print "skip"; ?>
 --FILE--
@@ -8,7 +8,7 @@ SPL: spl_array_iterator
 echo "==Normal==\n";
 
 $arr = array(0=>0, 1=>1, 2=>2);
-$obj = new spl_array($arr);
+$obj = new ArrayObject($arr);
 
 foreach($obj as $ak=>$av) {
        foreach($obj as $bk=>$bv) {
@@ -22,7 +22,7 @@ foreach($obj as $ak=>$av) {
 echo "==UseRef==\n";
 
 $arr = array(0=>0, 1=>1, 2=>2);
-$obj = new spl_array(&$arr);
+$obj = new ArrayObject(&$arr);
 
 foreach($obj as $ak=>$av) {
        foreach($obj as $bk=>$bv) {
@@ -33,7 +33,7 @@ foreach($obj as $ak=>$av) {
 echo "==Modify==\n";
 
 $arr = array(0=>0, 1=>1, 2=>2);
-$obj = new spl_array(&$arr);
+$obj = new ArrayObject(&$arr);
 
 foreach($obj as $ak=>$av) {
        foreach($obj as $bk=>$bv) {
@@ -47,7 +47,7 @@ foreach($obj as $ak=>$av) {
 echo "==Delete==\n";
 
 $arr = array(0=>0, 1=>1, 2=>2);
-$obj = new spl_array(&$arr);
+$obj = new ArrayObject(&$arr);
 
 foreach($obj as $ak=>$av) {
        foreach($obj as $bk=>$bv) {
@@ -61,7 +61,7 @@ foreach($obj as $ak=>$av) {
 echo "==Change==\n";
 
 $arr = array(0=>0, 1=>1, 2=>2);
-$obj = new spl_array(&$arr);
+$obj = new ArrayObject(&$arr);
 
 foreach($obj as $ak=>$av) {
        foreach($obj as $bk=>$bv) {
@@ -112,11 +112,11 @@ echo "Done\n";
 1=>1 - 0=>0
 1=>1 - 1=>1
 
-Notice: spl_array_it::next(): Array was modified outside object and internal position is no longer valid in %sarray_iterator.php on line %d
+Notice: ArrayIterator::next(): Array was modified outside object and internal position is no longer valid in %sarray_iterator.php on line %d
 1=>1 - 0=>0
 1=>1 - 2=>2
 
-Notice: spl_array_it::next(): Array was modified outside object and internal position is no longer valid in %sarray_iterator.php on line %d
+Notice: ArrayIterator::next(): Array was modified outside object and internal position is no longer valid in %sarray_iterator.php on line %d
 0=>0 - 0=>0
 0=>0 - 2=>2
 2=>2 - 0=>0
@@ -128,11 +128,11 @@ Notice: spl_array_it::next(): Array was modified outside object and internal pos
 1=>1 - 0=>0
 1=>1 - 1=>1
 
-Notice: spl_array_it::next(): Array was modified outside object and is no longer an array in %sarray_iterator.php on line %d
+Notice: ArrayIterator::next(): Array was modified outside object and is no longer an array in %sarray_iterator.php on line %d
 
-Notice: spl_array_it::hasMore(): Array was modified outside object and is no longer an array in %sarray_iterator.php on line %d
+Notice: ArrayIterator::hasMore(): Array was modified outside object and is no longer an array in %sarray_iterator.php on line %d
 
-Notice: spl_array_it::next(): Array was modified outside object and is no longer an array in %sarray_iterator.php on line %d
+Notice: ArrayIterator::next(): Array was modified outside object and is no longer an array in %sarray_iterator.php on line %d
 
-Notice: spl_array_it::hasMore(): Array was modified outside object and is no longer an array in %sarray_iterator.php on line %d
+Notice: ArrayIterator::hasMore(): Array was modified outside object and is no longer an array in %sarray_iterator.php on line %d
 Done
similarity index 77%
rename from ext/spl/tests/array.phpt
rename to ext/spl/tests/array_object.phpt
index fcaaa65ee583221f23a3f09b3f099615a6b22fc9..1ba6101036fab6b7f375afd4e4e389045f2a398b 100755 (executable)
@@ -1,5 +1,5 @@
 --TEST--
-SPL: array
+SPL: ArrayObject
 --SKIPIF--
 <?php if (!extension_loaded("spl")) print "skip"; ?>
 --FILE--
@@ -70,15 +70,15 @@ object(ArrayObject)#1 (5) {
 }
 int(0)
 
-Notice: Undefined offset:  6 in %sarray.php on line %d
+Notice: Undefined offset:  6 in %sarray_object.php on line %d
 NULL
 
-Notice: Undefined index:  b in %sarray.php on line %d
+Notice: Undefined index:  b in %sarray_object.php on line %d
 NULL
 
-Notice: Undefined offset:  7 in %sarray.php on line %d
+Notice: Undefined offset:  7 in %sarray_object.php on line %d
 
-Notice: Undefined index:  c in %sarray.php on line %d
+Notice: Undefined index:  c in %sarray_object.php on line %d
 object(ArrayObject)#1 (2) {
   [0]=>
   int(0)
diff --git a/ext/spl/tests/array_read.phpt b/ext/spl/tests/array_read.phpt
deleted file mode 100755 (executable)
index 032373d..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
---TEST--
-SPL: array_read
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-
-echo "EXTERNAL\n";
-
-$a = array('1st', 1, 2=>'3rd', '4th'=>4);
-var_dump($a);
-
-class external implements spl_array_read {
-
-       function exists($index) {
-               echo __METHOD__ . "($index)\n";
-               return array_key_exists($index, $GLOBALS['a']);
-       }
-
-       function get($index) {
-               echo __METHOD__ . "($index)\n";
-               return $GLOBALS['a'][$index];
-       }
-}
-
-$obj = new external();
-
-var_dump($obj->get(0));
-var_dump($obj->get(1));
-var_dump($obj->get(2));
-var_dump($obj->get('4th'));
-var_dump($obj->get('5th'));
-var_dump($obj->get(6));
-
-var_dump($obj[0]);
-var_dump($obj[1]);
-var_dump($obj[2]);
-var_dump($obj['4th']);
-var_dump($obj['5th']);
-var_dump($obj[6]);
-
-$out = $obj[0]; echo "$out\n";
-$out = $obj[1]; echo "$out\n";
-$out = $obj[2]; echo "$out\n";
-$out = $obj['4th']; echo "$out\n";
-
-echo "INTERNAL\n";
-
-class internal implements spl_array_read {
-
-       public $a = array('1st', 1, 2=>'3rd', '4th'=>4);
-
-       function exists($index) {
-               echo __METHOD__ . "($index)\n";
-               return array_key_exists($index, $GLOBALS['a']);
-       }
-
-       function get($index) {
-               echo __METHOD__ . "($index)\n";
-               return $GLOBALS['a'][$index];
-       }
-}
-
-$obj = new internal();
-
-var_dump($obj->a);
-
-var_dump($obj->get(0));
-var_dump($obj->get(1));
-var_dump($obj->get(2));
-var_dump($obj->get('4th'));
-var_dump($obj->get('5th'));
-var_dump($obj->get(6));
-
-var_dump($obj[0]);
-var_dump($obj[1]);
-var_dump($obj[2]);
-var_dump($obj['4th']);
-var_dump($obj['5th']);
-var_dump($obj[6]);
-
-$out = $obj[0]; echo "$out\n";
-$out = $obj[1]; echo "$out\n";
-$out = $obj[2]; echo "$out\n";
-$out = $obj['4th']; echo "$out\n";
-
-print "Done\n";
-?>
---EXPECTF--
-EXTERNAL
-array(4) {
-  [0]=>
-  string(3) "1st"
-  [1]=>
-  int(1)
-  [2]=>
-  string(3) "3rd"
-  ["4th"]=>
-  int(4)
-}
-external::get(0)
-string(3) "1st"
-external::get(1)
-int(1)
-external::get(2)
-string(3) "3rd"
-external::get(4th)
-int(4)
-external::get(5th)
-
-Notice: Undefined index:  5th in %s on line %d
-NULL
-external::get(6)
-
-Notice: Undefined offset:  6 in %s on line %d
-NULL
-external::exists(0)
-external::get(0)
-string(3) "1st"
-external::exists(1)
-external::get(1)
-int(1)
-external::exists(2)
-external::get(2)
-string(3) "3rd"
-external::exists(4th)
-external::get(4th)
-int(4)
-external::exists(5th)
-
-Notice: Undefined index:  5th in %s on line %d
-NULL
-external::exists(6)
-
-Notice: Undefined index:  6 in %s on line %d
-NULL
-external::exists(0)
-external::get(0)
-1st
-external::exists(1)
-external::get(1)
-1
-external::exists(2)
-external::get(2)
-3rd
-external::exists(4th)
-external::get(4th)
-4
-INTERNAL
-array(4) {
-  [0]=>
-  string(3) "1st"
-  [1]=>
-  int(1)
-  [2]=>
-  string(3) "3rd"
-  ["4th"]=>
-  int(4)
-}
-internal::get(0)
-string(3) "1st"
-internal::get(1)
-int(1)
-internal::get(2)
-string(3) "3rd"
-internal::get(4th)
-int(4)
-internal::get(5th)
-
-Notice: Undefined index:  5th in %s on line %d
-NULL
-internal::get(6)
-
-Notice: Undefined offset:  6 in %s on line %d
-NULL
-internal::exists(0)
-internal::get(0)
-string(3) "1st"
-internal::exists(1)
-internal::get(1)
-int(1)
-internal::exists(2)
-internal::get(2)
-string(3) "3rd"
-internal::exists(4th)
-internal::get(4th)
-int(4)
-internal::exists(5th)
-
-Notice: Undefined index:  5th in %s on line %d
-NULL
-internal::exists(6)
-
-Notice: Undefined index:  6 in %s on line %d
-NULL
-internal::exists(0)
-internal::get(0)
-1st
-internal::exists(1)
-internal::get(1)
-1
-internal::exists(2)
-internal::get(2)
-3rd
-internal::exists(4th)
-internal::get(4th)
-4
-Done
diff --git a/ext/spl/tests/foreach.phpt b/ext/spl/tests/foreach.phpt
deleted file mode 100755 (executable)
index 0a4cd91..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
---TEST--
-SPL: foreach and iterator
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-class c_iter implements spl_forward_assoc {
-
-       private $obj;
-       private $num = 0;
-
-       function __construct($obj) {
-               echo __METHOD__ . "\n";
-               $this->num = 0;
-               $this->obj = $obj;
-       }
-       function current() {
-               echo __METHOD__ . "\n";
-               return $this->num;
-       }
-       function next() {
-               echo __METHOD__ . "\n";
-               $this->num++;
-       }
-       function hasMore() {
-               $more = $this->num < $this->obj->max;
-               echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n";
-               return $more;
-       }
-       function key() {
-               echo __METHOD__ . "\n";
-               switch($this->num) {
-                       case 0: return "1st";
-                       case 1: return "2nd";
-                       case 2: return "3rd";
-                       default: return "???";
-               }
-       }
-}
-       
-class c implements spl_iterator {
-
-       public $max = 3;
-
-       function newIterator() {
-               echo __METHOD__ . "\n";
-               return new c_iter($this);
-       }
-}
-
-$t = new c();
-
-for ($iter = $t->newIterator(); $iter->hasMore(); $iter->next()) {
-       echo $iter->current() . "\n";
-}
-
-$a = array(0,1,2);
-foreach($a as $v) {
-       echo "array:$v\n";
-}
-
-foreach($t as $v) {
-       echo "object:$v\n";
-}
-
-foreach($t as $v) {
-       foreach($t as $w) {
-               echo "double:$v:$w\n";
-       }
-}
-
-foreach($t as $i => $v) {
-       echo "object:$i=>$v\n";
-}
-
-print "Done\n";
-?>
---EXPECT--
-c::newIterator
-c_iter::__construct
-c_iter::hasMore = true
-c_iter::current
-0
-c_iter::next
-c_iter::hasMore = true
-c_iter::current
-1
-c_iter::next
-c_iter::hasMore = true
-c_iter::current
-2
-c_iter::next
-c_iter::hasMore = false
-array:0
-array:1
-array:2
-c::newIterator
-c_iter::__construct
-c_iter::hasMore = true
-c_iter::current
-c_iter::key
-object:0
-c_iter::next
-c_iter::hasMore = true
-c_iter::current
-c_iter::key
-object:1
-c_iter::next
-c_iter::hasMore = true
-c_iter::current
-c_iter::key
-object:2
-c_iter::next
-c_iter::hasMore = false
-c::newIterator
-c_iter::__construct
-c_iter::hasMore = true
-c_iter::current
-c_iter::key
-c::newIterator
-c_iter::__construct
-c_iter::hasMore = true
-c_iter::current
-c_iter::key
-double:0:0
-c_iter::next
-c_iter::hasMore = true
-c_iter::current
-c_iter::key
-double:0:1
-c_iter::next
-c_iter::hasMore = true
-c_iter::current
-c_iter::key
-double:0:2
-c_iter::next
-c_iter::hasMore = false
-c_iter::next
-c_iter::hasMore = true
-c_iter::current
-c_iter::key
-c::newIterator
-c_iter::__construct
-c_iter::hasMore = true
-c_iter::current
-c_iter::key
-double:1:0
-c_iter::next
-c_iter::hasMore = true
-c_iter::current
-c_iter::key
-double:1:1
-c_iter::next
-c_iter::hasMore = true
-c_iter::current
-c_iter::key
-double:1:2
-c_iter::next
-c_iter::hasMore = false
-c_iter::next
-c_iter::hasMore = true
-c_iter::current
-c_iter::key
-c::newIterator
-c_iter::__construct
-c_iter::hasMore = true
-c_iter::current
-c_iter::key
-double:2:0
-c_iter::next
-c_iter::hasMore = true
-c_iter::current
-c_iter::key
-double:2:1
-c_iter::next
-c_iter::hasMore = true
-c_iter::current
-c_iter::key
-double:2:2
-c_iter::next
-c_iter::hasMore = false
-c_iter::next
-c_iter::hasMore = false
-c::newIterator
-c_iter::__construct
-c_iter::hasMore = true
-c_iter::current
-c_iter::key
-object:1st=>0
-c_iter::next
-c_iter::hasMore = true
-c_iter::current
-c_iter::key
-object:2nd=>1
-c_iter::next
-c_iter::hasMore = true
-c_iter::current
-c_iter::key
-object:3rd=>2
-c_iter::next
-c_iter::hasMore = false
-Done
diff --git a/ext/spl/tests/foreach_break.phpt b/ext/spl/tests/foreach_break.phpt
deleted file mode 100755 (executable)
index 184b762..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
---TEST--
-SPL: foreach and break
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-class c_iter implements spl_forward_assoc {
-
-       private $obj;
-       private $num = 0;
-
-       function __construct($obj) {
-               $this->obj = $obj;
-       }
-       function current() {
-               echo __METHOD__ . "\n";
-               return $this->num;
-       }
-       function next() {
-               echo __METHOD__ . "\n";
-               $this->num++;
-       }
-       function hasMore() {
-               $more = $this->num < $this->obj->max;
-               echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n";
-               return $more;
-       }
-       function key() {
-               echo __METHOD__ . "\n";
-               switch($this->num) {
-                       case 0: return "1st";
-                       case 1: return "2nd";
-                       case 2: return "3rd";
-                       default: return "???";
-               }
-       }
-}
-       
-class c implements spl_iterator {
-
-       public $max = 3;
-
-       function newIterator() {
-               echo __METHOD__ . "\n";
-               return new c_iter($this);
-       }
-}
-
-$t = new c();
-
-foreach($t as $v) {
-       foreach($t as $w) {
-               echo "double:$v:$w\n";
-               break;
-       }
-}
-
-print "Done\n";
-?>
---EXPECT--
-c::newIterator
-c_iter::hasMore = true
-c_iter::current
-c_iter::key
-c::newIterator
-c_iter::hasMore = true
-c_iter::current
-c_iter::key
-double:0:0
-c_iter::next
-c_iter::hasMore = true
-c_iter::current
-c_iter::key
-c::newIterator
-c_iter::hasMore = true
-c_iter::current
-c_iter::key
-double:1:0
-c_iter::next
-c_iter::hasMore = true
-c_iter::current
-c_iter::key
-c::newIterator
-c_iter::hasMore = true
-c_iter::current
-c_iter::key
-double:2:0
-c_iter::next
-c_iter::hasMore = false
-Done
diff --git a/ext/spl/tests/foreach_continue.phpt b/ext/spl/tests/foreach_continue.phpt
deleted file mode 100755 (executable)
index 289f67e..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
---TEST--
-SPL: foreach and break
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-class c_iter implements spl_forward {
-
-       private $obj;
-       private $num = 0;
-
-       function __construct($obj) {
-               $this->obj = $obj;
-       }
-       function current() {
-               echo __METHOD__ . "\n";
-               return $this->num;
-       }
-       function next() {
-               echo __METHOD__ . "\n";
-               $this->num++;
-       }
-       function hasMore() {
-               $more = $this->num < $this->obj->max;
-               echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n";
-               return $more;
-       }
-}
-       
-class c implements spl_iterator {
-
-       public $max = 4;
-
-       function newIterator() {
-               echo __METHOD__ . "\n";
-               return new c_iter($this);
-       }
-}
-
-$t = new c();
-
-foreach($t as $v) {
-       if ($v == 0) {
-               echo "continue outer\n";
-               continue;
-       }
-       foreach($t as $w) {
-               if ($w == 1) {
-                       echo "continue inner\n";
-                       continue;
-               }
-               if ($w == 2) {
-                       echo "break inner\n";
-                       break;
-               }
-               echo "double:$v:$w\n";
-       }
-       if ($v == 2) {
-               echo "break outer\n";
-               break;
-       }
-}
-
-print "Done\n";
-?>
---EXPECT--
-c::newIterator
-c_iter::hasMore = true
-c_iter::current
-continue outer
-c_iter::next
-c_iter::hasMore = true
-c_iter::current
-c::newIterator
-c_iter::hasMore = true
-c_iter::current
-double:1:0
-c_iter::next
-c_iter::hasMore = true
-c_iter::current
-continue inner
-c_iter::next
-c_iter::hasMore = true
-c_iter::current
-break inner
-c_iter::next
-c_iter::hasMore = true
-c_iter::current
-c::newIterator
-c_iter::hasMore = true
-c_iter::current
-double:2:0
-c_iter::next
-c_iter::hasMore = true
-c_iter::current
-continue inner
-c_iter::next
-c_iter::hasMore = true
-c_iter::current
-break inner
-break outer
-Done
diff --git a/ext/spl/tests/foreach_non_spl.phpt b/ext/spl/tests/foreach_non_spl.phpt
deleted file mode 100755 (executable)
index 71a7cb7..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
---TEST--
-SPL: foreach non spl classes
---SKIPIF--
-<?php if (0 && !extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-
-echo "1st try\n";
-
-class c1 {}
-
-$obj = new c1();
-
-foreach($obj as $w) {
-       echo "object:$w\n";
-}
-
-echo "2nd try\n";
-
-class c2 {
-
-       public $max = 3;
-       public $num = 0;
-
-       function current() {
-               echo __METHOD__ . "\n";
-               return $this->num;
-       }
-       function next() {
-               echo __METHOD__ . "\n";
-               $this->num++;
-       }
-       function hasMore() {
-               echo __METHOD__ . "\n";
-               return $this->num < $this->max;
-       }
-       function key() {
-               echo __METHOD__ . "\n";
-               switch($this->num) {
-                       case 0: return "1st";
-                       case 1: return "2nd";
-                       case 2: return "3rd";
-                       default: return "???";
-               }
-       }
-}
-
-$obj = new c2();
-
-foreach($obj as $v => $w) {
-       echo "object:$v=>$w\n";
-}
-
-print "Done\n";
-?>
---EXPECTF--
-1st try
-2nd try
-object:max=>3
-object:num=>0
-Done
diff --git a/ext/spl/tests/forward.phpt b/ext/spl/tests/forward.phpt
deleted file mode 100755 (executable)
index 8a14a52..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
---TEST--
-SPL: forward
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-class c implements spl_forward_assoc {
-
-       public $max = 3;
-       public $num = 0;
-
-       function current() {
-               echo __METHOD__ . "\n";
-               return $this->num;
-       }
-       function next() {
-               echo __METHOD__ . "\n";
-               $this->num++;
-       }
-       function hasMore() {
-               echo __METHOD__ . "\n";
-               return $this->num < $this->max;
-       }
-       function key() {
-               echo __METHOD__ . "\n";
-               switch($this->num) {
-                       case 0: return "1st";
-                       case 1: return "2nd";
-                       case 2: return "3rd";
-                       default: return "???";
-               }
-       }
-}
-
-$i = new c();
-
-$implements = class_implements($i);
-asort($implements);
-$c_info = array(get_class($i) => array('inheits' => class_parents($i), 'implements' => $implements));
-print_r($c_info);
-$methods = get_class_methods("spl_forward_assoc");
-sort($methods);
-print_r($methods);
-$methods = get_class_methods($i);
-sort($methods);
-print_r($methods);
-
-
-echo "1st try\n";
-foreach($i as $w) {
-       echo "object:$w\n";
-}
-
-echo "2nd try\n";
-
-foreach($i as $v => $w) {
-       echo "object:$v=>$w\n";
-}
-
-echo "3rd try\n";
-$i->num = 0;
-
-foreach($i as $v => $w) {
-       echo "object:$v=>$w\n";
-}
-
-print "Done\n";
-?>
---EXPECT--
-Array
-(
-    [c] => Array
-        (
-            [inheits] => Array
-                (
-                )
-
-            [implements] => Array
-                (
-                    [spl_assoc] => spl_assoc
-                    [spl_forward] => spl_forward
-                    [spl_forward_assoc] => spl_forward_assoc
-                )
-
-        )
-
-)
-Array
-(
-    [0] => current
-    [1] => hasMore
-    [2] => key
-    [3] => next
-)
-Array
-(
-    [0] => current
-    [1] => hasMore
-    [2] => key
-    [3] => next
-)
-1st try
-c::hasMore
-c::current
-c::key
-object:0
-c::next
-c::hasMore
-c::current
-c::key
-object:1
-c::next
-c::hasMore
-c::current
-c::key
-object:2
-c::next
-c::hasMore
-2nd try
-c::hasMore
-3rd try
-c::hasMore
-c::current
-c::key
-object:1st=>0
-c::next
-c::hasMore
-c::current
-c::key
-object:2nd=>1
-c::next
-c::hasMore
-c::current
-c::key
-object:3rd=>2
-c::next
-c::hasMore
-Done
diff --git a/ext/spl/tests/sequence.phpt b/ext/spl/tests/sequence.phpt
deleted file mode 100755 (executable)
index 34ea7fd..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
---TEST--
-SPL: sequence
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-class c implements spl_iterator {
-
-       public $max = 3;
-
-       function newIterator() {
-               echo __METHOD__ . "\n";
-               return new c_iter($this);
-       }
-}
-
-class c_iter implements spl_sequence_assoc {
-
-       private $obj;
-       private $num = 0;
-
-       function __construct($obj) {
-               $this->obj = $obj;
-       }
-       function rewind() {
-               echo __METHOD__ . "\n";
-               $this->num = 0;
-       }
-       function current() {
-               echo __METHOD__ . "\n";
-               return $this->num;
-       }
-       function next() {
-               echo __METHOD__ . "\n";
-               $this->num++;
-       }
-       function hasMore() {
-               echo __METHOD__ . "\n";
-               return $this->num < $this->obj->max;
-       }
-       function key() {
-               echo __METHOD__ . "\n";
-               switch($this->num) {
-                       case 0: return "1st";
-                       case 1: return "2nd";
-                       case 2: return "3rd";
-                       default: return "???";
-               }
-       }
-}
-
-$t = new c();
-$i = $t->newIterator(); 
-
-$implements_t = class_implements($t);
-asort($implements_t);
-$implements_i = class_implements($i);
-asort($implements_i);
-
-$c_info = array(get_class($t) => array('inheits' => class_parents($t), 'implements' => $implements_t),
-                get_class($i) => array('inheits' => class_parents($i), 'implements' => $implements_i));
-print_r($c_info);
-
-foreach($i as $w) {
-       echo "object:$w\n";
-}
-
-foreach($i as $v => $w) {
-       echo "object:$v=>$w\n";
-}
-
-print "Done\n";
-?>
---EXPECT--
-c::newIterator
-Array
-(
-    [c] => Array
-        (
-            [inheits] => Array
-                (
-                )
-
-            [implements] => Array
-                (
-                    [spl_iterator] => spl_iterator
-                )
-
-        )
-
-    [c_iter] => Array
-        (
-            [inheits] => Array
-                (
-                )
-
-            [implements] => Array
-                (
-                    [spl_assoc] => spl_assoc
-                    [spl_forward] => spl_forward
-                    [spl_forward_assoc] => spl_forward_assoc
-                    [spl_sequence] => spl_sequence
-                    [spl_sequence_assoc] => spl_sequence_assoc
-                )
-
-        )
-
-)
-c_iter::rewind
-c_iter::hasMore
-c_iter::current
-c_iter::key
-object:0
-c_iter::next
-c_iter::hasMore
-c_iter::current
-c_iter::key
-object:1
-c_iter::next
-c_iter::hasMore
-c_iter::current
-c_iter::key
-object:2
-c_iter::next
-c_iter::hasMore
-c_iter::rewind
-c_iter::hasMore
-c_iter::current
-c_iter::key
-object:1st=>0
-c_iter::next
-c_iter::hasMore
-c_iter::current
-c_iter::key
-object:2nd=>1
-c_iter::next
-c_iter::hasMore
-c_iter::current
-c_iter::key
-object:3rd=>2
-c_iter::next
-c_iter::hasMore
-Done
\ No newline at end of file