summaryrefslogtreecommitdiff
path: root/ext/spl
diff options
context:
space:
mode:
Diffstat (limited to 'ext/spl')
-rwxr-xr-xext/spl/CREDITS2
-rwxr-xr-xext/spl/EXPERIMENTAL0
-rwxr-xr-xext/spl/README88
-rwxr-xr-xext/spl/README.PROFILING98
-rwxr-xr-xext/spl/TODO13
-rwxr-xr-xext/spl/config.m441
-rwxr-xr-xext/spl/examples/dba_array.php79
-rwxr-xr-xext/spl/examples/dba_dump.php66
-rwxr-xr-xext/spl/php_spl.c314
-rwxr-xr-xext/spl/php_spl.h112
-rwxr-xr-xext/spl/spl.php304
-rwxr-xr-xext/spl/spl_array.c353
-rwxr-xr-xext/spl/spl_array.h49
-rwxr-xr-xext/spl/spl_engine.c340
-rwxr-xr-xext/spl/spl_engine.h115
-rwxr-xr-xext/spl/spl_foreach.c269
-rwxr-xr-xext/spl/spl_foreach.h38
-rwxr-xr-xext/spl/spl_functions.c151
-rwxr-xr-xext/spl/spl_functions.h74
-rwxr-xr-xext/spl/tests/.htaccess3
-rwxr-xr-xext/spl/tests/array_access_001.phpt127
-rwxr-xr-xext/spl/tests/array_access_002.phpt137
-rwxr-xr-xext/spl/tests/array_access_ex.phpt154
-rwxr-xr-xext/spl/tests/array_read.phpt208
-rwxr-xr-xext/spl/tests/foreach.phpt193
-rwxr-xr-xext/spl/tests/foreach_break.phpt90
-rwxr-xr-xext/spl/tests/forward.phpt136
-rwxr-xr-xext/spl/tests/sequence.phpt138
28 files changed, 0 insertions, 3692 deletions
diff --git a/ext/spl/CREDITS b/ext/spl/CREDITS
deleted file mode 100755
index 8710aac550..0000000000
--- a/ext/spl/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-SPL
-Marcus Boerger
diff --git a/ext/spl/EXPERIMENTAL b/ext/spl/EXPERIMENTAL
deleted file mode 100755
index e69de29bb2..0000000000
--- a/ext/spl/EXPERIMENTAL
+++ /dev/null
diff --git a/ext/spl/README b/ext/spl/README
deleted file mode 100755
index 60c6d97425..0000000000
--- a/ext/spl/README
+++ /dev/null
@@ -1,88 +0,0 @@
-This is an extension that aims to implement some efficient data access
-interfaces and classes. You'll find the classes documented using php
-code in the file spl.php.
-
-There are special SPL interfaces that provides the ability to hook into
-foreach and array reading/writng. By inheriting these interfaces, instances
-of the resulting classes can be iterated using the foreach construct or
-use array read write notation.
-
-Look into the examples subdirectory for some basic examples which will
-demonstracte this.
-
-Also some classes of extensions like SQLite inherit SPL interfaces so that
-they take advantage of the foreach or array overloading.
-
-1) Iterators
-
-Iterator is design pattern that allows to enumerate and list all elements of
-a collection whatsoever using an oo protocol. The minimalistic Iterator needs
-a method that returns the current value, a method that moves to the next value
-and a method that checks whether or not the Iterator can provide more elements.
-
-In SPL this basich Iterator is defined by the interface spl_forward:
-
-interface spl_forward {
- function current();
- function next();
- function has_more();
-}
-
-This basic Iterator does not allow to rewind itself nor does it in anyway
-support to name the values by some kind association as key/value mappings
-provided by the standard PHP arrays. All these additions to the basic Iterator
-are done in specialized interfaces as described in detail in the file spl.php.
-
-SPL allows to hook into the engine opcodes that realize the foreach construct.
-This construct normally works on arrays the following way. First it rewinds
-the current array position to the beginning. Then it loops through the whole
-array by first checking whether or not the end of the array is reached and
-if not returning the current array value and or key. After that it move the
-current array pointer forward and does starts the loop process again. As you
-can see this perfectly maps to the interface spl_forward. So the foreach
-hooking simply checks whether or not the variable passed to foreach is an
-object of a class implementing the interface spl_forward. The foreach hook
-can be activated by --enable-spl-foreach which is on by default.
-
-class it implements spl_forward...
-$obj = new it();
-foreach($obj as $value) ...
-
-2) Arrays
-
-Arrays in general, not specifically PHP arrays, provide a collection of pairs
-normally referred to as key and value. A PHP object consists of properties and
-a class type specifing the methods available for the object. SPL now allows
-this to be combined using the spl_array_<xy> interfaces.
-
-The minimalistic array interface is spl_array_read which only support reading:
-
-interface spl_array_read {
- function exists($key);
- function get($key);
-}
-
-Any instance of a class that implements spl_array_read can be used with array
-read notation when the corresponding hook is activated --enable-spl-array-read.
-
-class ar implements spl_array_read...
-$obj = new ar();
-$value = $obj[$key];
-
-SPL also supports the write notation by the interface spl_array_access:
-
-interface spl_array_access extends spl_array_read {
- function set($value, $index);
-}
-
-When the array write hook is activated by --enable-spl-array-write the
-following can be done:
-
-class ar implements spl_array_access...
-$obj = new ar();
-$value = $obj[$key];
-$obj[$key] = $value;
-
-However this hook should only be activated when it is made use of, since it
-slows down noticeable. That is the case because first there is some not used
-overhead and second the overhead is in one the most often used opcodes. \ No newline at end of file
diff --git a/ext/spl/README.PROFILING b/ext/spl/README.PROFILING
deleted file mode 100755
index 67e55b3717..0000000000
--- a/ext/spl/README.PROFILING
+++ /dev/null
@@ -1,98 +0,0 @@
-SQLite is the first extension that makes use of SPL automatically by simply
-enabling both.
-
-SQLite offers four access strategies:
-1) sqlite_query + sqlite_fetch_array
-2) sqlite_unbuffered_query + sqlite_fetch_array
-3) sqlite_query + iterators (sqlite_current)
-4) sqlite_unbuffered_query + iterators (sqlite_current)
-5) sqlite_array_query
-
-1) and 3) do "over eager evaluating" since they fetch all rows directly.
-
-2) does "eager evaluating". It always fetches the next row but doesn't
-keep the current row, so that it must be stored elsewhere if it must be
-accessed more then once. For instance this happens when you need to access
-columns separately.
-
-4) does "eager evaluating". But in contrast to 2) it keeps the current row
-hence its name.
-
-There is no efficient way for "lazy or just in time evaluating" so 4) should
-be the best case. And 4) also enables the foreach trick.
-
-5) does a full buffered fetch and returns the complete result into an array.
-As long as you only have a few rows in your result this is very fast and of
-course it is very flexible since you can access any column/row as often you
-like and in any order you like. But it needs to store the full result what
-is called "eager evaluating".
-
-Speedwise analysis:
-
-I compared a database using a table of round about 200 rows with 3 columns.
-I measured the case where 10 rows are returned, since i guess this is a
-value often taken as default list size in web applications. However i did
-that 10 times because the loop initialization is the slowest part of foreach
-overloading. Since we are only interested in the relative effect foreach
-overloading has i stiped the setup part and used a query result iteration
-that does nothing. That means i run 'php -h' in the profiler first and then
-profiled every single case. For completeness i also computed the values
-including the setup process.
-
-Method, without setup, with setup
-1) 100.00% 100.00%
-2) 89.32% 97.16%
-3) 88.35% 96.90%
-
-Furthermore i did some more checks and found out that the loop process using
-foreach overloading (2) takes a constant time while it seems that the time
-needed to add more rows to the array increases with the number of rows being
-already in the array. As a result (2) is faster than (3) after round about 45
-rows.
-
-The loop codes used:
-
-1) Unbuffered query
-
-<?php
-$dbname = dirname(__FILE__).'/profile.sqlite';
-$db = sqlite_factory($dbname);
-
-for ($i = 0; $i < 10; $i++) {
- $res = $db->unbuffered_query("SELECT idx, name, size from files LIMIT 10", SQLITE_NUM);
- while ($res->has_more()) {
-// var_dump($res->current());
- $res->current();
- $res->next();
- }
-}
-echo "DONE!\n";
-?>
-
-2) Unbuffered query using foreach overloading
-
-<?php
-$dbname = dirname(__FILE__).'/profile.sqlite';
-$db = sqlite_factory($dbname);
-
-for ($i = 0; $i < 10; $i++) {
- foreach($db->unbuffered_query("SELECT idx, name, size from files LIMIT 10", SQLITE_NUM) as $row) {
-// var_dump($row);
- }
-}
-echo "DONE!\n";
-?>
-
-3) Array query method
-
-<?php
-$dbname = dirname(__FILE__).'/profile.sqlite';
-$db = sqlite_factory($dbname);
-
-for ($i = 0; $i < 10; $i++) {
- foreach($db->array_query("SELECT idx, name, size from files LIMIT 10", SQLITE_NUM) as $row) {
-// var_dump($row);
- }
-}
-echo "DONE!\n";
-?> \ No newline at end of file
diff --git a/ext/spl/TODO b/ext/spl/TODO
deleted file mode 100755
index 5311ef6c11..0000000000
--- a/ext/spl/TODO
+++ /dev/null
@@ -1,13 +0,0 @@
-This is the ToDo of ext/spl:
-
-- spl::array_access cals set() which is supposed to return a value.
- Currently you *must* return a value even when it is not used.
- $obj[$idx] = $val; // doesn't use the return value
- $x = $obj[$idx] = $val; // here it is used
- Since array_access.phpt is a test with a return value there
- should be a test without a return value. Maybe an error message
- is required in case there is no return value.
-
-- spl::array_access_ex is not completely done and not tested.
-
-If you have further questions: mailto:helly@php.net
diff --git a/ext/spl/config.m4 b/ext/spl/config.m4
deleted file mode 100755
index bcae05f2fb..0000000000
--- a/ext/spl/config.m4
+++ /dev/null
@@ -1,41 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension SPL
-
-PHP_ARG_ENABLE(spl, enable SPL suppport,
-[ --enable-spl Enable Standard PHP Library])
-
-dnl first enable/disable all hooks
-
-PHP_ARG_ENABLE(spl, enable all hooks,
-[ --enable-spl-hook-all SPL: Enable all hooks])
-
-dnl now all single enable/disable for hooks
-
-PHP_ARG_ENABLE(spl, enable hook on foreach,
-[ --disable-spl-foreach SPL: Disable hook on forach], yes)
-
-PHP_ARG_ENABLE(spl, enable hook on array read,
-[ --enable-spl-array-read SPL: Enable hook on array read])
-
-PHP_ARG_ENABLE(spl, enable hook on array write,
-[ --enable-spl-array-write SPL: Enable hook on array write (+read)])
-
-dnl last do checks on hooks
-
-if test "$PHP_SPL_HOOK_ALL" != "no" -o "$PHP_SPL_FOREACH" != "no"; then
- AC_DEFINE(SPL_FOREACH, 1, [Activate opcode hook on foreach])
- PHP_SPL="yes"
-fi
-if test "$PHP_SPL_HOOK_ALL" != "no" -o "$PHP_SPL_ARRAY_READ" != "no" -o "$PHP_SPL_ARRAY_WRITE" != "no"; then
- AC_DEFINE(SPL_ARRAY_READ, 1, [Activate opcode hook on array read])
- PHP_SPL="yes"
-fi
-if test "$PHP_SPL_HOOK_ALL" != "no" -o "$PHP_SPL_ARRAY_WRITE" != "no"; then
- AC_DEFINE(SPL_ARRAY_WRITE, 1, [Activate opcode hook on array write])
- PHP_SPL="yes"
-fi
-
-if test "$PHP_SPL" != "no"; then
- AC_DEFINE(HAVE_SPL, 1, [Whether you want SPL (Standard Php Library) support])
- PHP_NEW_EXTENSION(spl, php_spl.c spl_functions.c spl_engine.c spl_foreach.c spl_array.c, $ext_shared)
-fi
diff --git a/ext/spl/examples/dba_array.php b/ext/spl/examples/dba_array.php
deleted file mode 100755
index ebbe5a7bac..0000000000
--- a/ext/spl/examples/dba_array.php
+++ /dev/null
@@ -1,79 +0,0 @@
-<?php
-
-/* dba array utility
- *
- * Usage php dba_dump <file> <handler> <key> [<value>]
- *
- * If <value> is specified then <key> is set to <value> in <file>.
- * Else the value of <key> is printed only.
- *
- * Note: configure with --enable-dba
- *
- * (c) Marcus Boerger
- */
-
-class dba_array implements spl_array_access {
- private $db;
-
- function __construct($file, $handler)
- {
- $this->db = dba_popen($file, "c", $handler);
- if (!$this->db) {
- throw new exception("Databse could not be opened");
- }
- }
-
- function __destruct()
- {
- dba_close($this->db);
- }
-
- function get($name)
- {
- $data = dba_fetch($name, $this->db);
- if($data) {
- if (ini_get('magic_quotes_runtime')) {
- $data = stripslashes($data);
- }
- return unserialize($data);
- }
- else
- {
- return NULL;
- }
- }
-
- function set($name, $value)
- {
- dba_replace($name, serialize($value), $this->db);
- return $value;
- }
-
- function exists($name)
- {
- return dba_exists($name, $this->db);
- }
-}
-
-try {
- if ($argc > 2) {
- $dba = new dba_array($argv[1], $argv[2]);
- if ($dba && $argc > 3) {
- if ($argc > 4) {
- $dba[$argv[3]] = $argv[4];
- }
- var_dump(array('Index' => $argv[3], 'Value' => $dba[$argv[3]]));
- }
- $dba = NULL;
- }
- else
- {
- echo "Not enough parameters\n";
- exit(1);
- }
-}
-catch (exception $err) {
- var_dump($err);
- exit(1);
-}
-?> \ No newline at end of file
diff --git a/ext/spl/examples/dba_dump.php b/ext/spl/examples/dba_dump.php
deleted file mode 100755
index 0481d15a92..0000000000
--- a/ext/spl/examples/dba_dump.php
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-
-/* dba dump utility
- *
- * Usage php dba_dump <file> <handler>
- *
- * Note: configure with --enable-dba
- *
- * (c) Marcus Boerger
- */
-
-class dba_reader implements spl_sequence_assoc
-{
-
- private $db = NULL;
- private $key = false;
- private $val = false;
-
- function __construct($file, $handler) {
- $this->db = dba_open($file, 'r', $handler);
- }
-
- function __destruct() {
- if ($this->db) {
- dba_close($this->db);
- }
- }
-
- function rewind() {
- if ($this->db) {
- $this->key = dba_firstkey($this->db);
- }
- }
-
- function current() {
- return $this->val;
- }
-
- function next() {
- if ($this->db) {
- $this->key = dba_nextkey($this->db);
- if ($this->key !== false) {
- $this->val = dba_fetch($this->key, $this->db);
- }
- }
- }
-
- function has_more() {
- if ($this->db && $this->key !== false) {
- return true;
- } else {
- return false;
- }
- }
-
- function key() {
- return $this->key;
- }
-}
-
-$db = new dba_reader($argv[1], $argv[2]);
-foreach($db as $key => $val) {
- echo "'$key' => '$val'\n";
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
deleted file mode 100755
index fb8593f2a5..0000000000
--- a/ext/spl/php_spl.c
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "php_spl.h"
-#include "spl_functions.h"
-#include "spl_engine.h"
-#include "spl_foreach.h"
-#include "spl_array.h"
-
-#ifdef COMPILE_DL_SPL
-ZEND_GET_MODULE(spl)
-#endif
-
-ZEND_DECLARE_MODULE_GLOBALS(spl)
-
-/* {{{ spl_functions
- */
-function_entry spl_functions[] = {
- PHP_FE(spl_classes, NULL)
- PHP_FE(class_parents, NULL)
- PHP_FE(class_implements, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ spl_module_entry
- */
-zend_module_entry spl_module_entry = {
- STANDARD_MODULE_HEADER,
- "spl",
- spl_functions,
- PHP_MINIT(spl),
- PHP_MSHUTDOWN(spl),
- PHP_RINIT(spl),
- PHP_RSHUTDOWN(spl),
- PHP_MINFO(spl),
- "0.1",
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-zend_class_entry *spl_ce_iterator;
-zend_class_entry *spl_ce_forward;
-zend_class_entry *spl_ce_assoc;
-zend_class_entry *spl_ce_sequence;
-zend_class_entry *spl_ce_forward_assoc;
-zend_class_entry *spl_ce_sequence_assoc;
-zend_class_entry *spl_ce_array_read;
-zend_class_entry *spl_ce_array_access;
-zend_class_entry *spl_ce_array_access_ex;
-zend_class_entry *spl_ce_array_writer;
-#ifdef SPL_ARRAY_WRITE
-zend_class_entry *spl_ce_array_writer_default;
-#endif /* SPL_ARRAY_WRITE */
-
-/* {{{ spl_functions_none
- */
-function_entry spl_functions_none[] = {
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-static unsigned char first_of_two_force_ref[] = { 2, BYREF_FORCE, BYREF_NONE };
-
-/* {{{ spl_array_writer_funcs
- */
-function_entry spl_array_writer_funcs[] = {
- SPL_CLASS_FE(array_writer_default, __construct, first_of_two_force_ref)
- SPL_CLASS_FE(array_writer_default, set, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ spl_init_globals
- */
-static void spl_init_globals(zend_spl_globals *spl_globals)
-{
-#ifdef SPL_FOREACH
- ZEND_EXECUTE_HOOK(ZEND_FE_RESET);
- ZEND_EXECUTE_HOOK(ZEND_FE_FETCH);
- ZEND_EXECUTE_HOOK(ZEND_SWITCH_FREE);
-#endif
-
-#if defined(SPL_ARRAY_READ) | defined(SPL_ARRAY_WRITE)
- ZEND_EXECUTE_HOOK(ZEND_FETCH_DIM_R);
- ZEND_EXECUTE_HOOK(ZEND_FETCH_DIM_W);
- ZEND_EXECUTE_HOOK(ZEND_FETCH_DIM_RW);
-#endif
-
-#ifdef SPL_ARRAY_WRITE
- ZEND_EXECUTE_HOOK(ZEND_ASSIGN);
-#endif /* SPL_ARRAY_WRITE */
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION(spl)
- */
-PHP_MINIT_FUNCTION(spl)
-{
- ZEND_INIT_MODULE_GLOBALS(spl, spl_init_globals, NULL);
-
- REGISTER_SPL_INTERFACE(iterator);
- REGISTER_SPL_INTF_FUNC(iterator, new_iterator);
-
- REGISTER_SPL_INTERFACE(forward);
- REGISTER_SPL_INTF_FUNC(forward, current);
- REGISTER_SPL_INTF_FUNC(forward, next);
- REGISTER_SPL_INTF_FUNC(forward, has_more);
-
- REGISTER_SPL_INTERFACE(sequence);
- REGISTER_SPL_INTF_FUNC(sequence, rewind);
- REGISTER_SPL_IMPLEMENT(sequence, forward);
-
- REGISTER_SPL_INTERFACE(assoc);
- REGISTER_SPL_INTF_FUNC(assoc, key);
-
- REGISTER_SPL_INTERFACE(forward_assoc);
- REGISTER_SPL_IMPLEMENT(forward_assoc, assoc);
- REGISTER_SPL_IMPLEMENT(forward_assoc, forward);
-
- REGISTER_SPL_INTERFACE(sequence_assoc);
- REGISTER_SPL_IMPLEMENT(sequence_assoc, forward_assoc);
- REGISTER_SPL_IMPLEMENT(sequence_assoc, sequence);
-
- REGISTER_SPL_INTERFACE(array_read);
- REGISTER_SPL_INTF_FUNC(array_read, get);
- REGISTER_SPL_INTF_FUNC(array_read, exists);
-
- REGISTER_SPL_INTERFACE(array_access);
- REGISTER_SPL_IMPLEMENT(array_access, array_read);
- REGISTER_SPL_INTF_FUNC(array_access, set);
-
- REGISTER_SPL_INTERFACE(array_access_ex);
- REGISTER_SPL_IMPLEMENT(array_access_ex, array_access);
- REGISTER_SPL_INTF_FUNC(array_access_ex, new_writer);
-
- REGISTER_SPL_INTERFACE(array_writer);
- REGISTER_SPL_INTF_FUNC(array_writer, set);
-
-#ifdef SPL_ARRAY_WRITE
- REGISTER_SPL_STD_CLASS(array_writer_default, spl_array_writer_default_create);
- REGISTER_SPL_FUNCTIONS(array_writer_default, spl_array_writer_funcs);
-#endif
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RINIT_FUNCTION(spl)
- */
-PHP_RINIT_FUNCTION(spl)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RSHUTDOWN_FUNCTION(spl)
- */
-PHP_RSHUTDOWN_FUNCTION(spl)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION(spl)
- */
-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);
-#endif /* SPL_ARRAY_WRITE */
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO(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, "forward_assoc", foreach);
- php_info_print_table_row(2, "sequence_assoc", foreach);
- php_info_print_table_row(2, "array_read", array_read);
- php_info_print_table_row(2, "array_access", array_write);
- php_info_print_table_row(2, "array_access_ex", array_write);
- php_info_print_table_row(2, "array_writer", array_write);
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ class_parents
- */
-PHP_FUNCTION(class_parents)
-{
- zval *obj;
- zend_class_entry *parent_class;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &obj) == FAILURE) {
- RETURN_FALSE;
- }
- array_init(return_value);
- parent_class = Z_OBJCE_P(obj)->parent;
- while (parent_class) {
- spl_add_class_name(return_value, parent_class TSRMLS_CC);
- parent_class = parent_class->parent;
- }
-}
-/* }}} */
-
-/* {{{ class_implements
- */
-PHP_FUNCTION(class_implements)
-{
- zval *obj;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &obj) == FAILURE) {
- RETURN_FALSE;
- }
- array_init(return_value);
- spl_add_interfaces(return_value, Z_OBJCE_P(obj) TSRMLS_CC);
-}
-/* }}} */
-
-#define SPL_ADD_CLASS(class_name) \
- spl_add_classes(&spl_ce_ ## class_name, return_value TSRMLS_CC)
-
-/* {{{ spl_classes */
-PHP_FUNCTION(spl_classes)
-{
- array_init(return_value);
-
- SPL_ADD_CLASS(iterator);
- SPL_ADD_CLASS(forward);
- SPL_ADD_CLASS(sequence);
- SPL_ADD_CLASS(assoc);
- SPL_ADD_CLASS(forward_assoc);
- SPL_ADD_CLASS(sequence_assoc);
- SPL_ADD_CLASS(array_read);
- SPL_ADD_CLASS(array_access);
- SPL_ADD_CLASS(array_access_ex);
- SPL_ADD_CLASS(array_writer);
-
-#ifdef SPL_ARRAY_WRITE
- SPL_ADD_CLASS(array_writer_default);
-#endif
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/ext/spl/php_spl.h b/ext/spl/php_spl.h
deleted file mode 100755
index 3ae3b636da..0000000000
--- a/ext/spl/php_spl.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_SPL_H
-#define PHP_SPL_H
-
-#include "php.h"
-#include <stdarg.h>
-
-#if 0
-#define SPL_DEBUG(x) x
-#else
-#define SPL_DEBUG(x)
-#endif
-
-extern zend_module_entry spl_module_entry;
-#define phpext_spl_ptr &spl_module_entry
-
-#if defined(PHP_WIN32) && !defined(COMPILE_DL_SPL)
-#undef phpext_spl
-#define phpext_spl NULL
-#endif
-
-PHP_MINIT_FUNCTION(spl);
-PHP_MSHUTDOWN_FUNCTION(spl);
-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);
-#endif
-ZEND_END_MODULE_GLOBALS(spl)
-
-#ifdef ZTS
-# define SPL_G(v) TSRMG(spl_globals_id, zend_spl_globals *, v)
-extern int spl_globals_id;
-#else
-# define SPL_G(v) (spl_globals.v)
-extern zend_spl_globals spl_globals;
-#endif
-
-extern zend_class_entry *spl_ce_iterator;
-extern zend_class_entry *spl_ce_forward;
-extern zend_class_entry *spl_ce_sequence;
-extern zend_class_entry *spl_ce_assoc;
-extern zend_class_entry *spl_ce_forward_assoc;
-extern zend_class_entry *spl_ce_sequence_assoc;
-extern zend_class_entry *spl_ce_array_read;
-extern zend_class_entry *spl_ce_array_access;
-extern zend_class_entry *spl_ce_array_access_ex;
-extern zend_class_entry *spl_ce_array_writer;
-#ifdef SPL_ARRAY_WRITE
-extern zend_class_entry *spl_ce_array_writer_default;
-#endif /* SPL_ARRAY_WRITE */
-
-PHP_FUNCTION(spl_classes);
-PHP_FUNCTION(class_parents);
-PHP_FUNCTION(class_implements);
-
-#endif /* PHP_SPL_H */
-
-/*
- * Local Variables:
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/ext/spl/spl.php b/ext/spl/spl.php
deleted file mode 100755
index 5e21888dd3..0000000000
--- a/ext/spl/spl.php
+++ /dev/null
@@ -1,304 +0,0 @@
-<?php
-
-/* Standard PHP Library
- *
- * (c) M.Boerger 2003
- */
-
-/*! \brief Interface to foreach() construct
- *
- * Any class that implements this interface can for example be used as
- * the input parameter to foreach() calls which would normally be an
- * array.
- *
- * The only thing a class has to do is
- */
-interface spl_iterator {
-
- /*! \brief Create a new iterator
- *
- * used for example in foreach() operator.
- */
- function new_iterator();
-}
-
-/*! \brief Simple forward iterator
- *
- * Any class that implements this interface can be used as the
- * return of a foreach interface. And hence the class itself
- * can be used as a parameter to be iterated (normally an array).
- *
- * \code
- class c implements spl_iterator, spl_forward {
- private $num = 0;
- function new_iterator() {
- $this->num = 0;
- return $this;
- }
- function current() {
- return $this->num;
- }
- function next() {
- $this->num++;
- }
- function has_more() {
- return $this->num < 5;
- }
- }
-
- $t = new c();
-
- foreach($t as $num) {
- echo "$num\n";
- }
- \endcode
- *
- * A very interesting usage scenario are for example database queries.
- * Without this interface you need to do it without foreach or fetch the
- * whole rowset into an array.
- *
- * In the above code the class implements both the foreach and the
- * forward interface. Doing this you cannot have nested foreach calls.
- * If you need this you must split the two parts.
- *
- * \code
- class c implements spl_iterator {
- public $max = 3;
- function new_iterator() {
- return new c_iter($this);
- }
- }
- class c_iter implements spl_forward {
- private $obj;
- private $num = 0;
- function __construct($obj) {
- $this->obj = $obj;
- }
- function current() {
- return $this->num;
- }
- function next() {
- $this->num++;
- }
- function has_more() {
- return $this->num < $this->obj->max;
- }
- }
-
- $t = new c();
-
- foreach($t as $outer) {
- foreach($t as $inner) {
- echo "$outer,$inner\n";
- }
- }
- \endcode
- *
- * You can also use this interface with the for() construct.
- *
- * \code
- class c implements spl_iterator {
- public $max = 3;
- function new_iterator() {
- return new c_iter($this);
- }
- }
- class c_iter implements spl_forward {
- private $obj;
- private $num = 0;
- function __construct($obj) {
- $this->obj = $obj;
- }
- function current() {
- return $this->num;
- }
- function next() {
- $this->num++;
- }
- function has_more() {
- return $this->num < $this->obj->max;
- }
- }
-
- $t = new c();
-
- for ($iter = $t->new_iterator(); $iter->has_more(); $iter->next()) {
- echo $iter->current() . "\n";
- }
- \endcode
- */
-interface spl_forward {
-
- /*! \brief Retrieve the current currentent
- *
- * \return \c mixed current element or \c false if no more elements
- */
- function current();
-
- /*! \brief Forward to next element.
- */
- function next();
-
- /*! \brief Check if more elements are available.
- *
- * \return \c bool whether or not more elements are available
- */
- function has_more();
-}
-
-/*! \brief A restartable iterator.
- *
- * This iterator allows you to implement a restartable iterator. That
- * means the iterator can be rewind to the first element after accessing
- * any number of elements.
- *
- * \note If you use sequence in foreach then rewind() will be called
- * first.
- */
-interface spl_sequence extends spl_forward {
-
- /*! Restart the sequence by positioning it to the first element.
- */
- function rewind();
-}
-
-/*! \brief associative interface
- *
- * This interface allows to implement associative iterators
- * and containers.
- */
-interface spl_assoc {
-
- /*! \brief Retrieve the current elements key
- *
- * \return \c mixed current key or \c false if no more elements
- */
- function key();
-}
-
-/*! \brief associative foreach() interface
- *
- * This interface extends the forward interface to support keys.
- * With this interface you can do:
- * \code
- $t = new c();
- foreach($t as $key => $elem).
- \endcode
- */
-interface spl_assoc_forward implements spl_forward, spl_assoc {
-}
-
-/*! \brief associative sequence
- */
-interface spl_assoc_sequence implements spl_sequence, spl_assoc {
-}
-
-/*! \brief array read only access for objects
- */
-interface spl_array_read {
-
- /*! Check whether or not the given index exists.
- * The returned value is interpreted as converted to bool.
- */
- function exists($index);
-
- /*! Read the value at position $index.
- * This function is only beeing called if exists() returns true.
- */
- function get($index);
-}
-
-/*! \brief array read/write access for objects.
- *
- * The following example shows how to use an array_writer:
- * \code
- class array_emulation implemets spl_array_access {
- private $ar = array();
- function exists($index) {
- return array_key_exists($index, $this->ar);
- }
- function get($index) {
- return $this->ar[$index];
- }
- function set($index, $value) {
- $this->ar[$index] = $value;
- }
- }
- \endcode
- */
-interface spl_array_access extends spl_array_read {
-
- /*! Set the value identified by $index to $value.
- */
- function set($value, $index);
-}
-
-/*! \brief array read/write access with customized array_writer
- *
- * The internal structure requires that write access via interfaces
- * is divided into two parts. First the index is used to create an
- * array_writer which will later receive the new value and calls the
- * containers set() method with appropriate parameters.
- *
- * Sometimes it is helpfull to overwrite this behavior and have your
- * own implementation for the array_writer.
- *
- * The following example shows how to use a customized array_writer:
- * \code
- class array_emulation_ex extends array_emulation implemets spl_array_access_ex {
- private $last_index = NULL;
- function new_writer($index) {
- $last_index = $index;
- return new array_write(&$this, $index);
- }
- }
- \endcode
- */
-interface spl_array_access_ex extends spl_array_access {
-
- /*! Create an array_writer interface for the specified index.
- *
- * If your container uses array_access instead of array_access_ex
- * the following code would be equal to the internal new_writer()
- * method:
- \code
- function new_writer($index) {
- return new array_write(&$this, $index);
- }
- \endcode
- */
- function new_writer($index);
-}
-
-/*! \brief array writer interface
- *
- * for every write access to an array_access instance an array_writer
- * is created which receives the originating object and the index as
- * parameters for the constructor call.
- *
- * The following shows the equivalent php code for the default
- * implementation array_write.
- * \code
- class array_write implements array_writer {
- private $obj;
- private $idx;
- function __construct(&$obj, $index = null) {
- $this->obj = $obj;
- $this->idx = $index;
- }
- function set($value) {
- return $this->obj->set($this->idx, $value);
- }
- }
- \endcode
- *
- * See array_access for more.
- */
-interface spl_array_writer {
-
- /*! Set the corresponding value to $value.
- */
- function set($value);
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
deleted file mode 100755
index 5a6c034f6a..0000000000
--- a/ext/spl/spl_array.c
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "zend_compile.h"
-#include "zend_execute_locks.h"
-
-#include "php_spl.h"
-#include "spl_functions.h"
-#include "spl_engine.h"
-#include "spl_array.h"
-
-#define DELETE_ZVAL(z) \
- if ((z)->refcount < 2) { \
- zval_dtor(z); \
- FREE_ZVAL(z); /* maybe safe_free_zval_ptr is needed for the uninitialised things */ \
- }
-
-#define DELETE_RET_ZVAL(z) \
- if ((z)->refcount < 3) { \
- zval_dtor(z); \
- FREE_ZVAL(z); /* maybe safe_free_zval_ptr is needed for the uninitialised things */ \
- }
-
-#define AI_PTR_2_PTR_PTR(ai) \
- (ai).ptr_ptr = &((ai).ptr)
-
-/* {{{ spl_array_writer_default stuff */
-typedef struct {
- zval *obj;
- zval *idx;
- int locked;
-} spl_array_writer_object;
-
-static zend_class_entry *spl_array_writer_default_get_class(zval *object TSRMLS_DC)
-{
-#ifdef SPL_ARRAY_WRITE
- return spl_ce_array_writer_default;
-#else
- return (zend_class_entry *)1; /* force an error here: this ensures not equal */
-#endif
-}
-
-static zend_object_handlers spl_array_writer_default_handlers = {
- ZEND_OBJECTS_STORE_HANDLERS,
-
- NULL, /* read_property */
- NULL, /* write_property */
- NULL, /* get_property_ptr */
- NULL, /* get_property_zval_ptr */
- NULL, /* get */
- NULL, /* set */
- NULL, /* has_property */
- NULL, /* unset_property */
- NULL, /* get_properties */
- NULL, /* get_method */
- NULL, /* call_method */
- NULL, /* get_constructor */
- spl_array_writer_default_get_class, /* get_class_entry */
- NULL, /* get_class_name */
- NULL /* compare_objects */
-};
-/* }}} */
-
-/* {{{ spl_array_writer_dtor */
-void spl_array_writer_default_dtor(void *object, zend_object_handle handle TSRMLS_DC)
-{
- spl_array_writer_object *writer = (spl_array_writer_object*) object;
-
- if (writer->obj)
- {
- writer->obj->refcount--;
-/* DELETE_ZVAL(writer->obj); */
- }
- if (writer->idx)
- {
- if (writer->locked) {
- PZVAL_UNLOCK(writer->idx);
- } else {
- writer->idx->refcount--;
- DELETE_ZVAL(writer->idx);
- }
- }
- efree(writer);
-}
-/* }}} */
-
-/* {{{ spl_array_writer_default_create */
-zend_object_value spl_array_writer_default_create(zend_class_entry *class_type TSRMLS_DC)
-{
- zend_object_value retval;
- spl_array_writer_object *intern;
-
- intern = ecalloc(sizeof(spl_array_writer_object), 1);
-
- retval.handle = zend_objects_store_put(intern, spl_array_writer_default_dtor, NULL TSRMLS_CC);
- retval.handlers = &spl_array_writer_default_handlers;
-
- return retval;
-}
-/* }}} */
-
-/* {{{ spl_array_writer_default_set */
-void spl_array_writer_default_set(zval *object, zval *newval, zval **retval TSRMLS_DC)
-{
- spl_array_writer_object *writer;
-
- writer = (spl_array_writer_object *) zend_object_store_get_object(object TSRMLS_CC);
- spl_begin_method_call_arg_ex2(&writer->obj, NULL, NULL, "set", sizeof("set")-1, retval, writer->idx, newval TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ SPL_CLASS_FUNCTION(array_writer_default, __construct) */
-SPL_CLASS_FUNCTION(array_writer_default, __construct)
-{
- zval *object = getThis();
- zval *obj, *idx;
- spl_array_writer_object *writer;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &obj, &idx) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Failed to parse parameters");
- return;
- }
- writer = (spl_array_writer_object *) zend_object_store_get_object(object TSRMLS_CC);
- writer->obj = obj; obj->refcount++;
- writer->idx = idx; idx->refcount++;
-}
-/* }}} */
-
-/* {{{ SPL_CLASS_FUNCTION(array_writer_default, set) */
-SPL_CLASS_FUNCTION(array_writer_default, set)
-{
- zval *object = getThis();
- zval *newval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &newval) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Failed to parse parameters");
- return;
- }
- spl_array_writer_default_set(object, newval, &return_value TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ spl_fetch_dimension_address */
-int spl_fetch_dimension_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type TSRMLS_DC)
-{
- zval **container_ptr = spl_get_zval_ptr_ptr(op1, Ts TSRMLS_CC);
-
- if (spl_is_instance_of(container_ptr, spl_ce_array_read TSRMLS_CC)) {
- zval **retval = &(T(result->u.var).var.ptr);
- zval *dim = spl_get_zval_ptr(op2, Ts, &EG(free_op2) TSRMLS_CC);
- zval *exists;
-
- /*ALLOC_ZVAL(exists); not needed */
- spl_begin_method_call_arg_ex1(container_ptr, NULL, NULL, "exists", sizeof("exists")-1, &exists, dim TSRMLS_CC);
- if (!i_zend_is_true(exists)) {
- if (type == BP_VAR_R || type == BP_VAR_RW) {
- SEPARATE_ZVAL(&dim);
- convert_to_string_ex(&dim);
- zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(dim));
- DELETE_ZVAL(dim);
- }
- if (type == BP_VAR_R || type == BP_VAR_IS) {
- DELETE_RET_ZVAL(exists);
- *retval = &EG(error_zval);
- (*retval)->refcount++;
- FREE_OP(Ts, op2, EG(free_op2));
- SELECTIVE_PZVAL_LOCK(*retval, result);
- return 0;
- }
- }
- DELETE_RET_ZVAL(exists);
- if (type == BP_VAR_R || type == BP_VAR_IS) {
- spl_begin_method_call_arg_ex1(container_ptr, NULL, NULL, "get", sizeof("get")-1, retval, dim TSRMLS_CC);
- (*retval)->refcount--;
- } else
-#ifdef SPL_ARRAY_WRITE
- if (spl_is_instance_of(container_ptr, spl_ce_array_access_ex TSRMLS_CC)) {
- /* array_access_ex instaces have their own way of creating an access_writer */
- spl_begin_method_call_arg_ex1(container_ptr, NULL, NULL, "new_writer", sizeof("new_writer")-1, retval, dim TSRMLS_CC);
- T(result->u.var).var.ptr = *retval;
- AI_PTR_2_PTR_PTR(T(result->u.var).var);
- SELECTIVE_PZVAL_LOCK(*retval, result);
- } else if (spl_is_instance_of(container_ptr, spl_ce_array_access TSRMLS_CC)) {
- /* array_access instances create the default array_writer: array_write */
- spl_array_writer_object *writer;
- spl_instanciate(spl_ce_array_writer_default, retval TSRMLS_CC);
- T(result->u.var).var.ptr = *retval;
- AI_PTR_2_PTR_PTR(T(result->u.var).var);
- writer = (spl_array_writer_object *) zend_object_store_get_object(*retval TSRMLS_CC);
- writer->obj = *container_ptr;
- writer->obj->refcount++;
- writer->idx = dim;
- PZVAL_LOCK(writer->idx);
- writer->locked = 1;
- SELECTIVE_PZVAL_LOCK(*retval, result);
- } else {
- zend_error(E_ERROR, "Object must implement spl_array_access for write access");
- retval = &EG(error_zval_ptr);
- }
- SELECTIVE_PZVAL_LOCK(*retval, result);
-#else
- zend_error(E_ERROR, "SPL compiled without array write hook");
-#endif
- FREE_OP(Ts, op2, EG(free_op2));
- return 0;
- }
- return 1;
-}
-/* }}} */
-
-/* {{{ ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FETCH_DIM_R) */
-#ifdef SPL_ARRAY_READ
-ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FETCH_DIM_R)
-{
- if (!spl_fetch_dimension_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_R TSRMLS_CC))
- {
- if (EX(opline)->extended_value == ZEND_FETCH_ADD_LOCK) {
- PZVAL_LOCK(*EX_T(EX(opline)->op1.u.var).var.ptr_ptr);
- }
- spl_unlock_zval_ptr_ptr(&EX(opline)->op1, EX(Ts) TSRMLS_CC);
-
- AI_PTR_2_PTR_PTR(EX_T(EX(opline)->result.u.var).var);
- NEXT_OPCODE();
- }
- ZEND_EXECUTE_HOOK_ORIGINAL(ZEND_FETCH_DIM_R);
-}
-#endif
-/* }}} */
-
-/* {{{ ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FETCH_DIM_W) */
-#ifdef SPL_ARRAY_READ
-ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FETCH_DIM_W)
-{
- if (!spl_fetch_dimension_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_W TSRMLS_CC))
- {
- spl_unlock_zval_ptr_ptr(&EX(opline)->op1, EX(Ts) TSRMLS_CC);
-
- NEXT_OPCODE();
- }
- ZEND_EXECUTE_HOOK_ORIGINAL(ZEND_FETCH_DIM_W);
-}
-#endif
-/* }}} */
-
-/* {{{ ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FETCH_DIM_RW) */
-#ifdef SPL_ARRAY_READ
-ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FETCH_DIM_RW)
-{
- if (!spl_fetch_dimension_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_RW TSRMLS_CC))
- {
- spl_unlock_zval_ptr_ptr(&EX(opline)->op1, EX(Ts) TSRMLS_CC);
-
- NEXT_OPCODE();
- }
- ZEND_EXECUTE_HOOK_ORIGINAL(ZEND_FETCH_DIM_RW);
-}
-#endif
-/* }}} */
-
-/* {{{ ZEND_EXECUTE_HOOK_FUNCTION(ZEND_ASSIGN) */
-#ifdef SPL_ARRAY_WRITE
-ZEND_EXECUTE_HOOK_FUNCTION(ZEND_ASSIGN)
-{
- zval **writer = spl_get_zval_ptr_ptr(&EX(opline)->op1, EX(Ts) TSRMLS_CC);
- zval *newval, *retval, *target;
- znode *result;
-
- if (writer && *writer && Z_TYPE_PP(writer) == IS_OBJECT) {
- /* optimization: do pre checks and only test for handlers in case of
- * spl_array_writer_default, for spl_array_writer we must use the
- * long way of calling spl_instance
- * if (spl_is_instance_of(writer, spl_ce_array_writer_default TSRMLS_CC))
- */
- if ((*writer)->value.obj.handlers == &spl_array_writer_default_handlers) {
- newval = spl_get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2) TSRMLS_CC);
- spl_array_writer_default_set(*writer, newval, &retval TSRMLS_CC);
- } else if (spl_is_instance_of(writer, spl_ce_array_writer TSRMLS_CC)) {
- newval = spl_get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2) TSRMLS_CC);
- spl_begin_method_call_arg_ex1(writer, NULL, NULL, "set", sizeof("set")-1, &retval, newval TSRMLS_CC);
- } else {
- ZEND_EXECUTE_HOOK_ORIGINAL(ZEND_ASSIGN);
- }
- } else {
- ZEND_EXECUTE_HOOK_ORIGINAL(ZEND_ASSIGN);
- }
- spl_unlock_zval_ptr_ptr(&EX(opline)->op1, EX(Ts) TSRMLS_CC);
-
- result = &EX(opline)->result;
- if (result) {
- if (retval->refcount<2) {
- if ((*writer)->value.obj.handlers == &spl_array_writer_default_handlers) {
- spl_array_writer_object *object = (spl_array_writer_object *) zend_object_store_get_object(*writer TSRMLS_CC);
- target = object->obj;
- } else {
- target = *writer;
- }
- zend_error(E_WARNING, "Method %s::set() did not return a value, using NULL", Z_OBJCE_P(target)->name);
- DELETE_ZVAL(retval);
- DELETE_ZVAL(newval);
- /* Unfortunately it doesn't work when trying to return newval.
- * But anyhow it wouldn't make sense...and confuse reference counting and such.
- */
- retval = &EG(uninitialized_zval);
- } else {
- retval->refcount--;
- }
- EX_T(EX(opline)->result.u.var).var.ptr = retval;
- AI_PTR_2_PTR_PTR(EX_T(EX(opline)->result.u.var).var);
- SELECTIVE_PZVAL_LOCK(retval, result);
- } else {
- retval->refcount = 1;
- DELETE_ZVAL(retval);
- }
-
- (*writer)->refcount = 1;
- DELETE_ZVAL(*writer);
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
-
- NEXT_OPCODE();
-}
-#endif
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/ext/spl/spl_array.h b/ext/spl/spl_array.h
deleted file mode 100755
index 2b75753a31..0000000000
--- a/ext/spl/spl_array.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef SPL_ARRAY_H
-#define SPL_ARRAY_H
-
-#include "php.h"
-#include "php_spl.h"
-
-#ifdef SPL_ARRAY_READ
-ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FETCH_DIM_R);
-ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FETCH_DIM_W);
-ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FETCH_DIM_RW);
-#endif
-
-#ifdef SPL_ARRAY_WRITE
-ZEND_EXECUTE_HOOK_FUNCTION(ZEND_ASSIGN);
-#endif
-
-SPL_CLASS_FUNCTION(array_writer_default, __construct);
-SPL_CLASS_FUNCTION(array_writer_default, set);
-
-zend_object_value spl_array_writer_default_create(zend_class_entry *class_type TSRMLS_DC);
-
-#endif /* SPL_ARRAY_H */
-
-/*
- * Local Variables:
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/ext/spl/spl_engine.c b/ext/spl/spl_engine.c
deleted file mode 100755
index 692be6d094..0000000000
--- a/ext/spl/spl_engine.c
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "zend_compile.h"
-#include "zend_execute_locks.h"
-
-#include "php_spl.h"
-#include "spl_functions.h"
-#include "spl_engine.h"
-
-/* {{{ spl_instanciate */
-void spl_instanciate(zend_class_entry *pce, zval **object TSRMLS_DC)
-{
- ALLOC_ZVAL(*object);
- object_init_ex(*object, pce);
- (*object)->refcount = 1;
- (*object)->is_ref = 1; /* check if this can be hold always */
-}
-/* }}} */
-
-/* {{{ spl_instanciate_arg_ex2 */
-int spl_instanciate_arg_ex2(zend_class_entry *pce, zval **retval, zval *arg1, zval *arg2, HashTable *symbol_table TSRMLS_DC)
-{
- zval *object;
-
- spl_instanciate(pce, &object TSRMLS_CC);
-
- retval = &EG(uninitialized_zval_ptr);
-
- spl_call_method(&object, pce, &pce->constructor, pce->constructor->common.function_name, strlen(pce->constructor->common.function_name), retval, NULL TSRMLS_CC, 2, arg1, arg2);
- *retval = object;
- return 0;
-}
-/* }}} */
-
-/* {{{ spl_get_zval_ptr_ptr
- Remember to call spl_unlock_ptr_ptr when needed */
-zval ** spl_get_zval_ptr_ptr(znode *node, temp_variable *Ts TSRMLS_DC)
-{
- if (node->op_type==IS_VAR) {
- return T(node->u.var).var.ptr_ptr;
- } else {
- return NULL;
- }
-}
-/* }}} */
-
-/* {{{ spl_unlock_zval_ptr_ptr */
-void spl_unlock_zval_ptr_ptr(znode *node, temp_variable *Ts TSRMLS_DC)
-{
- if (node->op_type==IS_VAR) {
- if (T(node->u.var).var.ptr_ptr) {
- PZVAL_UNLOCK(*T(node->u.var).var.ptr_ptr);
- } else if (T(node->u.var).EA.type==IS_STRING_OFFSET) {
- PZVAL_UNLOCK(T(node->u.var).EA.data.str_offset.str);
- }
- }
-}
-/* }}} */
-
-/* {{{ spl_get_zval_ptr */
-zval * spl_get_zval_ptr(znode *node, temp_variable *Ts, zval **should_free TSRMLS_DC)
-{
- switch (node->op_type) {
- case IS_CONST:
- *should_free = 0;
- return &node->u.constant;
- break;
- case IS_TMP_VAR:
- return *should_free = &T(node->u.var).tmp_var;
- break;
- case IS_VAR:
- if (T(node->u.var).var.ptr) {
- PZVAL_UNLOCK(T(node->u.var).var.ptr);
- *should_free = 0;
- return T(node->u.var).var.ptr;
- } else {
- *should_free = &T(node->u.var).tmp_var;
-
- switch (T(node->u.var).EA.type) {
- case IS_STRING_OFFSET: {
- temp_variable *T = &T(node->u.var);
- zval *str = T->EA.data.str_offset.str;
-
- if (T->EA.data.str_offset.str->type != IS_STRING
- || (T->EA.data.str_offset.offset<0)
- || (T->EA.data.str_offset.str->value.str.len <= T->EA.data.str_offset.offset)) {
- zend_error(E_NOTICE, "Uninitialized string offset: %d", T->EA.data.str_offset.offset);
- T->tmp_var.value.str.val = empty_string;
- T->tmp_var.value.str.len = 0;
- } else {
- char c = str->value.str.val[T->EA.data.str_offset.offset];
-
- T->tmp_var.value.str.val = estrndup(&c, 1);
- T->tmp_var.value.str.len = 1;
- }
- PZVAL_UNLOCK(str);
- T->tmp_var.refcount=1;
- T->tmp_var.is_ref=1;
- T->tmp_var.type = IS_STRING;
- return &T->tmp_var;
- }
- break;
- }
- }
- break;
- case IS_UNUSED:
- *should_free = 0;
- return NULL;
- break;
- EMPTY_SWITCH_DEFAULT_CASE()
- }
- return NULL;
-}
-/* }}} */
-
-/* {{{ spl_is_instance_of */
-int spl_is_instance_of(zval **obj, zend_class_entry *ce TSRMLS_DC)
-{
- /* Ensure everything needed is available before checking for the type.
- */
- zend_class_entry *instance_ce;
-
- if (obj && (instance_ce = spl_get_class_entry(*obj TSRMLS_CC)) != NULL) {
- return instanceof_function(instance_ce, ce TSRMLS_CC);
- }
- return 0;
-}
-/* }}} */
-
-/* {{{ spl_implements */
-spl_is_a spl_implements(zend_class_entry *ce)
-{
- register spl_is_a is_a = 0;
- register int i = ce->num_interfaces;
- register zend_class_entry **pce = ce->interfaces;
-
- while (i--) {
- if (*pce == spl_ce_iterator) is_a |= SPL_IS_A_ITERATOR;
- else if (*pce == spl_ce_forward) is_a |= SPL_IS_A_FORWARD;
- else if (*pce == spl_ce_assoc) is_a |= SPL_IS_A_ASSOC;
- else if (*pce == spl_ce_sequence) is_a |= SPL_IS_A_SEQUENCE;
- pce++;
- }
- return is_a;
-}
-/* }}} */
-
-#undef EX
-#define EX(element) execute_data.element
-
-/* {{{ spl_call_method */
-int spl_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, char *function_name, int fname_len, zval **retval, HashTable *symbol_table TSRMLS_DC, int param_count, ...)
-{
- int i, l;
- zval *arg;
- zval *param;
- unsigned char *arg_types;
- zval **original_return_value;
- HashTable *calling_symbol_table;
- zend_function_state *original_function_state_ptr;
- zend_op_array *original_op_array;
- zend_op **original_opline_ptr;
- zval *orig_free_op1, *orig_free_op2;
- int (*orig_unary_op)(zval *result, zval *op1);
- int (*orig_binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC);
- zend_class_entry *current_scope;
- zval *current_this;
- zend_execute_data execute_data;
- va_list args;
-
- if (!object_pp || (!obj_ce && (obj_ce = spl_get_class_entry(*object_pp TSRMLS_CC)) == NULL)) {
- return FAILURE;
- }
-
- /* Initialize execute_data */
- EX(fbc) = NULL;
- EX(Ts) = NULL;
- EX(op_array) = NULL;
- EX(opline) = NULL;
-
- EX(object) = *object_pp;
-
- original_function_state_ptr = EG(function_state_ptr);
- if (fn_proxy && *fn_proxy) {
- EX(function_state).function = *fn_proxy;
- } else {
- if (zend_hash_find(&obj_ce->function_table, function_name, fname_len+1, (void **) &EX(function_state).function)==FAILURE) {
- return FAILURE;
- }
- if (fn_proxy) {
- *fn_proxy = EX(function_state).function;
- }
- }
-
- va_start(args, param_count);
- if (param_count) {
- if ((arg_types = EX(function_state).function->common.arg_types) != NULL) {
- l = arg_types[0];
- } else {
- l = 0;
- }
- for (i=1; i<=param_count; i++) {
- arg = va_arg(args, zval*);
-
- if (i<=l && arg_types[i]==BYREF_FORCE && !PZVAL_IS_REF(arg)) {
- if (arg->refcount > 1) {
- zval *new_zval;
-
- ALLOC_ZVAL(new_zval);
- *new_zval = *arg;
- zval_copy_ctor(new_zval);
- new_zval->refcount = 2;
- new_zval->is_ref = 1;
- arg->refcount--;
- param = new_zval;
- } else {
- arg->refcount++;
- arg->is_ref = 1;
- param = arg;
- }
- } else if (arg != &EG(uninitialized_zval)) {
- arg->refcount++;
- param = arg;
- } else {
- ALLOC_ZVAL(param);
- *param = *arg;
- INIT_PZVAL(param);
- }
- zend_ptr_stack_push(&EG(argument_stack), param);
- }
- }
- va_end(args);
-
- zend_ptr_stack_push(&EG(argument_stack), (void *) (long) param_count);
- zend_ptr_stack_push(&EG(argument_stack), NULL);
-
- EG(function_state_ptr) = &EX(function_state);
-
- current_scope = EG(scope);
- EG(scope) = obj_ce;
-
- current_this = EG(This);
- EG(This) = *object_pp;
-
- if (!PZVAL_IS_REF(EG(This))) {
- EG(This)->refcount++; /* For $this pointer */
- } else {
- zval *this_ptr;
-
- ALLOC_ZVAL(this_ptr);
- *this_ptr = *EG(This);
- INIT_PZVAL(this_ptr);
- zval_copy_ctor(this_ptr);
- EG(This) = this_ptr;
- }
-
- EX(prev_execute_data) = EG(current_execute_data);
- EG(current_execute_data) = &execute_data;
-
- if (EX(function_state).function->type == ZEND_USER_FUNCTION) {
- calling_symbol_table = EG(active_symbol_table);
- if (symbol_table) {
- EG(active_symbol_table) = symbol_table;
- } else {
- ALLOC_HASHTABLE(EG(active_symbol_table));
- zend_hash_init(EG(active_symbol_table), 0, NULL, ZVAL_PTR_DTOR, 0);
- }
-
- original_return_value = EG(return_value_ptr_ptr);
- original_op_array = EG(active_op_array);
- EG(return_value_ptr_ptr) = retval;
- EG(active_op_array) = (zend_op_array *) EX(function_state).function;
- original_opline_ptr = EG(opline_ptr);
- orig_free_op1 = EG(free_op1);
- orig_free_op2 = EG(free_op2);
- orig_unary_op = EG(unary_op);
- orig_binary_op = EG(binary_op);
- zend_execute(EG(active_op_array) TSRMLS_CC);
- if (!symbol_table) {
- zend_hash_destroy(EG(active_symbol_table));
- FREE_HASHTABLE(EG(active_symbol_table));
- }
- EG(active_symbol_table) = calling_symbol_table;
- EG(active_op_array) = original_op_array;
- EG(return_value_ptr_ptr)=original_return_value;
- EG(opline_ptr) = original_opline_ptr;
- EG(free_op1) = orig_free_op1;
- EG(free_op2) = orig_free_op2;
- EG(unary_op) = orig_unary_op;
- EG(binary_op) = orig_binary_op;
- } else {
- ALLOC_INIT_ZVAL(*retval);
- ((zend_internal_function *) EX(function_state).function)->handler(param_count, *retval, *object_pp, 1 TSRMLS_CC);
- INIT_PZVAL(*retval);
- }
- zend_ptr_stack_clear_multiple(TSRMLS_C);
- EG(function_state_ptr) = original_function_state_ptr;
-
- if (EG(This)) {
- zval_ptr_dtor(&EG(This));
- }
- EG(scope) = current_scope;
- EG(This) = current_this;
- EG(current_execute_data) = EX(prev_execute_data); \
-
- return SUCCESS;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/ext/spl/spl_engine.h b/ext/spl/spl_engine.h
deleted file mode 100755
index e20ea39bb6..0000000000
--- a/ext/spl/spl_engine.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef SPL_ENGINE_H
-#define SPL_ENGINE_H
-
-#include "php.h"
-#include "php_spl.h"
-
-#include "zend_compile.h"
-#include "zend_execute_locks.h"
-
-#undef EX
-#define EX(element) execute_data->element
-#define EX_T(offset) (*(temp_variable *)((char *) EX(Ts) + offset))
-#define T(offset) (*(temp_variable *)((char *) Ts + offset))
-
-#define NEXT_OPCODE() \
- EX(opline)++; \
- return 0;
-
-int zend_do_fcall_common_helper(ZEND_OPCODE_HANDLER_ARGS);
-
-int spl_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, char *function_name, int function_name_len, zval **retval_ptr, HashTable *symbol_table TSRMLS_DC, int param_count, ...);
-
-/* {{{ zend_class_entry */
-static inline zend_class_entry *spl_get_class_entry(zval *obj TSRMLS_DC)
-{
- if (obj && Z_TYPE_P(obj) == IS_OBJECT && Z_OBJ_HT_P(obj)->get_class_entry) {
- return Z_OBJ_HT_P(obj)->get_class_entry(obj TSRMLS_CC);
- } else {
- return NULL;
- }
-}
-/* }}} */
-
-/* {{{ spl_begin_method_call_arg */
-static inline int spl_begin_method_call_arg(zval **ce, zend_class_entry *obj_ce, zend_function **fn_proxy, char *function_name, int fname_len, zval *retval, zval *arg1 TSRMLS_DC)
-{
- zval *local_retval;
- int ret = spl_call_method(ce, obj_ce, fn_proxy, function_name, fname_len, &local_retval, NULL TSRMLS_CC, 1, arg1);
- if (local_retval) {
- COPY_PZVAL_TO_ZVAL(*retval, local_retval);
- } else {
- INIT_ZVAL(*retval);
- }
- return ret;
-}
-/* }}} */
-
-/* {{{ spl_begin_method_call_no_retval */
-static inline int spl_begin_method_call_no_retval(zval **ce, zend_class_entry *obj_ce, zend_function **fn_proxy, char *function_name, int fname_len TSRMLS_DC)
-{
- zval *retval;
- int ret = spl_call_method(ce, obj_ce, fn_proxy, function_name, fname_len, &retval, NULL TSRMLS_CC, 0);
- if (retval) {
- zval_dtor(retval);
- FREE_ZVAL(retval);
- }
- return ret;
-}
-/* }}} */
-
-#define spl_begin_method_call_ex(ce, obj_ce, fn_proxy, function_name, fname_len, retval) \
- spl_call_method(ce, obj_ce, fn_proxy, function_name, fname_len, retval, NULL TSRMLS_CC, 0)
-
-#define spl_begin_method_call_arg_ex1(ce, obj_ce, fn_proxy, function_name, fname_len, retval, arg1) \
- spl_call_method(ce, obj_ce, fn_proxy, function_name, fname_len, retval, NULL TSRMLS_CC, 1, arg1)
-
-#define spl_begin_method_call_arg_ex2(ce, obj_ce, fn_proxy, function_name, fname_len, retval, arg1, arg2) \
- spl_call_method(ce, obj_ce, fn_proxy, function_name, fname_len, retval, NULL TSRMLS_CC, 2, arg1, arg2)
-
-void spl_instanciate(zend_class_entry *pce, zval **object TSRMLS_DC);
-int spl_instanciate_arg_ex2(zend_class_entry *pce, zval **retval, zval *arg1, zval *arg2, HashTable *symbol_table TSRMLS_DC);
-
-zval ** spl_get_zval_ptr_ptr(znode *node, temp_variable *Ts TSRMLS_DC);
-void spl_unlock_zval_ptr_ptr(znode *node, temp_variable *Ts TSRMLS_DC);
-zval * spl_get_zval_ptr(znode *node, temp_variable *Ts, zval **should_free TSRMLS_DC);
-
-int spl_is_instance_of(zval **obj, zend_class_entry *ce TSRMLS_DC);
-
-typedef enum {
- SPL_IS_A_ITERATOR = 1,
- SPL_IS_A_FORWARD = 2,
- SPL_IS_A_ASSOC = 4,
- SPL_IS_A_SEQUENCE = 8
-} spl_is_a;
-
-spl_is_a spl_implements(zend_class_entry *ce);
-
-#endif /* SPL_ENGINE_H */
-
-/*
- * Local Variables:
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/ext/spl/spl_foreach.c b/ext/spl/spl_foreach.c
deleted file mode 100755
index 56a613ad4a..0000000000
--- a/ext/spl/spl_foreach.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "zend_compile.h"
-#include "zend_execute_locks.h"
-
-#include "php_spl.h"
-#include "spl_functions.h"
-#include "spl_engine.h"
-#include "spl_foreach.h"
-
-#define OPTIMIZED_ARRAY_CONSTRUCT
-
-typedef struct {
- zend_function *next;
- zend_function *rewind;
- zend_function *more;
- zend_function *current;
- zend_function *key;
-} spl_foreach_funcs;
-
-typedef struct {
- zval *obj;
- zend_class_entry *obj_ce;
- zend_uint index;
- spl_is_a is_a;
- spl_foreach_funcs funcs;
- char dummy; /* needed for '\0' but we can't set it due to compiler optimizations */
-} spl_foreach_proxy;
-
-/* {{{ ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FE_RESET) */
-ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FE_RESET)
-{
- zval **obj, *retval;
- spl_foreach_proxy *proxy;
- zend_class_entry *instance_ce, *obj_ce;
- spl_is_a is_a;
- temp_variable *tmp;
-
- obj = spl_get_zval_ptr_ptr(&EX(opline)->op1, EX(Ts) TSRMLS_CC);
-
- if (!obj || (instance_ce = spl_get_class_entry(*obj TSRMLS_CC)) == NULL) {
- ZEND_EXECUTE_HOOK_ORIGINAL(ZEND_FE_RESET);
- }
-
- is_a = spl_implements(instance_ce);
-
- if (is_a & SPL_IS_A_ITERATOR) {
- spl_unlock_zval_ptr_ptr(&EX(opline)->op1, EX(Ts) TSRMLS_CC);
- spl_begin_method_call_ex(obj, NULL, NULL, "new_iterator", sizeof("new_iterator")-1, &retval);
- obj_ce = instance_ce;
- instance_ce = spl_get_class_entry(retval TSRMLS_CC);
- is_a = spl_implements(instance_ce);
- if (!(is_a & SPL_IS_A_FORWARD)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Objects created by %s::new_iterator() must implement spl_forward", obj_ce->name);
- ZEND_EXECUTE_HOOK_ORIGINAL(ZEND_FE_RESET);
- }
- PZVAL_LOCK(retval);
- } else if (is_a & SPL_IS_A_FORWARD) {
- spl_unlock_zval_ptr_ptr(&EX(opline)->op1, EX(Ts) TSRMLS_CC);
- retval = *obj;
- retval->refcount += 2; /* lock two times */
- } else {
- ZEND_EXECUTE_HOOK_ORIGINAL(ZEND_FE_RESET);
- }
-
- /* create the proxy */
- proxy = emalloc(sizeof(spl_foreach_proxy));
- proxy->obj = retval;
- proxy->obj_ce = instance_ce;
- proxy->index = 0;
- proxy->is_a = is_a;
- memset(&proxy->funcs, 0, sizeof(spl_foreach_funcs));
- ((char*)proxy)[sizeof(spl_foreach_proxy)-1] = '\0';
- /* And pack it into a zval. Since it is nowhere accessible using a
- * zval of type STRING is the fastest approach of storing the proxy.
- */
- ALLOC_ZVAL(retval);
- ZVAL_STRINGL(retval, (char*)proxy, sizeof(spl_foreach_proxy)-1, 0);
- retval->is_ref = 0;
- retval->refcount = 2; /* lock two times */
- /* return the created proxy container */
- tmp = &EX_T(EX(opline)->result.u.var);
- tmp->var.ptr = retval;
- tmp->var.ptr_ptr = &tmp->var.ptr;
-
- NEXT_OPCODE();
-}
-/* }}} */
-
-/* {{{ OPTIMIZED_ARRAY_CONSTRUCT macros */
-#ifdef OPTIMIZED_ARRAY_CONSTRUCT
-#define CONNECT_TO_BUCKET_DLLIST(element, list_head) \
- (element)->pNext = (list_head); \
- (element)->pLast = NULL;
-
-#define CONNECT_TO_GLOBAL_DLLIST(element, ht) \
- (element)->pListLast = (ht)->pListTail; \
- (ht)->pListTail = (element); \
- (element)->pListNext = NULL; \
- if ((element)->pListLast != NULL) { \
- (element)->pListLast->pListNext = (element); \
- } \
- if (!(ht)->pListHead) { \
- (ht)->pListHead = (element); \
- } \
- if ((ht)->pInternalPointer == NULL) { \
- (ht)->pInternalPointer = (element); \
- }
-#endif
-/* }}} */
-
-/* {{{ ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FE_FETCH) */
-ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FE_FETCH)
-{
- znode *op1 = &EX(opline)->op1;
- zval **obj = spl_get_zval_ptr_ptr(op1, EX(Ts) TSRMLS_CC);
- zval *more, *value, *key, *result;
- spl_foreach_proxy *proxy;
-
- if (Z_TYPE_PP(obj) == IS_STRING) {
-
- proxy = (spl_foreach_proxy*)Z_STRVAL_PP(obj);
- obj = &proxy->obj; /* will be optimized out */
-
- if (proxy->index++) {
- spl_begin_method_call_no_retval(obj, proxy->obj_ce, &proxy->funcs.next, "next", sizeof("next")-1 TSRMLS_CC);
- } else {
- if (proxy->is_a & SPL_IS_A_SEQUENCE) {
- spl_begin_method_call_no_retval(obj, proxy->obj_ce, &proxy->funcs.rewind, "rewind", sizeof("rewind")-1 TSRMLS_CC);
- }
- op_array->opcodes[EX(opline)->op2.u.opline_num].op2 = *op1;
- }
-
- spl_begin_method_call_ex(obj, proxy->obj_ce, &proxy->funcs.more, "has_more", sizeof("has_more")-1, &more);
- if (!more->type == IS_BOOL && !more->type == IS_LONG) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Method %s::has_more implements spl_forward::has_more and should return a value of type boolean or int");
- convert_to_boolean(more);
- }
- if (more->value.lval) {
- zval_dtor(more);
- FREE_ZVAL(more);
- result = &EX_T(EX(opline)->result.u.var).tmp_var;
-
- spl_begin_method_call_ex(obj, proxy->obj_ce, &proxy->funcs.current, "current", sizeof("current")-1, &value);
-
- if (proxy->is_a & SPL_IS_A_ASSOC) {
- spl_begin_method_call_ex(obj, proxy->obj_ce, &proxy->funcs.key, "key", sizeof("key")-1, &key);
- } else {
- MAKE_STD_ZVAL(key);
- key->value.lval = proxy->index;
- key->type = IS_LONG;
- }
-#ifndef OPTIMIZED_ARRAY_CONSTRUCT
- array_init(result);
- add_next_index_zval(result, value);
- add_next_index_zval(result, key);
-#else
- {
- Bucket *p;
- HashTable *ht;
-
- ht = emalloc(sizeof(HashTable));
- result->value.ht = ht;
- ht->nTableSize = 1 << 1;
- ht->nTableMask = ht->nTableSize - 1;
-#if ZEND_DEBUG
- ht->inconsistent = 0; /*HT_OK;*/
-#endif
-
- ht->arBuckets = (Bucket **)emalloc(ht->nTableSize * sizeof(Bucket *));
-
- ht->pDestructor = ZVAL_PTR_DTOR;
- ht->pListHead = NULL;
- ht->pListTail = NULL;
- ht->nNumOfElements = 0;
- ht->nNextFreeElement = 0;
- ht->pInternalPointer = NULL;
- ht->persistent = 0;
- ht->nApplyCount = 0;
- ht->bApplyProtection = 1;
- result->type = IS_ARRAY;
-
- p = (Bucket*)emalloc(sizeof(Bucket)-1);
- p->pDataPtr = value;
- p->pData = &p->pDataPtr;
- p->nKeyLength = 0;
- p->h = 0;
- result->value.ht->arBuckets[0] = p;
- CONNECT_TO_BUCKET_DLLIST(p, ht->arBuckets[0]);
- CONNECT_TO_GLOBAL_DLLIST(p, ht);
-
- p = (Bucket*)emalloc(sizeof(Bucket)-1);
- p->pDataPtr = key;
- p->pData = &p->pDataPtr;
- p->nKeyLength = 0;
- p->h = 1;
- result->value.ht->arBuckets[1] = p;
- CONNECT_TO_BUCKET_DLLIST(p, ht->arBuckets[1]);
- CONNECT_TO_GLOBAL_DLLIST(p, ht);
-
- ht->nNumOfElements = 2;
- }
-#endif
- NEXT_OPCODE();
- }
- zval_dtor(more);
- FREE_ZVAL(more);
- EX(opline) = op_array->opcodes+EX(opline)->op2.u.opline_num;
- return 0;
- }
- ZEND_EXECUTE_HOOK_ORIGINAL(ZEND_FE_FETCH);
-}
-/* }}} */
-
-/* {{{ ZEND_EXECUTE_HOOK_FUNCTION(ZEND_SWITCH_FREE) */
-ZEND_EXECUTE_HOOK_FUNCTION(ZEND_SWITCH_FREE)
-{
- znode *op2 = &EX(opline)->op2;
- zval *tmp, **obj = spl_get_zval_ptr_ptr(op2, EX(Ts) TSRMLS_CC);
- spl_foreach_proxy *proxy;
-
- if (obj) {
- proxy = (spl_foreach_proxy*)Z_STRVAL_PP(obj);
- tmp = *obj;
- *obj = proxy->obj; /* restore */
-
- efree(tmp->value.str.val);
- FREE_ZVAL(tmp);
-
- spl_unlock_zval_ptr_ptr(&EX(opline)->op1, EX(Ts) TSRMLS_CC);
- PZVAL_LOCK(*obj);
-
- SET_UNUSED(*op2);
- }
- ZEND_EXECUTE_HOOK_ORIGINAL(ZEND_SWITCH_FREE);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/ext/spl/spl_foreach.h b/ext/spl/spl_foreach.h
deleted file mode 100755
index e27f9e77de..0000000000
--- a/ext/spl/spl_foreach.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef SPL_FOREACH_H
-#define SPL_FOREACH_H
-
-#include "php.h"
-#include "php_spl.h"
-
-ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FE_RESET);
-ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FE_FETCH);
-ZEND_EXECUTE_HOOK_FUNCTION(ZEND_SWITCH_FREE);
-
-#endif /* SPL_FOREACH_H */
-
-/*
- * Local Variables:
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/ext/spl/spl_functions.c b/ext/spl/spl_functions.c
deleted file mode 100755
index 8ad81a110f..0000000000
--- a/ext/spl/spl_functions.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "php_spl.h"
-#include "spl_foreach.h"
-
-/* {{{ spl_destroy_class */
-void spl_destroy_class(zend_class_entry ** ppce)
-{
- SPL_DEBUG(fprintf(stderr, "Destroy(%s): %s\n", (*ppce)->type == ZEND_USER_CLASS ? "user" : "other", (*ppce)->name);)
- destroy_zend_class(ppce);
-}
-/* }}} */
-
-/* {{{ spl_register_interface */
-void spl_register_interface(zend_class_entry ** ppce, char * class_name TSRMLS_DC)
-{
- zend_class_entry ce;
-
- INIT_CLASS_ENTRY(ce, class_name, NULL);
- ce.name_length = strlen(class_name);
- *ppce = zend_register_internal_class(&ce TSRMLS_CC);
-
- /* entries changed by initialize */
- (*ppce)->ce_flags = ZEND_ACC_ABSTRACT | ZEND_ACC_INTERFACE;
-}
-/* }}} */
-
-/* {{{ spl_register_std_class */
-void spl_register_std_class(zend_class_entry ** ppce, char * class_name, void * obj_ctor TSRMLS_DC)
-{
- zend_class_entry ce;
-
- INIT_CLASS_ENTRY(ce, class_name, NULL);
- ce.name_length = strlen(class_name);
- *ppce = zend_register_internal_class(&ce TSRMLS_CC);
-
- /* entries changed by initialize */
- (*ppce)->create_object = obj_ctor;
-}
-/* }}} */
-
-/* {{{ spl_register_interface_function */
-void spl_register_interface_function(zend_class_entry * class_entry, char * fn_name TSRMLS_DC)
-{
- zend_function function, *reg_function;
- zend_internal_function *pfunction = (zend_internal_function *)&function;
-
- pfunction->type = ZEND_INTERNAL_FUNCTION;
- pfunction->handler = NULL;
- pfunction->arg_types = NULL;
- pfunction->function_name = fn_name;
- pfunction->scope = class_entry;
- pfunction->fn_flags = ZEND_ACC_ABSTRACT | ZEND_ACC_PUBLIC;
- pfunction->prototype = NULL;
- zend_hash_add(&class_entry->function_table, fn_name, strlen(fn_name)+1, &function, sizeof(zend_function), (void**)&reg_function);
-}
-/* }}} */
-
-/* {{{ spl_register_parent_ce */
-void spl_register_parent_ce(zend_class_entry * class_entry, zend_class_entry * parent_class TSRMLS_DC)
-{
- class_entry->parent = parent_class;
-}
-/* }}} */
-
-/* {{{ spl_register_implement */
-void spl_register_implement(zend_class_entry * class_entry, zend_class_entry * interface_entry TSRMLS_DC)
-{
- class_entry->interfaces = realloc(class_entry->interfaces, sizeof(zend_class_entry*) * (class_entry->num_interfaces+1));
- class_entry->interfaces[class_entry->num_interfaces++] = interface_entry;
- zend_do_implement_interface(class_entry, interface_entry);
-}
-/* }}} */
-
-/* {{{ spl_register_functions */
-void spl_register_functions(zend_class_entry * class_entry, function_entry * function_list TSRMLS_DC)
-{
- zend_register_functions(class_entry, function_list, &class_entry->function_table, MODULE_PERSISTENT TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ spl_add_class_name */
-void spl_add_class_name(zval * list, zend_class_entry * pce TSRMLS_DC)
-{
- size_t len = strlen(pce->name);
- zval *tmp;
-
- if (zend_hash_find(Z_ARRVAL_P(list), pce->name, len+1, (void*)&tmp) == FAILURE) {
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRING(tmp, pce->name, 1);
- zend_hash_add(Z_ARRVAL_P(list), pce->name, len+1, &tmp, sizeof(zval *), NULL);
- }
-}
-/* }}} */
-
-/* {{{ spl_add_interfaces */
-void spl_add_interfaces(zval *list, zend_class_entry * pce TSRMLS_DC)
-{
- zend_uint num_interfaces;
-
- for (num_interfaces = 0; num_interfaces < pce->num_interfaces; num_interfaces++) {
- spl_add_class_name(list, pce->interfaces[num_interfaces] TSRMLS_CC);
- }
-}
-/* }}} */
-
-/* {{{ spl_add_classes */
-int spl_add_classes(zend_class_entry ** ppce, zval *list TSRMLS_DC)
-{
- zend_class_entry *pce = *ppce;
- spl_add_class_name(list, pce TSRMLS_CC);
- spl_add_interfaces(list, pce TSRMLS_CC);
- while (pce->parent) {
- pce = pce->parent;
- spl_add_classes(&pce, list TSRMLS_CC);
- }
- return 0;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/ext/spl/spl_functions.h b/ext/spl/spl_functions.h
deleted file mode 100755
index 1a9794e022..0000000000
--- a/ext/spl/spl_functions.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_FUNCTIONS_H
-#define PHP_FUNCTIONS_H
-
-#include "php.h"
-
-typedef zend_object_value (*create_object_func_t)(zend_class_entry *class_type TSRMLS_DC);
-
-#define REGISTER_SPL_STD_CLASS(class_name, obj_ctor) \
- spl_register_std_class(&spl_ce_ ## class_name, "spl_" # class_name, obj_ctor TSRMLS_CC);
-
-#define REGISTER_SPL_INTERFACE(class_name) \
- spl_register_interface(&spl_ce_ ## class_name, "spl_" # class_name TSRMLS_CC);
-
-#define REGISTER_SPL_INTF_FUNC(class_name, function_name) \
- spl_register_interface_function(spl_ce_ ## class_name, # function_name TSRMLS_CC);
-
-#define REGISTER_SPL_PARENT_CE(class_name, parent_class) \
- spl_register_parent_ce(spl_ce_ ## class_name, spl_ce_ ## parent_class TSRMLS_CC);
-
-#define REGISTER_SPL_IMPLEMENT(class_name, interface_name) \
- spl_register_implement(spl_ce_ ## class_name, spl_ce_ ## interface_name TSRMLS_CC);
-
-#define REGISTER_SPL_FUNCTIONS(class_name, function_list) \
- spl_register_functions(spl_ce_ ## class_name, function_list TSRMLS_CC);
-
-void spl_destroy_class(zend_class_entry ** ppce);
-
-void spl_register_std_class(zend_class_entry ** ppce, char * class_name, create_object_func_t ctor TSRMLS_DC);
-
-void spl_register_interface(zend_class_entry ** ppce, char * class_name TSRMLS_DC);
-
-void spl_register_interface_function(zend_class_entry * class_entry, char * fn_name TSRMLS_DC);
-void spl_register_parent_ce(zend_class_entry * class_entry, zend_class_entry * parent_class TSRMLS_DC);
-void spl_register_implement(zend_class_entry * class_entry, zend_class_entry * interface_entry TSRMLS_DC);
-void spl_register_functions(zend_class_entry * class_entry, function_entry * function_list TSRMLS_DC);
-
-void spl_add_class_name(zval * list, zend_class_entry * pce TSRMLS_DC);
-void spl_add_interfaces(zval * list, zend_class_entry * pce TSRMLS_DC);
-int spl_add_classes(zend_class_entry ** ppce, zval *list TSRMLS_DC);
-
-#define SPL_CLASS_FE(class_name, function_name, arg_types) \
- PHP_NAMED_FE( function_name, spl_ ## class_name ## function_name, arg_types)
-
-#define SPL_CLASS_FUNCTION(class_name, function_name) \
- PHP_NAMED_FUNCTION(spl_ ## class_name ## function_name)
-
-#endif /* PHP_FUNCTIONS_H */
-
-/*
- * Local Variables:
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/ext/spl/tests/.htaccess b/ext/spl/tests/.htaccess
deleted file mode 100755
index 5a01a1c16e..0000000000
--- a/ext/spl/tests/.htaccess
+++ /dev/null
@@ -1,3 +0,0 @@
-<IfModule mod_autoindex.c>
- IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t *.php
-</IfModule>
diff --git a/ext/spl/tests/array_access_001.phpt b/ext/spl/tests/array_access_001.phpt
deleted file mode 100755
index 12b70e4c31..0000000000
--- a/ext/spl/tests/array_access_001.phpt
+++ /dev/null
@@ -1,127 +0,0 @@
---TEST--
-SPL: array_access
---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;
- }
-}
-
-$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 %s on line %d
-NULL
-c::exists(6)
-
-Notice: Undefined index: 6 in %s on line %d
-NULL
-WRITE 1
-c::exists(1)
-c::set(1,Changed 1)
-c::exists(1)
-c::get(1)
-string(9) "Changed 1"
-WRITE 2
-c::exists(4th)
-c::set(4th,Changed 4th)
-c::exists(4th)
-c::get(4th)
-string(11) "Changed 4th"
-WRITE 3
-c::exists(5th)
-c::set(5th,Added 5th)
-c::exists(5th)
-c::get(5th)
-string(9) "Added 5th"
-WRITE 4
-c::exists(6)
-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::exists(6)
-c::set(6,changed 6)
-c::exists(6)
-c::get(6)
-string(9) "changed 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
index 64dccb3acb..0000000000
--- a/ext/spl/tests/array_access_002.phpt
+++ /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;
- }
-}
-
-$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 %s on line %d
-NULL
-c::exists(6)
-
-Notice: Undefined index: 6 in %s on line %d
-NULL
-WRITE 1
-c::exists(1)
-c::set(1,Changed 1)
-
-Warning: Method c::set() did not return a value, using NULL in %s on line %d
-c::exists(1)
-c::get(1)
-string(9) "Changed 1"
-WRITE 2
-c::exists(4th)
-c::set(4th,Changed 4th)
-
-Warning: Method c::set() did not return a value, using NULL in %s on line %d
-c::exists(4th)
-c::get(4th)
-string(11) "Changed 4th"
-WRITE 3
-c::exists(5th)
-c::set(5th,Added 5th)
-
-Warning: Method c::set() did not return a value, using NULL in %s on line %d
-c::exists(5th)
-c::get(5th)
-string(9) "Added 5th"
-WRITE 4
-c::exists(6)
-c::set(6,Added 6)
-
-Warning: Method c::set() did not return a value, using NULL in %s 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::exists(6)
-c::set(6,changed 6)
-
-Warning: Method c::set() did not return a value, using NULL in %s on line %d
-c::exists(6)
-c::get(6)
-string(9) "changed 6"
-NULL
-Done
diff --git a/ext/spl/tests/array_access_ex.phpt b/ext/spl/tests/array_access_ex.phpt
deleted file mode 100755
index ed7aceab19..0000000000
--- a/ext/spl/tests/array_access_ex.phpt
+++ /dev/null
@@ -1,154 +0,0 @@
---TEST--
-SPL: array_access
---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 array_write implements spl_array_writer {
- private $obj;
- private $idx;
-
- function __construct(&$obj, $index = null) {
- $this->obj = &$obj;
- $this->idx = $index;
- }
-
- function set($value) {
- echo __METHOD__ . "($value,".$this->idx.")\n";
- return $this->obj->set($this->idx, $value);
- }
-}
-
-class c implements spl_array_access_ex {
-
- public $a = array('1st', 1, 2=>'3rd', '4th'=>4);
-
- function new_writer($index) {
- return new array_write(&$this, $index);
- }
-
- 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;
- }
-}
-
-$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_ex.php on line %d
-NULL
-c::exists(6)
-
-Notice: Undefined index: 6 in %sarray_access_ex.php on line %d
-NULL
-WRITE 1
-c::exists(1)
-array_write::set(Changed 1,1)
-c::set(1,Changed 1)
-c::exists(1)
-c::get(1)
-string(9) "Changed 1"
-WRITE 2
-c::exists(4th)
-array_write::set(Changed 4th,4th)
-c::set(4th,Changed 4th)
-c::exists(4th)
-c::get(4th)
-string(11) "Changed 4th"
-WRITE 3
-c::exists(5th)
-array_write::set(Added 5th,5th)
-c::set(5th,Added 5th)
-c::exists(5th)
-c::get(5th)
-string(9) "Added 5th"
-WRITE 4
-c::exists(6)
-array_write::set(Added 6,6)
-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::exists(6)
-array_write::set(changed 6,6)
-c::set(6,changed 6)
-c::exists(6)
-c::get(6)
-string(9) "changed 6"
-string(9) "changed 6"
-Done
diff --git a/ext/spl/tests/array_read.phpt b/ext/spl/tests/array_read.phpt
deleted file mode 100755
index 032373d52d..0000000000
--- a/ext/spl/tests/array_read.phpt
+++ /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
index de05f4b3f5..0000000000
--- a/ext/spl/tests/foreach.phpt
+++ /dev/null
@@ -1,193 +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) {
- $this->obj = $obj;
- }
- function current() {
- echo __METHOD__ . "\n";
- return $this->num;
- }
- function next() {
- echo __METHOD__ . "\n";
- $this->num++;
- }
- function has_more() {
- $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 new_iterator() {
- echo __METHOD__ . "\n";
- return new c_iter($this);
- }
-}
-
-$t = new c();
-
-for ($iter = $t->new_iterator(); $iter->has_more(); $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::new_iterator
-c_iter::has_more = true
-c_iter::current
-0
-c_iter::next
-c_iter::has_more = true
-c_iter::current
-1
-c_iter::next
-c_iter::has_more = true
-c_iter::current
-2
-c_iter::next
-c_iter::has_more = false
-array:0
-array:1
-array:2
-c::new_iterator
-c_iter::has_more = true
-c_iter::current
-c_iter::key
-object:0
-c_iter::next
-c_iter::has_more = true
-c_iter::current
-c_iter::key
-object:1
-c_iter::next
-c_iter::has_more = true
-c_iter::current
-c_iter::key
-object:2
-c_iter::next
-c_iter::has_more = false
-c::new_iterator
-c_iter::has_more = true
-c_iter::current
-c_iter::key
-c::new_iterator
-c_iter::has_more = true
-c_iter::current
-c_iter::key
-double:0:0
-c_iter::next
-c_iter::has_more = true
-c_iter::current
-c_iter::key
-double:0:1
-c_iter::next
-c_iter::has_more = true
-c_iter::current
-c_iter::key
-double:0:2
-c_iter::next
-c_iter::has_more = false
-c_iter::next
-c_iter::has_more = true
-c_iter::current
-c_iter::key
-c::new_iterator
-c_iter::has_more = true
-c_iter::current
-c_iter::key
-double:1:0
-c_iter::next
-c_iter::has_more = true
-c_iter::current
-c_iter::key
-double:1:1
-c_iter::next
-c_iter::has_more = true
-c_iter::current
-c_iter::key
-double:1:2
-c_iter::next
-c_iter::has_more = false
-c_iter::next
-c_iter::has_more = true
-c_iter::current
-c_iter::key
-c::new_iterator
-c_iter::has_more = true
-c_iter::current
-c_iter::key
-double:2:0
-c_iter::next
-c_iter::has_more = true
-c_iter::current
-c_iter::key
-double:2:1
-c_iter::next
-c_iter::has_more = true
-c_iter::current
-c_iter::key
-double:2:2
-c_iter::next
-c_iter::has_more = false
-c_iter::next
-c_iter::has_more = false
-c::new_iterator
-c_iter::has_more = true
-c_iter::current
-c_iter::key
-object:1st=>0
-c_iter::next
-c_iter::has_more = true
-c_iter::current
-c_iter::key
-object:2nd=>1
-c_iter::next
-c_iter::has_more = true
-c_iter::current
-c_iter::key
-object:3rd=>2
-c_iter::next
-c_iter::has_more = false
-Done \ No newline at end of file
diff --git a/ext/spl/tests/foreach_break.phpt b/ext/spl/tests/foreach_break.phpt
deleted file mode 100755
index b17831c74c..0000000000
--- a/ext/spl/tests/foreach_break.phpt
+++ /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 has_more() {
- $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 new_iterator() {
- 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::new_iterator
-c_iter::has_more = true
-c_iter::current
-c_iter::key
-c::new_iterator
-c_iter::has_more = true
-c_iter::current
-c_iter::key
-double:0:0
-c_iter::next
-c_iter::has_more = true
-c_iter::current
-c_iter::key
-c::new_iterator
-c_iter::has_more = true
-c_iter::current
-c_iter::key
-double:1:0
-c_iter::next
-c_iter::has_more = true
-c_iter::current
-c_iter::key
-c::new_iterator
-c_iter::has_more = true
-c_iter::current
-c_iter::key
-double:2:0
-c_iter::next
-c_iter::has_more = false
-Done
diff --git a/ext/spl/tests/forward.phpt b/ext/spl/tests/forward.phpt
deleted file mode 100755
index 1be8f1913e..0000000000
--- a/ext/spl/tests/forward.phpt
+++ /dev/null
@@ -1,136 +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 has_more() {
- 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();
-
-$c_info = array(get_class($i) => array('inheits' => class_parents($i), 'implements' => class_implements($i)));
-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_forward_assoc] => spl_forward_assoc
- [spl_assoc] => spl_assoc
- [spl_forward] => spl_forward
- )
-
- )
-
-)
-Array
-(
- [0] => current
- [1] => has_more
- [2] => key
- [3] => next
-)
-Array
-(
- [0] => current
- [1] => has_more
- [2] => key
- [3] => next
-)
-1st try
-c::has_more
-c::current
-c::key
-object:0
-c::next
-c::has_more
-c::current
-c::key
-object:1
-c::next
-c::has_more
-c::current
-c::key
-object:2
-c::next
-c::has_more
-2nd try
-c::has_more
-3rd try
-c::has_more
-c::current
-c::key
-object:1st=>0
-c::next
-c::has_more
-c::current
-c::key
-object:2nd=>1
-c::next
-c::has_more
-c::current
-c::key
-object:3rd=>2
-c::next
-c::has_more
-Done \ No newline at end of file
diff --git a/ext/spl/tests/sequence.phpt b/ext/spl/tests/sequence.phpt
deleted file mode 100755
index aa8d2c4258..0000000000
--- a/ext/spl/tests/sequence.phpt
+++ /dev/null
@@ -1,138 +0,0 @@
---TEST--
-SPL: sequence
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-class c implements spl_iterator {
-
- public $max = 3;
-
- function new_iterator() {
- 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 has_more() {
- 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->new_iterator();
-
-$c_info = array(get_class($t) => array('inheits' => class_parents($t), 'implements' => class_implements($t)),
- get_class($i) => array('inheits' => class_parents($i), 'implements' => class_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::new_iterator
-Array
-(
- [c] => Array
- (
- [inheits] => Array
- (
- )
-
- [implements] => Array
- (
- [spl_iterator] => spl_iterator
- )
-
- )
-
- [c_iter] => Array
- (
- [inheits] => Array
- (
- )
-
- [implements] => Array
- (
- [spl_sequence_assoc] => spl_sequence_assoc
- [spl_forward_assoc] => spl_forward_assoc
- [spl_assoc] => spl_assoc
- [spl_forward] => spl_forward
- [spl_sequence] => spl_sequence
- )
-
- )
-
-)
-c_iter::rewind
-c_iter::has_more
-c_iter::current
-c_iter::key
-object:0
-c_iter::next
-c_iter::has_more
-c_iter::current
-c_iter::key
-object:1
-c_iter::next
-c_iter::has_more
-c_iter::current
-c_iter::key
-object:2
-c_iter::next
-c_iter::has_more
-c_iter::rewind
-c_iter::has_more
-c_iter::current
-c_iter::key
-object:1st=>0
-c_iter::next
-c_iter::has_more
-c_iter::current
-c_iter::key
-object:2nd=>1
-c_iter::next
-c_iter::has_more
-c_iter::current
-c_iter::key
-object:3rd=>2
-c_iter::next
-c_iter::has_more
-Done \ No newline at end of file