summaryrefslogtreecommitdiff
path: root/ext/spl
diff options
context:
space:
mode:
authorSVN Migration <svn@php.net>2005-06-10 18:06:44 +0000
committerSVN Migration <svn@php.net>2005-06-10 18:06:44 +0000
commit02889a1980340caaa4f2450c834da87fb675f848 (patch)
tree2e0b0f07f6810a635d5ecba89f63b6bfb63126f8 /ext/spl
parent3b1f8e9ad74ad07580e4248b39fd0db261c31aa0 (diff)
downloadphp-git-php-5.0.1b1.tar.gz
This commit was manufactured by cvs2svn to create tag 'php_5_0_1b1'.php-5.0.1b1
Diffstat (limited to 'ext/spl')
-rwxr-xr-xext/spl/CREDITS2
-rwxr-xr-xext/spl/README7
-rwxr-xr-xext/spl/TODO4
-rwxr-xr-xext/spl/config.m414
-rw-r--r--ext/spl/config.w3212
-rwxr-xr-xext/spl/doxygen.cfg217
-rwxr-xr-xext/spl/examples/autoload.inc50
-rwxr-xr-xext/spl/examples/dba_array.php52
-rwxr-xr-xext/spl/examples/dba_dump.php42
-rwxr-xr-xext/spl/examples/dbaarray.inc98
-rwxr-xr-xext/spl/examples/dbareader.inc96
-rwxr-xr-xext/spl/examples/directoryfilterdots.inc45
-rw-r--r--ext/spl/examples/directorygraphiterator.inc25
-rwxr-xr-xext/spl/examples/directorytree.inc27
-rwxr-xr-xext/spl/examples/directorytree.php37
-rw-r--r--ext/spl/examples/directorytreeiterator.inc47
-rwxr-xr-xext/spl/examples/findfile.inc65
-rwxr-xr-xext/spl/examples/findfile.php33
-rwxr-xr-xext/spl/examples/findregex.php36
-rwxr-xr-xext/spl/examples/ini_groups.php41
-rwxr-xr-xext/spl/examples/inigroups.inc54
-rwxr-xr-xext/spl/examples/keyfilter.inc64
-rwxr-xr-xext/spl/examples/nocvsdir.php44
-rwxr-xr-xext/spl/examples/recursivefilteriterator.inc58
-rwxr-xr-xext/spl/examples/regexfindfile.inc40
-rwxr-xr-xext/spl/examples/searchiterator.inc58
-rwxr-xr-xext/spl/examples/tests/examples.inc23
-rwxr-xr-xext/spl/examples/tree.php40
-rwxr-xr-xext/spl/internal/appenditerator.inc122
-rwxr-xr-xext/spl/internal/cachingiterator.inc141
-rwxr-xr-xext/spl/internal/cachingrecursiveiterator.inc90
-rwxr-xr-xext/spl/internal/emptyiterator.inc62
-rwxr-xr-xext/spl/internal/fileobject.inc350
-rwxr-xr-xext/spl/internal/filteriterator.inc129
-rwxr-xr-xext/spl/internal/infiniteiterator.inc48
-rwxr-xr-xext/spl/internal/iteratoriterator.inc121
-rwxr-xr-xext/spl/internal/limititerator.inc134
-rwxr-xr-xext/spl/internal/norewinditerator.inc28
-rwxr-xr-xext/spl/internal/outeriterator.inc25
-rwxr-xr-xext/spl/internal/parentiterator.inc53
-rwxr-xr-xext/spl/internal/recursiveiterator.inc30
-rwxr-xr-xext/spl/internal/recursiveiteratoriterator.inc183
-rwxr-xr-xext/spl/internal/seekableiterator.inc48
-rwxr-xr-xext/spl/package.xml77
-rwxr-xr-xext/spl/php_spl.c607
-rwxr-xr-xext/spl/php_spl.h84
-rwxr-xr-xext/spl/spl.php801
-rwxr-xr-xext/spl/spl_array.c1197
-rwxr-xr-xext/spl/spl_array.h44
-rwxr-xr-xext/spl/spl_directory.c1619
-rwxr-xr-xext/spl/spl_directory.h75
-rwxr-xr-xext/spl/spl_engine.c67
-rwxr-xr-xext/spl/spl_engine.h72
-rwxr-xr-xext/spl/spl_exceptions.c81
-rwxr-xr-xext/spl/spl_exceptions.h53
-rwxr-xr-xext/spl/spl_functions.c166
-rwxr-xr-xext/spl/spl_functions.h95
-rwxr-xr-xext/spl/spl_iterators.c1978
-rwxr-xr-xext/spl/spl_iterators.h117
-rwxr-xr-xext/spl/spl_observer.c88
-rwxr-xr-xext/spl/spl_observer.h41
-rwxr-xr-xext/spl/spl_sxe.c178
-rwxr-xr-xext/spl/spl_sxe.h40
-rwxr-xr-xext/spl/tests/.htaccess3
-rwxr-xr-xext/spl/tests/array_001.phpt103
-rwxr-xr-xext/spl/tests/array_002.phpt37
-rwxr-xr-xext/spl/tests/array_003.phpt61
-rwxr-xr-xext/spl/tests/array_004.phpt143
-rwxr-xr-xext/spl/tests/array_005.phpt93
-rwxr-xr-xext/spl/tests/array_006.phpt32
-rwxr-xr-xext/spl/tests/array_007.phpt65
-rwxr-xr-xext/spl/tests/array_008.phpt62
-rwxr-xr-xext/spl/tests/array_009.phpt39
-rwxr-xr-xext/spl/tests/array_010.phpt146
-rwxr-xr-xext/spl/tests/array_011.phpt37
-rwxr-xr-xext/spl/tests/array_012.phpt65
-rwxr-xr-xext/spl/tests/array_013.phpt81
-rwxr-xr-xext/spl/tests/array_014.phpt61
-rwxr-xr-xext/spl/tests/array_015.phpt85
-rwxr-xr-xext/spl/tests/array_016.phpt34
-rwxr-xr-xext/spl/tests/bug28822.phpt18
-rwxr-xr-xext/spl/tests/bug31185.phpt61
-rwxr-xr-xext/spl/tests/bug31346.phpt19
-rwxr-xr-xext/spl/tests/bug31348.phpt15
-rwxr-xr-xext/spl/tests/bug31926.phpt27
-rwxr-xr-xext/spl/tests/bug32134.phpt48
-rwxr-xr-xext/spl/tests/bug32394.phpt17
-rwxr-xr-xext/spl/tests/dit_001.phpt19
-rwxr-xr-xext/spl/tests/fileobject_001.phpt88
-rwxr-xr-xext/spl/tests/fileobject_001a.txt6
-rwxr-xr-xext/spl/tests/fileobject_001b.txt6
-rwxr-xr-xext/spl/tests/fileobject_002.phpt122
-rwxr-xr-xext/spl/tests/iterator_001.phpt173
-rwxr-xr-xext/spl/tests/iterator_002.phpt57
-rwxr-xr-xext/spl/tests/iterator_003.phpt97
-rwxr-xr-xext/spl/tests/iterator_004.phpt144
-rwxr-xr-xext/spl/tests/iterator_005.phpt54
-rwxr-xr-xext/spl/tests/iterator_006.phpt24
-rwxr-xr-xext/spl/tests/iterator_007.phpt168
-rwxr-xr-xext/spl/tests/iterator_008.phpt91
-rwxr-xr-xext/spl/tests/iterator_009.phpt47
-rwxr-xr-xext/spl/tests/iterator_010.phpt18
-rwxr-xr-xext/spl/tests/iterator_011.phpt51
-rwxr-xr-xext/spl/tests/iterator_012.phpt33
-rwxr-xr-xext/spl/tests/iterator_013.phpt66
-rwxr-xr-xext/spl/tests/iterator_014.phpt143
-rwxr-xr-xext/spl/tests/iterator_015.phpt75
-rwxr-xr-xext/spl/tests/iterator_016.phpt89
-rwxr-xr-xext/spl/tests/iterator_017.phpt18
-rwxr-xr-xext/spl/tests/iterator_018.phpt51
-rwxr-xr-xext/spl/tests/iterator_019.phpt33
-rwxr-xr-xext/spl/tests/iterator_020.phpt66
-rwxr-xr-xext/spl/tests/iterator_021.phpt185
-rwxr-xr-xext/spl/tests/iterator_022.phpt191
-rwxr-xr-xext/spl/tests/observer_001.phpt116
-rwxr-xr-xext/spl/tests/spl_001.phpt34
-rwxr-xr-xext/spl/tests/spl_002.phpt22
-rwxr-xr-xext/spl/tests/spl_003.phpt76
-rwxr-xr-xext/spl/tests/spl_autoload_001.phpt136
-rwxr-xr-xext/spl/tests/spl_autoload_002.phpt68
-rwxr-xr-xext/spl/tests/spl_autoload_003.phpt44
-rwxr-xr-xext/spl/tests/sxe_001.phpt60
-rwxr-xr-xext/spl/tests/sxe_002.phpt75
-rwxr-xr-xext/spl/tests/sxe_003.phpt77
-rwxr-xr-xext/spl/tests/sxe_004.phpt145
-rwxr-xr-xext/spl/tests/testclass5
-rwxr-xr-xext/spl/tests/testclass.class.inc9
-rwxr-xr-xext/spl/tests/testclass.inc5
-rwxr-xr-xext/spl/tests/testclass.php.inc5
129 files changed, 0 insertions, 14719 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/README b/ext/spl/README
deleted file mode 100755
index b2aeb596d0..0000000000
--- a/ext/spl/README
+++ /dev/null
@@ -1,7 +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 or in the corresponding .inc file in the examples
-subdirectory. Based on the internal implementations or the files in the
-examples subdirectory there are also some .php files to experiment with.
-
-For more information look at: http://php.net/~helly/php/ext/spl
diff --git a/ext/spl/TODO b/ext/spl/TODO
deleted file mode 100755
index 68b00da6a5..0000000000
--- a/ext/spl/TODO
+++ /dev/null
@@ -1,4 +0,0 @@
-This is the ToDo of ext/spl:
-
-Implement the classes/interfaces from the .inc files in
-directory examples. \ No newline at end of file
diff --git a/ext/spl/config.m4 b/ext/spl/config.m4
deleted file mode 100755
index eea8092166..0000000000
--- a/ext/spl/config.m4
+++ /dev/null
@@ -1,14 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension SPL
-
-PHP_ARG_ENABLE(spl, enable SPL suppport,
-[ --disable-spl Disable Standard PHP Library], yes)
-
-if test "$PHP_SPL" != "no"; then
- if test "$ext_shared" = "yes"; then
- AC_MSG_ERROR(Cannot build SPL as a shared module)
- fi
- 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_iterators.c spl_array.c spl_directory.c spl_sxe.c spl_exceptions.c spl_observer.c, $ext_shared)
- PHP_ADD_EXTENSION_DEP(spl, simplexml)
-fi
diff --git a/ext/spl/config.w32 b/ext/spl/config.w32
deleted file mode 100644
index 931a6704c7..0000000000
--- a/ext/spl/config.w32
+++ /dev/null
@@ -1,12 +0,0 @@
-// $Id$
-// vim:ft=javascript
-
-ARG_ENABLE("spl", "SPL (Standard PHP Library) support", "yes");
-
-if (PHP_SPL != "no") {
- if (PHP_SPL_SHARED) {
- ERROR("SPL cannot be compiled as a shared ext");
- }
- EXTENSION("spl", "php_spl.c spl_functions.c spl_engine.c spl_iterators.c spl_array.c spl_directory.c spl_sxe.c spl_exceptions.c spl_observer.c");
- AC_DEFINE('HAVE_SPL', 1);
-}
diff --git a/ext/spl/doxygen.cfg b/ext/spl/doxygen.cfg
deleted file mode 100755
index 1d79e40465..0000000000
--- a/ext/spl/doxygen.cfg
+++ /dev/null
@@ -1,217 +0,0 @@
-# Doxyfile 1.3.9.1
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = SPL-StandardPHPLibrary
-PROJECT_NUMBER =
-OUTPUT_DIRECTORY =
-CREATE_SUBDIRS = NO
-OUTPUT_LANGUAGE = English
-USE_WINDOWS_ENCODING = YES
-BRIEF_MEMBER_DESC = NO
-REPEAT_BRIEF = YES
-ABBREVIATE_BRIEF =
-ALWAYS_DETAILED_SEC = YES
-INLINE_INHERITED_MEMB = YES
-FULL_PATH_NAMES = NO
-STRIP_FROM_PATH =
-STRIP_FROM_INC_PATH =
-SHORT_NAMES = NO
-JAVADOC_AUTOBRIEF = YES
-MULTILINE_CPP_IS_BRIEF = YES
-DETAILS_AT_TOP = NO
-INHERIT_DOCS = YES
-DISTRIBUTE_GROUP_DOC = YES
-TAB_SIZE = 4
-ALIASES =
-OPTIMIZE_OUTPUT_FOR_C = NO
-OPTIMIZE_OUTPUT_JAVA = NO
-SUBGROUPING = YES
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-EXTRACT_ALL = YES
-EXTRACT_PRIVATE = YES
-EXTRACT_STATIC = YES
-EXTRACT_LOCAL_CLASSES = YES
-EXTRACT_LOCAL_METHODS = YES
-HIDE_UNDOC_MEMBERS = NO
-HIDE_UNDOC_CLASSES = NO
-HIDE_FRIEND_COMPOUNDS = NO
-HIDE_IN_BODY_DOCS = NO
-INTERNAL_DOCS = YES
-CASE_SENSE_NAMES = YES
-HIDE_SCOPE_NAMES = NO
-SHOW_INCLUDE_FILES = YES
-INLINE_INFO = YES
-SORT_MEMBER_DOCS = YES
-SORT_BRIEF_DOCS = YES
-SORT_BY_SCOPE_NAME = NO
-GENERATE_TODOLIST = YES
-GENERATE_TESTLIST = YES
-GENERATE_BUGLIST = YES
-GENERATE_DEPRECATEDLIST= YES
-ENABLED_SECTIONS =
-MAX_INITIALIZER_LINES = 30
-SHOW_USED_FILES = YES
-SHOW_DIRECTORIES = YES
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET = NO
-WARNINGS = YES
-WARN_IF_UNDOCUMENTED = YES
-WARN_IF_DOC_ERROR = YES
-WARN_FORMAT = "$file:$line: $text"
-WARN_LOGFILE =
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = spl.php \
- examples \
- internal
-FILE_PATTERNS = *.inc \
- *.php
-RECURSIVE = NO
-EXCLUDE =
-EXCLUDE_SYMLINKS = NO
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS =
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
-INPUT_FILTER =
-FILTER_PATTERNS =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-SOURCE_BROWSER = NO
-INLINE_SOURCES = NO
-STRIP_CODE_COMMENTS = YES
-REFERENCED_BY_RELATION = YES
-REFERENCES_RELATION = YES
-VERBATIM_HEADERS = YES
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-ALPHABETICAL_INDEX = YES
-COLS_IN_ALPHA_INDEX = 4
-IGNORE_PREFIX =
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-GENERATE_HTML = YES
-HTML_OUTPUT = html
-HTML_FILE_EXTENSION = .html
-HTML_HEADER =
-HTML_FOOTER =
-HTML_STYLESHEET =
-HTML_ALIGN_MEMBERS = YES
-GENERATE_HTMLHELP = YES
-CHM_FILE = ../spl.chm
-HHC_LOCATION = hhc.exe
-GENERATE_CHI = NO
-BINARY_TOC = NO
-TOC_EXPAND = NO
-DISABLE_INDEX = NO
-ENUM_VALUES_PER_LINE = 1
-GENERATE_TREEVIEW = YES
-TREEVIEW_WIDTH = 250
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-GENERATE_LATEX = NO
-LATEX_OUTPUT = latex
-LATEX_CMD_NAME = latex
-MAKEINDEX_CMD_NAME = makeindex
-COMPACT_LATEX = NO
-PAPER_TYPE = a4wide
-EXTRA_PACKAGES =
-LATEX_HEADER =
-PDF_HYPERLINKS = NO
-USE_PDFLATEX = NO
-LATEX_BATCHMODE = NO
-LATEX_HIDE_INDICES = NO
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-GENERATE_RTF = NO
-RTF_OUTPUT = rtf
-COMPACT_RTF = NO
-RTF_HYPERLINKS = NO
-RTF_STYLESHEET_FILE =
-RTF_EXTENSIONS_FILE =
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-GENERATE_MAN = NO
-MAN_OUTPUT = man
-MAN_EXTENSION = .3
-MAN_LINKS = NO
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-GENERATE_XML = YES
-XML_OUTPUT = xml
-XML_SCHEMA =
-XML_DTD =
-XML_PROGRAMLISTING = YES
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-GENERATE_AUTOGEN_DEF = NO
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-GENERATE_PERLMOD = NO
-PERLMOD_LATEX = NO
-PERLMOD_PRETTY = YES
-PERLMOD_MAKEVAR_PREFIX =
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = NO
-EXPAND_ONLY_PREDEF = NO
-SEARCH_INCLUDES = YES
-INCLUDE_PATH =
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-TAGFILES =
-GENERATE_TAGFILE =
-ALLEXTERNALS = NO
-EXTERNAL_GROUPS = YES
-PERL_PATH = /usr/bin/perl
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-CLASS_DIAGRAMS = YES
-HIDE_UNDOC_RELATIONS = YES
-HAVE_DOT = NO
-CLASS_GRAPH = YES
-COLLABORATION_GRAPH = YES
-UML_LOOK = NO
-TEMPLATE_RELATIONS = NO
-INCLUDE_GRAPH = YES
-INCLUDED_BY_GRAPH = YES
-CALL_GRAPH = YES
-GRAPHICAL_HIERARCHY = YES
-DOT_IMAGE_FORMAT = png
-DOT_PATH =
-DOTFILE_DIRS =
-MAX_DOT_GRAPH_WIDTH = 1200
-MAX_DOT_GRAPH_HEIGHT = 1024
-MAX_DOT_GRAPH_DEPTH = 0
-GENERATE_LEGEND = YES
-DOT_CLEANUP = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine
-#---------------------------------------------------------------------------
-SEARCHENGINE = NO
diff --git a/ext/spl/examples/autoload.inc b/ext/spl/examples/autoload.inc
deleted file mode 100755
index 5871e7d63b..0000000000
--- a/ext/spl/examples/autoload.inc
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-
-/** @file autoload.inc
- * @ingroup Examples
- * @brief function __autoload
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-/** \internal
- * Tries to load class $classname from directory $dir.
- */
-function __load_class($classname, $dir)
-{
- $file = $dir . '/' . $classname . '.inc';
- if (file_exists($file))
- {
- require_once($file);
- return true;
- }
- return false;
-}
-
-/**
- * @brief Class loader for SPL example classes
- * @author Marcus Boerger
- * @version 1.0
- *
- * Loads classes automatically from include_path as given by ini or from
- * current directory of script or include file.
- */
-function __autoload($classname) {
- $classname = strtolower($classname);
- $inc = split(':', ini_get('include_path'));
- $inc[] = '.';
- $inc[] = dirname($_SERVER['PATH_TRANSLATED']);
- foreach($inc as $dir)
- {
- if (__load_class($classname, $dir))
- {
- fprintf(STDERR, 'Loading class('.$classname.")\n");
- return;
- }
- }
- fprintf(STDERR, 'Class not found ('.$classname.")\n");
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/dba_array.php b/ext/spl/examples/dba_array.php
deleted file mode 100755
index 346ac1f2f7..0000000000
--- a/ext/spl/examples/dba_array.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-
-/** @file dba_array.php
- * @brief Program DBA array utility
- * @ingroup Examples
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * Usage php dba_array.php \<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
- */
-
-if ($argc < 4) {
- echo <<<EOF
-Usage: php ${_SERVER['PHP_SELF']} <file> <handler> <key> [<value>]
-
-If <value> is specified then <key> is set to <value> in <file>.
-Else the value of <key> is printed only.
-
-
-EOF;
- exit(1);
-}
-
-if (!class_exists("DbaReader", false)) require_once("dbareader.inc");
-
-try {
- if ($argc > 2) {
- $dba = new DbaArray($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]]));
- }
- unset($dba);
- }
- 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 2c698d427a..0000000000
--- a/ext/spl/examples/dba_dump.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-
-/** @file dba_dump.php
- * @brief Program DBA dump utility
- * @ingroup Examples
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * Usage: php dba_dump.php \<file\> \<handler\> [\<regex\>]
- *
- * Show all groups in the ini file specified by \<file\>.
- * The regular expression \<regex\> is used to filter the by setting name.
- *
- * Note: configure with --enable-dba
- */
-
-if ($argc < 3) {
- echo <<<EOF
-Usage: php ${_SERVER['PHP_SELF']} <file> <handler> [<regex>]
-
-Show all groups in the ini file specified by <file>.
-The regular expression <regex> is used to filter the by setting name.
-
-
-EOF;
- exit(1);
-}
-
-if (!class_exists("DbaReader", false)) require_once("dbareader.inc");
-if (!class_exists("KeyFilter", false)) require_once("keyfilter.inc");
-
-$db = new DbaReader($argv[1], $argv[2]);
-
-if ($argc>3) {
- $db = new KeyFilter($db, $argv[3]);
-}
-
-foreach($db as $key => $val) {
- echo "'$key' => '$val'\n";
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/dbaarray.inc b/ext/spl/examples/dbaarray.inc
deleted file mode 100755
index fcd6bb378a..0000000000
--- a/ext/spl/examples/dbaarray.inc
+++ /dev/null
@@ -1,98 +0,0 @@
-<?php
-
-/** @file dbaarray.inc
- * @ingroup Examples
- * @brief class DbaArray
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-if (!class_exists("DbaReader", false)) require_once("dbareader.inc");
-
-/** @ingroup Examples
- * @brief This implements a DBA Array
- * @author Marcus Boerger
- * @version 1.0
- */
-class DbaArray extends DbaReader implements ArrayAccess
-{
-
- /**
- * Open database $file with $handler in read only mode.
- *
- * @param file Database file to open.
- * @param handler Handler to use for database access.
- */
- function __construct($file, $handler)
- {
- $this->db = dba_popen($file, "c", $handler);
- if (!$this->db) {
- throw new exception("Databse could not be opened");
- }
- }
-
- /**
- * Close database.
- */
- function __destruct()
- {
- parent::__destruct();
- }
-
- /**
- * Read an entry.
- *
- * @param $name key to read from
- * @return value associated with $name
- */
- function offsetGet($name)
- {
- $data = dba_fetch($name, $this->db);
- if($data) {
- if (ini_get('magic_quotes_runtime')) {
- $data = stripslashes($data);
- }
- //return unserialize($data);
- return $data;
- }
- else
- {
- return NULL;
- }
- }
-
- /**
- * Set an entry.
- *
- * @param $name key to write to
- * @param $value value to write
- */
- function offsetSet($name, $value)
- {
- //dba_replace($name, serialize($value), $this->db);
- dba_replace($name, $value, $this->db);
- return $value;
- }
-
- /**
- * @return whether key $name exists.
- */
- function offsetExists($name)
- {
- return dba_exists($name, $this->db);
- }
-
- /**
- * Delete a key/value pair.
- *
- * @param $name key to delete.
- */
- function offsetUnset($name)
- {
- return dba_delete($name, $this->db);
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/dbareader.inc b/ext/spl/examples/dbareader.inc
deleted file mode 100755
index b09791239b..0000000000
--- a/ext/spl/examples/dbareader.inc
+++ /dev/null
@@ -1,96 +0,0 @@
-<?php
-
-/** @file dbareader.inc
- * @ingroup Examples
- * @brief class DbaReader
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-/** @ingroup Examples
- * @brief This implements a DBA Iterator.
- * @author Marcus Boerger
- * @version 1.0
- */
-class DbaReader implements Iterator
-{
-
- protected $db = NULL;
- private $key = false;
- private $val = false;
-
- /**
- * Open database $file with $handler in read only mode.
- *
- * @param file Database file to open.
- * @param handler Handler to use for database access.
- */
- function __construct($file, $handler) {
- if (!$this->db = dba_open($file, 'r', $handler)) {
- throw new exception('Could not open file ' . $file);
- }
- }
-
- /**
- * Close database.
- */
- function __destruct() {
- dba_close($this->db);
- }
-
- /**
- * Rewind to first element.
- */
- function rewind() {
- $this->key = dba_firstkey($this->db);
- $this->fetch_data();
- }
-
- /**
- * Move to next element.
- *
- * @return void
- */
- function next() {
- $this->key = dba_nextkey($this->db);
- $this->fetch_data();
- }
-
- /**
- * Fetches the current data if $key is valid
- */
- private function fetch_data() {
- if ($this->key !== false) {
- $this->val = dba_fetch($this->key, $this->db);
- }
- }
-
- /**
- * @return Current data.
- */
- function current() {
- return $this->val;
- }
-
- /**
- * @return Whether more elements are available.
- */
- function valid() {
- if ($this->db && $this->key !== false) {
- return true;
- } else {
- return false;
- }
- }
-
- /**
- * @return Current key.
- */
- function key() {
- return $this->key;
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/directoryfilterdots.inc b/ext/spl/examples/directoryfilterdots.inc
deleted file mode 100755
index fceeda2a23..0000000000
--- a/ext/spl/examples/directoryfilterdots.inc
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-
-/** @file directoryfilterdots.inc
- * @ingroup Examples
- * @brief class DirectoryFilterDots
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-/** @ingroup Examples
- * @brief A filtered DirectoryIterator
- * @author Marcus Boerger
- * @version 1.1
- *
- * This Iteraotr takes a pathname from which it creates a DirectoryIterator
- * and makes it recursive. Further more it filters the entries '.' and '..'.
- */
-class DirectoryFilterDots extends RecursiveFilterIterator
-{
- /** Construct from a path.
- * @param $path directory to iterate
- */
- function __construct($path)
- {
- parent::__construct(new DirectoryIterator($path));
- }
-
- /** @return whether the current entry is neither '.' nor '..'
- */
- function accept()
- {
- return !$this->getInnerIterator()->isDot();
- }
-
- /** @return the current entries path name
- */
- function key()
- {
- return $this->getInnerIterator()->getPathname();
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/directorygraphiterator.inc b/ext/spl/examples/directorygraphiterator.inc
deleted file mode 100644
index ea31aa2b8a..0000000000
--- a/ext/spl/examples/directorygraphiterator.inc
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-/** @file directorygraphiterator.inc
- * @ingroup Examples
- * @brief class DirectoryGraphIterator
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-/** @ingroup Examples
- * @brief A tree iterator that only shows directories.
- * @author Marcus Boerger
- * @version 1.0
- */
-class DirectoryGraphIterator extends DirectoryTreeIterator
-{
- function __construct($path)
- {
- RecursiveIteratorIterator::__construct(new CachingRecursiveIterator(new ParentIterator(new RecursiveDirectoryIterator($path)), CIT_CALL_TOSTRING|CIT_CATCH_GET_CHILD), 1);
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/directorytree.inc b/ext/spl/examples/directorytree.inc
deleted file mode 100755
index 7bd9c2c597..0000000000
--- a/ext/spl/examples/directorytree.inc
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-
-/** @file directorytree.inc
- * @ingroup Examples
- * @brief class DirectoryTree
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-/** @ingroup Examples
- * @brief A directory iterator that does not show '.' and '..'.
- * @author Marcus Boerger
- * @version 1.0
- */
-class DirectoryTree extends RecursiveIteratorIterator
-{
- /** Construct from a path.
- * @param $path directory to iterate
- */
- function __construct($path) {
- parent::__construct(new DirectoryFilterDots($path));
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/directorytree.php b/ext/spl/examples/directorytree.php
deleted file mode 100755
index dc26d6cc22..0000000000
--- a/ext/spl/examples/directorytree.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-
-/** @file directorytree.php
- * @brief Program Directory tree example
- * @ingroup Examples
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * Usage: php directorytree.php \<path\> [\<start\> [\<count\>]]
- *
- * Simply specify the path to tree with parameter \<path\>.
- */
-
-if ($argc < 2) {
- echo <<<EOF
-Usage: php ${_SERVER['PHP_SELF']} <path>
-
-Displays a graphical directory tree for the given <path>.
-
-<path> The directory for which to generate the directory tree graph.
-
-
-EOF;
- exit(1);
-}
-
-if (!class_exists("DirectoryTreeIterator", false)) require_once("directorytreeiterator.inc");
-
-$length = $argc > 3 ? $argv[3] : -1;
-
-echo $argv[1]."\n";
-foreach(new LimitIterator(new DirectoryTreeIterator($argv[1]), @$argv[2], $length) as $key=>$file) {
-//foreach(new DirectoryTreeIterator($argv[1]) as $file) {
- echo $file . "\n";
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/directorytreeiterator.inc b/ext/spl/examples/directorytreeiterator.inc
deleted file mode 100644
index 845e7fdce3..0000000000
--- a/ext/spl/examples/directorytreeiterator.inc
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-
-/** @file directorytreeiterator.inc
- * @ingroup Examples
- * @brief class DirectoryTreeIterator
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-/** @ingroup Examples
- * @brief DirectoryIterator to generate ASCII graphic directory trees
- * @author Marcus Boerger
- * @version 1.0
- */
-class DirectoryTreeIterator extends RecursiveIteratorIterator
-{
- /** Construct from a path.
- * @param $path directory to iterate
- */
- function __construct($path)
- {
- parent::__construct(new CachingRecursiveIterator(new RecursiveDirectoryIterator($path), CIT_CALL_TOSTRING|CIT_CATCH_GET_CHILD), 1);
- }
-
- /** @return the current element prefixed with ASCII graphics
- */
- function current()
- {
- $tree = '';
- for ($l=0; $l < $this->getDepth(); $l++) {
- $tree .= $this->getSubIterator($l)->hasNext() ? '| ' : ' ';
- }
- return $tree . ($this->getSubIterator($l)->hasNext() ? '|-' : '\-')
- . $this->getSubIterator($l)->__toString();
- }
-
- /** Aggregates the inner iterator
- */
- function __call($func, $params)
- {
- return call_user_func_array(array($this->getSubIterator(), $func), $params);
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/findfile.inc b/ext/spl/examples/findfile.inc
deleted file mode 100755
index 05d525a3fb..0000000000
--- a/ext/spl/examples/findfile.inc
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
-
-/** @file findfile.inc
- * @ingroup Examples
- * @brief class FindFile
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-if (!class_exists("FindFile", false)) require_once("findfile.inc");
-if (!class_exists("AppendIterator", false)) require_once("appenditerator.inc");
-
-/** @ingroup Examples
- * @brief Base class to find files
- * @author Marcus Boerger
- * @version 1.1
- *
- */
-class FindFile extends FilterIterator
-{
- /** @internal filename to find */
- private $file;
-
- /** Construct from path and filename
- *
- * @param $path the directory to search in
- * If path contains ';' then this parameter is split and every
- * part of it is used as separate directory.
- * @param $file the name of the files to search fro
- */
- function __construct($path, $file)
- {
- $this->file = $file;
- $list = split(';', $path);
- if (count($list) <= 1) {
- parent::__construct(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)));
- } else {
- $it = new AppendIterator();
- foreach($list as $path) {
- $it->append(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)));
- }
- parent::__construct($it);
- }
- }
-
- /** @return whether the current file matches the given filename
- */
- function accept()
- {
- return !strcmp($this->current(), $this->file);
- }
-
- /** @return the filename to search for.
- * @note This may be overloaded and contain a regular expression for an
- * extended class that uses regular expressions to search.
- */
- function getSearch()
- {
- return $this->file;
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/findfile.php b/ext/spl/examples/findfile.php
deleted file mode 100755
index 60146cbffd..0000000000
--- a/ext/spl/examples/findfile.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-/** @file findfile.php
- * @brief Program Find a specific file by name.
- * @ingroup Examples
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * Usage: php findfile.php \<path\> \<name\>
- *
- * \<path\> Path to search in. You can specify multiple paths by separating
- * them with ';'.
- * \<name\> Filename to look for.
- */
-
-if ($argc < 3) {
- echo <<<EOF
-Usage: php findfile.php <path> <name>
-
-Find a specific file by name.
-
-<path> Path to search in.
-<name> Filename to look for.
-
-
-EOF;
- exit(1);
-}
-
-if (!class_exists("FindFile", false)) require_once("findfile.inc");
-
-foreach(new FindFile($argv[1], $argv[2]) as $file) echo $file->getPathname()."\n";
-?> \ No newline at end of file
diff --git a/ext/spl/examples/findregex.php b/ext/spl/examples/findregex.php
deleted file mode 100755
index b43ee0cbbc..0000000000
--- a/ext/spl/examples/findregex.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-
-/** @file findregex.php
- * @brief Program Find a specific file by name.
- * @ingroup Examples
- * @author Marcus Boerger, Adam Trachtenberg
- * @date 2004
- *
- * Usage: php findregex.php \<path\> \<name\>
- *
- * \<path\> Path to search in.
- * \<name\> Filename to look for.
- */
-
-if ($argc < 3) {
- echo <<<EOF
-Usage: php findregex.php <file> <name>
-
-Find a specific file by name.
-
-<path> Path to search in.
-<name> Regex for filenames to look for.
-
-
-EOF;
- exit(1);
-}
-
-if (!class_exists("RegexFindFile", false)) require_once("regexfindfile.inc");
-
-foreach(new RegexFindFile($argv[1], $argv[2]) as $file)
-{
- echo $file->getPathname()."\n";
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/ini_groups.php b/ext/spl/examples/ini_groups.php
deleted file mode 100755
index 5136911096..0000000000
--- a/ext/spl/examples/ini_groups.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-
-/** @file ini_groups.php
- * @brief Program List groups within an ini file
- * @ingroup Examples
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * Usage: php dba_dump.php \<file\> [\<regex\>]
- *
- * Show all groups in the ini file specified by \<file\>.
- * The regular expression \<regex\> is used to filter the result.
- *
- * Note: configure with --enable-dba
- */
-
-if ($argc < 2) {
- echo <<<EOF
-Usage: php dba_dump.php <file> [<regex>]
-
-Show all groups in the ini file specified by <file>.
-The regular expression <regex> is used to filter the result.
-
-
-EOF;
- exit(1);
-}
-
-if (!class_exists("KeyFilter", false)) require_once("keyfilter.inc");
-if (!class_exists("IniGroups", false)) require_once("inigroups.inc");
-
-$it = new IniGroups($argv[1]);
-if ($argc>2) {
- $it = new KeyFilter($it, $argv[2]);
-}
-
-foreach($it as $group) {
- echo "$group\n";
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/inigroups.inc b/ext/spl/examples/inigroups.inc
deleted file mode 100755
index 62cfa3e029..0000000000
--- a/ext/spl/examples/inigroups.inc
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-
-/** @file inigroups.inc
- * @ingroup Examples
- * @brief class IniGroups
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-if (!class_exists("KeyFilter", false)) require_once("keyfilter.inc");
-if (!class_exists("DbaReader", false)) require_once("dbareader.inc");
-
-/** @ingroup Examples
- * @brief Class to iterate all groups within an ini file.
- * @author Marcus Boerger
- * @version 1.1
- *
- * Using this class you can iterator over all groups of a ini file.
- *
- * This class uses a 'is-a' relation to KeyFilter in contrast to a 'has-a'
- * relation. Doing so both current() and key() methods must be overwritten.
- * If it would use a 'has-a' relation there would be much more to type...
- * but for puritists that would allow correctness in so far as then no
- * key() would be needed.
- */
-class IniGroups extends KeyFilter
-{
- /**
- * Construct an ini file group iterator from a filename.
- *
- * @param file Ini file to open.
- */
- function __construct($file) {
- parent::__construct(new DbaReader($file, 'inifile'), '^\[.*\]$');
- }
-
- /**
- * @return The current group.
- */
- function current() {
- return substr(parent::key(),1,-1);
- }
-
- /**
- * @return The current group.
- */
- function key() {
- return substr(parent::key(),1,-1);
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/keyfilter.inc b/ext/spl/examples/keyfilter.inc
deleted file mode 100755
index eaf6b77364..0000000000
--- a/ext/spl/examples/keyfilter.inc
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-
-/** @file keyfilter.inc
- * @ingroup Examples
- * @brief class KeyFilter
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-/** @ingroup Examples
- * @brief Regular expression filter for string iterators
- * @author Marcus Boerger
- * @version 1.1
- *
- * Instances of this class act as a filter around iterators whose elements
- * are strings. In other words you can put an iterator into the constructor
- * and the instance will only return elements which match the given regular
- * expression.
- */
-class KeyFilter extends FilterIterator
-{
- /** @internal regular exoression used as filter */
- private $regex;
-
- /**
- * Constructs a filter around an iterator whose elemnts are strings.
- * If the given iterator is of type spl_sequence then its rewind()
- * method is called.
- *
- * @param it Object that implements at least spl_forward
- * @param regex Regular expression used as a filter.
- */
- function __construct(Iterator $it, $regex)
- {
- parent::__construct($it);
- $this->regex = $regex;
- }
-
- /** \return whether the current key mathes the regular expression
- */
- function accept()
- {
- return ereg($this->regex, $this->getInnerIterator()->key());
- }
-
- /** @return regular expression used as filter
- */
- function getRegex()
- {
- return $this->regex;
- }
-
- /**
- * hidden __clone
- */
- protected function __clone()
- {
- // disallow clone
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/nocvsdir.php b/ext/spl/examples/nocvsdir.php
deleted file mode 100755
index 5ad57864b0..0000000000
--- a/ext/spl/examples/nocvsdir.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-
-/** @file nocvsdir.php
- * @brief Program Dir without CVS subdirs
- * @ingroup Examples
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * Usage: php nocvsdir.php \<path\>
- *
- * Simply specify the path to tree with parameter \<path\>.
- */
-
-if ($argc < 2) {
- echo <<<EOF
-Usage: php ${_SERVER['PHP_SELF']} <path>
-
-Show the directory and all it's contents without any CVS directory in <path>.
-
-<path> The directory for which to generate the directory.
-
-
-EOF;
- exit(1);
-}
-
-if (!class_exists("RecursiveFilterIterator")) require_once("recursivefilteriterator.inc");
-
-class NoCvsDirectory extends RecursiveFilterIterator
-{
- function accept()
- {
- return $this->getInnerIterator()->getFilename() != 'CVS';
- }
-}
-
-$it = new RecursiveIteratorIterator(new NoCvsDirectory(new RecursiveDirectoryIterator($argv[1])));
-
-foreach($it as $pathname => $file)
-{
- echo $pathname."\n";
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/recursivefilteriterator.inc b/ext/spl/examples/recursivefilteriterator.inc
deleted file mode 100755
index 44e1bbcb99..0000000000
--- a/ext/spl/examples/recursivefilteriterator.inc
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-
-/** @file recursivefilteriterator.inc
- * @ingroup Examples
- * @brief class RecursiveFilterIterator
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-/** @ingroup Examples
- * @brief A recursive Filter
- * @author Marcus Boerger
- * @version 1.0
- *
- * Passes the RecursiveIterator interface to the inner Iterator and provides
- * the same functionality as FilterIterator. This allows you to skip parents
- * and all their childs before loading them all. You need to care about
- * function getChildren() because it may not always suit your needs. The
- * builtin behavior uses reflection to return a new instance of the exact same
- * class it is called from. That is you extend RecursiveFilterIterator and
- * getChildren() will create instance of that class. The problem is that doing
- * this does not transport any state or control information of your accept()
- * implementation to the new instance. To overcome this problem you might
- * need to overwrite getChildren(), call this implementation and pass the
- * control vaules manually.
- */
-abstract class RecursiveFilterIterator extends FilterIterator implements RecursiveIterator
-{
- /*! The constructor takes a RecursiveIterator
- */
- function __construct(RecursiveIterator $it)
- {
- $this->ref = new ReflectionClass($this);
- parent::__construct($it);
- }
-
- /*! return whether the inner iterator has children
- */
- function hasChildren()
- {
- return $this->getInnerIterator()->hasChildren();
- }
-
- /*! \return children as instance of derived RecursiveFilterIterator class
- *
- * \see RecursiveFilterIterator
- */
- function getChildren()
- {
- return $this->ref->newInstance($this->getInnerIterator()->getChildren());
- }
-
- private $ref;
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/regexfindfile.inc b/ext/spl/examples/regexfindfile.inc
deleted file mode 100755
index d5dd722536..0000000000
--- a/ext/spl/examples/regexfindfile.inc
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-
-/** @file regexfindfile.inc
- * @ingroup Examples
- * @brief class RegexFindFile
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-/** @ingroup Examples
- * @brief Find files by regular expression
- * @author Marcus Boerger
- * @version 1.1
- *
- */
-class RegexFindFile extends FindFile
-{
- /** Construct from path and regular expression
- *
- * @param $path the directory to search in
- * If path contains ';' then this parameter is split and every
- * part of it is used as separate directory.
- * @param $regex perl style regular expression to find files with
- */
- function __construct($path, $regex)
- {
- parent::__construct($path, $regex);
- }
-
- /** @return whether the current filename matches the regular expression.
- */
- function accept()
- {
- return preg_match($this->getSearch(), $this->current());
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/searchiterator.inc b/ext/spl/examples/searchiterator.inc
deleted file mode 100755
index 944a4ac5a5..0000000000
--- a/ext/spl/examples/searchiterator.inc
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-
-/** @file searchiterator.inc
- * @ingroup Examples
- * @brief abstract class SearchIterator
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-/** @ingroup Examples
- * @brief Iterator to search for a specific element
- * @author Marcus Boerger
- * @version 1.0
- *
- * This extended FilterIterator stops after finding the first acceptable
- * value.
- */
-abstract class SearchIterator extends FilterIterator
-{
- /** @internal whether an entry was found already */
- private $done = false;
-
- /** Rewind and reset so that it once again searches.
- * @return void
- */
- function rewind()
- {
- parent::rewind();
- $this->done = false;
- }
-
- /** @return whether the current element is valid
- * which can only happen once per iteration.
- */
- function valid()
- {
- return !$this->done && parent::valid();
- }
-
- /** Do not move forward but instead mark as finished.
- * @return void
- */
- function next()
- {
- $this->done = true;
- }
-
- /** Aggregates the inner iterator
- */
- function __call($func, $params)
- {
- return call_user_func_array(array($this->getInnerIterator(), $func), $params);
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/tests/examples.inc b/ext/spl/examples/tests/examples.inc
deleted file mode 100755
index feeba7db24..0000000000
--- a/ext/spl/examples/tests/examples.inc
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-
-class IncludeFiles extends ArrayIterator
-{
- function __construct($path, $classes)
- {
- parent::__construct();
- foreach($classes as $c)
- {
- $this->append($path . '/' . strtolower($c) . '.inc');
- }
- }
-}
-
-$classes = array(
-);
-
-foreach (new IncludeFiles(dirname(__FILE__). '/..', $classes) as $file)
-{
- require_once($file);
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/tree.php b/ext/spl/examples/tree.php
deleted file mode 100755
index 5af36a673c..0000000000
--- a/ext/spl/examples/tree.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-
-/** @file tree.php
- * @brief Program Tree view example
- * @ingroup Examples
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * Usage: php tree.php \<path\>
- *
- * Simply specify the path to tree with parameter \<path\>.
- */
-
-// The following line only operates on classes which are converted to c already.
-// But does not generate a graphical output.
-//foreach(new RecursiveIteratorIterator(new ParentIterator(new RecursiveDirectoryIterator($argv[1])), 1) as $file) {
-
-if ($argc < 2) {
- echo <<<EOF
-Usage: php ${_SERVER['PHP_SELF']} <path>
-
-Displays a graphical tree for the given <path>.
-
-<path> The directory for which to generate the tree graph.
-
-
-EOF;
- exit(1);
-}
-
-if (!class_exists("DirectoryTreeIterator", false)) require_once("directorytreeiterator.inc");
-if (!class_exists("DirectoryGraphIterator", false)) require_once("directorygraphiterator.inc");
-
-echo $argv[1]."\n";
-foreach(new DirectoryGraphIterator($argv[1]) as $file)
-{
- echo $file . "\n";
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/internal/appenditerator.inc b/ext/spl/internal/appenditerator.inc
deleted file mode 100755
index 74f254d11e..0000000000
--- a/ext/spl/internal/appenditerator.inc
+++ /dev/null
@@ -1,122 +0,0 @@
-<?php
-
-/** @file appenditerator.inc
- * @ingroup SPL
- * @brief class AppendIterator
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-/** @ingroup SPL
- * @brief Iterator that iterates over several iterators one after the other
- * @author Marcus Boerger
- * @version 1.0
- * @since PHP 5.1
- */
-class AppendIterator implements OuterIterator
-{
- /** @internal array of inner iterators */
- private $iterators;
-
- /** Construct an empty AppendIterator
- */
- function __construct()
- {
- $this->iterators = new ArrayIterator();
- }
-
- /** Append an Iterator
- * @param $it Iterator to append
- *
- * If the current state is invalid but the appended iterator is valid
- * the the AppendIterator itself becomes valid. However there will be no
- * call to $it->rewind(). Also if the current state is invalid the inner
- * ArrayIterator will be rewound und forwarded to the appended element.
- */
- function append(Iterator $it)
- {
- $this->iterators->append($it);
- }
-
- /** @return the current inner Iterator
- */
- function getInnerIterator()
- {
- return $this->iterators->current();
- }
-
- /** Rewind to the first element of the first inner Iterator.
- * @return void
- */
- function rewind()
- {
- $this->iterators->rewind();
- if ($this->iterators->valid())
- {
- $this->getInnerIterator()->rewind();
- }
- }
-
- /** @return whether the current element is valid
- */
- function valid()
- {
- return $this->iterators->valid() && $this->getInnerIterator()->valid();
- }
-
- /** @return the current value if it is valid or \c NULL
- */
- function current()
- {
- /* Using $this->valid() would be exactly the same; it would omit
- * the access to a non valid element in the inner iterator. Since
- * the user didn't respect the valid() return value false this
- * must be intended hence we go on. */
- return $this->iterators->valid() ? $this->getInnerIterator()->current() : NULL;
- }
-
- /** @return the current key if it is valid or \c NULL
- */
- function key()
- {
- return $this->iterators->valid() ? $this->getInnerIterator()->key() : NULL;
- }
-
- /** Move to the next element. If this means to another Iterator that
- * rewind that Iterator.
- * @return void
- */
- function next()
- {
- if (!$this->iterators->valid())
- {
- return; /* done all */
- }
- $this->getInnerIterator()->next();
- if ($this->getInnerIterator()->valid())
- {
- return; /* found valid element in current inner iterator */
- }
- $this->iterators->next();
- while ($this->iterators->valid())
- {
- $this->getInnerIterator()->rewind();
- if ($this->getInnerIterator()->valid())
- {
- return; /* found element as first elemet in another iterator */
- }
- $this->iterators->next();
- }
- }
-
- /** Aggregates the inner iterator
- */
- function __call($func, $params)
- {
- return call_user_func_array(array($this->getInnerIterator(), $func), $params);
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/internal/cachingiterator.inc b/ext/spl/internal/cachingiterator.inc
deleted file mode 100755
index dfefd9987f..0000000000
--- a/ext/spl/internal/cachingiterator.inc
+++ /dev/null
@@ -1,141 +0,0 @@
-<?php
-
-/** @file cachingiterator.inc
- * @ingroup SPL
- * @brief class CachingIterator
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-define('CIT_CALL_TOSTRING', 1);
-define('CIT_CATCH_GET_CHILD', 2);
-
-/**
- * @brief Cached iteration over another Iterator
- * @author Marcus Boerger
- * @version 1.1
- * @since PHP 5.0
- *
- * This iterator wrapper does a one ahead iteration. This way it knows whether
- * the inner iterator has one more element.
- *
- * @note If you want to convert the elements into strings and the inner
- * Iterator is an internal Iterator then you need to provide the
- * flag CIT_CALL_TOSTRING to do the conversion when the actual element
- * is being fetched. Otherwise the conversion would happen with the
- * already changed iterator. If you do not need this then it you should
- * omit this flag because it costs unneccessary work and time.
- */
-class CachingIterator implements OuterIterator
-{
- private $it;
- private $current;
- private $key;
- private $valid;
- private $strValue;
-
- /** Construct from another iterator
- *
- * @param it Iterator to cache
- * @param flags Bitmask:
- * - CIT_CALL_TOSTRING (whether to call __toString() for every element)
- */
- function __construct(Iterator $it, $flags = CIT_CALL_TOSTRING)
- {
- $this->it = $it;
- $this->flags = $flags & (CIT_CALL_TOSTRING|CIT_CATCH_GET_CHILD);
- $this->next();
- }
-
- /** Rewind the Iterator
- */
- function rewind()
- {
- $this->it->rewind();
- $this->next();
- }
-
- /** Forward to the next element
- */
- function next()
- {
- if ($this->valid = $this->it->valid()) {
- $this->current = $this->it->current();
- $this->key = $this->it->key();
- if ($this->flags & CIT_CALL_TOSTRING) {
- if (is_object($this->current)) {
- $this->strValue = $this->current->__toString();
- } else {
- $this->strValue = (string)$this->current;
- }
- }
- } else {
- $this->current = NULL;
- $this->key = NULL;
- $this->strValue = NULL;
- }
- $this->it->next();
- }
-
- /** @return whether teh iterator is valid
- */
- function valid()
- {
- return $this->valid;
- }
-
- /** @return whether there is one more element
- */
- function hasNext()
- {
- return $this->it->valid();
- }
-
- /** @return the current element
- */
- function current()
- {
- return $this->current;
- }
-
- /** @return the current key
- */
- function key()
- {
- return $this->key;
- }
-
- /** Aggregate the inner iterator
- *
- * @param func Name of method to invoke
- * @param params Array of parameters to pass to method
- */
- function __call($func, $params)
- {
- return call_user_func_array(array($this->it, $func), $params);
- }
-
- /** @return the string represenatation that was generated for the current
- * element
- * @throw exception when CIT_CALL_TOSTRING was not specified in constructor
- */
- function __toString()
- {
- if (!$this->flags & CIT_CALL_TOSTRING) {
- throw new exception('CachingIterator does not fetch string value (see CachingIterator::__construct)');
- }
- return $this->strValue;
- }
-
- /**
- * @return The inner iterator
- */
- function getInnerIterator()
- {
- return $this->it;
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/internal/cachingrecursiveiterator.inc b/ext/spl/internal/cachingrecursiveiterator.inc
deleted file mode 100755
index 72204d9399..0000000000
--- a/ext/spl/internal/cachingrecursiveiterator.inc
+++ /dev/null
@@ -1,90 +0,0 @@
-<?php
-
-/** @file cachingrecursiveiterator.inc
- * @ingroup SPL
- * @brief class CachingRecursiveIterator
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-/**
- * @brief Cached recursive iteration over another Iterator
- * @author Marcus Boerger
- * @version 1.1
- * @since PHP 5.0
- *
- * @see CachingIterator
- */
-class CachingRecursiveIterator extends CachingIterator implements RecursiveIterator
-{
- private $hasChildren;
- private $getChildren;
-
- /** Construct from another iterator
- *
- * @param it Iterator to cache
- * @param flags Bitmask:
- * - CIT_CALL_TOSTRING (whether to call __toString() for every element)
- * - CIT_CATCH_GET_CHILD (whether to catch exceptions when trying to get childs)
- */
- function __construct(RecursiveIterator $it, $flags = CIT_CALL_TOSTRING)
- {
- parent::__construct($it, $flags);
- }
-
- /** Rewind Iterator
- */
- function rewind();
- {
- $this->hasChildren = false;
- $this->getChildren = NULL;
- parent::rewind();
- }
-
- /** Forward to next element if necessary then an Iterator for the Children
- * will be created.
- */
- function next()
- {
- if ($this->hasChildren = $this->it->hasChildren()) {
- try {
- //$this->getChildren = new CachingRecursiveIterator($this->it->getChildren(), $this->flags);
- // workaround memleaks...
- $child = $this->it->getChildren();
- $this->getChildren = new CachingRecursiveIterator($child, $this->flags);
- }
- catch(Exception $e) {
- if (!$this->flags & CIT_CATCH_GET_CHILD) {
- throw $e;
- }
- $this->hasChildren = false;
- $this->getChildren = NULL;
- }
- } else {
- $this->getChildren = NULL;
- }
- parent::next();
- }
-
- /** @return whether the current element has children
- * @note The check whether the Iterator for the children can be created was
- * already executed. Hence when flag CIT_CATCH_GET_CHILD was given in
- * constructor this fucntion returns false so that getChildren does
- * not try to access those children.
- */
- function hasChildren()
- {
- return $this->hasChildren;
- }
-
- /** @return An Iterator for the children
- */
- function getChildren()
- {
- return $this->getChildren;
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/internal/emptyiterator.inc b/ext/spl/internal/emptyiterator.inc
deleted file mode 100755
index 52e844dfe5..0000000000
--- a/ext/spl/internal/emptyiterator.inc
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-
-/** @file emptyiterator.inc
- * @ingroup SPL
- * @brief class EmptyIterator
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-/** @ingroup SPL
- * @brief An empty Iterator
- * @author Marcus Boerger
- * @version 1.0
- * @since PHP 5.1
- */
-class EmptyIterator implements Iterator
-{
- /** No operation.
- * @return void
- */
- function rewind()
- {
- // nothing to do
- }
-
- /** @return \c false
- */
- function valid()
- {
- return false;
- }
-
- /** This function must not be called. It throws an exception upon access.
- * @throw Exception
- * @return void
- */
- function current()
- {
- throw new Exception('Accessing the value of an EmptyIterator');
- }
-
- /** This function must not be called. It throws an exception upon access.
- * @throw Exception
- * @return void
- */
- function key()
- {
- throw new Exception('Accessing the key of an EmptyIterator');
- }
-
- /** No operation.
- * @return void
- */
- function next()
- {
- // nothing to do
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/internal/fileobject.inc b/ext/spl/internal/fileobject.inc
deleted file mode 100755
index 51ecc06ddb..0000000000
--- a/ext/spl/internal/fileobject.inc
+++ /dev/null
@@ -1,350 +0,0 @@
-<?php
-
-/** @file fileobject.inc
- * @ingroup SPL
- * @brief class FileObject
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-/** @ingroup SPL
- * @brief Object representation for any stream
- * @author Marcus Boerger
- * @version 1.0
- * @since PHP 5.1
- */
-class FileObject implements RecursiveIterator, SeekableIterator
-{
- private $fp;
- private $fname;
- private $line = NULL;
- private $lnum = 0;
- private $max_len = 0;
- private $flags = 0;
-
- /**
- * Constructs a new file object
- *
- * @param $file_name The name of the stream to open
- * @param $open_mode The file open mode
- * @param $use_include_path Whether to search in include paths
- * @param $context A stream context
- * @throw RuntimeException If file cannot be opened (e.g. insufficient
- * access rights).
- */
- function __construct($file_name, $open_mode = 'r', $use_include_path = false, $context = NULL)
- {
- $this->fp = fopen($file_name, $open_mode, $use_include_path, $context);
- if (!$this->fp)
- {
- throw new RuntimeException("Cannot open file $file_name");
- }
- $this->fname = $file_name;
- }
-
- /**
- * @return the filename as specified in the constructor
- */
- function getFilename()
- {
- return $this->fname;
- }
-
- /**
- * @return whethe rend of stream is reached
- */
- function eof()
- {
- return eof($this->fp);
- }
-
- /** increase current line number
- * @return next line from stream
- */
- function fgets()
- {
- $this->freeLine();
- $this->lnum++;
- $buf = fgets($this->fp, $this->max_len);
-
- return $buf;
- }
-
- /**
- * @param delimiter character used as field separator
- * @param enclosure end of
- * @return array containing read data
- */
- function fgetcsv($delimiter = ';', $enclosure = '')
- {
- $this->freeLine();
- $this->lnum++;
- return fgetcsv($this->fp, $this->max_len, $delimiter, $enclosure);
- }
-
- /**
- * @param operation lock opeation (LOCK_SH, LOCK_EX, LOCK_UN, LOCK_NB)
- * @retval $wouldblock whether the operation would block
- */
- function flock($operation, &$wouldblock)
- {
- return flock($this->fp, $operation, $wouldblock);
- }
-
- /**
- * Flush current data
- * @return success or failure
- */
- function fflush()
- {
- return fflush($this->fp);
- }
-
- /**
- * @return current file position
- */
- function ftell()
- {
- return ftell($this->fp);
- }
-
- /**
- * @param pos new file position
- * @param whence seek method (SEEK_SET, SEEK_CUR, SEEK_END)
- * @return Upon success, returns 0; otherwise, returns -1. Note that
- * seeking past EOF is not considered an error.
- */
- function fseek($pos, $whence = SEEK_SET)
- {
- return fseek($this->fp, $pos, $whence);
- }
-
- /**
- * @return next char from file
- * @note a new line character does not increase $this->lnum
- */
- function fgetc()
- {
- $this->freeLine();
- $c = fgetc($this->fp);
- if ($c == '\n') {
- $this->lnum++;
- }
- }
-
- /** Read and return remaining part of stream
- * @return size of remaining part passed through
- */
- function fpassthru()
- {
- return fpassthru($this->fp);
- }
-
- /** Get a line from the file and strip HTML tags
- * @param $allowable_tags tags to keep in the string
- */
- function fgetss($allowable_tags = NULL)
- {
- return fgetss($this->fp, $allowable_tags);
- }
-
- /** Scan the next line
- * @param $format string specifying format to parse
- */
- function fscanf($format /* , ... */)
- {
- $this->freeLine();
- $this->lnum++;
- return fscanf($this->fp, $format /* , ... */);
- }
-
- /**
- * @param $str to write
- * @param $length maximum line length to write
- */
- function fwrite($str, $length = NULL)
- {
- return fwrite($this->fp, $length);
- }
-
- /**
- * @return array of file stat information
- */
- function fstat()
- {
- return fstat($this->fp);
- }
-
- /**
- * @param $size new size to truncate file to
- */
- function ftruncate($size)
- {
- return ftruncate($this->fp, $size);
- }
-
- /**
- * @param $flags new flag set
- */
- function setFlags($flags)
- {
- $this->flags = $flags;
- }
-
- /**
- * @return current set of flags
- */
- function getFlags()
- {
- return $this->flags;
- }
-
- /**
- * @param $max_len set the maximum line length read
- */
- function setMaxLineLen($max_len)
- {
- $this->max_len = $max_len;
- }
-
- /**
- * @return curren tsetting for max line
- */
- function getMaxLineLen()
- {
- return $this->max_len;
- }
-
- /**
- * @return false
- */
- function hasChildren()
- {
- return false;
- }
-
- /**
- * @return false
- */
- function getChildren()
- {
- return NULL;
- }
-
- /**
- * Invalidate current line buffer and set line number to 0.
- */
- function rewind()
- {
- $this->freeLine();
- $this->lnum = 0;
- }
-
- /**
- * @return whether more data can be read
- */
- function valid()
- {
- return !$this->eof();
- }
-
- /**
- * @note Fill current line buffer if not done yet.
- * @return line buffer
- */
- function current()
- {
- if (is_null($this->line))
- {
- $this->line = getCurrentLine();
- }
- return $this->line;
- }
-
- /**
- * @return line number
- * @note fgetc() will increase the line number when reaing a new line char.
- * This has the effect key() called on a read a new line will already
- * return the increased line number.
- * @note Line counting works as long as you only read the file and do not
- * use fseek().
- */
- function key()
- {
- return $this->lnum;
- }
-
- /** Invalidate current line buffer.
- */
- function next()
- {
- $this->freeLine();
- }
-
- /**
- * @return next line read from file and increase the line counter
- */
- private function readLine()
- {
- if ($this->eof())
- {
- $this->freeLine();
- throw new RuntimeException("Cannot read from file " . $this->fname);
- }
- if ($this->line) {
- $this->lnum++;
- }
- $this->freeLine();
- $this->line = fgets($this->fp, $this->max_len);
- return $this->line;
- }
-
- /**
- * Free the current line buffer and increment the line counter
- */
- private function freeLine()
- {
- if ($this->line) {
- $this->line = NULL;
- }
- }
-
- /*
- * @note If you DO overload this function key() and current() will increment
- * $this->lnum automatically. If not then function reaLine() will do
- * that for you.
- */
- function getCurrentLine()
- {
- $this->freeLine();
- if ($this->eof())
- {
- throw new RuntimeException("Cannot read from file " . $this->fname);
- }
- $this->readLine();
- }
-
- /**
- * @return current line
- */
- function __toString()
- {
- return current();
- }
-
- /**
- * @param $line_pos Seek to this line
- */
- function seek($line_pos)
- {
- $this->rewind();
- while($this->lnum < $line_pos && !$this->eof())
- {
- $this->getCurrentLine();
- }
- }
-}
-
-?>
diff --git a/ext/spl/internal/filteriterator.inc b/ext/spl/internal/filteriterator.inc
deleted file mode 100755
index cc9c999a40..0000000000
--- a/ext/spl/internal/filteriterator.inc
+++ /dev/null
@@ -1,129 +0,0 @@
-<?php
-
-/** @file filteriterator.inc
- * @ingroup SPL
- * @brief class FilterIterator
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-/**
- * @brief Regular expression filter for string iterators
- * @author Marcus Boerger
- * @version 1.1
- * @since PHP 5.0
- *
- * Instances of this class act as a filter around iterators. In other words
- * you can put an iterator into the constructor and the instance will only
- * return selected (accepted) elements.
- *
- * The only thing that needs to be done to make this work is implementing
- * method accept(). Typically this invloves reading the current element or
- * key of the inner Iterator and checking whether it is acceptable.
- */
-abstract class FilterIterator implements OuterIterator
-{
- private $it;
-
- /**
- * Constructs a filter around an iterator whose elemnts are strings.
- * If the given iterator is of type spl_sequence then its rewind()
- * method is called.
- *
- * @param it Object that implements at least spl_forward
- */
- function __construct(Iterator $it) {
- $this->it = $it;
- }
-
- /**
- * Rewind the inner iterator.
- */
- function rewind() {
- $this->it->rewind();
- $this->fetch();
- }
-
- /**
- * Accept function to decide whether an element of the inner iterator
- * should be accessible through the Filteriterator.
- *
- * @return whether or not to expose the current element of the inner
- * iterator.
- */
- abstract function accept();
-
- /**
- * Fetch next element and store it.
- *
- * @return void
- */
- protected function fetch() {
- while ($this->it->valid()) {
- if ($this->accept()) {
- return;
- }
- $this->it->next();
- };
- }
-
- /**
- * Move to next element
- *
- * @return void
- */
- function next() {
- $this->it->next();
- $this->fetch();
- }
-
- /**
- * @return Whether more elements are available
- */
- function valid() {
- return $this->it->valid();
- }
-
- /**
- * @return The current key
- */
- function key() {
- return $this->it->key();
- }
-
- /**
- * @return The current value
- */
- function current() {
- return $this->it->current();
- }
-
- /**
- * hidden __clone
- */
- protected function __clone() {
- // disallow clone
- }
-
- /**
- * @return The inner iterator
- */
- function getInnerIterator()
- {
- return $this->it;
- }
-
- /** Aggregate the inner iterator
- *
- * @param func Name of method to invoke
- * @param params Array of parameters to pass to method
- */
- function __call($func, $params)
- {
- return call_user_func_array(array($this->it, $func), $params);
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/internal/infiniteiterator.inc b/ext/spl/internal/infiniteiterator.inc
deleted file mode 100755
index 3d97b903b1..0000000000
--- a/ext/spl/internal/infiniteiterator.inc
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-
-/** @file infiniteiterator.inc
- * @ingroup SPL
- * @brief class InfiniteIterator
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-/** @ingroup SPL
- * @brief An infinite Iterator
- * @author Marcus Boerger
- * @version 1.1
- * @since PHP 5.1
- *
- * This Iterator takes another Iterator and infinitvely iterates it by
- * rewinding it when its end is reached.
- *
- * \note Even an InfiniteIterator stops if its inner Iterator is empty.
- *
- \verbatim
- $it = new ArrayIterator(array(1,2,3));
- $infinite = new InfiniteIterator($it);
- $limit = new LimitIterator($infinite, 0, 5);
- foreach($limit as $val=>$key)
- {
- echo "$val=>$key\n";
- }
- \endverbatim
- */
-class InfiniteIterator extends IteratorIterator
-{
- /** Move the inner Iterator forward to its next element or rewind it.
- * @return void
- */
- function next()
- {
- $this->getInnerIterator()->next();
- if (!$this->getInnerIterator()->valid())
- {
- $this->getInnerIterator()->rewind();
- }
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/internal/iteratoriterator.inc b/ext/spl/internal/iteratoriterator.inc
deleted file mode 100755
index 147f93fade..0000000000
--- a/ext/spl/internal/iteratoriterator.inc
+++ /dev/null
@@ -1,121 +0,0 @@
-<?php
-
-/** @file iteratoriterator.inc
- * @ingroup SPL
- * @brief class IteratorIterator
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-/** @ingroup SPL
- * @brief Basic Iterator wrapper
- * @since PHP 5.1
- *
- * This iterator wrapper allows to convert anything that is traversable into
- * an Iterator. It is very important to understand that most classes that do
- * not implement Iterator have their reasone to. Most likely they do not allow
- * the full Iterator feature set. If so you need to provide techniques to
- * prevent missuse. If you do not you must expect exceptions or fatal erros.
- *
- * It is also possible to derive the class and implement IteratorAggregate by
- * downcasting the instances returned in getIterator. See the following
- * example (assuming BaseClass implements Traversable):
- \code
- class SomeClass extends BaseClass implements IteratorAggregate
- {
- function getIterator()
- {
- return new IteratorIterator($this, 'BaseClass');
- }
- }
- \endcode
- *
- * As you can see in the example this approach requires that the class to
- * downcast to is actually a base class of the specified iterator to wrap.
- * Omitting the downcast in the above example would result in an endless loop
- * since IteratorIterator::__construct() would call SomeClass::getIterator().
- */
-class IteratorIterator implements OuterIterator
-{
- /** Construct an IteratorIterator from an Iterator or an IteratorAggregate.
- *
- * @param iterator inner iterator
- * @param classname optional class the iterator has to be downcasted to
- */
- function __construct(Traversable $iterator, $classname = null)
- {
- if ($iterator instanceof IteratorAggregate)
- {
- $iterator = $iterator->getIterator();
- }
- if ($iterator instanceof Iterator)
- {
- $this->iterator = $iterator;
- }
- else
- {
- throw new Exception("Classes that only implement Traversable can be wrapped only after converting class IteratorItaerator into c code");
- }
- }
-
- /** \return the inner iterator as passed to the constructor
- */
- function getInnerIterator()
- {
- return $this->iterator;
- }
-
- /** \return whether the iterator is valid
- */
- function valid()
- {
- return $this->iterator->valid();
- }
-
- /** \return current key
- */
- function key()
- {
- return $this->iterator->key();
- }
-
- /** \return current value
- */
- function current()
- {
- return $this->iterator->current();
- }
-
- /** forward to next element
- */
- function next()
- {
- return $this->iterator->next();
- }
-
- /** rewind to the first element
- */
- function rewind()
- {
- return $this->iterator->rewind();
- }
-
- /** Aggregate the inner iterator
- *
- * @param func Name of method to invoke
- * @param params Array of parameters to pass to method
- */
- function __call($func, $params)
- {
- return call_user_func_array(array($this->it, $func), $params);
- }
-
- /** The inner iterator must be private because when this class will be
- * converted to c code it won't no longer be available.
- */
- private $iterator;
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/internal/limititerator.inc b/ext/spl/internal/limititerator.inc
deleted file mode 100755
index 930ba535fa..0000000000
--- a/ext/spl/internal/limititerator.inc
+++ /dev/null
@@ -1,134 +0,0 @@
-<?php
-
-/** @file limititerator.inc
- * @ingroup SPL
- * @brief class LimitIterator
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-/**
- * @brief Limited Iteration over another Iterator
- * @author Marcus Boerger
- * @version 1.1
- * @since PHP 5.0
- *
- * A class that starts iteration at a certain offset and only iterates over
- * a specified amount of elements.
- *
- * This class uses SeekableIterator::seek() if available and rewind() plus
- * a skip loop otehrwise.
- */
-class LimitIterator implements OuterIterator
-{
- private $it;
- private $offset;
- private $count;
- private $pos;
-
- /** Construct
- *
- * @param it Iterator to limit
- * @param offset Offset to first element
- * @param count Maximum number of elements to show or NULL for all
- */
- function __construct(Iterator $it, $offset = 0, $count = -1)
- {
- if ($offset < 0) {
- throw new exception('Parameter offset must be > 0');
- }
- if ($count < 0 && $count != -1) {
- throw new exception('Parameter count must either be -1 or a value greater than or equal to 0');
- }
- $this->it = $it;
- $this->offset = $offset;
- $this->count = $count;
- $this->pos = 0;
- }
-
- /** Seek to specified position
- * @param position offset to seek to (relative to beginning not offset
- * specified in constructor).
- * @throw exception when position is invalid
- */
- function seek($position) {
- if ($position < $this->offset) {
- throw new exception('Cannot seek to '.$position.' which is below offset '.$this->offset);
- }
- if ($position > $this->offset + $this->count && $this->count != -1) {
- throw new exception('Cannot seek to '.$position.' which is behind offset '.$this->offset.' plus count '.$this->count);
- }
- if ($this->it instanceof SeekableIterator) {
- $this->it->seek($position);
- $this->pos = $position;
- } else {
- while($this->pos < $position && $this->it->valid()) {
- $this->next();
- }
- }
- }
-
- /** Rewind to offset specified in constructor
- */
- function rewind()
- {
- $this->it->rewind();
- $this->pos = 0;
- $this->seek($this->offset);
- }
-
- /** @return whether iterator is valid
- */
- function valid() {
- return ($this->count == -1 || $this->pos < $this->offset + $this->count)
- && $this->it->valid();
- }
-
- /** @return current key
- */
- function key() {
- return $this->it->key();
- }
-
- /** @return current element
- */
- function current() {
- return $this->it->current();
- }
-
- /** Forward to nect element
- */
- function next() {
- $this->it->next();
- $this->pos++;
- }
-
- /** @return current position relative to zero (not to offset specified in
- * constructor).
- */
- function getPosition() {
- return $this->pos;
- }
-
- /**
- * @return The inner iterator
- */
- function getInnerIterator()
- {
- return $this->it;
- }
-
- /** Aggregate the inner iterator
- *
- * @param func Name of method to invoke
- * @param params Array of parameters to pass to method
- */
- function __call($func, $params)
- {
- return call_user_func_array(array($this->it, $func), $params);
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/internal/norewinditerator.inc b/ext/spl/internal/norewinditerator.inc
deleted file mode 100755
index 37cfcc3ead..0000000000
--- a/ext/spl/internal/norewinditerator.inc
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-/** @file norewinditerator.inc
- * @ingroup SPL
- * @brief class NoRewindIterator
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-/** @ingroup SPL
- * @brief An Iterator wrapper that doesn't call rewind
- * @author Marcus Boerger
- * @version 1.1
- * @since PHP 5.1
- */
-class NoRewindIterator extends IteratorIterator
-{
- /** Simply prevent execution of inner iterators rewind().
- */
- function rewind()
- {
- // nothing to do
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/internal/outeriterator.inc b/ext/spl/internal/outeriterator.inc
deleted file mode 100755
index dc7b11e05a..0000000000
--- a/ext/spl/internal/outeriterator.inc
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-/** @file outeriterator.inc
- * @ingroup SPL
- * @brief class OuterIterator
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-/**
- * @brief Interface to access the current inner iteraor of iterator wrappers
- * @author Marcus Boerger
- * @version 1.0
- * @since PHP 5.1
- */
-interface OuterIterator extends Iterator
-{
- /** @return inner iterator
- */
- function getInnerIterator();
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/internal/parentiterator.inc b/ext/spl/internal/parentiterator.inc
deleted file mode 100755
index 7fb0f11dd3..0000000000
--- a/ext/spl/internal/parentiterator.inc
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-
-/** @file parentiterator.inc
- * @ingroup SPL
- * @brief class FilterIterator
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-/**
- * @brief Iterator to filter parents
- * @author Marcus Boerger
- * @version 1.1
- * @since PHP 5.0
- *
- * This extended FilterIterator allows a recursive iteration using
- * RecursiveIteratorIterator that only shows those elements which have
- * children.
- */
-class ParentIterator extends FilterIterator implements RecursiveIterator
-{
- /** @param $it the RecursiveIterator to filter
- */
- function __construct(RecursiveIterator $it)
- {
- parent::__construct($it);
- }
-
- /** @return whetehr the current element has children
- */
- function accept()
- {
- return $this->it->hasChildren();
- }
-
- /** @return whether the current element has children
- */
- function hasChildren()
- {
- return $this->it->hasChildren();
- }
-
- /** @return the ParentIterator for the current elements children
- */
- function getChildren()
- {
- return new ParentIterator($this->it->getChildren());
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/internal/recursiveiterator.inc b/ext/spl/internal/recursiveiterator.inc
deleted file mode 100755
index 640be25a13..0000000000
--- a/ext/spl/internal/recursiveiterator.inc
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-
-/** @file recursiveiterator.inc
- * @ingroup SPL
- * @brief class RecursiveIterator
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-/**
- * @brief Interface for recursive iteration with RecursiveIteratorIterator
- * @author Marcus Boerger
- * @version 1.0
- * @since PHP 5.0
- */
-interface RecursiveIterator implements Iterator
-{
- /** @return whether the current element has children
- */
- function hasChildren();
-
- /** @return the sub iterator for the current element
- * @note The returned object must implement RecursiveIterator.
- */
- function getChildren();
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/internal/recursiveiteratoriterator.inc b/ext/spl/internal/recursiveiteratoriterator.inc
deleted file mode 100755
index 0e76de21dd..0000000000
--- a/ext/spl/internal/recursiveiteratoriterator.inc
+++ /dev/null
@@ -1,183 +0,0 @@
-<?php
-
-/** @file recursiveiteratoriterator.inc
- * @ingroup SPL
- * @brief class RecursiveIteratorIterator
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-define('RIT_LEAVES_ONLY', 0);
-define('RIT_SELF_FIRST', 1);
-define('RIT_CHILD_FIRST', 2);
-
-/**
- * @brief Iterates through recursive iterators
- * @author Marcus Boerger
- * @version 1.1
- * @since PHP 5.0
- *
- * The objects of this class are created by instances of RecursiveIterator.
- * Elements of those iterators may be traversable themselves. If so these
- * sub elements are recursed into.
- */
-class RecursiveIteratorIterator implements OuterIterator
-{
- private $ait = array();
- private $count = 0;
-
- /** Construct from RecursiveIterator
- *
- * @param it RecursiveIterator to iterate
- * @param flags Operation mode:
- * - RIT_LEAVES_ONLY only show leaves
- * - RIT_SELF_FIRST show parents prior to their childs
- * - RIT_CHILD_FIRST show all childs prior to their parent
- */
- function __construct(RecursiveIterator $it, $flags)
- {
- $this->ait[0] = $it;
- }
-
- /** Rewind to top iterator as set in constructor
- */
- function rewind()
- {
- while ($this->count) {
- unset($this->ait[$this->count--]);
- $this->endChildren();
- }
- $this->ait[0]->rewind();
- $this->ait[0]->recursed = false;
- }
-
- /** @return whether iterator is valid
- */
- function valid()
- {
- $count = $this->count;
- while ($count) {
- $it = $this->ait[$count];
- if ($it->valid()) {
- return true;
- }
- $count--;
- $this->endChildren();
- }
- return false;
- }
-
- /** @return current key
- */
- function key()
- {
- $it = $this->ait[$this->count];
- return $it->key();
- }
-
- /** @return current element
- */
- function current()
- {
- $it = $this->ait[$this->count];
- return $it->current();
- }
-
- /** Forward to next element
- */
- function next()
- {
- while ($this->count) {
- $it = $this->ait[$this->count];
- if ($it->valid()) {
- if (!$it->recursed && callHasChildren()) {
- $it->recursed = true;
- $sub = callGetChildren();
- $sub->recursed = false;
- $sub->rewind();
- if ($sub->valid()) {
- $this->ait[++$this->count] = $sub;
- if (!$sub instanceof RecursiveIterator) {
- throw new Exception(get_class($sub).'::getChildren() must return an object that implements RecursiveIterator');
- }
- $this->beginChildren();
- return;
- }
- unset($sub);
- }
- $it->next();
- $it->recursed = false;
- if ($it->valid()) {
- return;
- }
- $it->recursed = false;
- }
- if ($this->count) {
- unset($this->ait[$this->count--]);
- $it = $this->ait[$this->count];
- $this->endChildren();
- }
- }
- }
-
- /** @return Sub Iterator at given level or if unspecified the current sub
- * Iterator
- */
- function getSubIterator($level = NULL)
- {
- if (is_null($level)) {
- $level = $this->count;
- }
- return @$this->ait[$level];
- }
-
- /**
- * @return The inner iterator
- */
- function getInnerIterator()
- {
- return $this->it;
- }
-
- /** @return Current Depth (Number of parents)
- */
- function getDepth()
- {
- return $this->level;
- }
-
- /** @return whether current sub iterators current element has children
- * @since PHP 5.1
- */
- function callHasChildren()
- {
- return $this->ait[$this->count]->hasChildren();
- }
-
- /** @return current sub iterators current children
- * @since PHP 5.1
- */
- function callGetChildren()
- {
- return $this->ait[$this->count]->getChildren();
- }
-
- /** Called right after calling getChildren() and its rewind().
- * @since PHP 5.1
- */
- function beginChildren()
- {
- }
-
- /** Called after current child iterator is invalid and right before it
- * gets destructed.
- * @since PHP 5.1
- */
- function endChildren()
- {
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/internal/seekableiterator.inc b/ext/spl/internal/seekableiterator.inc
deleted file mode 100755
index c00d264a95..0000000000
--- a/ext/spl/internal/seekableiterator.inc
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-
-/** @file seekableiterator.inc
- * @ingroup SPL
- * @brief class SeekableIterator
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-/** @brief seekable iterator
- * @author Marcus Boerger
- * @version 1.0
- * @since PHP 5.0
- *
- * Turns a normal iterator ino a seekable iterator. When there is a way
- * to seek on an iterator LimitIterator can use this to efficiently rewind
- * to offset.
- */
-interface SeekableIterator implements Iterator
-{
- /** Seek to an absolute position
- *
- * \param $index position to seek to
- * \return void
- *
- * The method should throw an exception if it is not possible to seek to
- * the given position. Typically this exception should be of type
- * OutOfBoundsException.
- \code
- function seek($index);
- $this->rewind();
- $position = 0;
- while($position < $index && $this->valid()) {
- $this->next();
- $position++;
- }
- if (!$this->valid()) {
- throw new OutOfBoundsException('Invalid seek position');
- }
- }
- \endcode
- */
- function seek($index);
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/package.xml b/ext/spl/package.xml
deleted file mode 100755
index f99cd7ce41..0000000000
--- a/ext/spl/package.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE package SYSTEM "../pear/package.dtd">
-<package>
- <name>SPL</name>
- <summary>Standard PHP Library</summary>
- <maintainers>
- <maintainer>
- <user>helly</user>
- <name>Marcus Boerger</name>
- <email>helly@php.net</email>
- <role>lead</role>
- </maintainer>
- </maintainers>
- <description>
-SPL is a collection of interfaces and classes that are meant to solve
-standard problems.
- </description>
- <license>PHP</license>
- <release>
- <state>stable</state>
- <version>0.1-dev</version>
- <date>TBA</date>
- <filelist>
- <file role="src" name="config.m4"/>
- <file role="src" name="php_spl.c"/>
- <file role="src" name="php_spl.h"/>
- <file role="src" name="spl_array.c"/>
- <file role="src" name="spl_array.h"/>
- <file role="src" name="spl_directory.c"/>
- <file role="src" name="spl_directory.h"/>
- <file role="src" name="spl_engine.c"/>
- <file role="src" name="spl_engine.h"/>
- <file role="src" name="spl_functions.c"/>
- <file role="src" name="spl_functions.h"/>
- <file role="src" name="spl_iterators.c"/>
- <file role="src" name="spl_iterators.h"/>
- <file role="src" name="spl_sxe.c"/>
- <file role="src" name="spl_sxe.h"/>
- <file role="doc" name="CREDITS"/>
- <file role="doc" name="README"/>
- <file role="doc" name="TODO"/>
- <file role="doc" name="spl.php"/>
- <file role="test" name="tests/array_iterator.phpt"/>
- <file role="test" name="tests/array_object.phpt"/>
- <dir name="examples">
- <file role="doc" name="autoload.inc"/>
- <file role="doc" name="cachingiterator.inc"/>
- <file role="doc" name="cachingrecursiveiterator.inc"/>
- <file role="doc" name="dba_array.php"/>
- <file role="doc" name="dba_dump.php"/>
- <file role="doc" name="dba_reader.inc"/>
- <file role="doc" name="directoryfilterdots.inc"/>
- <file role="doc" name="directorygraphiterator.inc"/>
- <file role="doc" name="directorytree.inc"/>
- <file role="doc" name="directorytree.php"/>
- <file role="doc" name="directorytreeiterator.inc"/>
- <file role="doc" name="findfile.php"/>
- <file role="doc" name="filteriterator.inc"/>
- <file role="doc" name="ini_groups.php"/>
- <file role="doc" name="key_filter.inc"/>
- <file role="doc" name="limititerator.inc"/>
- <file role="doc" name="parentiterator.inc"/>
- <file role="doc" name="recursiveiterator.inc"/>
- <file role="doc" name="recursiveiteratoriterator.inc"/>
- <file role="doc" name="searchiterator.inc"/>
- <file role="doc" name="seekableiterator.inc"/>
- <file role="doc" name="tree.php"/>
- </dir>
- </filelist>
- <deps>
- <dep type="php" rel="ge" version="5"/>
- </deps>
- </release>
-</package>
-<!--
-vim:et:ts=1:sw=1
--->
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
deleted file mode 100755
index b5d49d7311..0000000000
--- a/ext/spl/php_spl.c
+++ /dev/null
@@ -1,607 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 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> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#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_array.h"
-#include "spl_directory.h"
-#include "spl_iterators.h"
-#include "spl_sxe.h"
-#include "spl_exceptions.h"
-#include "spl_observer.h"
-#include "zend_exceptions.h"
-#include "zend_interfaces.h"
-
-#ifdef COMPILE_DL_SPL
-ZEND_GET_MODULE(spl)
-#endif
-
-ZEND_DECLARE_MODULE_GLOBALS(spl)
-
-/* {{{ spl_functions_none
- */
-function_entry spl_functions_none[] = {
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ spl_init_globals
- */
-static void spl_init_globals(zend_spl_globals *spl_globals)
-{
- spl_globals->autoload_extensions = NULL;
- spl_globals->autoload_functions = NULL;
-}
-/* }}} */
-
-static zend_class_entry * spl_find_ce_by_name(char *name, int len, zend_bool autoload TSRMLS_DC)
-{
- zend_class_entry **ce;
- int found;
- if (!autoload) {
- char *lc_name;
-
- lc_name = do_alloca(len + 1);
- zend_str_tolower_copy(lc_name, name, len);
-
- found = zend_hash_find(EG(class_table), lc_name, len +1, (void **) &ce);
- free_alloca(lc_name);
- } else {
- found = zend_lookup_class(name, len, &ce TSRMLS_CC);
- }
- if (found != SUCCESS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Class %s does not exist%s", name, autoload ? " and could not be loaded" : "");
- return NULL;
- }
-
- return *ce;
-}
-
-/* {{{ array class_parents(object instance)
- Return an array containing the names of all parent classes */
-PHP_FUNCTION(class_parents)
-{
- zval *obj;
- zend_class_entry *parent_class, *ce;
- zend_bool autoload = 1;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|b", &obj, &autoload) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (Z_TYPE_P(obj) != IS_OBJECT && Z_TYPE_P(obj) != IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "object or string expected");
- RETURN_FALSE;
- }
-
- if (Z_TYPE_P(obj) == IS_STRING) {
- if (NULL == (ce = spl_find_ce_by_name(Z_STRVAL_P(obj), Z_STRLEN_P(obj), autoload TSRMLS_CC))) {
- RETURN_FALSE;
- }
- } else {
- ce = Z_OBJCE_P(obj);
- }
-
- array_init(return_value);
- parent_class = ce->parent;
- while (parent_class) {
- spl_add_class_name(return_value, parent_class, 0, 0 TSRMLS_CC);
- parent_class = parent_class->parent;
- }
-}
-/* }}} */
-
-/* {{{ proto array class_implements(mixed what [, bool autoload ])
- Return all classes and interfaces implemented by SPL */
-PHP_FUNCTION(class_implements)
-{
- zval *obj;
- zend_bool autoload = 1;
- zend_class_entry *ce;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|b", &obj, &autoload) == FAILURE) {
- RETURN_FALSE;
- }
- if (Z_TYPE_P(obj) != IS_OBJECT && Z_TYPE_P(obj) != IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "object or string expected");
- RETURN_FALSE;
- }
-
- if (Z_TYPE_P(obj) == IS_STRING) {
- if (NULL == (ce = spl_find_ce_by_name(Z_STRVAL_P(obj), Z_STRLEN_P(obj), autoload TSRMLS_CC))) {
- RETURN_FALSE;
- }
- } else {
- ce = Z_OBJCE_P(obj);
- }
-
- array_init(return_value);
- spl_add_interfaces(return_value, ce, 1, ZEND_ACC_INTERFACE TSRMLS_CC);
-}
-/* }}} */
-
-#define SPL_ADD_CLASS(class_name, z_list, sub, allow, ce_flags) \
- spl_add_classes(&spl_ce_ ## class_name, z_list, sub, allow, ce_flags TSRMLS_CC)
-
-#define SPL_LIST_CLASSES(z_list, sub, allow, ce_flags) \
- SPL_ADD_CLASS(AppendIterator, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(ArrayObject, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(ArrayIterator, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(BadFunctionCallException, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(CachingIterator, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(CachingRecursiveIterator, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(Countable, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(DirectoryIterator, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(DomainException, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(EmptyIterator, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(FileObject, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(FilterIterator, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(InfiniteIterator, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(InvalidArgumentException, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(IteratorIterator, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(LengthException, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(LimitIterator, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(LogicException, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(NoRewindIterator, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(Observer, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(OuterIterator, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(OutOfRangeException, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(OutOfBoundsException, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(OverflowException, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(ParentIterator, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(RangeException, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(RecursiveDirectoryIterator, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(RecursiveIterator, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(RecursiveIteratorIterator, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(RuntimeException, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(SeekableIterator, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(SimpleXMLIterator, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(Subject, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(UnderflowException, z_list, sub, allow, ce_flags); \
-
-/* {{{ proto array spl_classes()
- Return an array containing the names of all clsses and interfaces defined in SPL */
-PHP_FUNCTION(spl_classes)
-{
- array_init(return_value);
-
- SPL_LIST_CLASSES(return_value, 0, 0, 0)
-}
-/* }}} */
-
-int spl_autoload(const char *class_name, const char * lc_name, int class_name_len, const char * file_extension TSRMLS_DC) /* {{{ */
-{
- char *class_file;
- int class_file_len;
- int dummy = 1;
- zend_file_handle file_handle;
- zend_op_array *new_op_array;
- zval *result = NULL;
-
- class_file_len = spprintf(&class_file, 0, "%s%s", lc_name, file_extension);
-
- if (zend_stream_open(class_file, &file_handle TSRMLS_CC) == SUCCESS) {
- if (!file_handle.opened_path) {
- file_handle.opened_path = estrndup(class_file, class_file_len);
- }
- if (zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void *)&dummy, sizeof(int), NULL)==SUCCESS) {
- new_op_array = zend_compile_file(&file_handle, ZEND_REQUIRE TSRMLS_CC);
- zend_destroy_file_handle(&file_handle TSRMLS_CC);
- } else {
- new_op_array = NULL;
- zend_file_handle_dtor(&file_handle);
- }
- if (new_op_array) {
- EG(return_value_ptr_ptr) = &result;
- EG(active_op_array) = new_op_array;
-
- zend_execute(new_op_array TSRMLS_CC);
-
- destroy_op_array(new_op_array TSRMLS_CC);
- efree(new_op_array);
- if (!EG(exception)) {
- if (EG(return_value_ptr_ptr)) {
- zval_ptr_dtor(EG(return_value_ptr_ptr));
- }
- }
-
- efree(class_file);
- return zend_hash_exists(EG(class_table), (char*)lc_name, class_name_len+1);
- }
- }
- efree(class_file);
- return 0;
-} /* }}} */
-
-/* {{{ void spl_autoload(string class_name [, string file_extensions])
- Default implementation for __autoload() */
-PHP_FUNCTION(spl_autoload)
-{
- char *class_name, *lc_name, *file_exts;
- int class_name_len, file_exts_len, found = 0;
- char *copy, *pos1, *pos2;
- zval **original_return_value = EG(return_value_ptr_ptr);
- zend_op **original_opline_ptr = EG(opline_ptr);
- zend_op_array *original_active_op_array = EG(active_op_array);
- zend_function_state *original_function_state_ptr = EG(function_state_ptr);
- zval err_mode;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &class_name, &class_name_len, &file_exts, &file_exts_len) == FAILURE) {
- RETURN_FALSE;
- }
-
- ZVAL_LONG(&err_mode, EG(error_reporting));
- php_alter_ini_entry("error_reporting", sizeof("error_reporting"), "0", 1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
-
- copy = pos1 = estrdup(ZEND_NUM_ARGS() > 1 ? file_exts : SPL_G(autoload_extensions));
- lc_name = zend_str_tolower_dup(class_name, class_name_len);
- while(pos1 && *pos1 && !EG(exception)) {
- EG(return_value_ptr_ptr) = original_return_value;
- EG(opline_ptr) = original_opline_ptr;
- EG(active_op_array) = original_active_op_array;
- EG(function_state_ptr) = original_function_state_ptr;
- pos2 = strchr(pos1, ',');
- if (pos2) *pos2 = '\0';
- if (spl_autoload(class_name, lc_name, class_name_len, pos1 TSRMLS_CC)) {
- found = 1;
- break; /* loaded */
- }
- pos1 = pos2 ? pos2 + 1 : NULL;
- }
- efree(lc_name);
- if (copy) {
- efree(copy);
- }
-
- if (!EG(error_reporting) && Z_LVAL(err_mode) != EG(error_reporting)) {
- convert_to_string(&err_mode);
- zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), Z_STRVAL(err_mode), Z_STRLEN(err_mode), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
- zendi_zval_dtor(err_mode);
- }
-
- EG(return_value_ptr_ptr) = original_return_value;
- EG(opline_ptr) = original_opline_ptr;
- EG(active_op_array) = original_active_op_array;
- EG(function_state_ptr) = original_function_state_ptr;
-
- if (!found) {
- zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Class %s could not be loaded", class_name);
- }
-} /* }}} */
-
-/* {{{ void string spl_autoload_extensions([string file_extensions])
- Register and return default file extensions for spl_autoload */
-PHP_FUNCTION(spl_autoload_extensions)
-{
- char *file_exts;
- int file_exts_len;
-
- if (ZEND_NUM_ARGS() > 0) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &file_exts, &file_exts_len) == FAILURE) {
- return;
- }
-
- if (SPL_G(autoload_extensions)) {
- efree(SPL_G(autoload_extensions));
- }
- SPL_G(autoload_extensions) = estrdup(file_exts);
- }
-
- RETURN_STRING(SPL_G(autoload_extensions), 1);
-} /* }}} */
-
-/* {{{ void spl_autoload_call(string class_name)
- Try all registerd autoload function to load the requested class */
-PHP_FUNCTION(spl_autoload_call)
-{
- zval **class_name, *retval = NULL;
- char *func_name, *lc_name;
- int func_name_len;
- long dummy;
- HashPosition function_pos;
- zend_function **func_ptr_ptr;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &class_name) == FAILURE || Z_TYPE_PP(class_name) != IS_STRING) {
- return;
- }
-
- if (SPL_G(autoload_functions)) {
- lc_name = zend_str_tolower_dup(Z_STRVAL_PP(class_name), Z_STRLEN_PP(class_name));
- zend_hash_internal_pointer_reset_ex(SPL_G(autoload_functions), &function_pos);
- while(zend_hash_has_more_elements_ex(SPL_G(autoload_functions), &function_pos) == SUCCESS && !EG(exception)) {
- zend_hash_get_current_key_ex(SPL_G(autoload_functions), &func_name, &func_name_len, &dummy, 0, &function_pos);
- zend_hash_get_current_data_ex(SPL_G(autoload_functions), (void **) &func_ptr_ptr, &function_pos);
- zend_call_method(NULL, NULL, func_ptr_ptr, func_name, func_name_len, &retval, 1, *class_name, NULL TSRMLS_CC);
- if (retval) {
- zval_ptr_dtor(&retval);
- }
- if (zend_hash_exists(EG(class_table), lc_name, Z_STRLEN_PP(class_name)+1)) {
- break;
- }
- zend_hash_move_forward_ex(SPL_G(autoload_functions), &function_pos);
- }
- efree(lc_name);
- } else {
- /* do not use or overwrite &EG(autoload_func) here */
- zend_call_method_with_1_params(NULL, NULL, NULL, "spl_autoload", NULL, *class_name);
- }
-} /* }}} */
-
-/* {{{ void spl_autoload_register([string autoload_function = "spl_autoload" [, throw = true]])
- Register given function as __autoload() implementation */
-PHP_FUNCTION(spl_autoload_register)
-{
- char *func_name, *lc_name;
- int func_name_len;
- zend_bool do_throw = 1;
- zend_function *spl_func_ptr, *func_ptr, **func_ptr_ptr;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sb", &func_name, &func_name_len, &do_throw) == FAILURE) {
- return;
- }
-
- if (ZEND_NUM_ARGS()) {
- lc_name = do_alloca(func_name_len + 1);
- zend_str_tolower_copy(lc_name, func_name, func_name_len);
-
- if (!strcmp(lc_name, "spl_autoload_call")) {
- if (do_throw) {
- zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Function spl_autoload_call() cannot be registered", func_name);
- }
- free_alloca(lc_name);
- return;
- }
-
- if (zend_hash_find(EG(function_table), lc_name, func_name_len+1, (void **) &func_ptr) == FAILURE) {
- if (do_throw) {
- zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Function '%s' not found", func_name);
- }
- free_alloca(lc_name);
- return;
- }
-
- if (!SPL_G(autoload_functions)) {
- ALLOC_HASHTABLE(SPL_G(autoload_functions));
- zend_hash_init(SPL_G(autoload_functions), 1, NULL, NULL, 0);
- }
-
- zend_hash_find(EG(function_table), "spl_autoload", sizeof("spl_autoload"), (void **) &spl_func_ptr);
-
- if (EG(autoload_func) == spl_func_ptr) { /* registered already, so we insert that first */
- zend_hash_add(SPL_G(autoload_functions), "spl_autoload", sizeof("spl_autoload"), &spl_func_ptr, sizeof(void*), (void**)&func_ptr_ptr);
- }
-
- zend_hash_add(SPL_G(autoload_functions), lc_name, func_name_len+1, &func_ptr, sizeof(void*), (void**)&func_ptr_ptr);
-
- free_alloca(lc_name);
- }
-
- if (SPL_G(autoload_functions)) {
- zend_hash_find(EG(function_table), "spl_autoload_call", sizeof("spl_autoload_call"), (void **) &EG(autoload_func));
- } else {
- zend_hash_find(EG(function_table), "spl_autoload", sizeof("spl_autoload"), (void **) &EG(autoload_func));
- }
-} /* }}} */
-
-/* {{{ bool spl_autoload_unregister(string autoload_function)
- Unregister given function as __autoload() implementation */
-PHP_FUNCTION(spl_autoload_unregister)
-{
- char *func_name, *lc_name;
- int func_name_len, success = FAILURE;
- zend_function *spl_func_ptr;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &func_name, &func_name_len) == FAILURE) {
- return;
- }
-
- lc_name = do_alloca(func_name_len + 1);
- zend_str_tolower_copy(lc_name, func_name, func_name_len);
-
- if (SPL_G(autoload_functions)) {
- if (!strcmp(lc_name, "spl_autoload_call")) {
- /* remove all */
- zend_hash_destroy(SPL_G(autoload_functions));
- FREE_HASHTABLE(SPL_G(autoload_functions));
- SPL_G(autoload_functions) = NULL;
- EG(autoload_func) = NULL;
- success = SUCCESS;
- } else {
- /* remove specific */
- success = zend_hash_del(SPL_G(autoload_functions), lc_name, func_name_len+1);
- }
- } else if (!strcmp(lc_name, "spl_autoload")) {
- /* register single spl_autoload() */
- zend_hash_find(EG(function_table), "spl_autoload", sizeof("spl_autoload"), (void **) &spl_func_ptr);
-
- if (EG(autoload_func) == spl_func_ptr) {
- success = SUCCESS;
- EG(autoload_func) = NULL;
- }
- }
-
- free_alloca(lc_name);
-
- RETURN_BOOL(success == SUCCESS);
-} /* }}} */
-
-/* {{{ false|array spl_autoload_functions()
- Return all registered __autoload() functionns */
-PHP_FUNCTION(spl_autoload_functions)
-{
- zend_function *fptr, **func_ptr_ptr;
- HashPosition function_pos;
-
- if (!EG(autoload_func)) {
- if (zend_hash_find(EG(function_table), ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME), (void **) &fptr) == SUCCESS) {
- array_init(return_value);
- add_next_index_stringl(return_value, ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME)-1, 1);
- return;
- }
- RETURN_FALSE;
- }
-
- zend_hash_find(EG(function_table), "spl_autoload_call", sizeof("spl_autoload_call"), (void **) &fptr);
-
- if (EG(autoload_func) == fptr) {
- array_init(return_value);
- zend_hash_internal_pointer_reset_ex(SPL_G(autoload_functions), &function_pos);
- while(zend_hash_has_more_elements_ex(SPL_G(autoload_functions), &function_pos) == SUCCESS) {
- zend_hash_get_current_data_ex(SPL_G(autoload_functions), (void **) &func_ptr_ptr, &function_pos);
- add_next_index_string(return_value, (*func_ptr_ptr)->common.function_name, 1);
- zend_hash_move_forward_ex(SPL_G(autoload_functions), &function_pos);
- }
- return;
- }
-
- array_init(return_value);
- add_next_index_string(return_value, EG(autoload_func)->common.function_name, 1);
-} /* }}} */
-
-int spl_build_class_list_string(zval **entry, char **list TSRMLS_DC) /* {{{ */
-{
- char *res;
-
- spprintf(&res, 0, "%s, %s", *list, Z_STRVAL_PP(entry));
- efree(*list);
- *list = res;
- return ZEND_HASH_APPLY_KEEP;
-} /* }}} */
-
-/* {{{ PHP_MINFO(spl)
- */
-PHP_MINFO_FUNCTION(spl)
-{
- zval list;
- char *strg;
-
- php_info_print_table_start();
- php_info_print_table_header(2, "SPL support", "enabled");
-
- INIT_PZVAL(&list);
- array_init(&list);
- SPL_LIST_CLASSES(&list, 0, 1, ZEND_ACC_INTERFACE)
- strg = estrdup("");
- zend_hash_apply_with_argument(Z_ARRVAL_P(&list), (apply_func_arg_t)spl_build_class_list_string, &strg TSRMLS_CC);
- zval_dtor(&list);
- php_info_print_table_row(2, "Interfaces", strg + 2);
- efree(strg);
-
- INIT_PZVAL(&list);
- array_init(&list);
- SPL_LIST_CLASSES(&list, 0, -1, ZEND_ACC_INTERFACE)
- strg = estrdup("");
- zend_hash_apply_with_argument(Z_ARRVAL_P(&list), (apply_func_arg_t)spl_build_class_list_string, &strg TSRMLS_CC);
- zval_dtor(&list);
- php_info_print_table_row(2, "Classes", strg + 2);
- efree(strg);
-
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ spl_functions
- */
-function_entry spl_functions[] = {
- PHP_FE(spl_classes, NULL)
- PHP_FE(spl_autoload, NULL)
- PHP_FE(spl_autoload_extensions, NULL)
- PHP_FE(spl_autoload_register, NULL)
- PHP_FE(spl_autoload_unregister, NULL)
- PHP_FE(spl_autoload_functions, NULL)
- PHP_FE(spl_autoload_call, NULL)
- PHP_FE(class_parents, NULL)
- PHP_FE(class_implements, NULL)
-#ifdef SPL_ITERATORS_H
- PHP_FE(iterator_to_array, NULL)
- PHP_FE(iterator_count, NULL)
-#endif /* SPL_ITERATORS_H */
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION(spl)
- */
-PHP_MINIT_FUNCTION(spl)
-{
- ZEND_INIT_MODULE_GLOBALS(spl, spl_init_globals, NULL);
-
- PHP_MINIT(spl_iterators)(INIT_FUNC_ARGS_PASSTHRU);
- PHP_MINIT(spl_array)(INIT_FUNC_ARGS_PASSTHRU);
- PHP_MINIT(spl_directory)(INIT_FUNC_ARGS_PASSTHRU);
- PHP_MINIT(spl_sxe)(INIT_FUNC_ARGS_PASSTHRU);
- PHP_MINIT(spl_exceptions)(INIT_FUNC_ARGS_PASSTHRU);
- PHP_MINIT(spl_observer)(INIT_FUNC_ARGS_PASSTHRU);
-
- return SUCCESS;
-}
-/* }}} */
-
-PHP_RINIT_FUNCTION(spl) /* {{{ */
-{
- SPL_G(autoload_extensions) = estrdup(".inc,.inc.php");
- return SUCCESS;
-} /* }}} */
-
-PHP_RSHUTDOWN_FUNCTION(spl) /* {{{ */
-{
- if (SPL_G(autoload_extensions)) {
- efree(SPL_G(autoload_extensions));
- SPL_G(autoload_extensions) = NULL;
- }
- if (SPL_G(autoload_functions)) {
- zend_hash_destroy(SPL_G(autoload_functions));
- FREE_HASHTABLE(SPL_G(autoload_functions));
- }
- return SUCCESS;
-} /* }}} */
-
-/* {{{ spl_module_entry
- */
-zend_module_entry spl_module_entry = {
- STANDARD_MODULE_HEADER,
- "SPL",
- spl_functions,
- PHP_MINIT(spl),
- NULL,
- PHP_RINIT(spl),
- PHP_RSHUTDOWN(spl),
- PHP_MINFO(spl),
- "0.2",
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-/*
- * 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 c098764c1d..0000000000
--- a/ext/spl/php_spl.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 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
-
-#ifdef PHP_WIN32
-# ifdef SPL_EXPORTS
-# define SPL_API __declspec(dllexport)
-# elif defined(COMPILE_DL_SPL)
-# define SPL_API __declspec(dllimport)
-# else
-# define SPL_API /* nothing */
-# endif
-#else
-# define SPL_API
-#endif
-
-#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);
-
-
-ZEND_BEGIN_MODULE_GLOBALS(spl)
- char * autoload_extensions;
- HashTable * autoload_functions;
-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
-
-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 307cec0c2d..0000000000
--- a/ext/spl/spl.php
+++ /dev/null
@@ -1,801 +0,0 @@
-<?php
-
-/** @file spl.php
- * @ingroup SPL
- * @brief Documentation of internal classes and interfaces
- *
- * SPL - Standard PHP Library
- *
- * (c) Marcus Boerger, 2003 - 2005
- */
-
-/** @mainpage SPL - Standard PHP Library
- *
- * SPL - Standard PHP Library
- *
- * SPL is a collection of interfaces and classes that are meant to solve
- * standard problems and implements some efficient data access interfaces
- * and classes. You'll find the classes documented using php code in the
- * file spl.php or in corresponding .inc files in subdirectories examples
- * and internal. Based on the internal implementations or the files in the
- * examples subdirectory there are also some .php files to experiment with.
- *
- * The .inc files are not included automatically because they are sooner or
- * later integrated into the extension. That means that you either need to
- * put the code of examples/autoload.inc into your autoprepend file or that
- * you have to point your ini setting auto_prepend_file to that file.
- *
- * Below is a list of interfaces/classes already availabel natively through
- * the SPL extension grouped by category.
- *
- * 1) Iterators
- *
- * SPL offers some advanced iterator algorithms:
- *
- * - interface RecursiveIterator implements Iterator
- * - interface OuterIterator extends Iterator
- * - class RecursiveIteratorIterator implements OuterIterator
- * - abstract class FilterIterator implements OuterIterator
- * - class ParentIterator extends FilterIterator implements RecursiveIterator
- * - interface SeekableIterator implements Iterator
- * - class LimitIterator implements OuterIterator
- * - class CachingIterator implements OuterIterator
- * - class CachingRecursiveIterator extends CachingIterator implements RecursiveIterator
- * - class IteratorIterator implements OuterIterator
- * - class NoRewindIterator implements OuterIterator
- * - class EmptyIterator implements Iterator
- * - class InfiniteIterator extends IteratorIterator
- * - class AppendIterator implements OuterIterator
- *
- * 2) Directories and Files
- *
- * SPL offers two advanced directory and file handling classes:
- *
- * - class DirectoryIterator implements Iterator
- * - class RecursiveDirectoryIterator extends DirectoryIterator implements RecursiveIterator
- * - class FileObject implements RecursiveIterator, SeekableIterator
- *
- * 3) XML
- *
- * SPL offers an advanced XML handling class:
- *
- * - class SimpleXMLIterator extends simplexml_element extends recursiveiterator
- *
- * 4) Array Overloading
- *
- * SPL offers advanced Array overloading:
- *
- * - class ArrayObject implements IteratorAggregate
- * - class ArrayIterator implements Iterator
- *
- * As the above suggest an ArrayObject creates an ArrayIterator when it comes to
- * iteration (e.g. ArrayObject instance used inside foreach).
- *
- * 5) Counting
- *
- * - interface Countable allows to hook into the standard array function count().
- *
- * 6) Exception%s
- *
- * SPL provides a set of standard Exception classes each meant to indicate a
- * certain problem type.
- *
- * - class LogicException extends Exception
- * - class BadFunctionCallException extends LogicException
- * - class BadMethodCallException extends BadFunctionCallException
- * - class DomainException extends LogicException
- * - class InvalidArgumentException extends LogicException
- * - class LengthException extends LogicException
- * - class OutOfRangeException extends LogicException
- * - class RuntimeException extends Exception
- * - class OutOfBoundsException extends RuntimeException
- * - class OverflowException extends RuntimeException
- * - class RangeException extends RuntimeException
- * - class UnderflowException extends RuntimeException
- *
- * 7) Observer
- *
- * SPL suggests a standard way of implementing the observer pattern.
- *
- * - interface Observer
- * - interface Subject
- *
- * Some articles about SPL:
- * - <a href="http://www.sitepoint.com/article/php5-standard-library/1">Introducing PHP 5's Standard Library</a>
- * - <a href="http://www.ramikayyali.com/archives/2005/02/25/iterators">Iterators in PHP5</a>
- * - <a href="http://www.phpriot.com/d/articles/php/oop/oop-with-spl-php-5-1/index.html">Advanced OOP with SPL in PHP 5</a>
- * - <a href="http://www.devshed.com/c/a/PHP/The-Standard-PHP-Library-Part-1/">The Standard PHP Library, Part 1</a>
- * - <a href="http://www.devshed.com/c/a/PHP/The-Standard-PHP-Library-Part-2/">The Standard PHP Library, Part 2</a>
- *
- * Talks on SPL:
- * - <a href="http://somabo.de/talks/200504_php_quebec_spl_for_the_masses.pps">SPL for the masses [pps]</a>
- * - <a href="http://somabo.de/talks/200504_php_quebec_spl_for_the_masses.pdf">SPL for the masses [pdf]</a>
- *
- * You can download this documentation as a chm file
- * <a href="http://php.net/~helly/php/ext/spl/spl.chm">here</a>.
- *
- * (c) Marcus Boerger, 2003 - 2005
- */
-
-/** @defgroup ZendEngine Zend engine classes
- *
- * The classes and interfaces in this group are contained in the c-code of
- * PHP's Zend engine.
- */
-
-/** @defgroup SPL Internal classes
- *
- * The classes and interfaces in this group are contained in the c-code of
- * ext/SPL.
- */
-
-/** @defgroup Examples Example classes
- *
- * The classes and interfaces in this group are contained as PHP code in the
- * examples subdirectory of ext/SPL. Sooner or later they will be moved to
- * c-code.
- */
-
-/** @ingroup ZendEngine
- * @brief Basic Exception class.
- * @since PHP 5.0
- */
-class Exception
-{
- /** The exception message */
- protected $message;
-
- /** The string represenations as generated during construction */
- private $string;
-
- /** The code passed to the constructor */
- protected $code;
-
- /** The file name where the exception was instantiated */
- protected $file;
-
- /** The line number where the exception was instantiated */
- protected $line;
-
- /** The stack trace */
- private $trace;
-
- /** Prevent clone
- */
- final private function __clone() {}
-
- /** Construct an exception
- *
- * @param $message Some text describing the exception
- * @param $code Some code describing the exception
- */
- function __construct($message = NULL, $code = 0) {
- if (func_num_args()) {
- $this->message = $message;
- }
- $this->code = $code;
- $this->file = __FILE__; // of throw clause
- $this->line = __LINE__; // of throw clause
- $this->trace = debug_backtrace();
- $this->string = StringFormat($this);
- }
-
- /** @return the message passed to the constructor
- */
- final public function getMessage()
- {
- return $this->message;
- }
-
- /** @return the code passed to the constructor
- */
- final public function getCode()
- {
- return $this->code;
- }
-
- /** @return the name of the file where the exception was thrown
- */
- final public function getFile()
- {
- return $this->file;
- }
-
- /** @return the line number where the exception was thrown
- */
- final public function getLine()
- {
- return $this->line;
- }
-
- /** @return the stack trace as array
- */
- final public function getTrace()
- {
- return $this->trace;
- }
-
- /** @return the stack trace as string
- */
- final public function getTraceAsString()
- {
- }
-
- /** @return string represenation of exception
- */
- public function __toString()
- {
- return $this->string;
- }
-}
-
-/** @ingroup SPL
- * @brief Exception that represents error in the program logic.
- * @since PHP 5.1
- *
- * This kind of exceptions should directly leed to a fix in your code.
- */
-class LogicException extends Exception
-{
-}
-
-/** @ingroup SPL
- * @brief Exception thrown when a function call was illegal.
- * @since PHP 5.1
- */
-class BadFunctionCallException extends LogicException
-{
-}
-
-/** @ingroup SPL
- * @brief Exception thrown when a method call was illegal.
- * @since PHP 5.1
- */
-class BadMethodCallException extends BadFunctionCallException
-{
-}
-
-/** @ingroup SPL
- * @brief Exception that denotes a value not in the valid domain was used.
- * @since PHP 5.1
- *
- * This kind of exception should be used to inform about domain erors in
- * mathematical sense.
- *
- * @see RangeException
- */
-class DomainException extends LogicException
-{
-}
-
-/** @ingroup SPL
- * @brief Exception that denotes invalid arguments were passed.
- * @since PHP 5.1
- *
- * @see UnexpectedValueException
- */
-class InvalidArgumentException extends LogicException
-{
-}
-
-/** @ingroup SPL
- * @brief Exception thrown when a parameter exceeds the allowed length.
- * @since PHP 5.1
- *
- * This can be used for strings length, array size, file size, number of
- * elements read from an Iterator and so on.
- */
-class LengthException extends LogicException
-{
-}
-
-/** @ingroup SPL
- * @brief Exception thrown when an illegal index was requested.
- * @since PHP 5.1
- *
- * This represents errors that should be detected at compile time.
- *
- * @see OutOfBoundsException
- */
-class OutOfRangeException extends LogicException
-{
-}
-
-/** @ingroup SPL
- * @brief Exception thrown for errors that are only detectable at runtime.
- * @since PHP 5.1
- */
-class RuntimeException extends Exception
-{
-}
-
-/** @ingroup SPL
- * @brief Exception thrown when an illegal index was requested.
- * @since PHP 5.1
- *
- * This represents errors that cannot be detected at compile time.
- *
- * @see OutOfRangeException
- */
-class OutOfBoundsException extends RuntimeException
-{
-}
-
-/** @ingroup SPL
- * @brief Exception thrown to indicate arithmetic/buffer overflow.
- * @since PHP 5.1
- */
-class OverflowException extends RuntimeException
-{
-}
-
-/** @ingroup SPL
- * @brief Exception thrown to indicate range errors during program execution.
- * @since PHP 5.1
- *
- * Normally this means there was an arithmetic error other than under/overflow.
- * This is the runtime version of DomainException.
- *
- * @see DomainException
- */
-class RangeException extends RuntimeException
-{
-}
-
-/** @ingroup SPL
- * @brief Exception thrown to indicate arithmetic/buffer underflow.
- * @since PHP 5.1
- */
-class UnderflowException extends RuntimeException
-{
-}
-
-/** @ingroup SPL
- * @brief Exception thrown to indicate an unexpected value.
- * @since PHP 5.1
- *
- * Typically this happens when a function calls another function and espects
- * the return value to be of a certain type or value not including arithmetic
- * or buffer related errors.
- *
- * @see InvalidArgumentException
- */
-class UnexpectedValueException extends RuntimeException
-{
-}
-
-/** @ingroup ZendEngine
- * @brief Interface to override array access of objects.
- * @since PHP 5.0
- */
-interface ArrayAccess
-{
- /** @param $offset to modify
- * @param $value new value
- */
- function offsetSet($offset, $value);
-
- /** @param $offset to retrieve
- * @return value at given offset
- */
- function offsetGet($offset);
-
- /** @param $offset to delete
- */
- function offsetUnset($offset);
-
- /** @param $offset to check
- * @return whether the offset exists.
- */
- function offsetExists($offset);
-}
-
-/** @ingroup ZendEngine
- * @brief Interface to detect a class is traversable using foreach.
- * @since PHP 5.0
- *
- * Abstract base interface that cannot be implemented alone. Instead it
- * must be implemented by either IteratorAggregate or Iterator.
- *
- * @note Internal classes that implement this interface can be used in a
- * foreach construct and do not need to implement IteratorAggregate or
- * Iterator.
- *
- * @note This is an engine internal interface which cannot be implemented
- * in PHP scripts. Either IteratorAggregate or Iterator must be used
- * instead.
- */
-interface Traversable
-{
-}
-
-/** @ingroup ZendEngine
- * @brief Interface to create an external Iterator.
- * @since PHP 5.0
- *
- * @note This is an engine internal interface.
- */
-interface IteratorAggregate extends Traversable
-{
- /** @return an Iterator for the implementing object.
- */
- function getIterator();
-}
-
-/** @ingroup ZendEngine
- * @brief Basic iterator
- * @since PHP 5.0
- *
- * Interface for external iterators or objects that can be iterated
- * themselves internally.
- *
- * @note This is an engine internal interface.
- */
-interface Iterator extends Traversable
-{
- /** Rewind the Iterator to the first element.
- */
- function rewind();
-
- /** Return the current element.
- */
- function current();
-
- /** Return the key of the current element.
- */
- function key();
-
- /** Move forward to next element.
- */
- function next();
-
- /** Check if there is a current element after calls to rewind() or next().
- */
- function valid();
-}
-
-/** @ingroup SPL
- * @brief This Interface allows to hook into the global count() function.
- * @since PHP 5.1
- */
-interface Countable
-{
- /** @return the number the global function count() should show
- */
- function count();
-}
-
-/** @ingroup ZendEngine
- * @brief Interface for customized serializing
- * @since 5.1
- *
- * Classes that implement this interface no longer support __sleep() and
- * __wakeup(). The method serialized is called whenever an instance needs to
- * be serialized. This does not invoke __destruct() or has any other side
- * effect unless programmed inside the method. When the data is unserialized
- * the class is known and the appropriate unserialize() method is called as a
- * constructor instead of calling __construct(). If you need to execute the
- * standard constructor you may do so in the method.
- */
-interface Serializeable
-{
- /**
- * @return string representation of the instance
- */
- function serialize();
-
- /**
- * @note This is a constructor
- *
- * @param $serialized data read from stream to construct the instance
- */
- function unserialize($serialized);
-}
-
-/** @ingroup SPL
- * @brief An Array wrapper
- * @since PHP 5.0
- *
- * This array wrapper allows to recursively iterate over Arrays and public
- * Object properties.
- *
- * @see ArrayIterator
- */
-class ArrayObject implements IteratorAggregate, ArrayAccess, Countable
-{
- /** Construct a new array iterator from anything that has a hash table.
- * That is any Array or Object.
- *
- * @param $array the array to use.
- */
- function __construct($array);
-
- /** @return the iterator which is an ArrayIterator object connected to
- * this object.
- */
- function getIterator();
-
- /** @param $index offset to inspect
- * @return whetehr offset $index esists
- */
- function offsetExists($index);
-
- /** @param $index offset to return value for
- * @return value at offset $index
- */
- function offsetGet($index);
-
- /** @param $index index to set
- * @param $newval new value to store at offset $index
- */
- function offsetSet($index, $newval);
-
- /** @param $index offset to unset
- */
- function offsetUnset($index);
-
- /** @param $value is appended as last element
- * @warning this method cannot be called when the ArrayObject refers to
- * an object.
- */
- function append($value);
-
- /** @return a \b copy of the array
- * @note when the ArrayObject refers to an object then this method
- * returns an array of the public properties.
- */
- function getArrayCopy();
-
- /** @return the number of elements in the array or the number of public
- * properties in the object.
- */
- function count();
-}
-
-/** @ingroup SPL
- * @brief An Array iterator
- * @since PHP 5.0
- *
- * This iterator allows to unset and modify values and keys while iterating
- * over Arrays and Objects.
- *
- * When you want to iterate over the same array multiple times you need to
- * instanciate ArrayObject and let it create ArrayIterator instances that
- * refer to it either by using foreach or by calling its getIterator()
- * method manually.
- */
-class ArrayIterator implements SeekableIterator, ArrayAccess, Countable
-{
- /** Construct a new array iterator from anything that has a hash table.
- * That is any Array or Object.
- *
- * @param $array the array to use.
- */
- public function __construct($array);
-
- /** @param $index offset to inspect
- * @return whetehr offset $index esists
- */
- function offsetExists($index);
-
- /** @param $index offset to return value for
- * @return value at offset $index
- */
- function offsetGet($index);
-
- /** @param $index index to set
- * @param $newval new value to store at offset $index
- */
- function offsetSet($index, $newval);
-
- /** @param $index offset to unset
- */
- function offsetUnset($index);
-
- /** @param $value is appended as last element
- * @warning this method cannot be called when the ArrayIterator refers to
- * an object.
- */
- function append($value);
-
- /** @return a \b copy of the array
- * @note when the ArrayIterator refers to an object then this method
- * returns an array of the public properties.
- */
- function getArrayCopy();
-
- /** @param $position offset to seek to
- * @throw OutOfBoundsException if $position is invalid
- */
- function seek($position);
-
- /** @return the number of elements in the array or the number of public
- * properties in the object.
- */
- function count();
-}
-
-/** @ingroup SPL
- * @brief Directory iterator
- * @since PHP 5.0
- */
-class DirectoryIterator implements Iterator
-{
- /** Construct a directory iterator from a path-string.
- *
- * @param $path directory to iterate.
- */
- function __construct($path);
-
- /** @return The opened path.
- */
- function getPath();
-
- /** @return The current file name.
- */
- function getFilename();
-
- /** @return The current entries path and file name.
- */
- function getPathname();
-
- /** @return The current entry's permissions.
- */
- function getPerms();
-
- /** @return The current entry's inode.
- */
- function getInode();
-
- /** @return The current entry's size in bytes .
- */
- function getSize();
-
- /** @return The current entry's owner name.
- */
- function getOwner();
-
- /** @return The current entry's group name.
- */
- function getGroup();
-
- /** @return The current entry's last access time.
- */
- function getATime();
-
- /** @return The current entry's last modification time.
- */
- function getMTime();
-
- /** @return The current entry's last change time.
- */
- function getCTime();
-
- /** @return The current entry's size in bytes .
- */
- function getType();
-
- /** @return Whether the current entry is writeable.
- */
- function isWritable();
-
- /** @return Whether the current entry is readable.
- */
- function isReadable();
-
- /** @return Whether the current entry is executable.
- */
- function isExecutable();
-
- /** @return Whether the current entry is .
- */
- function isFile();
-
- /** @return Whether the current entry is a directory.
- */
- function isDir();
-
- /** @return Whether the current entry is either '.' or '..'.
- */
- function isDot();
-
- /** @return whether the current entry is a link.
- */
- function isLink();
-
- /** @return getFilename()
- */
- function __toString();
-
- /** Open the current file as a FileObject instance
- *
- * @param mode open mode
- * @param use_include_path whether to search include paths (don't use)
- * @param context resource context to pased to open function
- * @throw RuntimeException if file cannot be opened (e.g. insufficient
- * access rights).
- * @return The opened file as a FileObject instance
- *
- * @see FileObject
- * @see file()
- */
- function DirectoryIterator::openFile($mode = 'r', $use_include_path = false, $context = NULL);
-}
-
-/** @ingroup SPL
- * @brief recursive directory iterator
- * @since PHP 5.0
- */
-class RecursiveDirectoryIterator extends DirectoryIterator implements RecursiveIterator
-{
- /** @return whether the current is a directory (not '.' or '..').
- */
- function hasChildren();
-
- /** @return a RecursiveDirectoryIterator for the current entry.
- */
- function getChildren();
-}
-
-/** @ingroup SPL
- * @brief recursive SimpleXML_Element iterator
- * @since PHP 5.0
- *
- * The SimpleXMLIterator implements the RecursiveIterator interface. This
- * allows iteration over all elements using foreach or an appropriate while
- * construct, just like SimpleXMLElement does. When using the foreach construct,
- * you will also iterate over the subelements. For every element which
- * has subelements, hasChildren() returns true. This will trigger a call to
- * getChildren() which returns the iterator for that sub element.
- */
-class SimpleXMLIterator extends SimpleXMLElement implements RecursiveIterator
-{
- /** @return whether the current node has sub nodes.
- */
- function hasChildren();
-
- /** @return a SimpleXMLIterator for the current node.
- */
- function getChildren();
-}
-
-/** @ingroup SPL
- * @brief observer of the observer pattern
- * @since PHP 5.1
- *
- * For a detailed explanation see Observer pattern in
- * <em>
- * Gamma, Helm, Johnson, Vlissides<br />
- * Design Patterns
- * </em>
- */
-interface Observer
-{
- /** Called from the subject (i.e. when it's value has changed).
- * @param $subject the callee
- */
- function update(Subject $subject);
-}
-
-/** @ingroup SPL
- * @brief ubject to the observer pattern
- * @since PHP 5.1
- * @see Observer
- */
-interface Subject
-{
- /** @param $observer new observer to attach
- */
- function attach(Observer $observer);
-
- /** @param $observer existing observer to detach
- * @note a non attached observer shouldn't result in a warning or similar
- */
- function detach(Observer $observer);
-
- /** Notify all observers
- */
- function notify();
-}
-
-?>
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
deleted file mode 100755
index 2449f59671..0000000000
--- a/ext/spl/spl_array.c
+++ /dev/null
@@ -1,1197 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 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> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "zend_interfaces.h"
-#include "zend_exceptions.h"
-
-#include "php_spl.h"
-#include "spl_functions.h"
-#include "spl_engine.h"
-#include "spl_iterators.h"
-#include "spl_array.h"
-#include "spl_exceptions.h"
-
-SPL_METHOD(Array, __construct);
-SPL_METHOD(Array, getIterator);
-SPL_METHOD(Array, rewind);
-SPL_METHOD(Array, current);
-SPL_METHOD(Array, key);
-SPL_METHOD(Array, next);
-SPL_METHOD(Array, valid);
-SPL_METHOD(Array, offsetExists);
-SPL_METHOD(Array, offsetGet);
-SPL_METHOD(Array, offsetSet);
-SPL_METHOD(Array, offsetUnset);
-SPL_METHOD(Array, append);
-SPL_METHOD(Array, getArrayCopy);
-SPL_METHOD(Array, exchangeArray);
-SPL_METHOD(Array, seek);
-SPL_METHOD(Array, count);
-SPL_METHOD(Array, getFlags);
-SPL_METHOD(Array, setFlags);
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_array___construct, 0)
- ZEND_ARG_INFO(0, array)
-ZEND_END_ARG_INFO();
-
-static
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_offsetGet, 0, 0, 1)
- ZEND_ARG_INFO(0, index)
-ZEND_END_ARG_INFO();
-
-static
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_offsetSet, 0, 0, 2)
- ZEND_ARG_INFO(0, index)
- ZEND_ARG_INFO(0, newval)
-ZEND_END_ARG_INFO();
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_array_append, 0)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO();
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_array_seek, 0)
- ZEND_ARG_INFO(0, position)
-ZEND_END_ARG_INFO();
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_array_exchangeArray, 0)
- ZEND_ARG_INFO(0, array)
-ZEND_END_ARG_INFO();
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_array_setFlags, 0)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO();
-
-static zend_function_entry spl_funcs_ArrayObject[] = {
- SPL_ME(Array, __construct, arginfo_array___construct, ZEND_ACC_PUBLIC)
- SPL_ME(Array, offsetExists, arginfo_array_offsetGet, ZEND_ACC_PUBLIC)
- SPL_ME(Array, offsetGet, arginfo_array_offsetGet, ZEND_ACC_PUBLIC)
- SPL_ME(Array, offsetSet, arginfo_array_offsetSet, ZEND_ACC_PUBLIC)
- SPL_ME(Array, offsetUnset, arginfo_array_offsetGet, ZEND_ACC_PUBLIC)
- SPL_ME(Array, append, arginfo_array_append, ZEND_ACC_PUBLIC)
- SPL_ME(Array, getArrayCopy, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(Array, count, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(Array, getFlags, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(Array, setFlags, arginfo_array_setFlags, ZEND_ACC_PUBLIC)
- /* ArrayObject specific */
- SPL_ME(Array, getIterator, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(Array, exchangeArray, arginfo_array_exchangeArray, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry spl_funcs_ArrayIterator[] = {
- SPL_ME(Array, __construct, arginfo_array___construct, ZEND_ACC_PUBLIC)
- SPL_ME(Array, offsetExists, arginfo_array_offsetGet, ZEND_ACC_PUBLIC)
- SPL_ME(Array, offsetGet, arginfo_array_offsetGet, ZEND_ACC_PUBLIC)
- SPL_ME(Array, offsetSet, arginfo_array_offsetSet, ZEND_ACC_PUBLIC)
- SPL_ME(Array, offsetUnset, arginfo_array_offsetGet, ZEND_ACC_PUBLIC)
- SPL_ME(Array, append, arginfo_array_append, ZEND_ACC_PUBLIC)
- SPL_ME(Array, getArrayCopy, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(Array, count, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(Array, getFlags, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(Array, setFlags, arginfo_array_setFlags, ZEND_ACC_PUBLIC)
- /* ArrayIterator specific */
- SPL_ME(Array, rewind, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(Array, current, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(Array, key, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(Array, next, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(Array, valid, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(Array, seek, arginfo_array_seek, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry spl_funcs_Countable[] = {
- SPL_ABSTRACT_ME(Countable, count, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_object_handlers spl_handler_ArrayObject;
-PHPAPI zend_class_entry *spl_ce_ArrayObject;
-
-zend_object_handlers spl_handler_ArrayIterator;
-PHPAPI zend_class_entry *spl_ce_ArrayIterator;
-
-PHPAPI zend_class_entry *spl_ce_Countable;
-
-#define SPL_ARRAY_STD_PROP_LIST 0x00000001
-#define SPL_ARRAY_ARRAY_AS_PROPS 0x00000002
-#define SPL_ARRAY_IS_REF 0x01000000
-#define SPL_ARRAY_IS_SELF 0x02000000
-#define SPL_ARRAY_INT_MASK 0xFF000000
-#define SPL_ARRAY_CLONE_MASK 0x03000003
-
-typedef struct _spl_array_object {
- zend_object std;
- zval *array;
- HashPosition pos;
- int ar_flags;
- int is_self;
- zend_function * fptr_offset_get;
- zend_function * fptr_offset_set;
- zend_function * fptr_offset_has;
- zend_function * fptr_offset_del;
-} spl_array_object;
-
-static inline HashTable *spl_array_get_hash_table(spl_array_object* intern TSRMLS_DC) {
- if ((intern->ar_flags & (SPL_ARRAY_STD_PROP_LIST|SPL_ARRAY_IS_SELF)) != 0) {
- return intern->std.properties;
- } else {
- return HASH_OF(intern->array);
- }
-}
-
-SPL_API int spl_hash_verify_pos(spl_array_object * intern TSRMLS_DC) /* {{{ */
-{
- HashTable *ht = spl_array_get_hash_table(intern TSRMLS_CC);
- Bucket *p;
-
-/* IS_CONSISTENT(ht);*/
-
-/* HASH_PROTECT_RECURSION(ht);*/
- p = ht->pListHead;
- while (p != NULL) {
- if (p == intern->pos) {
- return SUCCESS;
- }
- p = p->pListNext;
- }
-/* HASH_UNPROTECT_RECURSION(ht); */
- zend_hash_internal_pointer_reset_ex(spl_array_get_hash_table(intern TSRMLS_CC), &intern->pos);
- return FAILURE;
-}
-/* }}} */
-
-/* {{{ spl_array_object_free_storage */
-static void spl_array_object_free_storage(void *object TSRMLS_DC)
-{
- spl_array_object *intern = (spl_array_object *)object;
-
- zend_hash_destroy(intern->std.properties);
- FREE_HASHTABLE(intern->std.properties);
-
- zval_ptr_dtor(&intern->array);
-
- efree(object);
-}
-/* }}} */
-
-/* {{{ spl_array_object_new */
-static zend_object_value spl_array_object_new_ex(zend_class_entry *class_type, spl_array_object **obj, spl_array_object *orig TSRMLS_DC)
-{
- zend_object_value retval;
- spl_array_object *intern;
- zval *tmp;
- zend_class_entry * parent = class_type;
- int inherited = 0;
-
- intern = emalloc(sizeof(spl_array_object));
- memset(intern, 0, sizeof(spl_array_object));
- intern->std.ce = class_type;
- *obj = intern;
-
- ALLOC_HASHTABLE(intern->std.properties);
- zend_hash_init(intern->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
-
- intern->ar_flags = 0;
- if (orig) {
- intern->array = orig->array;
- ZVAL_ADDREF(intern->array);
- intern->ar_flags &= ~ SPL_ARRAY_CLONE_MASK;
- intern->ar_flags |= (orig->ar_flags & SPL_ARRAY_CLONE_MASK) | SPL_ARRAY_IS_REF;
- } else {
- MAKE_STD_ZVAL(intern->array);
- array_init(intern->array);
- intern->ar_flags &= ~SPL_ARRAY_IS_REF;
- }
-
- retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t) spl_array_object_free_storage, NULL TSRMLS_CC);
- while (parent) {
- if (parent == spl_ce_ArrayIterator) {
- retval.handlers = &spl_handler_ArrayIterator;
- break;
- } else if (parent == spl_ce_ArrayObject) {
- retval.handlers = &spl_handler_ArrayObject;
- break;
- }
- parent = parent->parent;
- inherited = 1;
- }
- if (!parent) { /* this must never happen */
- php_error_docref(NULL TSRMLS_CC, E_COMPILE_ERROR, "Internal compiler error, Class is not child of ArrayObject or arrayIterator");
- }
- if (inherited) {
- zend_hash_find(&class_type->function_table, "offsetget", sizeof("offsetget"), (void **) &intern->fptr_offset_get);
- if (intern->fptr_offset_get->common.scope == parent) {
- intern->fptr_offset_get = NULL;
- }
- zend_hash_find(&class_type->function_table, "offsetset", sizeof("offsetset"), (void **) &intern->fptr_offset_set);
- if (intern->fptr_offset_set->common.scope == parent) {
- intern->fptr_offset_set = NULL;
- }
- zend_hash_find(&class_type->function_table, "offsetexists", sizeof("offsetexists"), (void **) &intern->fptr_offset_has);
- if (intern->fptr_offset_has->common.scope == parent) {
- intern->fptr_offset_has = NULL;
- }
- zend_hash_find(&class_type->function_table, "offsetunset", sizeof("offsetunset"), (void **) &intern->fptr_offset_del);
- if (intern->fptr_offset_del->common.scope == parent) {
- intern->fptr_offset_del = NULL;
- }
- }
- zend_hash_internal_pointer_reset_ex(spl_array_get_hash_table(intern TSRMLS_CC), &intern->pos);
- return retval;
-}
-/* }}} */
-
-/* {{{ spl_array_object_new */
-static zend_object_value spl_array_object_new(zend_class_entry *class_type TSRMLS_DC)
-{
- spl_array_object *tmp;
- return spl_array_object_new_ex(class_type, &tmp, NULL TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ spl_array_object_clone */
-static zend_object_value spl_array_object_clone(zval *zobject TSRMLS_DC)
-{
- zend_object_value new_obj_val;
- zend_object *old_object;
- zend_object *new_object;
- zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
- spl_array_object *intern;
-
- old_object = zend_objects_get_address(zobject TSRMLS_CC);
- new_obj_val = spl_array_object_new_ex(old_object->ce, &intern, (spl_array_object*)old_object TSRMLS_CC);
- new_object = &intern->std;
-
- zend_objects_clone_members(new_object, new_obj_val, old_object, handle TSRMLS_CC);
-
- return new_obj_val;
-}
-/* }}} */
-
-static zval **spl_array_get_dimension_ptr_ptr(int check_inherited, zval *object, zval *offset, int type TSRMLS_DC) /* {{{ */
-{
- spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
- zval **retval;
- long index;
-
-/* We cannot get the pointer pointer so we don't allow it here for now
- if (check_inherited && intern->fptr_offset_get) {
- return zend_call_method_with_1_params(&object, Z_OBJCE_P(object), &intern->fptr_offset_get, "offsetGet", NULL, offset);
- }*/
-
- switch(Z_TYPE_P(offset)) {
- case IS_STRING:
- if (zend_symtable_find(spl_array_get_hash_table(intern TSRMLS_CC), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) &retval) == FAILURE) {
- zend_error(E_NOTICE, "Undefined index: %s", Z_STRVAL_P(offset));
- return &EG(uninitialized_zval_ptr);
- } else {
- return retval;
- }
- case IS_DOUBLE:
- case IS_RESOURCE:
- case IS_BOOL:
- case IS_LONG:
- if (offset->type == IS_DOUBLE) {
- index = (long)Z_DVAL_P(offset);
- } else {
- index = Z_LVAL_P(offset);
- }
- if (zend_hash_index_find(spl_array_get_hash_table(intern TSRMLS_CC), index, (void **) &retval) == FAILURE) {
- zend_error(E_NOTICE, "Undefined offset: %ld", Z_LVAL_P(offset));
- return &EG(uninitialized_zval_ptr);
- } else {
- return retval;
- }
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type");
- return &EG(uninitialized_zval_ptr);
- }
-} /* }}} */
-
-static zval *spl_array_read_dimension_ex(int check_inherited, zval *object, zval *offset, int type TSRMLS_DC) /* {{{ */
-{
- if (check_inherited) {
- spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
- if (intern->fptr_offset_get) {
- zval *rv;
- return zend_call_method_with_1_params(&object, Z_OBJCE_P(object), &intern->fptr_offset_get, "offsetGet", &rv, offset);
- }
- }
- return *spl_array_get_dimension_ptr_ptr(check_inherited, object, offset, type TSRMLS_CC);
-} /* }}} */
-
-static zval *spl_array_read_dimension(zval *object, zval *offset, int type TSRMLS_DC) /* {{{ */
-{
- return spl_array_read_dimension_ex(1, object, offset, type TSRMLS_CC);
-} /* }}} */
-
-static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval *offset, zval *value TSRMLS_DC) /* {{{ */
-{
- spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
- long index;
- zval *rv;
-
- if (check_inherited && intern->fptr_offset_set) {
- zend_call_method_with_2_params(&object, Z_OBJCE_P(object), &intern->fptr_offset_set, "offsetSet", &rv, offset, value);
- return;
- }
-
- if (!offset) {
- value->refcount++;
- zend_hash_next_index_insert(spl_array_get_hash_table(intern TSRMLS_CC), (void**)&value, sizeof(void*), NULL);
- return;
- }
- switch(Z_TYPE_P(offset)) {
- case IS_STRING:
- value->refcount++;
- zend_symtable_update(spl_array_get_hash_table(intern TSRMLS_CC), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void**)&value, sizeof(void*), NULL);
- return;
- case IS_DOUBLE:
- case IS_RESOURCE:
- case IS_BOOL:
- case IS_LONG:
- if (offset->type == IS_DOUBLE) {
- index = (long)Z_DVAL_P(offset);
- } else {
- index = Z_LVAL_P(offset);
- }
- value->refcount++;
- zend_hash_index_update(spl_array_get_hash_table(intern TSRMLS_CC), index, (void**)&value, sizeof(void*), NULL);
- return;
- default:
- zend_error(E_WARNING, "Illegal offset type");
- return;
- }
-} /* }}} */
-
-static void spl_array_write_dimension(zval *object, zval *offset, zval *value TSRMLS_DC) /* {{{ */
-{
- spl_array_write_dimension_ex(1, object, offset, value TSRMLS_CC);
-} /* }}} */
-
-static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval *offset TSRMLS_DC) /* {{{ */
-{
- spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
- long index;
- zval *rv;
-
- if (check_inherited && intern->fptr_offset_del) {
- zend_call_method_with_1_params(&object, Z_OBJCE_P(object), &intern->fptr_offset_del, "offsetUnset", &rv, offset);
- return;
- }
-
- switch(Z_TYPE_P(offset)) {
- case IS_STRING:
- if (spl_array_get_hash_table(intern TSRMLS_CC) == &EG(symbol_table)) {
- if (zend_delete_global_variable(Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC)) {
- zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(offset));
- }
- } else {
- if (zend_symtable_del(spl_array_get_hash_table(intern TSRMLS_CC), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1) == FAILURE) {
- zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(offset));
- }
- }
- break;
- case IS_DOUBLE:
- case IS_RESOURCE:
- case IS_BOOL:
- case IS_LONG:
- if (offset->type == IS_DOUBLE) {
- index = (long)Z_DVAL_P(offset);
- } else {
- index = Z_LVAL_P(offset);
- }
- if (zend_hash_index_del(spl_array_get_hash_table(intern TSRMLS_CC), index) == FAILURE) {
- zend_error(E_NOTICE,"Undefined offset: %ld", Z_LVAL_P(offset));
- }
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type");
- return;
- }
- spl_hash_verify_pos(intern TSRMLS_CC); /* call rewind on FAILURE */
-} /* }}} */
-
-static void spl_array_unset_dimension(zval *object, zval *offset TSRMLS_DC) /* {{{ */
-{
- spl_array_unset_dimension_ex(1, object, offset TSRMLS_CC);
-} /* }}} */
-
-static int spl_array_has_dimension_ex(int check_inherited, zval *object, zval *offset, int check_empty TSRMLS_DC) /* {{{ */
-{
- spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
- long index;
- zval *rv;
-
- if (check_inherited && intern->fptr_offset_has) {
- zend_call_method_with_1_params(&object, Z_OBJCE_P(object), &intern->fptr_offset_has, "offsetExists", &rv, offset);
- if (zend_is_true(rv)) {
- zval_ptr_dtor(&rv);
- return 1;
- }
- zval_ptr_dtor(&rv);
- return 0;
- }
-
- switch(Z_TYPE_P(offset)) {
- case IS_STRING:
- return zend_symtable_exists(spl_array_get_hash_table(intern TSRMLS_CC), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
- case IS_DOUBLE:
- case IS_RESOURCE:
- case IS_BOOL:
- case IS_LONG:
- if (offset->type == IS_DOUBLE) {
- index = (long)Z_DVAL_P(offset);
- } else {
- index = Z_LVAL_P(offset);
- }
- return zend_hash_index_exists(spl_array_get_hash_table(intern TSRMLS_CC), index);
- default:
- zend_error(E_WARNING, "Illegal offset type");
- }
- return 0;
-} /* }}} */
-
-static int spl_array_has_dimension(zval *object, zval *offset, int check_empty TSRMLS_DC) /* {{{ */
-{
- return spl_array_has_dimension_ex(1, object, offset, check_empty TSRMLS_CC);
-} /* }}} */
-
-/* {{{ proto bool ArrayObject::offsetExists(mixed $index)
- proto bool ArrayIterator::offsetExists(mixed $index)
- Returns whether the requested $index exists. */
-SPL_METHOD(Array, offsetExists)
-{
- zval *index;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &index) == FAILURE) {
- return;
- }
- RETURN_BOOL(spl_array_has_dimension_ex(0, getThis(), index, 1 TSRMLS_CC));
-} /* }}} */
-
-/* {{{ proto bool ArrayObject::offsetGet(mixed $index)
- proto bool ArrayIterator::offsetGet(mixed $index)
- Returns the value at the specified $index. */
-SPL_METHOD(Array, offsetGet)
-{
- zval *index, *value;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &index) == FAILURE) {
- return;
- }
- value = spl_array_read_dimension_ex(0, getThis(), index, BP_VAR_R TSRMLS_CC);
- RETURN_ZVAL(value, 1, 0);
-} /* }}} */
-
-/* {{{ proto void ArrayObject::offsetSet(mixed $index, mixed $newval)
- proto void ArrayIterator::offsetSet(mixed $index, mixed $newval)
- Sets the value at the specified $index to $newval. */
-SPL_METHOD(Array, offsetSet)
-{
- zval *index, *value = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &index, &value) == FAILURE) {
- return;
- }
- spl_array_write_dimension_ex(0, getThis(), index, value TSRMLS_CC);
-} /* }}} */
-
-
-void spl_array_iterator_append(zval *object, zval *append_value TSRMLS_DC) /* {{{ */
-{
- spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
- HashTable *aht = spl_array_get_hash_table(intern TSRMLS_CC);
-
- if (!aht) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and is no longer an array");
- return;
- }
-
- if (Z_TYPE_P(intern->array) == IS_OBJECT) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Cannot append properties to objects, use %s::offsetSet() instead", Z_OBJCE_P(object)->name);
- }
-
- spl_array_write_dimension(object, NULL, append_value TSRMLS_CC);
- if (!intern->pos) {
- intern->pos = aht->pListTail;
- }
-} /* }}} */
-
-/* {{{ proto void ArrayObject::append(mixed $newval)
- proto void ArrayIterator::append(mixed $newval)
- Appends the value (cannot be called for objects). */
-SPL_METHOD(Array, append)
-{
- zval *value;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &value) == FAILURE) {
- return;
- }
- spl_array_iterator_append(getThis(), value TSRMLS_CC);
-} /* }}} */
-
-/* {{{ proto void ArrayObject::offsetUnset(mixed $index)
- proto void ArrayIterator::offsetUnset(mixed $index)
- Unsets the value at the specified $index. */
-SPL_METHOD(Array, offsetUnset)
-{
- zval *index;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &index) == FAILURE) {
- return;
- }
- spl_array_unset_dimension_ex(0, getThis(), index TSRMLS_CC);
-} /* }}} */
-
-/* {{ proto array ArrayObject::getArrayCopy()
- proto array ArrayIterator::getArrayCopy()
- Return a copy of the contained array */
-SPL_METHOD(Array, getArrayCopy)
-{
- zval *object = getThis(), *tmp;
- spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
-
- array_init(return_value);
- zend_hash_copy(HASH_OF(return_value), spl_array_get_hash_table(intern TSRMLS_CC), (copy_ctor_func_t) zval_add_ref, &tmp, sizeof(zval*));
-} /* }}} */
-
-static HashTable *spl_array_get_properties(zval *object TSRMLS_DC) /* {{{ */
-{
- spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
-
- return spl_array_get_hash_table(intern TSRMLS_CC);
-} /* }}} */
-
-static zval *spl_array_read_property(zval *object, zval *member, int type TSRMLS_DC) /* {{{ */
-{
- spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
-
- if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0
- && !std_object_handlers.has_property(object, member, 2 TSRMLS_CC)) {
- return spl_array_read_dimension(object, member, type TSRMLS_CC);
- }
- return std_object_handlers.read_property(object, member, type TSRMLS_CC);
-} /* }}} */
-
-static void spl_array_write_property(zval *object, zval *member, zval *value TSRMLS_DC) /* {{{ */
-{
- spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
-
- if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0
- && !std_object_handlers.has_property(object, member, 2 TSRMLS_CC)) {
- spl_array_write_dimension(object, member, value TSRMLS_CC);
- return;
- }
- std_object_handlers.write_property(object, member, value TSRMLS_CC);
-} /* }}} */
-
-static zval **spl_array_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC) /* {{{ */
-{
- spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
-
- if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0
- && !std_object_handlers.has_property(object, member, 2 TSRMLS_CC)) {
- return spl_array_get_dimension_ptr_ptr(1, object, member, 0 TSRMLS_CC);
- }
- return std_object_handlers.get_property_ptr_ptr(object, member TSRMLS_CC);
-} /* }}} */
-
-static int spl_array_has_property(zval *object, zval *member, int has_set_exists TSRMLS_DC) /* {{{ */
-{
- spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
-
- if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0) {
- if (!std_object_handlers.has_property(object, member, 2 TSRMLS_CC)) {
- return spl_array_has_dimension(object, member, has_set_exists TSRMLS_CC);
- }
- return 0; /* if prop doesn't exist at all mode 0/1 cannot return 1 */
- }
- return std_object_handlers.has_property(object, member, has_set_exists TSRMLS_CC);
-} /* }}} */
-
-static void spl_array_rewind(spl_array_object *intern TSRMLS_DC);
-
-static void spl_array_unset_property(zval *object, zval *member TSRMLS_DC) /* {{{ */
-{
- spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
-
- if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0
- && !std_object_handlers.has_property(object, member, 2 TSRMLS_CC)) {
- spl_array_unset_dimension(object, member TSRMLS_CC);
- spl_array_rewind(intern TSRMLS_CC); /* because deletion might invalidate position */
- return;
- }
- std_object_handlers.unset_property(object, member TSRMLS_CC);
-} /* }}} */
-
-static int spl_array_skip_protected(spl_array_object *intern TSRMLS_DC) /* {{{ */
-{
- char *string_key;
- uint string_length;
- ulong num_key;
- HashTable *aht = spl_array_get_hash_table(intern TSRMLS_CC);
-
- if (Z_TYPE_P(intern->array) == IS_OBJECT) {
- do {
- if (zend_hash_get_current_key_ex(aht, &string_key, &string_length, &num_key, 0, &intern->pos) == HASH_KEY_IS_STRING) {
- if (!string_length || string_key[0]) {
- return SUCCESS;
- }
- } else {
- return SUCCESS;
- }
- if (zend_hash_has_more_elements_ex(aht, &intern->pos) != SUCCESS) {
- return FAILURE;
- }
- zend_hash_move_forward_ex(aht, &intern->pos);
- } while (1);
- }
- return FAILURE;
-}
-/* }}} */
-
-static int spl_array_next(spl_array_object *intern TSRMLS_DC) /* {{{ */
-{
- HashTable *aht = spl_array_get_hash_table(intern TSRMLS_CC);
-
- if ((intern->ar_flags & SPL_ARRAY_IS_REF) && spl_hash_verify_pos(intern TSRMLS_CC) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and internal position is no longer valid");
- return FAILURE;
- } else {
- zend_hash_move_forward_ex(aht, &intern->pos);
- if (Z_TYPE_P(intern->array) == IS_OBJECT) {
- return spl_array_skip_protected(intern TSRMLS_CC);
- } else {
- return zend_hash_has_more_elements_ex(aht, &intern->pos);
- }
- }
-} /* }}} */
-
-/* define an overloaded iterator structure */
-typedef struct {
- zend_object_iterator intern;
- spl_array_object *object;
-} spl_array_it;
-
-static void spl_array_it_dtor(zend_object_iterator *iter TSRMLS_DC) /* {{{ */
-{
- spl_array_it *iterator = (spl_array_it *)iter;
-
- zval_ptr_dtor((zval**)&iterator->intern.data);
-
- efree(iterator);
-}
-/* }}} */
-
-static int spl_array_it_valid(zend_object_iterator *iter TSRMLS_DC) /* {{{ */
-{
- spl_array_it *iterator = (spl_array_it *)iter;
- spl_array_object *object = iterator->object;
- HashTable *aht = spl_array_get_hash_table(object TSRMLS_CC);
-
- if (!aht) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "ArrayIterator::valid(): Array was modified outside object and is no longer an array");
- return FAILURE;
- }
-
- if (object->pos && (object->ar_flags & SPL_ARRAY_IS_REF) && spl_hash_verify_pos(object TSRMLS_CC) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "ArrayIterator::valid(): Array was modified outside object and internal position is no longer valid");
- return FAILURE;
- } else {
- return zend_hash_has_more_elements_ex(aht, &object->pos);
- }
-}
-/* }}} */
-
-static void spl_array_it_get_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC) /* {{{ */
-{
- spl_array_it *iterator = (spl_array_it *)iter;
- spl_array_object *object = iterator->object;
- HashTable *aht = spl_array_get_hash_table(object TSRMLS_CC);
-
- if (zend_hash_get_current_data_ex(aht, (void**)data, &object->pos) == FAILURE) {
- *data = NULL;
- }
-}
-/* }}} */
-
-static int spl_array_it_get_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) /* {{{ */
-{
- spl_array_it *iterator = (spl_array_it *)iter;
- spl_array_object *object = iterator->object;
- HashTable *aht = spl_array_get_hash_table(object TSRMLS_CC);
-
- if (!aht) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "ArrayIterator::current(): Array was modified outside object and is no longer an array");
- return HASH_KEY_NON_EXISTANT;
- }
-
- if ((object->ar_flags & SPL_ARRAY_IS_REF) && spl_hash_verify_pos(object TSRMLS_CC) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "ArrayIterator::current(): Array was modified outside object and internal position is no longer valid");
- return HASH_KEY_NON_EXISTANT;
- }
-
- return zend_hash_get_current_key_ex(aht, str_key, str_key_len, int_key, 1, &object->pos);
-}
-/* }}} */
-
-static void spl_array_it_move_forward(zend_object_iterator *iter TSRMLS_DC) /* {{{ */
-{
- spl_array_it *iterator = (spl_array_it *)iter;
- spl_array_object *object = iterator->object;
-
- HashTable *aht = spl_array_get_hash_table(object TSRMLS_CC);
-
- if (!aht) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "ArrayIterator::current(): Array was modified outside object and is no longer an array");
- return;
- }
-
- if ((object->ar_flags & SPL_ARRAY_IS_REF) && spl_hash_verify_pos(object TSRMLS_CC) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "ArrayIterator::next(): Array was modified outside object and internal position is no longer valid");
- } else {
- spl_array_next(object TSRMLS_CC);
- }
-}
-/* }}} */
-
-static void spl_array_rewind(spl_array_object *intern TSRMLS_DC) /* {{{ */
-{
- HashTable *aht = spl_array_get_hash_table(intern TSRMLS_CC);
-
- if (!aht) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "ArrayIterator::rewind(): Array was modified outside object and is no longer an array");
- return;
- }
-
- zend_hash_internal_pointer_reset_ex(aht, &intern->pos);
- spl_array_skip_protected(intern TSRMLS_CC);
-}
-/* }}} */
-
-static void spl_array_it_rewind(zend_object_iterator *iter TSRMLS_DC) /* {{{ */
-{
- spl_array_it *iterator = (spl_array_it *)iter;
- spl_array_object *object = iterator->object;
-
- spl_array_rewind(object TSRMLS_CC);
-}
-/* }}} */
-
-/* iterator handler table */
-zend_object_iterator_funcs spl_array_it_funcs = {
- spl_array_it_dtor,
- spl_array_it_valid,
- spl_array_it_get_current_data,
- spl_array_it_get_current_key,
- spl_array_it_move_forward,
- spl_array_it_rewind
-};
-
-zend_object_iterator *spl_array_get_iterator(zend_class_entry *ce, zval *object TSRMLS_DC) /* {{{ */
-{
- spl_array_it *iterator = emalloc(sizeof(spl_array_it));
- spl_array_object *array_object = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
-
- object->refcount++;
- iterator->intern.data = (void*)object;
- iterator->intern.funcs = &spl_array_it_funcs;
- iterator->object = array_object;
-
- return (zend_object_iterator*)iterator;
-}
-/* }}} */
-
-/* {{{ proto void ArrayObject::__construct(array|object ar = array())
- proto void ArrayIterator::__construct(array|object ar = array() [, int flags = 0])
- Cronstructs a new array iterator from a path. */
-SPL_METHOD(Array, __construct)
-{
- zval *object = getThis();
- spl_array_object *intern;
- zval *array;
- long ar_flags = 0;
-
- if (ZEND_NUM_ARGS() == 0) {
- return; /* nothing to do */
- }
- php_set_error_handling(EH_THROW, spl_ce_InvalidArgumentException TSRMLS_CC);
-
- intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &array, &ar_flags) == FAILURE) {
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
- return;
- }
-
- if (Z_TYPE_P(array) == IS_OBJECT && (Z_OBJ_HT_P(array) == &spl_handler_ArrayObject || Z_OBJ_HT_P(array) == &spl_handler_ArrayIterator)) {
- spl_array_object *other = (spl_array_object*)zend_object_store_get_object(array TSRMLS_CC);
- zval_ptr_dtor(&intern->array);
- intern->array = other->array;
- } else {
- if (Z_TYPE_P(array) != IS_OBJECT && Z_TYPE_P(array) != IS_ARRAY) {
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
- zend_throw_exception(spl_ce_InvalidArgumentException, "Passed variable is not an array or object, using empty array instead", 0 TSRMLS_CC);
- return;
- }
- zval_ptr_dtor(&intern->array);
- intern->array = array;
- }
- if (object == array) {
- intern->ar_flags |= SPL_ARRAY_IS_SELF;
- } else {
- intern->ar_flags &= ~SPL_ARRAY_IS_SELF;
- }
- intern->ar_flags |= ar_flags & ~SPL_ARRAY_INT_MASK;
- ZVAL_ADDREF(intern->array);
-
- spl_array_rewind(intern TSRMLS_CC);
-
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ proto int ArrayObject::getFlags()
- Get flags */
-SPL_METHOD(Array, getFlags)
-{
- zval *object = getThis();
- spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
-
- RETURN_LONG(intern->ar_flags & ~SPL_ARRAY_INT_MASK);
-}
-/* }}} */
-
-/* {{{ proto void ArrayObject::setFlags(int flags)
- Set flags */
-SPL_METHOD(Array, setFlags)
-{
- zval *object = getThis();
- spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
- long ar_flags = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &ar_flags) == FAILURE) {
- return;
- }
-
- intern->ar_flags = (intern->ar_flags & SPL_ARRAY_INT_MASK) | (ar_flags & ~SPL_ARRAY_INT_MASK);
-}
-/* }}} */
-
-/* {{{ proto Array|Object ArrayObject::exchangeArray(Array|Object ar = array())
- Replace the referenced array or object with a new one and return the old one (right now copy - to be changed) */
-SPL_METHOD(Array, exchangeArray)
-{
- zval *object = getThis(), *tmp, **array;
- spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
-
- array_init(return_value);
- zend_hash_copy(HASH_OF(return_value), spl_array_get_hash_table(intern TSRMLS_CC), (copy_ctor_func_t) zval_add_ref, &tmp, sizeof(zval*));
-
- if (ZEND_NUM_ARGS() > 1 || zend_get_parameters_ex(1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (Z_TYPE_PP(array) == IS_OBJECT && (Z_OBJ_HT_PP(array) == &spl_handler_ArrayObject || Z_OBJ_HT_PP(array) == &spl_handler_ArrayIterator)) {
- spl_array_object *other = (spl_array_object*)zend_object_store_get_object(*array TSRMLS_CC);
- zval_ptr_dtor(&intern->array);
- intern->array = other->array;
- } else {
- if (Z_TYPE_PP(array) != IS_OBJECT && !HASH_OF(*array)) {
- zend_throw_exception(spl_ce_InvalidArgumentException, "Passed variable is not an array or object, using empty array instead", 0 TSRMLS_CC);
- return;
- }
- zval_ptr_dtor(&intern->array);
- intern->array = *array;
- }
- if (object == *array) {
- intern->ar_flags |= SPL_ARRAY_IS_SELF;
- } else {
- intern->ar_flags &= ~SPL_ARRAY_IS_SELF;
- }
- ZVAL_ADDREF(intern->array);
-
- spl_array_rewind(intern TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ proto ArrayIterator ArrayObject::getIterator()
- Create a new iterator from a ArrayObject instance */
-SPL_METHOD(Array, getIterator)
-{
- zval *object = getThis();
- spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
- spl_array_object *iterator;
- HashTable *aht = spl_array_get_hash_table(intern TSRMLS_CC);
-
- if (!aht) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and is no longer an array");
- return;
- }
-
- return_value->type = IS_OBJECT;
- return_value->value.obj = spl_array_object_new_ex(spl_ce_ArrayIterator, &iterator, intern TSRMLS_CC);
- return_value->refcount = 1;
- return_value->is_ref = 1;
-}
-/* }}} */
-
-/* {{{ proto void ArrayIterator::rewind()
- Rewind array back to the start */
-SPL_METHOD(Array, rewind)
-{
- zval *object = getThis();
- spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
-
- spl_array_rewind(intern TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ proto void ArrayIterator::seek(int $position)
- Seek to position. */
-SPL_METHOD(Array, seek)
-{
- long opos, position;
- zval *object = getThis();
- spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
- HashTable *aht = spl_array_get_hash_table(intern TSRMLS_CC);
- int result;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &position) == FAILURE) {
- return;
- }
-
- if (!aht) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and is no longer an array");
- return;
- }
-
- opos = position;
-
- if (position >= 0) { /* negative values are not supported */
- zend_hash_internal_pointer_reset_ex(aht, &intern->pos);
-
- while (position-- > 0 && (result = spl_array_next(intern TSRMLS_CC)) == SUCCESS);
-
- if (intern->pos && (intern->ar_flags & SPL_ARRAY_IS_REF) && spl_hash_verify_pos(intern TSRMLS_CC) == FAILURE) {
- /* fail */
- } else {
- if (zend_hash_has_more_elements_ex(aht, &intern->pos) == SUCCESS) {
- return; /* ok */
- }
- }
- }
- zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Seek position %ld is out of range", opos);
-} /* }}} */
-
-int spl_array_object_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */
-{
- spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
- HashTable *aht = spl_array_get_hash_table(intern TSRMLS_CC);
- HashPosition pos;
-
- if (!aht) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and is no longer an array");
- *count = 0;
- return FAILURE;
- }
-
- if (Z_TYPE_P(intern->array) == IS_OBJECT) {
- /* We need to store the 'pos' since we'll modify it in the functions
- * we're going to call and which do not support 'pos' as parameter. */
- pos = intern->pos;
- *count = 0;
- zend_hash_internal_pointer_reset_ex(aht, &intern->pos);
- while(intern->pos && spl_array_next(intern TSRMLS_CC) == SUCCESS) {
- (*count)++;
- }
- intern->pos = pos;
- return SUCCESS;
- } else {
- *count = zend_hash_num_elements(aht);
- return SUCCESS;
- }
-} /* }}} */
-
-/* {{{ proto int ArrayObject::count()
- proto int ArrayIterator::count()
- Return the number of elements in the Iterator. */
-SPL_METHOD(Array, count)
-{
- long count;
-
- spl_array_object_count_elements(getThis(), &count TSRMLS_CC);
- RETURN_LONG(count);
-} /* }}} */
-
-/* {{{ proto mixed|NULL ArrayIterator::current()
- Return current array entry */
-SPL_METHOD(Array, current)
-{
- zval *object = getThis();
- spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
- zval **entry;
- HashTable *aht = spl_array_get_hash_table(intern TSRMLS_CC);
-
- if (!aht) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and is no longer an array");
- return;
- }
-
- if ((intern->ar_flags & SPL_ARRAY_IS_REF) && spl_hash_verify_pos(intern TSRMLS_CC) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and internal position is no longer valid");
- return;
- }
-
- if (zend_hash_get_current_data_ex(aht, (void **) &entry, &intern->pos) == FAILURE) {
- return;
- }
- RETVAL_ZVAL(*entry, 1, 0);
-}
-/* }}} */
-
-/* {{{ proto mixed|NULL ArrayIterator::key()
- Return current array key */
-SPL_METHOD(Array, key)
-{
- zval *object = getThis();
- spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
- char *string_key;
- uint string_length;
- ulong num_key;
- HashTable *aht = spl_array_get_hash_table(intern TSRMLS_CC);
-
- if (!aht) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and is no longer an array");
- return;
- }
-
- if ((intern->ar_flags & SPL_ARRAY_IS_REF) && spl_hash_verify_pos(intern TSRMLS_CC) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and internal position is no longer valid");
- return;
- }
-
- switch (zend_hash_get_current_key_ex(aht, &string_key, &string_length, &num_key, 1, &intern->pos)) {
- case HASH_KEY_IS_STRING:
- RETVAL_STRINGL(string_key, string_length - 1, 0);
- break;
- case HASH_KEY_IS_LONG:
- RETVAL_LONG(num_key);
- break;
- case HASH_KEY_NON_EXISTANT:
- return;
- }
-}
-/* }}} */
-
-/* {{{ proto void ArrayIterator::next()
- Move to next entry */
-SPL_METHOD(Array, next)
-{
- zval *object = getThis();
- spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
- HashTable *aht = spl_array_get_hash_table(intern TSRMLS_CC);
-
- if (!aht) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and is no longer an array");
- return;
- }
-
- spl_array_next(intern TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ proto bool ArrayIterator::valid()
- Check whether array contains more entries */
-SPL_METHOD(Array, valid)
-{
- zval *object = getThis();
- spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
- HashTable *aht = spl_array_get_hash_table(intern TSRMLS_CC);
-
- if (!aht) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and is no longer an array");
- return;
- }
-
- if (intern->pos && (intern->ar_flags & SPL_ARRAY_IS_REF) && spl_hash_verify_pos(intern TSRMLS_CC) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and internal position is no longer valid");
- RETURN_FALSE;
- } else {
- RETURN_BOOL(zend_hash_has_more_elements_ex(aht, &intern->pos) == SUCCESS);
- }
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION(spl_array) */
-PHP_MINIT_FUNCTION(spl_array)
-{
- REGISTER_SPL_STD_CLASS_EX(ArrayObject, spl_array_object_new, spl_funcs_ArrayObject);
- REGISTER_SPL_IMPLEMENTS(ArrayObject, Aggregate);
- REGISTER_SPL_IMPLEMENTS(ArrayObject, ArrayAccess);
- memcpy(&spl_handler_ArrayObject, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
- spl_handler_ArrayObject.clone_obj = spl_array_object_clone;
- spl_handler_ArrayObject.read_dimension = spl_array_read_dimension;
- spl_handler_ArrayObject.write_dimension = spl_array_write_dimension;
- spl_handler_ArrayObject.unset_dimension = spl_array_unset_dimension;
- spl_handler_ArrayObject.has_dimension = spl_array_has_dimension;
- spl_handler_ArrayObject.count_elements = spl_array_object_count_elements;
-
- spl_handler_ArrayObject.get_properties = spl_array_get_properties;
- spl_handler_ArrayObject.read_property = spl_array_read_property;
- spl_handler_ArrayObject.write_property = spl_array_write_property;
- spl_handler_ArrayObject.get_property_ptr_ptr = spl_array_get_property_ptr_ptr;
- spl_handler_ArrayObject.has_property = spl_array_has_property;
- spl_handler_ArrayObject.unset_property = spl_array_unset_property;
-
- REGISTER_SPL_STD_CLASS_EX(ArrayIterator, spl_array_object_new, spl_funcs_ArrayIterator);
- REGISTER_SPL_IMPLEMENTS(ArrayIterator, Iterator);
- REGISTER_SPL_IMPLEMENTS(ArrayIterator, ArrayAccess);
- REGISTER_SPL_IMPLEMENTS(ArrayIterator, SeekableIterator);
- memcpy(&spl_handler_ArrayIterator, &spl_handler_ArrayObject, sizeof(zend_object_handlers));
- spl_ce_ArrayIterator->get_iterator = spl_array_get_iterator;
-
- REGISTER_SPL_INTERFACE(Countable);
-
- REGISTER_SPL_IMPLEMENTS(ArrayObject, Countable);
- REGISTER_SPL_IMPLEMENTS(ArrayIterator, Countable);
-
- 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_array.h b/ext/spl/spl_array.h
deleted file mode 100755
index 9bbe5a4711..0000000000
--- a/ext/spl/spl_array.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 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> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef SPL_ARRAY_H
-#define SPL_ARRAY_H
-
-#include "php.h"
-#include "php_spl.h"
-
-extern PHPAPI zend_class_entry *spl_ce_ArrayObject;
-extern PHPAPI zend_class_entry *spl_ce_ArrayIterator;
-extern PHPAPI zend_class_entry *spl_ce_Countable;
-
-PHP_MINIT_FUNCTION(spl_array);
-
-extern void spl_array_iterator_append(zval *object, zval *append_value 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_directory.c b/ext/spl/spl_directory.c
deleted file mode 100755
index 4a942687fc..0000000000
--- a/ext/spl/spl_directory.c
+++ /dev/null
@@ -1,1619 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 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. |
- +----------------------------------------------------------------------+
- | Author: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "ext/standard/file.h"
-#include "ext/standard/php_string.h"
-#include "zend_compile.h"
-#include "zend_exceptions.h"
-#include "zend_interfaces.h"
-
-#include "php_spl.h"
-#include "spl_functions.h"
-#include "spl_engine.h"
-#include "spl_iterators.h"
-#include "spl_directory.h"
-#include "spl_exceptions.h"
-
-#include "php.h"
-#include "fopen_wrappers.h"
-
-#include "ext/standard/basic_functions.h"
-#include "ext/standard/php_filestat.h"
-
-/* declare the class handlers */
-static zend_object_handlers spl_ce_dir_handlers;
-
-/* decalre the class entry */
-PHPAPI zend_class_entry *spl_ce_DirectoryIterator;
-PHPAPI zend_class_entry *spl_ce_RecursiveDirectoryIterator;
-PHPAPI zend_class_entry *spl_ce_FileObject;
-
-static zend_object_value spl_file_object_new_ex(zend_class_entry *class_type, spl_file_object **obj TSRMLS_DC);
-static int spl_file_object_open(spl_file_object *intern, int use_include_path, int silent TSRMLS_DC);
-
-/* {{{ spl_ce_dir_object_free_storage */
-/* close all resources and the memory allocated for the object */
-static void spl_ce_dir_object_free_storage(void *object TSRMLS_DC)
-{
- spl_ce_dir_object *intern = (spl_ce_dir_object *)object;
-
- zend_hash_destroy(intern->std.properties);
- FREE_HASHTABLE(intern->std.properties);
-
- if (intern->path) {
- efree(intern->path);
- }
- if (intern->dirp) {
- php_stream_close(intern->dirp);
- }
- if (intern->path_name) {
- efree(intern->path_name);
- }
- if (intern->sub_path) {
- efree(intern->sub_path);
- }
- efree(object);
-}
-/* }}} */
-
-
-/* {{{ spl_ce_dir_object_new */
-/* creates the object by
- - allocating memory
- - initializing the object members
- - storing the object
- - setting it's handlers
-
- called from
- - clone
- - new
- */
-static zend_object_value spl_ce_dir_object_new_ex(zend_class_entry *class_type, spl_ce_dir_object **obj TSRMLS_DC)
-{
- zend_object_value retval;
- spl_ce_dir_object *intern;
- zval *tmp;
-
- intern = emalloc(sizeof(spl_ce_dir_object));
- memset(intern, 0, sizeof(spl_ce_dir_object));
- intern->std.ce = class_type;
- if (obj) *obj = intern;
-
- ALLOC_HASHTABLE(intern->std.properties);
- zend_hash_init(intern->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
-
- retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t) zend_objects_destroy_object, (zend_objects_free_object_storage_t) spl_ce_dir_object_free_storage, NULL TSRMLS_CC);
- retval.handlers = &spl_ce_dir_handlers;
- return retval;
-}
-/* }}} */
-
-
-/* {{{ spl_ce_dir_object_new */
-/* See spl_ce_dir_object_new_ex */
-static zend_object_value spl_ce_dir_object_new(zend_class_entry *class_type TSRMLS_DC)
-{
- return spl_ce_dir_object_new_ex(class_type, NULL TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ spl_ce_dir_open */
-/* open a directory resource */
-static void spl_ce_dir_open(spl_ce_dir_object* intern, char *path TSRMLS_DC)
-{
- int path_len = strlen(path);
-
- intern->dirp = php_stream_opendir(path, ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL);
-
- if (path_len && (path[path_len-1] == '/' || path[path_len-1] == '\\')) {
- intern->path = estrndup(path, --path_len);
- } else {
- intern->path = estrndup(path, path_len);
- }
- intern->index = 0;
-
- if (intern->dirp == NULL) {
- /* throw exception: should've been already happened */
- intern->entry.d_name[0] = '\0';
- } else {
- if (!php_stream_readdir(intern->dirp, &intern->entry)) {
- intern->entry.d_name[0] = '\0';
- }
- }
-}
-/* }}} */
-
-/* {{{ spl_ce_dir_object_clone */
-/* Local zend_object_value creation (on stack)
- Load the 'other' object
- Create a new empty object (See spl_ce_dir_object_new_ex)
- Open the directory
- Clone other members (properties)
- */
-static zend_object_value spl_ce_dir_object_clone(zval *zobject TSRMLS_DC)
-{
- zend_object_value new_obj_val;
- zend_object *old_object;
- zend_object *new_object;
- zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
- spl_ce_dir_object *intern;
-
- old_object = zend_objects_get_address(zobject TSRMLS_CC);
- new_obj_val = spl_ce_dir_object_new_ex(old_object->ce, &intern TSRMLS_CC);
- new_object = &intern->std;
-
- spl_ce_dir_open(intern, ((spl_ce_dir_object*)old_object)->path TSRMLS_CC);
-
- zend_objects_clone_members(new_object, new_obj_val, old_object, handle TSRMLS_CC);
-
- return new_obj_val;
-}
-/* }}} */
-
-/* {{{ proto void DirectoryIterator::__construct(string path)
- Cronstructs a new dir iterator from a path. */
-/* php_set_error_handling() is used to throw exceptions in case
- the constructor fails. Here we use this to ensure the object
- has a valid directory resource.
-
- When the constructor gets called the object is already created
- by the engine, so we must only call 'additional' initializations.
- */
-SPL_METHOD(DirectoryIterator, __construct)
-{
- zval *object = getThis();
- spl_ce_dir_object *intern;
- char *path;
- int len;
-
- php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &path, &len) == FAILURE) {
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
- return;
- }
-
- intern = (spl_ce_dir_object*)zend_object_store_get_object(object TSRMLS_CC);
- spl_ce_dir_open(intern, path TSRMLS_CC);
-
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ proto void DirectoryIterator::rewind()
- Rewind dir back to the start */
-SPL_METHOD(DirectoryIterator, rewind)
-{
- zval *object = getThis();
- spl_ce_dir_object *intern = (spl_ce_dir_object*)zend_object_store_get_object(object TSRMLS_CC);
-
- intern->index = 0;
- if (intern->dirp) {
- php_stream_rewinddir(intern->dirp);
- }
- if (!intern->dirp || !php_stream_readdir(intern->dirp, &intern->entry)) {
- intern->entry.d_name[0] = '\0';
- }
-}
-/* }}} */
-
-/* {{{ proto string DirectoryIterator::key()
- Return current dir entry */
-SPL_METHOD(DirectoryIterator, key)
-{
- zval *object = getThis();
- spl_ce_dir_object *intern = (spl_ce_dir_object*)zend_object_store_get_object(object TSRMLS_CC);
-
- if (intern->dirp) {
- RETURN_LONG(intern->index);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto DirectoryIterator DirectoryIterator::current()
- Return this (needed for Iterator interface) */
-SPL_METHOD(DirectoryIterator, current)
-{
- RETURN_ZVAL(getThis(), 1, 0);
-}
-/* }}} */
-
-/* {{{ proto void DirectoryIterator::next()
- Move to next entry */
-SPL_METHOD(DirectoryIterator, next)
-{
- zval *object = getThis();
- spl_ce_dir_object *intern = (spl_ce_dir_object*)zend_object_store_get_object(object TSRMLS_CC);
-
- intern->index++;
- if (!intern->dirp || !php_stream_readdir(intern->dirp, &intern->entry)) {
- intern->entry.d_name[0] = '\0';
- }
- if (intern->path_name) {
- efree(intern->path_name);
- intern->path_name = NULL;
- }
-}
-/* }}} */
-
-/* {{{ proto string DirectoryIterator::valid()
- Check whether dir contains more entries */
-SPL_METHOD(DirectoryIterator, valid)
-{
- zval *object = getThis();
- spl_ce_dir_object *intern = (spl_ce_dir_object*)zend_object_store_get_object(object TSRMLS_CC);
-
- RETURN_BOOL(intern->entry.d_name[0] != '\0');
-}
-/* }}} */
-
-/* {{{ proto string DirectoryIterator::getPath()
- Return directory path */
-SPL_METHOD(DirectoryIterator, getPath)
-{
- zval *object = getThis();
- spl_ce_dir_object *intern = (spl_ce_dir_object*)zend_object_store_get_object(object TSRMLS_CC);
-
- RETURN_STRING(intern->path, 1);
-}
-/* }}} */
-
-/* {{{ proto string DirectoryIterator::getFilename()
- Return filename of current dir entry */
-SPL_METHOD(DirectoryIterator, getFilename)
-{
- zval *object = getThis();
- spl_ce_dir_object *intern = (spl_ce_dir_object*)zend_object_store_get_object(object TSRMLS_CC);
-
- RETURN_STRING(intern->entry.d_name, 1);
-}
-/* }}} */
-
-static inline void spl_dir_get_path_name(spl_ce_dir_object *intern)
-{
- if (!intern->path_name) {
- intern->path_name_len = spprintf(&intern->path_name, 0, "%s/%s", intern->path, intern->entry.d_name);
- }
-}
-
-/* {{{ proto string DirectoryIterator::getPathname()
- Return path and filename of current dir entry */
-SPL_METHOD(DirectoryIterator, getPathname)
-{
- zval *object = getThis();
- spl_ce_dir_object *intern = (spl_ce_dir_object*)zend_object_store_get_object(object TSRMLS_CC);
-
- if (intern->entry.d_name[0]) {
- spl_dir_get_path_name(intern);
- RETURN_STRINGL(intern->path_name, intern->path_name_len, 1);
- } else {
- RETURN_BOOL(0);
- }
-}
-/* }}} */
-
-/* {{{ proto string RecursiveDirectoryIterator::key()
- Return path and filename of current dir entry */
-SPL_METHOD(RecursiveDirectoryIterator, key)
-{
- zval *object = getThis();
- spl_ce_dir_object *intern = (spl_ce_dir_object*)zend_object_store_get_object(object TSRMLS_CC);
-
- spl_dir_get_path_name(intern);
- RETURN_STRINGL(intern->path_name, intern->path_name_len, 1);
-}
-/* }}} */
-
-/* {{{ proto bool DirectoryIterator::isDot()
- Returns true if current entry is '.' or '..' */
-SPL_METHOD(DirectoryIterator, isDot)
-{
- zval *object = getThis();
- spl_ce_dir_object *intern = (spl_ce_dir_object*)zend_object_store_get_object(object TSRMLS_CC);
-
- RETURN_BOOL(!strcmp(intern->entry.d_name, ".") || !strcmp(intern->entry.d_name, ".."));
-}
-/* }}} */
-
-/* {{{ DirectoryFunction */
-#define DirectoryFunction(func_name, func_num) \
-SPL_METHOD(DirectoryIterator, func_name) \
-{ \
- spl_ce_dir_object *intern = (spl_ce_dir_object*)zend_object_store_get_object(getThis() TSRMLS_CC); \
- \
- spl_dir_get_path_name(intern); \
- php_stat(intern->path_name, intern->path_name_len, func_num, return_value TSRMLS_CC); \
-}
-/* }}} */
-
-/* {{{ proto int DirectoryIterator::getPerms()
- Get file permissions */
-DirectoryFunction(getPerms, FS_PERMS)
-/* }}} */
-
-/* {{{ proto int DirectoryIterator::getInode()
- Get file inode */
-DirectoryFunction(getInode, FS_INODE)
-/* }}} */
-
-/* {{{ proto int DirectoryIterator::getSize()
- Get file size */
-DirectoryFunction(getSize, FS_SIZE)
-/* }}} */
-
-/* {{{ proto int DirectoryIterator::getOwner()
- Get file owner */
-DirectoryFunction(getOwner, FS_OWNER)
-/* }}} */
-
-/* {{{ proto int DirectoryIterator::getGroup()
- Get file group */
-DirectoryFunction(getGroup, FS_GROUP)
-/* }}} */
-
-/* {{{ proto int DirectoryIterator::getATime()
- Get last access time of file */
-DirectoryFunction(getATime, FS_ATIME)
-/* }}} */
-
-/* {{{ proto int DirectoryIterator::getMTime()
- Get last modification time of file */
-DirectoryFunction(getMTime, FS_MTIME)
-/* }}} */
-
-/* {{{ proto int DirectoryIterator::getCTime()
- Get inode modification time of file */
-DirectoryFunction(getCTime, FS_CTIME)
-/* }}} */
-
-/* {{{ proto string DirectoryIterator::getType()
- Get file type */
-DirectoryFunction(getType, FS_TYPE)
-/* }}} */
-
-/* {{{ proto bool DirectoryIterator::isWritable()
- Returns true if file can be written */
-DirectoryFunction(isWritable, FS_IS_W)
-/* }}} */
-
-/* {{{ proto bool DirectoryIterator::isReadable()
- Returns true if file can be read */
-DirectoryFunction(isReadable, FS_IS_R)
-/* }}} */
-
-/* {{{ proto bool DirectoryIterator::isExecutable()
- Returns true if file is executable */
-DirectoryFunction(isExecutable, FS_IS_X)
-/* }}} */
-
-/* {{{ proto bool DirectoryIterator::isFile()
- Returns true if file is a regular file */
-DirectoryFunction(isFile, FS_IS_FILE)
-/* }}} */
-
-/* {{{ proto bool DirectoryIterator::isDir()
- Returns true if file is directory */
-DirectoryFunction(isDir, FS_IS_DIR)
-/* }}} */
-
-/* {{{ proto bool DirectoryIterator::isLink()
- Returns true if file is symbolic link */
-DirectoryFunction(isLink, FS_IS_LINK)
-/* }}} */
-
-/* {{{ proto FileObject DirectoryIterator::openFile([string mode = 'r' [, bool use_include_path [, resource context]]])
- Open the current file */
-SPL_METHOD(DirectoryIterator, openFile)
-{
- zval *object = getThis();
- spl_ce_dir_object *dir_obj = (spl_ce_dir_object*)zend_object_store_get_object(object TSRMLS_CC);
- spl_file_object *intern;
- zend_bool use_include_path = 0;
-
- php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC);
-
- if (!dir_obj->entry.d_name[0]) {
- zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Could not open file");
- zval_dtor(return_value);
- return;
- }
-
- return_value->value.obj = spl_file_object_new_ex(spl_ce_FileObject, &intern TSRMLS_CC);
-
- spl_dir_get_path_name(dir_obj);
- intern->file_name = dir_obj->path_name;
- intern->file_name_len = dir_obj->path_name_len;
-
- intern->open_mode = "r";
- intern->open_mode_len = 1;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sbr",
- &intern->open_mode, &intern->open_mode_len,
- &use_include_path, &intern->zcontext) == FAILURE) {
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
- zval_dtor(return_value);
- return;
- }
-
- if (spl_file_object_open(intern, use_include_path, 0 TSRMLS_CC) == SUCCESS) {
- Z_TYPE_P(return_value) = IS_OBJECT;
- } else {
- zval_dtor(return_value);
- return;
- }
-
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
-} /* }}} */
-
-/* {{{ proto void RecursiveDirectoryIterator::rewind()
- Rewind dir back to the start */
-SPL_METHOD(RecursiveDirectoryIterator, rewind)
-{
- zval *object = getThis();
- spl_ce_dir_object *intern = (spl_ce_dir_object*)zend_object_store_get_object(object TSRMLS_CC);
-
- intern->index = 0;
- if (intern->dirp) {
- php_stream_rewinddir(intern->dirp);
- }
- do {
- if (!intern->dirp || !php_stream_readdir(intern->dirp, &intern->entry)) {
- intern->entry.d_name[0] = '\0';
- }
- } while (!strcmp(intern->entry.d_name, ".") || !strcmp(intern->entry.d_name, ".."));
-}
-/* }}} */
-
-/* {{{ proto void RecursiveDirectoryIterator::next()
- Move to next entry */
-SPL_METHOD(RecursiveDirectoryIterator, next)
-{
- zval *object = getThis();
- spl_ce_dir_object *intern = (spl_ce_dir_object*)zend_object_store_get_object(object TSRMLS_CC);
-
- intern->index++;
- do {
- if (!intern->dirp || !php_stream_readdir(intern->dirp, &intern->entry)) {
- intern->entry.d_name[0] = '\0';
- }
- } while (!strcmp(intern->entry.d_name, ".") || !strcmp(intern->entry.d_name, ".."));
- if (intern->path_name) {
- efree(intern->path_name);
- intern->path_name = NULL;
- }
-}
-/* }}} */
-
-/* {{{ proto bool RecursiveDirectoryIterator::hasChildren([bool $allow_links = false])
- Returns whether current entry is a directory and not '.' or '..' */
-SPL_METHOD(RecursiveDirectoryIterator, hasChildren)
-{
- zend_bool allow_links = 0;
- zval *object = getThis();
- spl_ce_dir_object *intern = (spl_ce_dir_object*)zend_object_store_get_object(object TSRMLS_CC);
-
- if (!strcmp(intern->entry.d_name, ".") || !strcmp(intern->entry.d_name, "..")) {
- RETURN_BOOL(0);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &allow_links) == FAILURE) {
- return;
- }
- spl_dir_get_path_name(intern);
- if (!allow_links) {
- php_stat(intern->path_name, intern->path_name_len, FS_IS_LINK, return_value TSRMLS_CC);
- if (zend_is_true(return_value)) {
- RETURN_BOOL(0);
- }
- }
- php_stat(intern->path_name, intern->path_name_len, FS_IS_DIR, return_value TSRMLS_CC);
- }
-}
-/* }}} */
-
-/* {{{ proto RecursiveDirectoryIterator DirectoryIterator::getChildren()
- Returns an iterator for the current entry if it is a directory */
-SPL_METHOD(RecursiveDirectoryIterator, getChildren)
-{
- zval *object = getThis(), zpath;
- spl_ce_dir_object *intern = (spl_ce_dir_object*)zend_object_store_get_object(object TSRMLS_CC);
- spl_ce_dir_object *subdir;
-
- spl_dir_get_path_name(intern);
-
- INIT_PZVAL(&zpath);
- ZVAL_STRINGL(&zpath, intern->path_name, intern->path_name_len, 0);
-
- spl_instantiate_arg_ex1(spl_ce_RecursiveDirectoryIterator, &return_value, 0, &zpath TSRMLS_CC);
-
- subdir = (spl_ce_dir_object*)zend_object_store_get_object(return_value TSRMLS_CC);
- if (subdir) {
- if (intern->sub_path && intern->sub_path[0]) {
- subdir->sub_path_len = spprintf(&subdir->sub_path, 0, "%s/%s", intern->sub_path, intern->entry.d_name);
- } else {
- subdir->sub_path_len = strlen(intern->entry.d_name);
- subdir->sub_path = estrndup(intern->entry.d_name, subdir->sub_path_len);
- }
- }
-}
-/* }}} */
-
-/* {{{ proto void RecursiveDirectoryIterator::getSubPath()
- Get sub path */
-SPL_METHOD(RecursiveDirectoryIterator, getSubPath)
-{
- zval *object = getThis();
- spl_ce_dir_object *intern = (spl_ce_dir_object*)zend_object_store_get_object(object TSRMLS_CC);
-
- if (intern->sub_path) {
- RETURN_STRINGL(intern->sub_path, intern->sub_path_len, 1);
- } else {
- RETURN_STRINGL("", 0, 1);
- }
-}
-/* }}} */
-
-/* {{{ proto void RecursiveDirectoryIterator::getSubPathname()
- Get sub path and file name */
-SPL_METHOD(RecursiveDirectoryIterator, getSubPathname)
-{
- zval *object = getThis();
- spl_ce_dir_object *intern = (spl_ce_dir_object*)zend_object_store_get_object(object TSRMLS_CC);
- char *sub_name;
- int len;
-
- if (intern->sub_path) {
- len = spprintf(&sub_name, 0, "%s/%s", intern->sub_path, intern->entry.d_name);
- RETURN_STRINGL(sub_name, len, 0);
- } else {
- RETURN_STRING(intern->entry.d_name, 1);
- }
-}
-/* }}} */
-
-/* define an overloaded iterator structure */
-typedef struct {
- zend_object_iterator intern;
- zval *current;
- spl_ce_dir_object *object;
-} spl_ce_dir_it;
-
-/* forward declarations to the iterator handlers */
-static void spl_ce_dir_it_dtor(zend_object_iterator *iter TSRMLS_DC);
-static int spl_ce_dir_it_valid(zend_object_iterator *iter TSRMLS_DC);
-static void spl_ce_dir_it_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC);
-static int spl_ce_dir_it_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC);
-static void spl_ce_dir_it_move_forward(zend_object_iterator *iter TSRMLS_DC);
-static void spl_ce_dir_it_rewind(zend_object_iterator *iter TSRMLS_DC);
-
-/* iterator handler table */
-zend_object_iterator_funcs spl_ce_dir_it_funcs = {
- spl_ce_dir_it_dtor,
- spl_ce_dir_it_valid,
- spl_ce_dir_it_current_data,
- spl_ce_dir_it_current_key,
- spl_ce_dir_it_move_forward,
- spl_ce_dir_it_rewind
-};
-
-/* {{{ spl_ce_dir_get_iterator */
-zend_object_iterator *spl_ce_dir_get_iterator(zend_class_entry *ce, zval *object TSRMLS_DC)
-{
- spl_ce_dir_it *iterator = emalloc(sizeof(spl_ce_dir_it));
- spl_ce_dir_object *dir_object = (spl_ce_dir_object*)zend_object_store_get_object(object TSRMLS_CC);
-
- object->refcount++;
- iterator->intern.data = (void*)object;
- iterator->intern.funcs = &spl_ce_dir_it_funcs;
- iterator->current = object;
- object->refcount++;
- iterator->object = dir_object;
-
- return (zend_object_iterator*)iterator;
-}
-/* }}} */
-
-/* {{{ spl_ce_dir_it_dtor */
-static void spl_ce_dir_it_dtor(zend_object_iterator *iter TSRMLS_DC)
-{
- spl_ce_dir_it *iterator = (spl_ce_dir_it *)iter;
-
- zval_ptr_dtor(&iterator->current);
- zval_ptr_dtor((zval**)&iterator->intern.data);
-
- efree(iterator);
-}
-/* }}} */
-
-/* {{{ spl_ce_dir_it_valid */
-static int spl_ce_dir_it_valid(zend_object_iterator *iter TSRMLS_DC)
-{
- spl_ce_dir_it *iterator = (spl_ce_dir_it *)iter;
- spl_ce_dir_object *object = iterator->object;
-
- return object->entry.d_name[0] != '\0' ? SUCCESS : FAILURE;
-}
-/* }}} */
-
-
-/* {{{ spl_ce_dir_it_current_data */
-static void spl_ce_dir_it_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC)
-{
- spl_ce_dir_it *iterator = (spl_ce_dir_it *)iter;
-
- *data = &iterator->current;
-}
-/* }}} */
-
-/* {{{ spl_ce_dir_it_current_key */
-static int spl_ce_dir_it_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
-{
- spl_ce_dir_it *iterator = (spl_ce_dir_it *)iter;
- spl_ce_dir_object *object = iterator->object;
-
- *int_key = object->index;
- return HASH_KEY_IS_LONG;
-}
-/* }}} */
-
-/* {{{ spl_ce_dir_it_move_forward */
-static void spl_ce_dir_it_move_forward(zend_object_iterator *iter TSRMLS_DC)
-{
- spl_ce_dir_it *iterator = (spl_ce_dir_it *)iter;
- spl_ce_dir_object *object = iterator->object;
-
- object->index++;
- if (!object->dirp || !php_stream_readdir(object->dirp, &object->entry)) {
- object->entry.d_name[0] = '\0';
- }
- if (object->path_name) {
- efree(object->path_name);
- object->path_name = NULL;
- }
-}
-/* }}} */
-
-/* {{{ spl_ce_dir_it_rewind */
-static void spl_ce_dir_it_rewind(zend_object_iterator *iter TSRMLS_DC)
-{
- spl_ce_dir_it *iterator = (spl_ce_dir_it *)iter;
- spl_ce_dir_object *object = iterator->object;
-
- object->index = 0;
- if (object->dirp) {
- php_stream_rewinddir(object->dirp);
- }
- if (!object->dirp || !php_stream_readdir(object->dirp, &object->entry)) {
- object->entry.d_name[0] = '\0';
- }
-}
-/* }}} */
-
-/* {{{ spl_ce_dir_tree_it_current_key */
-static int spl_ce_dir_tree_it_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
-{
- spl_ce_dir_it *iterator = (spl_ce_dir_it *)iter;
- spl_ce_dir_object *object = iterator->object;
-
- spl_dir_get_path_name(object);
- *str_key_len = object->path_name_len + 1;
- *str_key = estrndup(object->path_name, object->path_name_len);
- return HASH_KEY_IS_STRING;
-}
-/* }}} */
-
-/* {{{ spl_ce_dir_tree_it_move_forward */
-static void spl_ce_dir_tree_it_move_forward(zend_object_iterator *iter TSRMLS_DC)
-{
- spl_ce_dir_it *iterator = (spl_ce_dir_it *)iter;
- spl_ce_dir_object *object = iterator->object;
-
- object->index++;
- do {
- if (!object->dirp || !php_stream_readdir(object->dirp, &object->entry)) {
- object->entry.d_name[0] = '\0';
- }
- } while (!strcmp(object->entry.d_name, ".") || !strcmp(object->entry.d_name, ".."));
- if (object->path_name) {
- efree(object->path_name);
- object->path_name = NULL;
- }
-}
-/* }}} */
-
-/* {{{ spl_ce_dir_tree_it_rewind */
-static void spl_ce_dir_tree_it_rewind(zend_object_iterator *iter TSRMLS_DC)
-{
- spl_ce_dir_it *iterator = (spl_ce_dir_it *)iter;
- spl_ce_dir_object *object = iterator->object;
-
- object->index = 0;
- if (object->dirp) {
- php_stream_rewinddir(object->dirp);
- }
- do {
- if (!object->dirp || !php_stream_readdir(object->dirp, &object->entry)) {
- object->entry.d_name[0] = '\0';
- }
- } while (!strcmp(object->entry.d_name, ".") || !strcmp(object->entry.d_name, ".."));
-}
-/* }}} */
-
-/* iterator handler table */
-zend_object_iterator_funcs spl_ce_dir_tree_it_funcs = {
- spl_ce_dir_it_dtor,
- spl_ce_dir_it_valid,
- spl_ce_dir_it_current_data,
- spl_ce_dir_tree_it_current_key,
- spl_ce_dir_tree_it_move_forward,
- spl_ce_dir_tree_it_rewind
-};
-
-/* {{{ spl_ce_dir_get_iterator */
-zend_object_iterator *spl_ce_dir_tree_get_iterator(zend_class_entry *ce, zval *object TSRMLS_DC)
-{
- spl_ce_dir_it *iterator = emalloc(sizeof(spl_ce_dir_it));
- spl_ce_dir_object *dir_object = (spl_ce_dir_object*)zend_object_store_get_object(object TSRMLS_CC);
-
- object->refcount++;
- iterator->intern.data = (void*)object;
- iterator->intern.funcs = &spl_ce_dir_tree_it_funcs;
- iterator->current = object;
- object->refcount++;
- iterator->object = dir_object;
-
- return (zend_object_iterator*)iterator;
-}
-/* }}} */
-
-/* {{{ spl_ce_dir_cast */
-static int spl_ce_dir_cast(zval *readobj, zval *writeobj, int type, int should_free TSRMLS_DC)
-{
- zval free_obj;
- spl_ce_dir_object *dir_object = (spl_ce_dir_object*)zend_object_store_get_object(readobj TSRMLS_CC);
-
- if (type ==IS_STRING && *dir_object->entry.d_name) {
- if (should_free) {
- free_obj = *writeobj;
- }
- ZVAL_STRING(writeobj, dir_object->entry.d_name, 1);
- if (should_free) {
- zval_dtor(&free_obj);
- }
- return SUCCESS;
- }
- return FAILURE;
-}
-/* }}} */
-
-/* declare method parameters */
-/* supply a name and default to call by parameter */
-static
-ZEND_BEGIN_ARG_INFO(arginfo_dir___construct, 0)
- ZEND_ARG_INFO(0, path) /* parameter name */
-ZEND_END_ARG_INFO();
-
-static
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dir_openFile, 0, 0, 0)
- ZEND_ARG_INFO(0, open_mode)
- ZEND_ARG_INFO(0, use_include_path)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO();
-
-/* the method table */
-/* each method can have its own parameters and visibility */
-static zend_function_entry spl_ce_dir_class_functions[] = {
- SPL_ME(DirectoryIterator, __construct, arginfo_dir___construct, ZEND_ACC_PUBLIC)
- SPL_ME(DirectoryIterator, rewind, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(DirectoryIterator, valid, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(DirectoryIterator, key, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(DirectoryIterator, current, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(DirectoryIterator, next, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(DirectoryIterator, getPath, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(DirectoryIterator, getFilename, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(DirectoryIterator, getPathname, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(DirectoryIterator, getPerms, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(DirectoryIterator, getInode, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(DirectoryIterator, getSize, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(DirectoryIterator, getOwner, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(DirectoryIterator, getGroup, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(DirectoryIterator, getATime, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(DirectoryIterator, getMTime, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(DirectoryIterator, getCTime, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(DirectoryIterator, getType, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(DirectoryIterator, isWritable, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(DirectoryIterator, isReadable, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(DirectoryIterator, isExecutable, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(DirectoryIterator, isFile, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(DirectoryIterator, isDir, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(DirectoryIterator, isLink, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(DirectoryIterator, isDot, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(DirectoryIterator, openFile, arginfo_dir_openFile, ZEND_ACC_PUBLIC)
- SPL_MA(DirectoryIterator, __toString, DirectoryIterator, getFilename, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry spl_ce_dir_tree_class_functions[] = {
- SPL_ME(RecursiveDirectoryIterator, rewind, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(RecursiveDirectoryIterator, next, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(RecursiveDirectoryIterator, key, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(RecursiveDirectoryIterator, hasChildren, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(RecursiveDirectoryIterator, getChildren, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(RecursiveDirectoryIterator, getSubPath, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(RecursiveDirectoryIterator, getSubPathname,NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-static void spl_file_object_free_line(spl_file_object *intern TSRMLS_DC) /* {{{ */
-{
- if (intern->current_line) {
- efree(intern->current_line);
- intern->current_line = NULL;
- }
- if (intern->current_zval) {
- zval_ptr_dtor(&intern->current_zval);
- intern->current_zval = NULL;
- }
-} /* }}} */
-
-static void spl_file_object_free_storage(void *object TSRMLS_DC) /* {{{ */
-{
- spl_file_object *intern = (spl_file_object*)object;
-
- zend_hash_destroy(intern->std.properties);
- FREE_HASHTABLE(intern->std.properties);
-
- if (intern->stream) {
- if (intern->zcontext) {
-/* zend_list_delref(Z_RESVAL_P(intern->zcontext));*/
- }
- if (!intern->stream->is_persistent) {
- php_stream_free(intern->stream, PHP_STREAM_FREE_CLOSE);
- } else {
- php_stream_free(intern->stream, PHP_STREAM_FREE_CLOSE_PERSISTENT);
- }
- if (intern->file_name) {
- efree(intern->file_name);
- }
- if (intern->open_mode) {
- efree(intern->open_mode);
- }
- }
- spl_file_object_free_line(intern TSRMLS_CC);
- efree(object);
-} /* }}} */
-
-static zend_object_value spl_file_object_new_ex(zend_class_entry *class_type, spl_file_object **obj TSRMLS_DC) /* {{{ */
-{
- zend_object_value retval;
- spl_file_object *intern;
- zval *tmp;
-
- intern = emalloc(sizeof(spl_ce_dir_object));
- memset(intern, 0, sizeof(spl_ce_dir_object));
- intern->std.ce = class_type;
- if (obj) *obj = intern;
-
- ALLOC_HASHTABLE(intern->std.properties);
- zend_hash_init(intern->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
-
- retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t) zend_objects_destroy_object, (zend_objects_free_object_storage_t) spl_file_object_free_storage, NULL TSRMLS_CC);
- retval.handlers = &spl_ce_dir_handlers;
- return retval;
-} /* }}} */
-
-static zend_object_value spl_file_object_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
-{
- return spl_file_object_new_ex(class_type, NULL TSRMLS_CC);
-} /* }}} */
-
-static int spl_file_object_read(spl_file_object *intern, int silent TSRMLS_DC) /* {{{ */
-{
- char *buf;
- size_t line_len;
- int len;
- long line_add = (intern->current_line || intern->current_zval) ? 1 : 0;
-
- spl_file_object_free_line(intern TSRMLS_CC);
-
- if (php_stream_eof(intern->stream)) {
- if (!silent) {
- zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Cannot read from file %s", intern->file_name);
- }
- return FAILURE;
- }
-
- buf = php_stream_get_line(intern->stream, NULL, intern->max_line_len, &line_len);
-
- if (!buf) {
- intern->current_line = estrdup("");
- intern->current_line_len = 0;
- } else {
- if (intern->flags & SPL_FILE_OBJECT_DROP_NEW_LINE) {
- line_len = strcspn(buf, "\r\n");
- buf[line_len] = '\0';
- }
-
- if (PG(magic_quotes_runtime)) {
- buf = php_addslashes(buf, line_len, &len, 1 TSRMLS_CC);
- line_len = len;
- }
-
- intern->current_line = buf;
- intern->current_line_len = line_len;
- }
- intern->current_line_num += line_add;
-
- return SUCCESS;
-} /* }}} */
-
-static int spl_file_object_read_line(zval * this_ptr, spl_file_object *intern, int silent TSRMLS_DC) /* {{{ */
-{
- zval *retval;
-
- /* if overloaded call the function, otherwise do it directly */
- if (intern->func_getCurr->common.scope != spl_ce_FileObject) {
- if (php_stream_eof(intern->stream)) {
- if (!silent) {
- zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Cannot read from file %s", intern->file_name);
- }
- return FAILURE;
- }
- zend_call_method_with_0_params(&getThis(), Z_OBJCE_P(getThis()), &intern->func_getCurr, "getCurrentLine", &retval);
- if (retval) {
- if (intern->current_line || intern->current_zval) {
- intern->current_line_num++;
- }
- spl_file_object_free_line(intern TSRMLS_CC);
- if (Z_TYPE_P(retval) == IS_STRING) {
- intern->current_line = estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval));
- intern->current_line_len = Z_STRLEN_P(retval);
- } else {
- MAKE_STD_ZVAL(intern->current_zval);
- ZVAL_ZVAL(intern->current_zval, retval, 1, 0);
- }
- zval_ptr_dtor(&retval);
- return SUCCESS;
- } else {
- return FAILURE;
- }
- } else {
- return spl_file_object_read(intern, silent TSRMLS_CC);
- }
-} /* }}} */
-
-static void spl_file_object_rewind(spl_file_object *intern TSRMLS_DC) /* {{{ */
-{
- if (-1 == php_stream_rewind(intern->stream)) {
- zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Cannot rewind file %s", intern->file_name);
- } else {
- spl_file_object_free_line(intern TSRMLS_CC);
- intern->current_line_num = 0;
- }
-} /* }}} */
-
-static int spl_file_object_open(spl_file_object *intern, int use_include_path, int silent TSRMLS_DC) /* {{{ */
-{
- intern->context = php_stream_context_from_zval(intern->zcontext, 0);
- intern->stream = php_stream_open_wrapper_ex(intern->file_name, intern->open_mode, (use_include_path ? USE_PATH : 0) | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, intern->context);
-
- if (intern->stream == NULL) {
- if (!EG(exception)) {
- zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Cannot open file %s", intern->file_name);
- }
- return FAILURE;
- }
-
- if (intern->zcontext) {
- zend_list_addref(Z_RESVAL_P(intern->zcontext));
- }
-
- intern->file_name = estrndup(intern->file_name, intern->file_name_len);
- intern->open_mode = estrndup(intern->open_mode, intern->open_mode_len);
-
- /* avoid reference counting in debug mode, thus do it manually */
- ZVAL_RESOURCE(&intern->zresource, php_stream_get_resource_id(intern->stream));
- intern->zresource.refcount = 1;
-
- zend_hash_find(&intern->std.ce->function_table, "getcurrentline", sizeof("getcurrentline"), (void **) &intern->func_getCurr);
-
- return SUCCESS;
-} /* }}} */
-
-/* {{{ proto void FileObject::__construct(string filename [, string mode = 'r' [, bool use_include_path [, resource context]]]])
- Construct a new file reader */
-SPL_METHOD(FileObject, __construct)
-{
- spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- zend_bool use_include_path = 0;
-
- php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC);
-
- intern->open_mode = "r";
- intern->open_mode_len = 1;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sbr",
- &intern->file_name, &intern->file_name_len,
- &intern->open_mode, &intern->open_mode_len,
- &use_include_path, &intern->zcontext) == FAILURE) {
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
- return;
- }
-
- spl_file_object_open(intern, use_include_path, 0 TSRMLS_CC);
-
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
-} /* }}} */
-
-/* {{{ proto void FileObject::rewind()
- Rewind the file and read the first line */
-SPL_METHOD(FileObject, rewind)
-{
- spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- spl_file_object_rewind(intern TSRMLS_CC);
-} /* }}} */
-
-/* {{{ proto string FileObject::getFilename()
- Return the filename */
-SPL_METHOD(FileObject, getFilename)
-{
- spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- RETURN_STRINGL(intern->file_name, intern->file_name_len, 1);
-} /* }}} */
-
-/* {{{ proto void FileObject::eof()
- Return whether end of file is reached */
-SPL_METHOD(FileObject, eof)
-{
- spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- RETURN_BOOL(php_stream_eof(intern->stream));
-} /* }}} */
-
-/* {{{ proto void FileObject::valid()
- Return !eof() */
-SPL_METHOD(FileObject, valid)
-{
- spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- RETVAL_BOOL(!php_stream_eof(intern->stream));
-} /* }}} */
-
-/* {{{ proto string FileObject::fgets()
- Rturn next line from file */
-SPL_METHOD(FileObject, fgets)
-{
- spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- if (spl_file_object_read(intern, 0 TSRMLS_CC) == FAILURE) {
- RETURN_FALSE;
- }
- RETURN_STRINGL(intern->current_line, intern->current_line_len, 1);
-} /* }}} */
-
-/* {{{ proto string FileObject::current()
- Return current line from file */
-SPL_METHOD(FileObject, current)
-{
- spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- if (!intern->current_line) {
- spl_file_object_read_line(getThis(), intern, 1 TSRMLS_CC);
- }
- if (intern->current_line) {
- RETURN_STRINGL(intern->current_line, intern->current_line_len, 1);
- } else if (intern->current_zval) {
- RETURN_ZVAL(intern->current_zval, 1, 0);
- }
- RETURN_FALSE;
-} /* }}} */
-
-/* {{{ proto int FileObject::key()
- Return line number */
-SPL_METHOD(FileObject, key)
-{
- spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
-/* Do not read the next line to support correct counting with fgetc()
- if (!intern->current_line) {
- spl_file_object_read_line(getThis(), intern, 1 TSRMLS_CC);
- } */
- RETURN_LONG(intern->current_line_num);
-} /* }}} */
-
-/* {{{ proto void FileObject::next()
- Read next line */
-SPL_METHOD(FileObject, next)
-{
- spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- spl_file_object_free_line(intern TSRMLS_CC);
- intern->current_line_num++;
-} /* }}} */
-
-/* {{{ proto void FileObject::setFlags(int flags)
- Set file handling flags */
-SPL_METHOD(FileObject, setFlags)
-{
- spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intern->flags);
-} /* }}} */
-
-/* {{{ proto int FileObject::getFlags()
- Get file handling flags */
-SPL_METHOD(FileObject, getFlags)
-{
- spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- RETURN_LONG(intern->flags);
-} /* }}} */
-
-/* {{{ proto void FileObject::setMaxLineLen(int max_len)
- Set maximum line length */
-SPL_METHOD(FileObject, setMaxLineLen)
-{
- long max_len;
-
- spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &max_len) == FAILURE) {
- return;
- }
-
- if (max_len < 0) {
- zend_throw_exception_ex(spl_ce_DomainException, 0 TSRMLS_CC, "Maximum line length must be greater than or equal zero");
- return;
- }
-
- intern->max_line_len = max_len;
-} /* }}} */
-
-/* {{{ proto int FileObject::getMaxLineLen()
- Get maximum line length */
-SPL_METHOD(FileObject, getMaxLineLen)
-{
- spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- RETURN_LONG((long)intern->max_line_len);
-} /* }}} */
-
-/* {{{ proto bool hasChildren()
- Rturn false */
-SPL_METHOD(FileObject, hasChildren)
-{
- RETURN_FALSE;
-} /* }}} */
-
-/* {{{ proto bool FileObject::getChildren()
- Read NULL */
-SPL_METHOD(FileObject, getChildren)
-{
- /* return NULL */
-} /* }}} */
-
-static int spl_file_object_call(INTERNAL_FUNCTION_PARAMETERS, spl_file_object *intern, zend_function *func_ptr, zval *arg2) /* {{{ */
-{
- zend_fcall_info fci;
- zend_fcall_info_cache fcic;
- zval z_fname;
- zval * zresource_ptr = &intern->zresource, *retval;
- int result;
-
- zval ***params = (zval***)safe_emalloc(ZEND_NUM_ARGS(), sizeof(zval**), (arg2 ? 2 : 1) * sizeof(zval**));
-
- params[0] = &zresource_ptr;
-
- if (arg2) {
- params[1] = &arg2;
- }
-
- zend_get_parameters_array_ex(ZEND_NUM_ARGS(), params+(arg2 ? 2 : 1));
-
- ZVAL_STRING(&z_fname, func_ptr->common.function_name, 0);
-
- fci.size = sizeof(fci);
- fci.function_table = EG(function_table);
- fci.object_pp = NULL;
- fci.function_name = &z_fname;
- fci.retval_ptr_ptr = &retval;
- fci.param_count = ZEND_NUM_ARGS() + (arg2 ? 2 : 1);
- fci.params = params;
- fci.no_separation = 1;
- fci.symbol_table = NULL;
-
- fcic.initialized = 1;
- fcic.function_handler = func_ptr;
- fcic.calling_scope = NULL;
- fcic.object_pp = NULL;
-
- result = zend_call_function(&fci, &fcic TSRMLS_CC);
-
- ZVAL_ZVAL(return_value, retval, 1, 1);
-
- efree(params);
- return result;
-} /* }}} */
-
-#define FileFunctionCall(func_name, arg2) \
-{ \
- zend_function *func_ptr; \
- zend_hash_find(EG(function_table), #func_name, sizeof(#func_name), (void **) &func_ptr); \
- spl_file_object_call(INTERNAL_FUNCTION_PARAM_PASSTHRU, intern, func_ptr, arg2); \
-}
-
-/* {{{ FileFunction */
-#define FileFunction(func_name) \
-SPL_METHOD(FileObject, func_name) \
-{ \
- spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC); \
- FileFunctionCall(func_name, NULL); \
-}
-/* }}} */
-
-/* {{{ proto array FileObject::fgetcsv([string delimiter [, string enclosure]])
- Return current line as csv */
-SPL_METHOD(FileObject, fgetcsv)
-{
- spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- zval *arg2 = NULL;
- MAKE_STD_ZVAL(arg2);
- ZVAL_LONG(arg2, intern->max_line_len);
-
- spl_file_object_free_line(intern TSRMLS_CC);
- intern->current_line_num++;
-
- FileFunctionCall(fgetcsv, arg2);
-
- zval_ptr_dtor(&arg2);
-}
-/* }}} */
-
-/* {{{ proto bool FileObject::flock(int operation [, int &wouldblock])
- Portable file locking */
-FileFunction(flock)
-/* }}} */
-
-/* {{{ proto bool FileObject::fflush()
- Flush the file */
-SPL_METHOD(FileObject, fflush)
-{
- spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- RETURN_BOOL(!php_stream_flush(intern->stream));
-} /* }}} */
-
-
-/* {{{ proto int FileObject::ftell()
- Return current file position */
-SPL_METHOD(FileObject, ftell)
-{
- spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- long ret = php_stream_tell(intern->stream);
-
- if (ret == -1) {
- RETURN_FALSE;
- } else {
- RETURN_LONG(ret);
- }
-} /* }}} */
-
-/* {{{ proto int FileObject::fseek(int pos [, int whence = SEEK_SET])
- Return current file position */
-SPL_METHOD(FileObject, fseek)
-{
- spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- long pos, whence = SEEK_SET;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &pos, &whence) == FAILURE) {
- return;
- }
-
- spl_file_object_free_line(intern TSRMLS_CC);
- RETURN_LONG(php_stream_seek(intern->stream, pos, whence));
-} /* }}} */
-
-/* {{{ proto int FileObject::fgetc()
- Get a character form the file */
-SPL_METHOD(FileObject, fgetc)
-{
- spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- char buf[2];
- int result;
-
- spl_file_object_free_line(intern TSRMLS_CC);
-
- result = php_stream_getc(intern->stream);
-
- if (result == EOF) {
- RETVAL_FALSE;
- } else {
- if (result == '\n') {
- intern->current_line_num++;
- }
- buf[0] = result;
- buf[1] = '\0';
-
- RETURN_STRINGL(buf, 1, 1);
- }
-} /* }}} */
-
-/* {{{ proto string FileObject::fgetss([string allowable_tags])
- Get a line from file pointer and strip HTML tags */
-SPL_METHOD(FileObject, fgetss)
-{
- spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- zval *arg2 = NULL;
- MAKE_STD_ZVAL(arg2);
- ZVAL_LONG(arg2, intern->max_line_len);
-
- spl_file_object_free_line(intern TSRMLS_CC);
- intern->current_line_num++;
-
- FileFunctionCall(fgetss, arg2);
-
- zval_ptr_dtor(&arg2);
-} /* }}} */
-
-/* {{{ proto int FileObject::fpassthru()
- Output all remaining data from a file pointer */
-SPL_METHOD(FileObject, fpassthru)
-{
- spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- RETURN_LONG(php_stream_passthru(intern->stream));
-} /* }}} */
-
-/* {{{ proto bool FileObject::fscanf(string format [, string ...])
- Implements a mostly ANSI compatible fscanf() */
-SPL_METHOD(FileObject, fscanf)
-{
- spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- spl_file_object_free_line(intern TSRMLS_CC);
- intern->current_line_num++;
-
- FileFunctionCall(fscanf, NULL);
-}
-/* }}} */
-
-/* {{{ proto mixed FileObject::fwrite(string str [, int length])
- Binary-safe file write */
-SPL_METHOD(FileObject, fwrite)
-{
- spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- char *str;
- int str_len;
- int ret;
- long length;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &length) == FAILURE) {
- return;
- }
-
- if (ZEND_NUM_ARGS() < 2) {
- str_len = MAX(0, MIN(length, str_len));
- }
- if (!str_len) {
- RETURN_LONG(0);
- }
-
- if (PG(magic_quotes_runtime)) {
- str = estrndup(str, str_len);
- php_stripslashes(str, &str_len TSRMLS_CC);
- ret = php_stream_write(intern->stream, str, str_len);
- efree(str);
- RETURN_LONG(ret);
- }
-
- RETURN_LONG(php_stream_write(intern->stream, str, str_len));
-} /* }}} */
-
-/* {{{ proto bool FileObject::fstat()
- Stat() on a filehandle */
-FileFunction(fstat)
-/* }}} */
-
-/* {{{ proto bool FileObject::ftruncate(int size)
- Truncate file to 'size' length */
-SPL_METHOD(FileObject, ftruncate)
-{
- spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- long size;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &size) == FAILURE) {
- return;
- }
-
- if (!php_stream_truncate_supported(intern->stream)) {
- zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Can't truncate file %s", intern->file_name);
- RETURN_FALSE;
- }
-
- RETURN_BOOL(0 == php_stream_truncate_set_size(intern->stream, size));
-} /* }}} */
-
-/* {{{ proto void FileObject::seek(int line_pos)
- Seek to specified line */
-SPL_METHOD(FileObject, seek)
-{
- spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- long line_pos;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &line_pos) == FAILURE) {
- return;
- }
- if (line_pos < 0) {
- zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Can't seek file %s to negative line %ld", intern->file_name, line_pos);
- RETURN_FALSE;
- }
-
- spl_file_object_rewind(intern TSRMLS_CC);
-
- while(intern->current_line_num < line_pos) {
- spl_file_object_read_line(getThis(), intern, 1 TSRMLS_CC);
- }
-}
-
-static
-ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object___construct, 0, 0, 1)
- ZEND_ARG_INFO(0, file_name)
- ZEND_ARG_INFO(0, open_mode)
- ZEND_ARG_INFO(0, use_include_path)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO();
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_file_object_setFlags, 0)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO();
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_file_object_setMaxLineLen, 0)
- ZEND_ARG_INFO(0, max_len)
-ZEND_END_ARG_INFO();
-
-static
-ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fgetcsv, 0, 0, 0)
- ZEND_ARG_INFO(0, delimiter)
- ZEND_ARG_INFO(0, enclosure)
-ZEND_END_ARG_INFO();
-
-static
-ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_flock, 0, 0, 1)
- ZEND_ARG_INFO(0, operation)
- ZEND_ARG_INFO(1, wouldblock])
-ZEND_END_ARG_INFO();
-
-static
-ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fseek, 0, 0, 1)
- ZEND_ARG_INFO(0, pos)
- ZEND_ARG_INFO(0, whence)
-ZEND_END_ARG_INFO();
-
-static
-ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fgetss, 0, 0, 0)
- ZEND_ARG_INFO(0, allowable_tags)
-ZEND_END_ARG_INFO();
-
-static
-ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fscanf, 0, 0, 1)
- ZEND_ARG_INFO(0, format)
-ZEND_END_ARG_INFO();
-
-static
-ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fwrite, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO();
-
-static
-ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_ftruncate, 0, 0, 1)
- ZEND_ARG_INFO(0, size)
-ZEND_END_ARG_INFO();
-
-static
-ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_seek, 0, 0, 1)
- ZEND_ARG_INFO(0, line_pos)
-ZEND_END_ARG_INFO();
-
-static zend_function_entry spl_file_object_class_functions[] = {
- SPL_ME(FileObject, __construct, arginfo_file_object___construct, ZEND_ACC_PUBLIC)
- SPL_ME(FileObject, getFilename, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(FileObject, rewind, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(FileObject, eof, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(FileObject, valid, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(FileObject, fgets, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(FileObject, fgetcsv, arginfo_file_object_fgetcsv, ZEND_ACC_PUBLIC)
- SPL_ME(FileObject, flock, arginfo_file_object_flock, ZEND_ACC_PUBLIC)
- SPL_ME(FileObject, fflush, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(FileObject, ftell, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(FileObject, fseek, arginfo_file_object_fseek, ZEND_ACC_PUBLIC)
- SPL_ME(FileObject, fgetc, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(FileObject, fpassthru, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(FileObject, fgetss, arginfo_file_object_fgetss, ZEND_ACC_PUBLIC)
- SPL_ME(FileObject, fscanf, arginfo_file_object_fscanf, ZEND_ACC_PUBLIC)
- SPL_ME(FileObject, fwrite, arginfo_file_object_fwrite, ZEND_ACC_PUBLIC)
- SPL_ME(FileObject, fstat, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(FileObject, ftruncate, arginfo_file_object_ftruncate, ZEND_ACC_PUBLIC)
- SPL_ME(FileObject, current, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(FileObject, key, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(FileObject, next, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(FileObject, setFlags, arginfo_file_object_setFlags, ZEND_ACC_PUBLIC)
- SPL_ME(FileObject, getFlags, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(FileObject, setMaxLineLen, arginfo_file_object_setMaxLineLen, ZEND_ACC_PUBLIC)
- SPL_ME(FileObject, getMaxLineLen, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(FileObject, hasChildren, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(FileObject, getChildren, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(FileObject, seek, arginfo_file_object_seek, ZEND_ACC_PUBLIC)
- // mappings
- SPL_MA(FileObject, getCurrentLine, FileObject, fgets, NULL, ZEND_ACC_PUBLIC)
- SPL_MA(FileObject, __toString, FileObject, current, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-/* {{{ PHP_MINIT_FUNCTION(spl_directory)
- */
-PHP_MINIT_FUNCTION(spl_directory)
-{
- REGISTER_SPL_STD_CLASS_EX(DirectoryIterator, spl_ce_dir_object_new, spl_ce_dir_class_functions);
- zend_class_implements(spl_ce_DirectoryIterator TSRMLS_CC, 1, zend_ce_iterator);
- memcpy(&spl_ce_dir_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
- spl_ce_dir_handlers.clone_obj = spl_ce_dir_object_clone;
- spl_ce_dir_handlers.cast_object = spl_ce_dir_cast;
-
- spl_ce_DirectoryIterator->get_iterator = spl_ce_dir_get_iterator;
-
- REGISTER_SPL_SUB_CLASS_EX(RecursiveDirectoryIterator, DirectoryIterator, spl_ce_dir_object_new, spl_ce_dir_tree_class_functions);
- REGISTER_SPL_IMPLEMENTS(RecursiveDirectoryIterator, RecursiveIterator);
-
- spl_ce_RecursiveDirectoryIterator->get_iterator = spl_ce_dir_tree_get_iterator;
-
- REGISTER_SPL_STD_CLASS_EX(FileObject, spl_file_object_new, spl_file_object_class_functions);
- REGISTER_SPL_IMPLEMENTS(FileObject, RecursiveIterator);
- REGISTER_SPL_IMPLEMENTS(FileObject, SeekableIterator);
-
- REGISTER_LONG_CONSTANT("FO_DROP_NEW_LINE", (long)SPL_FILE_OBJECT_DROP_NEW_LINE, CONST_CS | CONST_PERSISTENT);
-
- return SUCCESS;
-}
-/* }}} */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/spl/spl_directory.h b/ext/spl/spl_directory.h
deleted file mode 100755
index 0a6d98e74e..0000000000
--- a/ext/spl/spl_directory.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 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> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef SPL_DIRECTORY_H
-#define SPL_DIRECTORY_H
-
-#include "php.h"
-#include "php_spl.h"
-
-extern PHPAPI zend_class_entry *spl_ce_DirectoryIterator;
-extern PHPAPI zend_class_entry *spl_ce_RecursiveDirectoryIterator;
-extern PHPAPI zend_class_entry *spl_ce_FileObject;
-
-PHP_MINIT_FUNCTION(spl_directory);
-
-typedef struct _spl_ce_dir_object {
- zend_object std;
- php_stream *dirp;
- php_stream_dirent entry;
- char *path;
- char *path_name;
- int path_name_len;
- char *sub_path;
- int sub_path_len;
- int index;
-} spl_ce_dir_object;
-
-typedef struct _spl_file_object {
- zend_object std;
- php_stream *stream;
- php_stream_context *context;
- zval *zcontext;
- char *file_name;
- int file_name_len;
- char *open_mode;
- int open_mode_len;
- zval *current_zval;
- char *current_line;
- size_t current_line_len;
- size_t max_line_len;
- long current_line_num;
- long flags;
- zval zresource;
- zend_function *func_getCurr;
-} spl_file_object;
-
-#define SPL_FILE_OBJECT_DROP_NEW_LINE 0x00000001 /* drop new lines */
-
-#endif /* SPL_DIRECTORY_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 7ba631b4a9..0000000000
--- a/ext/spl/spl_engine.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 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_interfaces.h"
-
-#include "php_spl.h"
-#include "spl_functions.h"
-#include "spl_engine.h"
-
-#include "spl_array.h"
-
-/* {{{ spl_instantiate */
-void spl_instantiate(zend_class_entry *pce, zval **object, int alloc TSRMLS_DC)
-{
- if (alloc) {
- ALLOC_ZVAL(*object);
- }
- object_init_ex(*object, pce);
- (*object)->refcount = 1;
- (*object)->is_ref = 1; /* check if this can be hold always */
-}
-/* }}} */
-
-/* {{{ 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;
-}
-/* }}} */
-
-/*
- * 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 08820833c9..0000000000
--- a/ext/spl/spl_engine.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 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> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef SPL_ENGINE_H
-#define SPL_ENGINE_H
-
-#include "php.h"
-#include "php_spl.h"
-#include "zend_interfaces.h"
-
-/* {{{ 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;
- }
-}
-/* }}} */
-
-void spl_instantiate(zend_class_entry *pce, zval **object, int alloc TSRMLS_DC);
-
-/* {{{ spl_instantiate_arg_ex1 */
-static inline int spl_instantiate_arg_ex1(zend_class_entry *pce, zval **retval, int alloc, zval *arg1 TSRMLS_DC)
-{
- spl_instantiate(pce, retval, alloc TSRMLS_CC);
-
- zend_call_method(retval, pce, &pce->constructor, pce->constructor->common.function_name, strlen(pce->constructor->common.function_name), NULL, 1, arg1, NULL TSRMLS_CC);
- return 0;
-}
-/* }}} */
-
-/* {{{ spl_instantiate_arg_ex2 */
-static inline int spl_instantiate_arg_ex2(zend_class_entry *pce, zval **retval, int alloc, zval *arg1, zval *arg2 TSRMLS_DC)
-{
- spl_instantiate(pce, retval, alloc TSRMLS_CC);
-
- zend_call_method(retval, pce, &pce->constructor, pce->constructor->common.function_name, strlen(pce->constructor->common.function_name), NULL, 2, arg1, arg2 TSRMLS_CC);
- return 0;
-}
-/* }}} */
-
-int spl_is_instance_of(zval **obj, zend_class_entry *ce TSRMLS_DC);
-
-#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_exceptions.c b/ext/spl/spl_exceptions.c
deleted file mode 100755
index 8d0bbfa060..0000000000
--- a/ext/spl/spl_exceptions.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 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> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "zend_interfaces.h"
-#include "zend_exceptions.h"
-
-#include "php_spl.h"
-#include "spl_functions.h"
-#include "spl_engine.h"
-#include "spl_exceptions.h"
-
-PHPAPI zend_class_entry *spl_ce_LogicException;
-PHPAPI zend_class_entry *spl_ce_BadFunctionCallException;
-PHPAPI zend_class_entry *spl_ce_BadMethodCallException;
-PHPAPI zend_class_entry *spl_ce_DomainException;
-PHPAPI zend_class_entry *spl_ce_InvalidArgumentException;
-PHPAPI zend_class_entry *spl_ce_LengthException;
-PHPAPI zend_class_entry *spl_ce_OutOfRangeException;
-PHPAPI zend_class_entry *spl_ce_RuntimeException;
-PHPAPI zend_class_entry *spl_ce_OutOfBoundsException;
-PHPAPI zend_class_entry *spl_ce_OverflowException;
-PHPAPI zend_class_entry *spl_ce_RangeException;
-PHPAPI zend_class_entry *spl_ce_UnderflowException;
-PHPAPI zend_class_entry *spl_ce_UnexpectedValueException;
-
-#define spl_ce_Exception zend_exception_get_default()
-
-/* {{{ PHP_MINIT_FUNCTION(spl_exceptions) */
-PHP_MINIT_FUNCTION(spl_exceptions)
-{
- REGISTER_SPL_SUB_CLASS_EX(LogicException, Exception, NULL, NULL);
- REGISTER_SPL_SUB_CLASS_EX(BadFunctionCallException, LogicException, NULL, NULL);
- REGISTER_SPL_SUB_CLASS_EX(BadMethodCallException, BadFunctionCallException, NULL, NULL);
- REGISTER_SPL_SUB_CLASS_EX(DomainException, LogicException, NULL, NULL);
- REGISTER_SPL_SUB_CLASS_EX(InvalidArgumentException, LogicException, NULL, NULL);
- REGISTER_SPL_SUB_CLASS_EX(LengthException, LogicException, NULL, NULL);
- REGISTER_SPL_SUB_CLASS_EX(OutOfRangeException, LogicException, NULL, NULL);
-
- REGISTER_SPL_SUB_CLASS_EX(RuntimeException, Exception, NULL, NULL);
- REGISTER_SPL_SUB_CLASS_EX(OutOfBoundsException, RuntimeException, NULL, NULL);
- REGISTER_SPL_SUB_CLASS_EX(OverflowException, RuntimeException, NULL, NULL);
- REGISTER_SPL_SUB_CLASS_EX(RangeException, RuntimeException, NULL, NULL);
- REGISTER_SPL_SUB_CLASS_EX(UnderflowException, RuntimeException, NULL, NULL);
- REGISTER_SPL_SUB_CLASS_EX(UnexpectedValueException, RuntimeException, NULL, NULL);
-
- 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_exceptions.h b/ext/spl/spl_exceptions.h
deleted file mode 100755
index bb3e797092..0000000000
--- a/ext/spl/spl_exceptions.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 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> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef SPL_EXCEPTIONS_H
-#define SPL_EXCEPTIONS_H
-
-#include "php.h"
-#include "php_spl.h"
-
-extern PHPAPI zend_class_entry *spl_ce_LogicException;
-extern PHPAPI zend_class_entry *spl_ce_BadFunctionCallException;
-extern PHPAPI zend_class_entry *spl_ce_BadMethodCallException;
-extern PHPAPI zend_class_entry *spl_ce_DomainException;
-extern PHPAPI zend_class_entry *spl_ce_InvalidArgumentException;
-extern PHPAPI zend_class_entry *spl_ce_LengthException;
-extern PHPAPI zend_class_entry *spl_ce_OutOfRangeException;
-
-extern PHPAPI zend_class_entry *spl_ce_RuntimeException;
-extern PHPAPI zend_class_entry *spl_ce_OutOfBoundsException;
-extern PHPAPI zend_class_entry *spl_ce_OverflowException;
-extern PHPAPI zend_class_entry *spl_ce_RangeException;
-extern PHPAPI zend_class_entry *spl_ce_UnderflowException;
-extern PHPAPI zend_class_entry *spl_ce_UnexpectedValueException;
-
-PHP_MINIT_FUNCTION(spl_exceptions);
-
-#endif /* SPL_EXCEPTIONS_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 143f55cc1f..0000000000
--- a/ext/spl/spl_functions.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 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> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "php_spl.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, zend_function_entry *functions TSRMLS_DC)
-{
- zend_class_entry ce;
-
- INIT_CLASS_ENTRY(ce, class_name, functions);
- ce.name_length = strlen(class_name);
- *ppce = zend_register_internal_class(&ce TSRMLS_CC);
-
- /* entries changed by initialize */
- (*ppce)->ce_flags = ZEND_ACC_INTERFACE;
-}
-/* }}} */
-
-/* {{{ spl_register_std_class */
-void spl_register_std_class(zend_class_entry ** ppce, char * class_name, void * obj_ctor, function_entry * function_list TSRMLS_DC)
-{
- zend_class_entry ce;
-
- INIT_CLASS_ENTRY(ce, class_name, function_list);
- ce.name_length = strlen(class_name);
- *ppce = zend_register_internal_class(&ce TSRMLS_CC);
-
- /* entries changed by initialize */
- if (obj_ctor) {
- (*ppce)->create_object = obj_ctor;
- }
-}
-/* }}} */
-
-/* {{{ spl_register_sub_class */
-void spl_register_sub_class(zend_class_entry ** ppce, zend_class_entry * parent_ce, char * class_name, void *obj_ctor, function_entry * function_list TSRMLS_DC)
-{
- zend_class_entry ce;
-
- INIT_CLASS_ENTRY(ce, class_name, function_list);
- ce.name_length = strlen(class_name);
- *ppce = zend_register_internal_class_ex(&ce, parent_ce, NULL TSRMLS_CC);
-
- /* entries changed by initialize */
- if (obj_ctor) {
- (*ppce)->create_object = obj_ctor;
- } else {
- (*ppce)->create_object = parent_ce->create_object;
- }
-}
-/* }}} */
-
-/* {{{ 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_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_register_property */
-void spl_register_property( zend_class_entry * class_entry, char *prop_name, zval *prop_val, int prop_flags TSRMLS_DC)
-{
- if (!prop_val) {
- INIT_PZVAL(prop_val);
- prop_val->type = IS_NULL;
- }
-
- zend_declare_property(class_entry, prop_name, strlen(prop_name), prop_val, prop_flags TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ spl_add_class_name */
-void spl_add_class_name(zval *list, zend_class_entry * pce, int allow, int ce_flags TSRMLS_DC)
-{
- if (!allow || (allow > 0 && pce->ce_flags & ce_flags) || (allow < 0 && !(pce->ce_flags & ce_flags))) {
- 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, int allow, int ce_flags 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], allow, ce_flags TSRMLS_CC);
- }
-}
-/* }}} */
-
-/* {{{ spl_add_classes */
-int spl_add_classes(zend_class_entry ** ppce, zval *list, int sub, int allow, int ce_flags TSRMLS_DC)
-{
- zend_class_entry *pce = *ppce;
-
- if (!pce) {
- return 0;
- }
- spl_add_class_name(list, pce, allow, ce_flags TSRMLS_CC);
- if (sub) {
- spl_add_interfaces(list, pce, allow, ce_flags TSRMLS_CC);
- while (pce->parent) {
- pce = pce->parent;
- spl_add_classes(&pce, list, sub, allow, ce_flags 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 7071b64347..0000000000
--- a/ext/spl/spl_functions.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 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> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#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, # class_name, obj_ctor, NULL TSRMLS_CC);
-
-#define REGISTER_SPL_STD_CLASS_EX(class_name, obj_ctor, funcs) \
- spl_register_std_class(&spl_ce_ ## class_name, # class_name, obj_ctor, funcs TSRMLS_CC);
-
-#define REGISTER_SPL_SUB_CLASS_EX(class_name, parent_class_name, obj_ctor, funcs) \
- spl_register_sub_class(&spl_ce_ ## class_name, spl_ce_ ## parent_class_name, # class_name, obj_ctor, funcs TSRMLS_CC);
-
-#define REGISTER_SPL_INTERFACE(class_name) \
- spl_register_interface(&spl_ce_ ## class_name, # class_name, spl_funcs_ ## class_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_IMPLEMENTS(class_name, interface_name) \
- zend_class_implements(spl_ce_ ## class_name TSRMLS_CC, 1, spl_ce_ ## interface_name);
-
-#define REGISTER_SPL_ITERATOR(class_name) \
- zend_class_implements(spl_ce_ ## class_name TSRMLS_CC, 1, zend_ce_iterator);
-
-#define REGISTER_SPL_FUNCTIONS(class_name, function_list) \
- spl_register_functions(spl_ce_ ## class_name, function_list TSRMLS_CC);
-
-#define REGISTER_SPL_PROPERTY(class_name, prop_name) \
- spl_register_property(spl_ce_ ## class_name, prop_name, prop_val, prop_flags 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, function_entry * function_list TSRMLS_DC);
-void spl_register_sub_class(zend_class_entry ** ppce, zend_class_entry * parent_ce, char * class_name, create_object_func_t ctor, function_entry * function_list TSRMLS_DC);
-
-void spl_register_interface(zend_class_entry ** ppce, char * class_name, zend_function_entry *functions TSRMLS_DC);
-
-void spl_register_parent_ce(zend_class_entry * class_entry, zend_class_entry * parent_class TSRMLS_DC);
-void spl_register_functions(zend_class_entry * class_entry, function_entry * function_list TSRMLS_DC);
-void spl_register_property( zend_class_entry * class_entry, char *prop_name, zval *prop_val, int prop_flags TSRMLS_DC);
-
-/* sub: whether to allow subclasses/interfaces
- allow = 0: allow all classes and interfaces
- allow > 0: allow all that match and mask ce_flags
- allow < 0: disallow all that match and mask ce_flags
- */
-void spl_add_class_name(zval * list, zend_class_entry * pce, int allow, int ce_flags TSRMLS_DC);
-void spl_add_interfaces(zval * list, zend_class_entry * pce, int allow, int ce_flags TSRMLS_DC);
-int spl_add_classes(zend_class_entry ** ppce, zval *list, int sub, int allow, int ce_flags TSRMLS_DC);
-
-#define SPL_ME(class_name, function_name, arg_info, flags) \
- PHP_ME( spl_ ## class_name, function_name, arg_info, flags)
-
-#define SPL_ABSTRACT_ME(class_name, function_name, arg_info) \
- ZEND_ABSTRACT_ME( spl_ ## class_name, function_name, arg_info)
-
-#define SPL_METHOD(class_name, function_name) \
- PHP_METHOD(spl_ ## class_name, function_name)
-
-#define SPL_MA(class_name, function_name, alias_class, alias_function, arg_info, flags) \
- PHP_MALIAS(spl_ ## alias_class, function_name, alias_function, arg_info, flags)
-#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/spl_iterators.c b/ext/spl/spl_iterators.c
deleted file mode 100755
index d8f672cc36..0000000000
--- a/ext/spl/spl_iterators.c
+++ /dev/null
@@ -1,1978 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 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> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "zend_exceptions.h"
-#include "zend_interfaces.h"
-
-#include "php_spl.h"
-#include "spl_functions.h"
-#include "spl_engine.h"
-#include "spl_iterators.h"
-#include "spl_directory.h"
-#include "spl_array.h"
-#include "spl_exceptions.h"
-
-#define INLINE inline
-
-PHPAPI zend_class_entry *spl_ce_RecursiveIterator;
-PHPAPI zend_class_entry *spl_ce_RecursiveIteratorIterator;
-PHPAPI zend_class_entry *spl_ce_FilterIterator;
-PHPAPI zend_class_entry *spl_ce_ParentIterator;
-PHPAPI zend_class_entry *spl_ce_SeekableIterator;
-PHPAPI zend_class_entry *spl_ce_LimitIterator;
-PHPAPI zend_class_entry *spl_ce_CachingIterator;
-PHPAPI zend_class_entry *spl_ce_CachingRecursiveIterator;
-PHPAPI zend_class_entry *spl_ce_OuterIterator;
-PHPAPI zend_class_entry *spl_ce_IteratorIterator;
-PHPAPI zend_class_entry *spl_ce_NoRewindIterator;
-PHPAPI zend_class_entry *spl_ce_InfiniteIterator;
-PHPAPI zend_class_entry *spl_ce_EmptyIterator;
-PHPAPI zend_class_entry *spl_ce_AppendIterator;
-
-function_entry spl_funcs_RecursiveIterator[] = {
- SPL_ABSTRACT_ME(RecursiveIterator, hasChildren, NULL)
- SPL_ABSTRACT_ME(RecursiveIterator, getChildren, NULL)
- {NULL, NULL, NULL}
-};
-
-typedef enum {
- RIT_LEAVES_ONLY = 0,
- RIT_SELF_FIRST = 1,
- RIT_CHILD_FIRST = 2
-} RecursiveIteratorMode;
-
-typedef enum {
- RS_NEXT = 0,
- RS_TEST = 1,
- RS_SELF = 2,
- RS_CHILD = 3,
- RS_START = 4
-} RecursiveIteratorState;
-
-typedef struct _spl_sub_iterator {
- zend_object_iterator *iterator;
- zval *zobject;
- zend_class_entry *ce;
- RecursiveIteratorState state;
-} spl_sub_iterator;
-
-typedef struct _spl_recursive_it_object {
- zend_object std;
- spl_sub_iterator *iterators;
- int level;
- RecursiveIteratorMode mode;
- zend_function *callHasChildren;
- zend_function *callGetChildren;
- zend_function *beginChildren;
- zend_function *endChildren;
- zend_class_entry *ce;
-} spl_recursive_it_object;
-
-typedef struct _spl_recursive_it_iterator {
- zend_object_iterator intern;
- zval *zobject;
-} spl_recursive_it_iterator;
-
-static zend_object_handlers spl_handlers_rec_it_it;
-static zend_object_handlers spl_handlers_dual_it;
-
-static void spl_recursive_it_dtor(zend_object_iterator *_iter TSRMLS_DC)
-{
- spl_recursive_it_iterator *iter = (spl_recursive_it_iterator*)_iter;
- spl_recursive_it_object *object = (spl_recursive_it_object*)_iter->data;
- zend_object_iterator *sub_iter;
-
- while (object->level) {
- sub_iter = object->iterators[object->level].iterator;
- sub_iter->funcs->dtor(sub_iter TSRMLS_CC);
- zval_ptr_dtor(&object->iterators[object->level--].zobject);
- }
- erealloc(object->iterators, sizeof(spl_sub_iterator));
- object->level = 0;
-
- zval_ptr_dtor(&iter->zobject);
- efree(iter);
-}
-
-static int spl_recursive_it_valid_ex(spl_recursive_it_object *object TSRMLS_DC)
-{
- zend_object_iterator *sub_iter;
- int level = object->level;
-
- while (level >=0) {
- sub_iter = object->iterators[level].iterator;
- if (sub_iter->funcs->valid(sub_iter TSRMLS_CC) == SUCCESS) {
- return SUCCESS;
- }
- level--;
- }
- return FAILURE;
-}
-
-static int spl_recursive_it_valid(zend_object_iterator *iter TSRMLS_DC)
-{
- spl_recursive_it_object *object = (spl_recursive_it_object*)iter->data;
-
- return spl_recursive_it_valid_ex(object TSRMLS_CC);
-}
-
-static void spl_recursive_it_get_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC)
-{
- spl_recursive_it_object *object = (spl_recursive_it_object*)iter->data;
- zend_object_iterator *sub_iter = object->iterators[object->level].iterator;
-
- sub_iter->funcs->get_current_data(sub_iter, data TSRMLS_CC);
-}
-
-static int spl_recursive_it_get_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
-{
- spl_recursive_it_object *object = (spl_recursive_it_object*)iter->data;
- zend_object_iterator *sub_iter = object->iterators[object->level].iterator;
-
- if (sub_iter->funcs->get_current_key) {
- return sub_iter->funcs->get_current_key(sub_iter, str_key, str_key_len, int_key TSRMLS_CC);
- } else {
- *int_key = iter->index;
- return HASH_KEY_IS_LONG;
- }
-}
-
-static void spl_recursive_it_move_forward_ex(spl_recursive_it_object *object, zval *zthis TSRMLS_DC)
-{
- zend_object_iterator *iterator;
- zval *zobject;
- zend_class_entry *ce;
- zval *retval, *child;
- zend_object_iterator *sub_iter;
- int has_children;
-
- while (!EG(exception)) {
-next_step:
- iterator = object->iterators[object->level].iterator;
- switch (object->iterators[object->level].state) {
- case RS_NEXT:
- iterator->funcs->move_forward(iterator TSRMLS_CC);
- case RS_START:
- if (iterator->funcs->valid(iterator TSRMLS_CC) == FAILURE) {
- break;
- }
- object->iterators[object->level].state = RS_TEST;
- /* break; */
- case RS_TEST:
- ce = object->iterators[object->level].ce;
- zobject = object->iterators[object->level].zobject;
- if (object->callHasChildren) {
- zend_call_method_with_0_params(&zthis, object->ce, &object->callHasChildren, "callHasChildren", &retval);
- } else {
- zend_call_method_with_0_params(&zobject, ce, NULL, "haschildren", &retval);
- }
- if (retval) {
- has_children = zend_is_true(retval);
- zval_ptr_dtor(&retval);
- if (has_children) {
- switch (object->mode) {
- case RIT_LEAVES_ONLY:
- case RIT_CHILD_FIRST:
- object->iterators[object->level].state = RS_CHILD;
- goto next_step;
- case RIT_SELF_FIRST:
- object->iterators[object->level].state = RS_SELF;
- goto next_step;
- }
- }
- }
- object->iterators[object->level].state = RS_NEXT;
- return /* self */;
- case RS_SELF:
- if (object->mode == RIT_SELF_FIRST) {
- object->iterators[object->level].state = RS_CHILD;
- } else {
- object->iterators[object->level].state = RS_NEXT;
- }
- return /* self */;
- case RS_CHILD:
- ce = object->iterators[object->level].ce;
- zobject = object->iterators[object->level].zobject;
- if (object->callGetChildren) {
- zend_call_method_with_0_params(&zthis, object->ce, &object->callGetChildren, "callGetChildren", &child);
- } else {
- zend_call_method_with_0_params(&zobject, ce, NULL, "getchildren", &child);
- }
- ce = child && Z_TYPE_P(child) == IS_OBJECT ? Z_OBJCE_P(child) : NULL;
- if (!ce || !instanceof_function(ce, spl_ce_RecursiveIterator TSRMLS_CC)) {
- if (child) {
- zval_ptr_dtor(&child);
- }
- zend_throw_exception(spl_ce_UnexpectedValueException, "Objects returned by RecursiveIterator::getChildren() must implement RecursiveIterator", 0 TSRMLS_CC);
- return;
- }
- if (object->mode == RIT_CHILD_FIRST) {
- object->iterators[object->level].state = RS_SELF;
- } else {
- object->iterators[object->level].state = RS_NEXT;
- }
- object->iterators = erealloc(object->iterators, sizeof(spl_sub_iterator) * (++object->level+1));
- sub_iter = ce->get_iterator(ce, child TSRMLS_CC);
- object->iterators[object->level].iterator = sub_iter;
- object->iterators[object->level].zobject = child;
- object->iterators[object->level].ce = ce;
- object->iterators[object->level].state = RS_START;
- if (sub_iter->funcs->rewind) {
- sub_iter->funcs->rewind(sub_iter TSRMLS_CC);
- }
- if (object->beginChildren) {
- zend_call_method_with_0_params(&zthis, object->ce, &object->beginChildren, "beginchildren", NULL);
- }
- goto next_step;
- }
- /* no more elements */
- if (object->level > 0) {
- if (object->endChildren) {
- zend_call_method_with_0_params(&zthis, object->ce, &object->endChildren, "endchildren", NULL);
- }
- iterator->funcs->dtor(iterator TSRMLS_CC);
- zval_ptr_dtor(&object->iterators[object->level].zobject);
- object->level--;
- } else {
- return; /* done completeley */
- }
- }
-}
-
-static void spl_recursive_it_rewind_ex(spl_recursive_it_object *object, zval *zthis TSRMLS_DC)
-{
- zend_object_iterator *sub_iter;
-
- while (object->level) {
- sub_iter = object->iterators[object->level].iterator;
- sub_iter->funcs->dtor(sub_iter TSRMLS_CC);
- zval_ptr_dtor(&object->iterators[object->level--].zobject);
- if (!object->endChildren || object->endChildren->common.scope != spl_ce_RecursiveIteratorIterator) {
- zend_call_method_with_0_params(&zthis, object->ce, &object->endChildren, "endchildren", NULL);
- }
- }
- erealloc(object->iterators, sizeof(spl_sub_iterator));
- object->iterators[0].state = RS_START;
- sub_iter = object->iterators[0].iterator;
- if (sub_iter->funcs->rewind) {
- sub_iter->funcs->rewind(sub_iter TSRMLS_CC);
- }
- spl_recursive_it_move_forward_ex(object, zthis TSRMLS_CC);
-}
-
-static void spl_recursive_it_move_forward(zend_object_iterator *iter TSRMLS_DC)
-{
- spl_recursive_it_move_forward_ex((spl_recursive_it_object*)iter->data, ((spl_recursive_it_iterator*)iter)->zobject TSRMLS_CC);
-}
-
-static void spl_recursive_it_rewind(zend_object_iterator *iter TSRMLS_DC)
-{
- spl_recursive_it_rewind_ex((spl_recursive_it_object*)iter->data, ((spl_recursive_it_iterator*)iter)->zobject TSRMLS_CC);
-}
-
-static zend_object_iterator *spl_recursive_it_get_iterator(zend_class_entry *ce, zval *zobject TSRMLS_DC)
-{
- spl_recursive_it_iterator *iterator = emalloc(sizeof(spl_recursive_it_iterator));
- spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(zobject TSRMLS_CC);
-
- zobject->refcount++;
- iterator->intern.data = (void*)object;
- iterator->intern.funcs = ce->iterator_funcs.funcs;
- iterator->zobject = zobject;
- return (zend_object_iterator*)iterator;
-}
-
-zend_object_iterator_funcs spl_recursive_it_iterator_funcs = {
- spl_recursive_it_dtor,
- spl_recursive_it_valid,
- spl_recursive_it_get_current_data,
- spl_recursive_it_get_current_key,
- spl_recursive_it_move_forward,
- spl_recursive_it_rewind
-};
-
-/* {{{ proto RecursiveIteratorIterator::__construct(RecursiveIterator|IteratorAggregate it [, int flags = RIT_LEAVES_ONLY]) throws InvalidArgumentException
- Creates a RecursiveIteratorIterator from a RecursiveIterator. */
-SPL_METHOD(RecursiveIteratorIterator, __construct)
-{
- zval *object = getThis();
- spl_recursive_it_object *intern;
- zval *iterator;
- zend_class_entry *ce_iterator;
- long mode = RIT_LEAVES_ONLY;
-
- php_set_error_handling(EH_THROW, spl_ce_InvalidArgumentException TSRMLS_CC);
-
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "o|l", &iterator, &mode) == SUCCESS) {
- if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate TSRMLS_CC)) {
- zval *aggregate = iterator;
- zend_call_method_with_0_params(&aggregate, Z_OBJCE_P(aggregate), &Z_OBJCE_P(aggregate)->iterator_funcs.zf_new_iterator, "getiterator", &iterator);
- }
- } else {
- iterator = NULL;
- }
- if (!iterator || !instanceof_function(Z_OBJCE_P(iterator), spl_ce_RecursiveIterator TSRMLS_CC)) {
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
- zend_throw_exception(spl_ce_InvalidArgumentException, "An instance of RecursiveIterator or IteratorAggregate creating it is required", 0 TSRMLS_CC);
- return;
- }
-
- intern = (spl_recursive_it_object*)zend_object_store_get_object(object TSRMLS_CC);
- intern->iterators = emalloc(sizeof(spl_sub_iterator));
- intern->level = 0;
- intern->mode = mode;
- intern->ce = Z_OBJCE_P(object);
- zend_hash_find(&intern->ce->function_table, "callhaschildren", sizeof("callHasChildren"), (void **) &intern->callHasChildren);
- if (intern->callHasChildren->common.scope == spl_ce_RecursiveIteratorIterator) {
- intern->callHasChildren = NULL;
- }
- zend_hash_find(&intern->ce->function_table, "callgetchildren", sizeof("callGetChildren"), (void **) &intern->callGetChildren);
- if (intern->callGetChildren->common.scope == spl_ce_RecursiveIteratorIterator) {
- intern->callGetChildren = NULL;
- }
- zend_hash_find(&intern->ce->function_table, "beginchildren", sizeof("beginchildren"), (void **) &intern->beginChildren);
- if (intern->beginChildren->common.scope == spl_ce_RecursiveIteratorIterator) {
- intern->beginChildren = NULL;
- }
- zend_hash_find(&intern->ce->function_table, "endchildren", sizeof("endchildren"), (void **) &intern->endChildren);
- if (intern->endChildren->common.scope == spl_ce_RecursiveIteratorIterator) {
- intern->endChildren = NULL;
- }
- ce_iterator = Z_OBJCE_P(iterator); /* respect inheritance, don't use spl_ce_RecursiveIterator */
- intern->iterators[0].iterator = ce_iterator->get_iterator(ce_iterator, iterator TSRMLS_CC);
- iterator->refcount++;
- intern->iterators[0].zobject = iterator;
- intern->iterators[0].ce = ce_iterator;
- intern->iterators[0].state = RS_START;
-
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
-} /* }}} */
-
-/* {{{ proto void RecursiveIteratorIterator::rewind()
- Rewind the iterator to the first element of the top level inner iterator. */
-SPL_METHOD(RecursiveIteratorIterator, rewind)
-{
- spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- spl_recursive_it_rewind_ex(object, getThis() TSRMLS_CC);
-} /* }}} */
-
-/* {{{ proto bolean RecursiveIteratorIterator::valid()
- Check whether the current position is valid */
-SPL_METHOD(RecursiveIteratorIterator, valid)
-{
- spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- RETURN_BOOL(spl_recursive_it_valid_ex(object TSRMLS_CC) == SUCCESS);
-} /* }}} */
-
-/* {{{ proto mixed RecursiveIteratorIterator::key()
- Access the current key */
-SPL_METHOD(RecursiveIteratorIterator, key)
-{
- spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- zend_object_iterator *iterator = object->iterators[object->level].iterator;
-
- if (iterator->funcs->get_current_key) {
- char *str_key;
- uint str_key_len;
- ulong int_key;
- if (iterator->funcs->get_current_key(iterator, &str_key, &str_key_len, &int_key TSRMLS_CC) == HASH_KEY_IS_LONG) {
- RETURN_LONG(int_key);
- } else {
- RETURN_STRINGL(str_key, str_key_len-1, 0);
- }
- } else {
- RETURN_NULL();
- }
-} /* }}} */
-
-/* {{{ proto mixed RecursiveIteratorIterator::current()
- Access the current element value */
-SPL_METHOD(RecursiveIteratorIterator, current)
-{
- spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- zend_object_iterator *iterator = object->iterators[object->level].iterator;
- zval **data;
-
- iterator->funcs->get_current_data(iterator, &data TSRMLS_CC);
- RETURN_ZVAL(*data, 1, 0);
-} /* }}} */
-
-/* {{{ proto void RecursiveIteratorIterator::next()
- Move forward to the next element */
-SPL_METHOD(RecursiveIteratorIterator, next)
-{
- spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- spl_recursive_it_move_forward_ex(object, getThis() TSRMLS_CC);
-} /* }}} */
-
-/* {{{ proto int RecursiveIteratorIterator::getDepth()
- Get the current depth of the recursive iteration */
-SPL_METHOD(RecursiveIteratorIterator, getDepth)
-{
- spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- RETURN_LONG(object->level);
-} /* }}} */
-
-/* {{{ proto RecursiveIterator RecursiveIteratorIterator::getSubIterator([int level])
- The current active sub iterator or the iterator at specified level */
-SPL_METHOD(RecursiveIteratorIterator, getSubIterator)
-{
- spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- long level = object->level;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &level) == FAILURE) {
- return;
- }
- if (level < 0 || level > object->level) {
- RETURN_NULL();
- }
- RETURN_ZVAL(object->iterators[level].zobject, 1, 0);
-} /* }}} */
-
-/* {{{ proto RecursiveIterator RecursiveIteratorIterator::getInnerIterator()
- The current active sub iterator */
-SPL_METHOD(RecursiveIteratorIterator, getInnerIterator)
-{
- spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- long level = object->level;
-
- RETURN_ZVAL(object->iterators[level].zobject, 1, 0);
-} /* }}} */
-
-/* {{{ proto bool RecursiveIteratorIterator::callHasChildren()
- Called for each element to test whether it has children */
-SPL_METHOD(RecursiveIteratorIterator, callHasChildren)
-{
- spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- zend_class_entry *ce = object->iterators[object->level].ce;
- zval *retval, *zobject;
-
- zobject = object->iterators[object->level].zobject;
- if (!zobject) {
- RETURN_FALSE;
- } else {
- zend_call_method_with_0_params(&zobject, ce, NULL, "haschildren", &retval);
- RETURN_ZVAL(retval, 0, 1);
- }
-} /* }}} */
-
-/* {{{ proto RecursiveIterator RecursiveIteratorIterator::callGetChildren()
- Return children of current element */
-SPL_METHOD(RecursiveIteratorIterator, callGetChildren)
-{
- spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- zend_class_entry *ce = object->iterators[object->level].ce;
- zval *retval, *zobject;
-
- zobject = object->iterators[object->level].zobject;
- if (!zobject) {
- return;
- } else {
- zend_call_method_with_0_params(&zobject, ce, NULL, "getchildren", &retval);
- RETURN_ZVAL(retval, 0, 1);
- }
-} /* }}} */
-
-/* {{{ proto RecursiveIterator RecursiveIteratorIterator::beginChildren()
- Called when recursing one level down */
-SPL_METHOD(RecursiveIteratorIterator, beginChildren)
-{
- /* nothing to do */
-} /* }}} */
-
-/* {{{ proto RecursiveIterator RecursiveIteratorIterator::endChildren()
- Called when end recursing one level */
-SPL_METHOD(RecursiveIteratorIterator, endChildren)
-{
- /* nothing to do */
-} /* }}} */
-
-static union _zend_function *spl_recursive_it_get_method(zval **object_ptr, char *method, int method_len TSRMLS_DC)
-{
- union _zend_function *function_handler;
- spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(*object_ptr TSRMLS_CC);
- long level = object->level;
- zval *zobj = object->iterators[level].zobject;
-
- function_handler = std_object_handlers.get_method(object_ptr, method, method_len TSRMLS_CC);
- if (!function_handler) {
- if (zend_hash_find(&Z_OBJCE_P(zobj)->function_table, method, method_len+1, (void **) &function_handler) == FAILURE) {
- if (Z_OBJ_HT_P(zobj)->get_method) {
- *object_ptr = zobj;
- function_handler = Z_OBJ_HT_P(*object_ptr)->get_method(object_ptr, method, method_len TSRMLS_CC);
- }
- }
- }
- return function_handler;
-}
-
-/* {{{ spl_RecursiveIteratorIterator_dtor */
-static void spl_RecursiveIteratorIterator_free_storage(void *_object TSRMLS_DC)
-{
- spl_recursive_it_object *object = (spl_recursive_it_object *)_object;
- zend_object_iterator *sub_iter;
-
- if (object->iterators) {
- while (object->level >= 0) {
- sub_iter = object->iterators[object->level].iterator;
- sub_iter->funcs->dtor(sub_iter TSRMLS_CC);
- zval_ptr_dtor(&object->iterators[object->level--].zobject);
- }
- efree(object->iterators);
- }
-
- zend_hash_destroy(object->std.properties);
- FREE_HASHTABLE(object->std.properties);
-
- efree(object);
-}
-/* }}} */
-
-/* {{{ spl_RecursiveIteratorIterator_new */
-static zend_object_value spl_RecursiveIteratorIterator_new(zend_class_entry *class_type TSRMLS_DC)
-{
- zend_object_value retval;
- spl_recursive_it_object *intern;
- zval *tmp;
-
- intern = emalloc(sizeof(spl_recursive_it_object));
- memset(intern, 0, sizeof(spl_recursive_it_object));
- intern->std.ce = class_type;
-
- ALLOC_HASHTABLE(intern->std.properties);
- zend_hash_init(intern->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
-
- retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t) spl_RecursiveIteratorIterator_free_storage, NULL TSRMLS_CC);
- retval.handlers = &spl_handlers_rec_it_it;
- return retval;
-}
-/* }}} */
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_recursive_it___construct, 0)
- ZEND_ARG_OBJ_INFO(0, iterator, Traversable, 0)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO();
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_recursive_it_getSubIterator, 0)
- ZEND_ARG_INFO(0, level)
-ZEND_END_ARG_INFO();
-
-static zend_function_entry spl_funcs_RecursiveIteratorIterator[] = {
- SPL_ME(RecursiveIteratorIterator, __construct, arginfo_recursive_it___construct, ZEND_ACC_PUBLIC)
- SPL_ME(RecursiveIteratorIterator, rewind, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(RecursiveIteratorIterator, valid, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(RecursiveIteratorIterator, key, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(RecursiveIteratorIterator, current, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(RecursiveIteratorIterator, next, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(RecursiveIteratorIterator, getDepth, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(RecursiveIteratorIterator, getSubIterator, arginfo_recursive_it_getSubIterator, ZEND_ACC_PUBLIC)
- SPL_ME(RecursiveIteratorIterator, getInnerIterator, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(RecursiveIteratorIterator, callHasChildren, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(RecursiveIteratorIterator, callGetChildren, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(RecursiveIteratorIterator, beginChildren, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(RecursiveIteratorIterator, endChildren, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-#if MBO_0
-static int spl_dual_it_gets_implemented(zend_class_entry *interface, zend_class_entry *class_type TSRMLS_DC)
-{
- class_type->iterator_funcs.zf_valid = NULL;
- class_type->iterator_funcs.zf_current = NULL;
- class_type->iterator_funcs.zf_key = NULL;
- class_type->iterator_funcs.zf_next = NULL;
- class_type->iterator_funcs.zf_rewind = NULL;
- if (!class_type->iterator_funcs.funcs) {
- class_type->iterator_funcs.funcs = &zend_interface_iterator_funcs_iterator;
- }
-
- return SUCCESS;
-}
-#endif
-
-static union _zend_function *spl_dual_it_get_method(zval **object_ptr, char *method, int method_len TSRMLS_DC)
-{
- union _zend_function *function_handler;
- spl_dual_it_object *intern;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(*object_ptr TSRMLS_CC);
-
- function_handler = std_object_handlers.get_method(object_ptr, method, method_len TSRMLS_CC);
- if (!function_handler) {
- if (zend_hash_find(&intern->inner.ce->function_table, method, method_len+1, (void **) &function_handler) == FAILURE) {
- if (Z_OBJ_HT_P(intern->inner.zobject)->get_method) {
- *object_ptr = intern->inner.zobject;
- function_handler = Z_OBJ_HT_P(*object_ptr)->get_method(object_ptr, method, method_len TSRMLS_CC);
- }
- }
- }
- return function_handler;
-}
-
-#if MBO_0
-int spl_dual_it_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS)
-{
- zval ***func_params, func;
- zval *retval_ptr;
- int arg_count;
- int current = 0;
- int success;
- void **p;
- spl_dual_it_object *intern;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- ZVAL_STRING(&func, method, 0);
- if (!zend_is_callable(&func, 0, &method)) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Method %s::%s() does not exist", intern->inner.ce->name, method);
- return FAILURE;
- }
-
- p = EG(argument_stack).top_element-2;
- arg_count = (ulong) *p;
-
- func_params = safe_emalloc(sizeof(zval **), arg_count, 0);
-
- current = 0;
- while (arg_count-- > 0) {
- func_params[current] = (zval **) p - (arg_count-current);
- current++;
- }
-
- if (call_user_function_ex(EG(function_table), NULL, &func, &retval_ptr, arg_count, func_params, 0, NULL TSRMLS_CC) == SUCCESS && retval_ptr) {
- RETURN_ZVAL(retval_ptr, 0, 1);
-
- success = SUCCESS;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to call %s::%s()", intern->inner.ce->name, method);
- success = FAILURE;
- }
-
- efree(func_params);
- return success;
-}
-#endif
-
-static INLINE int spl_dual_it_fetch(spl_dual_it_object *intern, int check_more TSRMLS_DC);
-
-static INLINE spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *ce_inner, dual_it_type dit_type)
-{
- zval *zobject;
- spl_dual_it_object *intern;
- zend_class_entry *ce;
-
- php_set_error_handling(EH_THROW, spl_ce_InvalidArgumentException TSRMLS_CC);
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- intern->dit_type = dit_type;
- switch (dit_type) {
- case DIT_LimitIterator: {
- intern->u.limit.offset = 0; /* start at beginning */
- intern->u.limit.count = -1; /* get all */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|ll", &zobject, ce_inner, &intern->u.limit.offset, &intern->u.limit.count) == FAILURE) {
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
- return NULL;
- }
- if (intern->u.limit.offset < 0) {
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
- zend_throw_exception(spl_ce_OutOfRangeException, "Parameter offset must be > 0", 0 TSRMLS_CC);
- return NULL;
- }
- if (intern->u.limit.count < 0 && intern->u.limit.count != -1) {
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
- zend_throw_exception(spl_ce_OutOfRangeException, "Parameter count must either be -1 or a value greater than or equal 0", 0 TSRMLS_CC);
- return NULL;
- }
- break;
- }
- case DIT_CachingIterator:
- case DIT_CachingRecursiveIterator: {
- long flags = CIT_CALL_TOSTRING;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|l", &zobject, ce_inner, &flags) == FAILURE) {
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
- return NULL;
- }
- intern->u.caching.flags |= flags & CIT_PUBLIC;
- break;
- }
- case DIT_IteratorIterator: {
- zend_class_entry **pce_cast;
- char * class_name;
- int class_name_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|s", &zobject, ce_inner, &class_name, &class_name_len) == FAILURE) {
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
- return NULL;
- }
- ce = Z_OBJCE_P(zobject);
- if (!instanceof_function(ce, zend_ce_iterator TSRMLS_CC)) {
- if (ZEND_NUM_ARGS() > 1) {
- if (zend_lookup_class(class_name, class_name_len, &pce_cast TSRMLS_CC) == FAILURE
- || !instanceof_function(ce, *pce_cast TSRMLS_CC)
- || !(*pce_cast)->get_iterator
- ) {
- zend_throw_exception(spl_ce_LogicException, "Class to downcast to not found or not base class or does not implement Traversable", 0 TSRMLS_CC);
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
- return NULL;
- }
- ce = *pce_cast;
- }
- if (instanceof_function(ce, zend_ce_aggregate TSRMLS_CC)) {
- zval *retval;
- zobject = zend_call_method_with_0_params(&zobject, ce, &ce->iterator_funcs.zf_new_iterator, "getiterator", &retval);
- ce = Z_OBJCE_P(zobject);
- }
- }
- break;
- }
- case DIT_AppendIterator:
- spl_instantiate(spl_ce_ArrayIterator, &intern->u.append.zarrayit, 1 TSRMLS_CC);
- zend_call_method_with_0_params(&intern->u.append.zarrayit, spl_ce_ArrayIterator, &spl_ce_ArrayIterator->constructor, "__construct", NULL);
- intern->u.append.iterator = spl_ce_ArrayIterator->get_iterator(spl_ce_ArrayIterator, intern->u.append.zarrayit TSRMLS_CC);
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
- return intern;
- default:
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &zobject, ce_inner) == FAILURE) {
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
- return NULL;
- }
- break;
- }
-
- php_set_error_handling(EH_THROW, zend_exception_get_default() TSRMLS_CC);
-
- zobject->refcount++;
- intern->inner.zobject = zobject;
- intern->inner.ce = dit_type == DIT_IteratorIterator ? ce : Z_OBJCE_P(zobject);
- intern->inner.object = zend_object_store_get_object(zobject TSRMLS_CC);
- intern->inner.iterator = intern->inner.ce->get_iterator(intern->inner.ce, zobject TSRMLS_CC);
-
- php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
- return intern;
-}
-
-/* {{{ proto FilterIterator::__construct(Iterator it)
- Create an Iterator from another iterator */
-SPL_METHOD(dual_it, __construct)
-{
- spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, zend_ce_iterator, DIT_Default);
-} /* }}} */
-
-/* {{{ proto Iterator FilterIterator::getInnerIterator()
- proto Iterator CachingIterator::getInnerIterator()
- proto Iterator LimitIterator::getInnerIterator()
- proto Iterator ParentIterator::getInnerIterator()
- Get the inner iterator */
-SPL_METHOD(dual_it, getInnerIterator)
-{
- spl_dual_it_object *intern;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- if (intern->inner.zobject) {
- RETVAL_ZVAL(intern->inner.zobject, 1, 0);
- } else {
- RETURN_NULL();
- }
-} /* }}} */
-
-static INLINE void spl_dual_it_require(spl_dual_it_object *intern TSRMLS_DC)
-{
- if (!intern->inner.iterator) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "The inner constructor wasn't initialized with an iterator instance");
- }
-}
-
-static INLINE void spl_dual_it_free(spl_dual_it_object *intern TSRMLS_DC)
-{
- if (intern->inner.iterator && intern->inner.iterator->funcs->invalidate_current) {
- intern->inner.iterator->funcs->invalidate_current(intern->inner.iterator TSRMLS_CC);
- }
- if (intern->current.data) {
- zval_ptr_dtor(&intern->current.data);
- intern->current.data = NULL;
- }
- if (intern->current.str_key) {
- efree(intern->current.str_key);
- intern->current.str_key = NULL;
- }
- if (intern->dit_type == DIT_CachingIterator || intern->dit_type == DIT_CachingRecursiveIterator) {
- if (intern->u.caching.zstr) {
- zval_ptr_dtor(&intern->u.caching.zstr);
- intern->u.caching.zstr = NULL;
- }
- if (intern->u.caching.zchildren) {
- zval_ptr_dtor(&intern->u.caching.zchildren);
- intern->u.caching.zchildren = NULL;
- }
- }
-}
-
-static INLINE void spl_dual_it_rewind(spl_dual_it_object *intern TSRMLS_DC)
-{
- spl_dual_it_free(intern TSRMLS_CC);
- intern->current.pos = 0;
- if (intern->inner.iterator->funcs->rewind) {
- intern->inner.iterator->funcs->rewind(intern->inner.iterator TSRMLS_CC);
- }
-}
-
-static INLINE int spl_dual_it_valid(spl_dual_it_object *intern TSRMLS_DC)
-{
- /* FAILURE / SUCCESS */
- return intern->inner.iterator->funcs->valid(intern->inner.iterator TSRMLS_CC);
-}
-
-static INLINE int spl_dual_it_fetch(spl_dual_it_object *intern, int check_more TSRMLS_DC)
-{
- zval **data;
-
- spl_dual_it_free(intern TSRMLS_CC);
- if (!check_more || spl_dual_it_valid(intern TSRMLS_CC) == SUCCESS) {
- intern->inner.iterator->funcs->get_current_data(intern->inner.iterator, &data TSRMLS_CC);
- intern->current.data = *data;
- intern->current.data->refcount++;
- if (intern->inner.iterator->funcs->get_current_key) {
- intern->current.key_type = intern->inner.iterator->funcs->get_current_key(intern->inner.iterator, &intern->current.str_key, &intern->current.str_key_len, &intern->current.int_key TSRMLS_CC);
- } else {
- intern->current.key_type = HASH_KEY_IS_LONG;
- intern->current.int_key = intern->current.pos;
- }
- return SUCCESS;
- }
- return FAILURE;
-}
-
-static INLINE void spl_dual_it_next(spl_dual_it_object *intern, int do_free TSRMLS_DC)
-{
- if (do_free) {
- spl_dual_it_free(intern TSRMLS_CC);
- } else {
- spl_dual_it_require(intern TSRMLS_CC);
- }
- intern->inner.iterator->funcs->move_forward(intern->inner.iterator TSRMLS_CC);
- intern->current.pos++;
-}
-
-/* {{{ proto void ParentIterator::rewind()
- proto void IteratorIterator::rewind()
- Rewind the iterator
- */
-SPL_METHOD(dual_it, rewind)
-{
- spl_dual_it_object *intern;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- spl_dual_it_rewind(intern TSRMLS_CC);
- spl_dual_it_fetch(intern, 1 TSRMLS_CC);
-} /* }}} */
-
-/* {{{ proto boolean FilterIterator::valid()
- proto boolean ParentIterator::valid()
- proto boolean IteratorIterator::valid()
- proto boolean NoRewindIterator::valid()
- Check whether the current element is valid */
-SPL_METHOD(dual_it, valid)
-{
- spl_dual_it_object *intern;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- RETURN_BOOL(intern->current.data);
-} /* }}} */
-
-/* {{{ proto mixed FilterIterator::key()
- proto mixed CachingIterator::key()
- proto mixed LimitIterator::key()
- proto mixed ParentIterator::key()
- proto mixed IteratorIterator::key()
- proto mixed NoRewindIterator::key()
- proto mixed AppendIterator::key()
- Get the current key */
-SPL_METHOD(dual_it, key)
-{
- spl_dual_it_object *intern;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- if (intern->current.data) {
- if (intern->current.key_type == HASH_KEY_IS_STRING) {
- RETURN_STRINGL(intern->current.str_key, intern->current.str_key_len-1, 1);
- } else {
- RETURN_LONG(intern->current.int_key);
- }
- }
- RETURN_NULL();
-} /* }}} */
-
-/* {{{ proto mixed FilterIterator::current()
- proto mixed CachingIterator::current()
- proto mixed LimitIterator::current()
- proto mixed ParentIterator::current()
- proto mixed IteratorIterator::current()
- proto mixed NoRewindIterator::current()
- proto mixed AppendIterator::current()
- Get the current element value */
-SPL_METHOD(dual_it, current)
-{
- spl_dual_it_object *intern;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- if (intern->current.data) {
- RETVAL_ZVAL(intern->current.data, 1, 0);
- } else {
- RETURN_NULL();
- }
-} /* }}} */
-
-/* {{{ proto void ParentIterator::next()
- proto void IteratorIterator::next()
- proto void NoRewindIterator::next()
- Move the iterator forward */
-SPL_METHOD(dual_it, next)
-{
- spl_dual_it_object *intern;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- spl_dual_it_next(intern, 1 TSRMLS_CC);
- spl_dual_it_fetch(intern, 1 TSRMLS_CC);
-} /* }}} */
-
-static INLINE void spl_filter_it_fetch(zval *zthis, spl_dual_it_object *intern TSRMLS_DC)
-{
- zval *retval;
-
- while (spl_dual_it_fetch(intern, 1 TSRMLS_CC) == SUCCESS) {
- zend_call_method_with_0_params(&zthis, intern->std.ce, NULL, "accept", &retval);
- if (retval) {
- if (zend_is_true(retval)) {
- zval_ptr_dtor(&retval);
- return;
- }
- zval_ptr_dtor(&retval);
- }
-
- intern->inner.iterator->funcs->move_forward(intern->inner.iterator TSRMLS_CC);
- }
- spl_dual_it_free(intern TSRMLS_CC);
-}
-
-static INLINE void spl_filter_it_rewind(zval *zthis, spl_dual_it_object *intern TSRMLS_DC)
-{
- spl_dual_it_rewind(intern TSRMLS_CC);
- spl_filter_it_fetch(zthis, intern TSRMLS_CC);
-}
-
-static INLINE void spl_filter_it_next(zval *zthis, spl_dual_it_object *intern TSRMLS_DC)
-{
- spl_dual_it_next(intern, 1 TSRMLS_CC);
- spl_filter_it_fetch(zthis, intern TSRMLS_CC);
-}
-
-/* {{{ proto void FilterIterator::rewind()
- Rewind the iterator */
-SPL_METHOD(FilterIterator, rewind)
-{
- spl_dual_it_object *intern;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- spl_filter_it_rewind(getThis(), intern TSRMLS_CC);
-} /* }}} */
-
-/* {{{ proto void FilterIterator::next()
- Move the iterator forward */
-SPL_METHOD(FilterIterator, next)
-{
- spl_dual_it_object *intern;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- spl_filter_it_next(getThis(), intern TSRMLS_CC);
-} /* }}} */
-
-/* {{{ proto ParentIterator::__construct(RecursiveIterator it)
- Create a ParentIterator from a RecursiveIterator */
-SPL_METHOD(ParentIterator, __construct)
-{
- spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, spl_ce_RecursiveIterator, DIT_Default);
-} /* }}} */
-
-/* {{{ proto boolean ParentIterator::hasChildren()
- Check whether the inner iterator's current element has children */
-SPL_METHOD(ParentIterator, hasChildren)
-{
- spl_dual_it_object *intern;
- zval *retval;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "haschildren", &retval);
- RETURN_ZVAL(retval, 0, 1);
-} /* }}} */
-
-/* {{{ proto ParentIterator ParentIterator::getChildren()
- Return the inner iterator's children contained in a ParentIterator */
-SPL_METHOD(ParentIterator, getChildren)
-{
- spl_dual_it_object *intern;
- zval *retval;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &retval);
- spl_instantiate_arg_ex1(spl_ce_ParentIterator, &return_value, 0, retval TSRMLS_CC);
- zval_ptr_dtor(&retval);
-} /* }}} */
-
-/* {{{ spl_dual_it_free_storage */
-static INLINE void spl_dual_it_free_storage(void *_object TSRMLS_DC)
-{
- spl_dual_it_object *object = (spl_dual_it_object *)_object;
-
- spl_dual_it_free(object TSRMLS_CC);
-
- if (object->inner.iterator) {
- object->inner.iterator->funcs->dtor(object->inner.iterator TSRMLS_CC);
- }
-
- if (object->inner.zobject) {
- zval_ptr_dtor(&object->inner.zobject);
- }
-
- if (object->dit_type == DIT_AppendIterator) {
- object->u.append.iterator->funcs->dtor(object->u.append.iterator TSRMLS_CC);
- zval_ptr_dtor(&object->u.append.zarrayit);
- }
-
- zend_hash_destroy(object->std.properties);
- FREE_HASHTABLE(object->std.properties);
-
- efree(object);
-}
-/* }}} */
-
-/* {{{ spl_dual_it_new */
-static zend_object_value spl_dual_it_new(zend_class_entry *class_type TSRMLS_DC)
-{
- zend_object_value retval;
- spl_dual_it_object *intern;
- zval *tmp;
-
- intern = emalloc(sizeof(spl_dual_it_object));
- memset(intern, 0, sizeof(spl_dual_it_object));
- intern->std.ce = class_type;
-
- ALLOC_HASHTABLE(intern->std.properties);
- zend_hash_init(intern->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
-
- retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t) spl_dual_it_free_storage, NULL TSRMLS_CC);
- retval.handlers = &spl_handlers_dual_it;
- return retval;
-}
-/* }}} */
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_filter_it___construct, 0)
- ZEND_ARG_OBJ_INFO(0, iterator, Iterator, 0)
-ZEND_END_ARG_INFO();
-
-static zend_function_entry spl_funcs_FilterIterator[] = {
- SPL_ME(dual_it, __construct, arginfo_filter_it___construct, ZEND_ACC_PUBLIC)
- SPL_ME(FilterIterator, rewind, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(dual_it, valid, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(dual_it, key, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(dual_it, current, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(FilterIterator, next, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(dual_it, getInnerIterator, NULL, ZEND_ACC_PUBLIC)
- SPL_ABSTRACT_ME(FilterIterator, accept, NULL)
- {NULL, NULL, NULL}
-};
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_parent_it___construct, 0)
- ZEND_ARG_OBJ_INFO(0, iterator, Iterator, 0)
-ZEND_END_ARG_INFO();
-
-static zend_function_entry spl_funcs_ParentIterator[] = {
- SPL_ME(ParentIterator, __construct, arginfo_parent_it___construct, ZEND_ACC_PUBLIC)
- SPL_MA(ParentIterator, accept, ParentIterator, hasChildren, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(ParentIterator, hasChildren, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(ParentIterator, getChildren, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(dual_it, getInnerIterator, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-static INLINE int spl_limit_it_valid(spl_dual_it_object *intern TSRMLS_DC)
-{
- /* FAILURE / SUCCESS */
- if (intern->u.limit.count != -1 && intern->current.pos >= intern->u.limit.offset + intern->u.limit.count) {
- return FAILURE;
- } else {
- return spl_dual_it_valid(intern TSRMLS_CC);
- }
-}
-
-static INLINE void spl_limit_it_seek(spl_dual_it_object *intern, long pos TSRMLS_DC)
-{
- zval *zpos;
-
- spl_dual_it_free(intern TSRMLS_CC);
- if (pos < intern->u.limit.offset) {
- zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Cannot seek to %ld which is below the offset %ld", pos, intern->u.limit.offset);
- return;
- }
- if (pos > intern->u.limit.offset + intern->u.limit.count && intern->u.limit.count != -1) {
- zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Cannot seek to %ld which is behind offest %ld plus count %ld", pos, intern->u.limit.offset, intern->u.limit.count);
- return;
- }
- if (instanceof_function(intern->inner.ce, spl_ce_SeekableIterator TSRMLS_CC)) {
- MAKE_STD_ZVAL(zpos);
- ZVAL_LONG(zpos, pos);
- spl_dual_it_free(intern TSRMLS_CC);
- zend_call_method_with_1_params(&intern->inner.zobject, intern->inner.ce, NULL, "seek", NULL, zpos);
- zval_ptr_dtor(&zpos);
- intern->current.pos = pos;
- if (spl_limit_it_valid(intern TSRMLS_CC) == SUCCESS) {
- spl_dual_it_fetch(intern, 0 TSRMLS_CC);
- }
- } else {
- /* emulate the forward seek, by next() calls */
- /* a back ward seek is done by a previous rewind() */
- if (pos < intern->current.pos) {
- spl_dual_it_rewind(intern TSRMLS_CC);
- }
- while (pos > intern->current.pos && spl_dual_it_valid(intern TSRMLS_CC) == SUCCESS) {
- spl_dual_it_next(intern, 1 TSRMLS_CC);
- }
- if (spl_dual_it_valid(intern TSRMLS_CC) == SUCCESS) {
- spl_dual_it_fetch(intern, 1 TSRMLS_CC);
- }
- }
-}
-
-/* {{{ proto LimitIterator::__construct(Iterator it [, int offset, int count])
- Construct a LimitIterator from an Iterator with a given starting offset and optionally a maximum count */
-SPL_METHOD(LimitIterator, __construct)
-{
- spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, zend_ce_iterator, DIT_LimitIterator);
-} /* }}} */
-
-/* {{{ proto void LimitIterator::rewind()
- Rewind the iterator to the specified starting offset */
-SPL_METHOD(LimitIterator, rewind)
-{
- spl_dual_it_object *intern;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- spl_dual_it_rewind(intern TSRMLS_CC);
- spl_limit_it_seek(intern, intern->u.limit.offset TSRMLS_CC);
-} /* }}} */
-
-/* {{{ proto boolean LimitIterator::valid()
- Check whether the current element is valid */
-SPL_METHOD(LimitIterator, valid)
-{
- spl_dual_it_object *intern;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
-/* RETURN_BOOL(spl_limit_it_valid(intern TSRMLS_CC) == SUCCESS);*/
- RETURN_BOOL((intern->u.limit.count == -1 || intern->current.pos < intern->u.limit.offset + intern->u.limit.count) && intern->current.data);
-} /* }}} */
-
-/* {{{ proto void LimitIterator::next()
- Move the iterator forward */
-SPL_METHOD(LimitIterator, next)
-{
- spl_dual_it_object *intern;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- spl_dual_it_next(intern, 1 TSRMLS_CC);
- if (intern->u.limit.count == -1 || intern->current.pos < intern->u.limit.offset + intern->u.limit.count) {
- spl_dual_it_fetch(intern, 1 TSRMLS_CC);
- }
-} /* }}} */
-
-/* {{{ proto void LimitIterator::seek(int position)
- Seek to the given position */
-SPL_METHOD(LimitIterator, seek)
-{
- spl_dual_it_object *intern;
- long pos;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &pos) == FAILURE) {
- return;
- }
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- spl_limit_it_seek(intern, pos TSRMLS_CC);
- RETURN_LONG(intern->current.pos);
-} /* }}} */
-
-/* {{{ proto int LimitIterator::getPosition()
- Return the current position */
-SPL_METHOD(LimitIterator, getPosition)
-{
- spl_dual_it_object *intern;
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- RETURN_LONG(intern->current.pos);
-} /* }}} */
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_seekable_it_seek, 0)
- ZEND_ARG_INFO(0, position)
-ZEND_END_ARG_INFO();
-
-static zend_function_entry spl_funcs_SeekableIterator[] = {
- SPL_ABSTRACT_ME(SeekableIterator, seek, arginfo_seekable_it_seek)
- {NULL, NULL, NULL}
-};
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_limit_it___construct, 0)
- ZEND_ARG_OBJ_INFO(0, iterator, Iterator, 0)
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, count)
-ZEND_END_ARG_INFO();
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_limit_it_seek, 0)
- ZEND_ARG_INFO(0, position)
-ZEND_END_ARG_INFO();
-
-static zend_function_entry spl_funcs_LimitIterator[] = {
- SPL_ME(LimitIterator, __construct, arginfo_limit_it___construct, ZEND_ACC_PUBLIC)
- SPL_ME(LimitIterator, rewind, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(LimitIterator, valid, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(dual_it, key, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(dual_it, current, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(LimitIterator, next, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(LimitIterator, seek, arginfo_limit_it_seek, ZEND_ACC_PUBLIC)
- SPL_ME(LimitIterator, getPosition, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(dual_it, getInnerIterator, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-static INLINE int spl_caching_it_valid(spl_dual_it_object *intern TSRMLS_DC)
-{
- return intern->u.caching.flags & CIT_VALID ? SUCCESS : FAILURE;
-}
-
-static INLINE int spl_caching_it_has_next(spl_dual_it_object *intern TSRMLS_DC)
-{
- return spl_dual_it_valid(intern TSRMLS_CC);
-}
-
-static INLINE void spl_caching_it_next(spl_dual_it_object *intern TSRMLS_DC)
-{
- if (spl_dual_it_fetch(intern, 1 TSRMLS_CC) == SUCCESS) {
- intern->u.caching.flags |= CIT_VALID;
- if (intern->dit_type == DIT_CachingRecursiveIterator) {
- zval *retval, *zchildren, zflags;
- zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "haschildren", &retval);
- if (zend_is_true(retval)) {
- zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &zchildren);
- if (EG(exception) && intern->u.caching.flags & CIT_CATCH_GET_CHILD) {
- zval_ptr_dtor(&EG(exception));
- EG(exception) = NULL;
- if (zchildren) {
- zval_ptr_dtor(&zchildren);
- }
- } else {
- INIT_PZVAL(&zflags);
- ZVAL_LONG(&zflags, intern->u.caching.flags & CIT_PUBLIC);
- spl_instantiate_arg_ex2(spl_ce_CachingRecursiveIterator, &intern->u.caching.zchildren, 1, zchildren, &zflags TSRMLS_CC);
- zval_ptr_dtor(&zchildren);
- }
- }
- zval_ptr_dtor(&retval);
- }
- if (intern->u.caching.flags & CIT_CALL_TOSTRING) {
- if (Z_TYPE_P(intern->current.data) == IS_OBJECT) {
- zval expr_copy;
- if (intern->current.data->value.obj.handlers->cast_object &&
- intern->current.data->value.obj.handlers->cast_object(intern->current.data, &expr_copy, IS_STRING, 0 TSRMLS_CC) == SUCCESS)
- {
- ALLOC_ZVAL(intern->u.caching.zstr);
- *intern->u.caching.zstr = expr_copy;
- INIT_PZVAL(intern->u.caching.zstr);
- zval_copy_ctor(intern->u.caching.zstr);
- zval_dtor(&expr_copy);
- } else {
- zend_class_entry *ce_data = spl_get_class_entry(intern->current.data TSRMLS_CC);
- if (ce_data && zend_hash_exists(&ce_data->function_table, "__tostring", sizeof("__tostring"))) {
- zend_call_method_with_0_params(&intern->current.data, ce_data, NULL, "__tostring", &intern->u.caching.zstr);
- } else {
- ALLOC_ZVAL(intern->u.caching.zstr);
- *intern->u.caching.zstr = *intern->current.data;
- zval_copy_ctor(intern->u.caching.zstr);
- INIT_PZVAL(intern->u.caching.zstr);
- convert_to_string(intern->u.caching.zstr);
- }
- }
- } else {
- /* This version requires zend_make_printable_zval() being able to
- * call __toString().
- */
- int use_copy;
- zval expr_copy;
- ALLOC_ZVAL(intern->u.caching.zstr);
- *intern->u.caching.zstr = *intern->current.data;
- zend_make_printable_zval(intern->u.caching.zstr, &expr_copy, &use_copy);
- if (use_copy) {
- *intern->u.caching.zstr = expr_copy;
- INIT_PZVAL(intern->u.caching.zstr);
- zval_copy_ctor(intern->u.caching.zstr);
- zval_dtor(&expr_copy);
- } else {
- INIT_PZVAL(intern->u.caching.zstr);
- zval_copy_ctor(intern->u.caching.zstr);
- }
- }
- }
- spl_dual_it_next(intern, 0 TSRMLS_CC);
- } else {
- intern->u.caching.flags &= ~CIT_VALID;
- }
-}
-
-static INLINE void spl_caching_it_rewind(spl_dual_it_object *intern TSRMLS_DC)
-{
- spl_dual_it_rewind(intern TSRMLS_CC);
- spl_caching_it_next(intern TSRMLS_CC);
-}
-
-/* {{{ proto CachingIterator::__construct(Iterator it [, flags = CIT_CALL_TOSTRING])
- Construct a CachingIterator from an Iterator */
-SPL_METHOD(CachingIterator, __construct)
-{
- spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, zend_ce_iterator, DIT_CachingIterator);
-} /* }}} */
-
-/* {{{ proto void CachingIterator::rewind()
- Rewind the iterator */
-SPL_METHOD(CachingIterator, rewind)
-{
- spl_dual_it_object *intern;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- spl_caching_it_rewind(intern TSRMLS_CC);
-} /* }}} */
-
-/* {{{ proto boolean CachingIterator::valid()
- Check whether the current element is valid */
-SPL_METHOD(CachingIterator, valid)
-{
- spl_dual_it_object *intern;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- RETURN_BOOL(spl_caching_it_valid(intern TSRMLS_CC) == SUCCESS);
-} /* }}} */
-
-/* {{{ proto void CachingIterator::next()
- Move the iterator forward */
-SPL_METHOD(CachingIterator, next)
-{
- spl_dual_it_object *intern;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- spl_caching_it_next(intern TSRMLS_CC);
-} /* }}} */
-
-/* {{{ proto boolean CachingIterator::hasNext()
- Check whether the inner iterator has a valid next element */
-SPL_METHOD(CachingIterator, hasNext)
-{
- spl_dual_it_object *intern;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- RETURN_BOOL(spl_caching_it_has_next(intern TSRMLS_CC) == SUCCESS);
-} /* }}} */
-
-/* {{{ proto string CachingIterator::__toString()
- Return the string representation of the current element */
-SPL_METHOD(CachingIterator, __toString)
-{
- spl_dual_it_object *intern;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- if (!(intern->u.caching.flags & CIT_CALL_TOSTRING)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%s does not fetch string value (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name);
- }
- if (intern->u.caching.zstr) {
- RETURN_STRINGL(Z_STRVAL_P(intern->u.caching.zstr), Z_STRLEN_P(intern->u.caching.zstr), 1);
- } else {
- RETURN_NULL();
- }
-} /* }}} */
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_caching_it___construct, 0)
- ZEND_ARG_OBJ_INFO(0, iterator, Iterator, 0)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO();
-
-static zend_function_entry spl_funcs_CachingIterator[] = {
- SPL_ME(CachingIterator, __construct, arginfo_caching_it___construct, ZEND_ACC_PUBLIC)
- SPL_ME(CachingIterator, rewind, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(CachingIterator, valid, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(dual_it, key, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(dual_it, current, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(CachingIterator, next, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(CachingIterator, hasNext, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(CachingIterator, __toString, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(dual_it, getInnerIterator, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-/* {{{ proto CachingRecursiveIterator::__construct(RecursiveIterator it [, flags = CIT_CALL_TOSTRING])
- Create an iterator from a RecursiveIterator */
-SPL_METHOD(CachingRecursiveIterator, __construct)
-{
- spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, spl_ce_RecursiveIterator, DIT_CachingRecursiveIterator);
-} /* }}} */
-
-/* {{{ proto bolean CachingRecursiveIterator::hasChildren()
- Check whether the current element of the inner iterator has children */
-SPL_METHOD(CachingRecursiveIterator, hasChildren)
-{
- spl_dual_it_object *intern;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- RETURN_BOOL(intern->u.caching.zchildren);
-} /* }}} */
-
-/* {{{ proto CachingRecursiveIterator CachingRecursiveIterator::getChildren()
- Return the inner iterator's children as a CachingRecursiveIterator */
-SPL_METHOD(CachingRecursiveIterator, getChildren)
-{
- spl_dual_it_object *intern;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- if (intern->u.caching.zchildren) {
- RETURN_ZVAL(intern->u.caching.zchildren, 1, 0);
- } else {
- RETURN_NULL();
- }
-} /* }}} */
-
-static
-ZEND_BEGIN_ARG_INFO_EX(arginfo_caching_rec_it___construct, 0, ZEND_RETURN_REFERENCE_AGNOSTIC, 2)
- ZEND_ARG_OBJ_INFO(0, iterator, Iterator, 0)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO();
-
-static zend_function_entry spl_funcs_CachingRecursiveIterator[] = {
- SPL_ME(CachingRecursiveIterator, __construct, arginfo_caching_rec_it___construct, ZEND_ACC_PUBLIC)
- SPL_ME(CachingRecursiveIterator, hasChildren, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(CachingRecursiveIterator, getChildren, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-/* {{{ proto IteratorIterator::__construct(Traversable it)
- Create an iterator from anything that is traversable */
-SPL_METHOD(IteratorIterator, __construct)
-{
- spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, zend_ce_traversable, DIT_IteratorIterator);
-} /* }}} */
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_iterator_it___construct, 0)
- ZEND_ARG_OBJ_INFO(0, iterator, Traversable, 0)
-ZEND_END_ARG_INFO();
-
-static zend_function_entry spl_funcs_IteratorIterator[] = {
- SPL_ME(IteratorIterator, __construct, arginfo_iterator_it___construct, ZEND_ACC_PUBLIC)
- SPL_ME(dual_it, rewind, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(dual_it, valid, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(dual_it, key, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(dual_it, current, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(dual_it, next, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(dual_it, getInnerIterator, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-/* {{{ proto NoRewindIterator::__construct(Iterator it)
- Create an iterator from another iterator */
-SPL_METHOD(NoRewindIterator, __construct)
-{
- spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, zend_ce_iterator, DIT_NoRewindIterator);
-} /* }}} */
-
-/* {{{ proto void NoRewindIterator::rewind()
- Prevent a call to inner iterators rewind() */
-SPL_METHOD(NoRewindIterator, rewind)
-{
- /* nothing to do */
-} /* }}} */
-
-/* {{{ proto void NoRewindIterator::valid()
- Return inner iterators valid() */
-SPL_METHOD(NoRewindIterator, valid)
-{
- spl_dual_it_object *intern;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- RETURN_BOOL(intern->inner.iterator->funcs->valid(intern->inner.iterator TSRMLS_CC) == SUCCESS);
-} /* }}} */
-
-/* {{{ proto mixed NoRewindIterator::key()
- Return inner iterators key() */
-SPL_METHOD(NoRewindIterator, key)
-{
- spl_dual_it_object *intern;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- if (intern->inner.iterator->funcs->get_current_key) {
- char *str_key;
- uint str_key_len;
- ulong int_key;
- if (intern->inner.iterator->funcs->get_current_key(intern->inner.iterator, &str_key, &str_key_len, &int_key TSRMLS_CC) == HASH_KEY_IS_LONG) {
- RETURN_LONG(int_key);
- } else {
- RETURN_STRINGL(str_key, str_key_len-1, 0);
- }
- } else {
- RETURN_NULL();
- }
-} /* }}} */
-
-/* {{{ proto mixed NoRewindIterator::current()
- Return inner iterators current() */
-SPL_METHOD(NoRewindIterator, current)
-{
- spl_dual_it_object *intern;
- zval **data;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- intern->inner.iterator->funcs->get_current_data(intern->inner.iterator, &data TSRMLS_CC);
- RETURN_ZVAL(*data, 1, 0);
-} /* }}} */
-
-/* {{{ proto void NoRewindIterator::next()
- Return inner iterators next() */
-SPL_METHOD(NoRewindIterator, next)
-{
- spl_dual_it_object *intern;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- intern->inner.iterator->funcs->move_forward(intern->inner.iterator TSRMLS_CC);
-} /* }}} */
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_norewind_it___construct, 0)
- ZEND_ARG_OBJ_INFO(0, iterator, Iterator, 0)
-ZEND_END_ARG_INFO();
-
-static zend_function_entry spl_funcs_NoRewindIterator[] = {
- SPL_ME(NoRewindIterator, __construct, arginfo_norewind_it___construct, ZEND_ACC_PUBLIC)
- SPL_ME(NoRewindIterator, rewind, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(NoRewindIterator, valid, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(NoRewindIterator, key, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(NoRewindIterator, current, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(NoRewindIterator, next, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(dual_it, getInnerIterator, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-/* {{{ proto InfiniteIterator::__construct(Iterator it)
- Create an iterator from another iterator */
-SPL_METHOD(InfiniteIterator, __construct)
-{
- spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, zend_ce_iterator, DIT_InfiniteIterator);
-} /* }}} */
-
-/* {{{ proto InfiniteIterator::next()
- Prevent a call to inner iterators rewind() (internally the current data will be fetched if valid()) */
-SPL_METHOD(InfiniteIterator, next)
-{
- spl_dual_it_object *intern;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- spl_dual_it_next(intern, 1 TSRMLS_CC);
- if (spl_dual_it_valid(intern TSRMLS_CC) == SUCCESS) {
- spl_dual_it_fetch(intern, 0 TSRMLS_CC);
- } else {
- spl_dual_it_rewind(intern TSRMLS_CC);
- if (spl_dual_it_valid(intern TSRMLS_CC) == SUCCESS) {
- spl_dual_it_fetch(intern, 0 TSRMLS_CC);
- }
- }
-} /* }}} */
-
-static zend_function_entry spl_funcs_InfiniteIterator[] = {
- SPL_ME(InfiniteIterator, __construct, arginfo_norewind_it___construct, ZEND_ACC_PUBLIC)
- SPL_ME(InfiniteIterator, next, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-/* {{{ proto EmptyIterator::rewind()
- Does nothing */
-SPL_METHOD(EmptyIterator, rewind)
-{
-} /* }}} */
-
-/* {{{ proto EmptyIterator::valid()
- Return false */
-SPL_METHOD(EmptyIterator, valid)
-{
- RETURN_FALSE;
-} /* }}} */
-
-/* {{{ proto EmptyIterator::key()
- Throws exception */
-SPL_METHOD(EmptyIterator, key)
-{
- zend_throw_exception(spl_ce_BadMethodCallException, "Accessing the key of an EmptyIterator", 0 TSRMLS_CC);
-} /* }}} */
-
-/* {{{ proto EmptyIterator::current()
- Throws exception */
-SPL_METHOD(EmptyIterator, current)
-{
- zend_throw_exception(spl_ce_BadMethodCallException, "Accessing the value of an EmptyIterator", 0 TSRMLS_CC);
-} /* }}} */
-
-/* {{{ proto EmptyIterator::next()
- Does nothing */
-SPL_METHOD(EmptyIterator, next)
-{
-} /* }}} */
-
-static zend_function_entry spl_funcs_EmptyIterator[] = {
- SPL_ME(EmptyIterator, rewind, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(EmptyIterator, valid, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(EmptyIterator, key, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(EmptyIterator, current, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(EmptyIterator, next, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-int spl_append_it_next_iterator(spl_dual_it_object *intern TSRMLS_DC) /* {{{*/
-{
- spl_dual_it_free(intern TSRMLS_CC);
-
- if (intern->inner.zobject) {
- zval_ptr_dtor(&intern->inner.zobject);
- intern->inner.zobject = NULL;
- intern->inner.ce = NULL;
- intern->inner.object = NULL;
- intern->inner.iterator = NULL;
- }
- if (intern->u.append.iterator->funcs->valid(intern->u.append.iterator TSRMLS_CC) == SUCCESS) {
- zval **it;
-
- intern->u.append.iterator->funcs->get_current_data(intern->u.append.iterator, &it TSRMLS_CC);
- (*it)->refcount++;
- intern->inner.zobject = *it;
- intern->inner.ce = Z_OBJCE_PP(it);
- intern->inner.object = zend_object_store_get_object(*it TSRMLS_CC);
- intern->inner.iterator = intern->inner.ce->get_iterator(intern->inner.ce, *it TSRMLS_CC);
- spl_dual_it_rewind(intern TSRMLS_CC);
- intern->u.append.iterator->funcs->move_forward(intern->u.append.iterator TSRMLS_CC);
- return SUCCESS;
- } else {
- return FAILURE;
- }
-} /* }}} */
-
-void spl_append_it_fetch(spl_dual_it_object *intern TSRMLS_DC) /* {{{*/
-{
- while (spl_dual_it_valid(intern TSRMLS_CC) != SUCCESS) {
- if (spl_append_it_next_iterator(intern TSRMLS_CC) != SUCCESS) {
- return;
- }
- }
- spl_dual_it_fetch(intern, 0 TSRMLS_CC);
-} /* }}} */
-
-void spl_append_it_next(spl_dual_it_object *intern TSRMLS_DC) /* {{{ */
-{
- if (spl_dual_it_valid(intern TSRMLS_CC) == SUCCESS) {
- spl_dual_it_next(intern, 1 TSRMLS_CC);
- }
- spl_append_it_fetch(intern TSRMLS_CC);
-} /* }}} */
-
-/* {{{ proto AppendIterator::__construct()
- Create an AppendIterator */
-SPL_METHOD(AppendIterator, __construct)
-{
- spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, zend_ce_iterator, DIT_AppendIterator);
-} /* }}} */
-
-/* {{{ proto void AppendIterator::append(Iterator it)
- Append an iterator */
-SPL_METHOD(AppendIterator, append)
-{
- spl_dual_it_object *intern;
- zval *it;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &it, zend_ce_iterator) == FAILURE) {
- return;
- }
- spl_array_iterator_append(intern->u.append.zarrayit, it TSRMLS_CC);
-
- if (!intern->inner.iterator || spl_dual_it_valid(intern TSRMLS_CC) != SUCCESS) {
- if (intern->u.append.iterator->funcs->valid(intern->u.append.iterator TSRMLS_CC) != SUCCESS) {
- intern->u.append.iterator->funcs->rewind(intern->u.append.iterator TSRMLS_CC);
- }
- do {
- spl_append_it_next_iterator(intern TSRMLS_CC);
- } while (intern->inner.zobject != it);
- spl_append_it_fetch(intern TSRMLS_CC);
- }
-} /* }}} */
-
-/* {{{ proto void AppendIterator::rewind()
- Rewind to the first iterator and rewind the first iterator, too */
-SPL_METHOD(AppendIterator, rewind)
-{
- spl_dual_it_object *intern;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- intern->u.append.iterator->funcs->rewind(intern->u.append.iterator TSRMLS_CC);
- if (spl_append_it_next_iterator(intern TSRMLS_CC) == SUCCESS) {
- spl_append_it_fetch(intern TSRMLS_CC);
- }
-} /* }}} */
-
-/* {{{ proto boolean AppendIterator::valid()
- Check if the current state is valid */
-SPL_METHOD(AppendIterator, valid)
-{
- spl_dual_it_object *intern;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- RETURN_BOOL(intern->current.data);
-} /* }}} */
-
-/* {{{ proto AppendIterator::next()
- Forward to next element */
-SPL_METHOD(AppendIterator, next)
-{
- spl_dual_it_object *intern;
-
- intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- spl_append_it_next(intern TSRMLS_CC);
-} /* }}} */
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_append_it_append, 0)
- ZEND_ARG_OBJ_INFO(0, iterator, Iterator, 0)
-ZEND_END_ARG_INFO();
-
-static zend_function_entry spl_funcs_AppendIterator[] = {
- SPL_ME(AppendIterator, __construct, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(AppendIterator, append, arginfo_append_it_append, ZEND_ACC_PUBLIC)
- SPL_ME(AppendIterator, rewind, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(AppendIterator, valid, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(dual_it, key, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(dual_it, current, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(AppendIterator, next, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(dual_it, getInnerIterator, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-/* {{{ array iterator_to_array(Traversable it)
- Copy the iterator into an array */
-PHP_FUNCTION(iterator_to_array)
-{
- zval *obj, **data;
- zend_object_iterator *iter;
- char *str_key;
- uint str_key_len;
- ulong int_key;
- int key_type;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &obj, zend_ce_traversable) == FAILURE) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- iter = Z_OBJCE_P(obj)->get_iterator(Z_OBJCE_P(obj), obj TSRMLS_CC);
-
- iter->funcs->rewind(iter TSRMLS_CC);
- while (iter->funcs->valid(iter TSRMLS_CC) == SUCCESS) {
- key_type = iter->funcs->get_current_key(iter, &str_key, &str_key_len, &int_key TSRMLS_CC);
- iter->funcs->get_current_data(iter, &data TSRMLS_CC);
- (*data)->refcount++;
- switch(key_type) {
- case HASH_KEY_IS_STRING:
- add_assoc_zval_ex(return_value, str_key, str_key_len, *data);
- efree(str_key);
- break;
- case HASH_KEY_IS_LONG:
- add_index_zval(return_value, int_key, *data);
- break;
- }
- iter->funcs->move_forward(iter TSRMLS_CC);
- }
- iter->funcs->dtor(iter TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ int iterator_count(IteratorAggregate it)
- Count the elements in an iterator */
-PHP_FUNCTION(iterator_count)
-{
- zval *obj;
- zend_object_iterator *iter;
- long count = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &obj, zend_ce_aggregate) == FAILURE) {
- RETURN_FALSE;
- }
-
- iter = Z_OBJCE_P(obj)->get_iterator(Z_OBJCE_P(obj), obj TSRMLS_CC);
-
- iter->funcs->rewind(iter TSRMLS_CC);
- while (iter->funcs->valid(iter TSRMLS_CC) == SUCCESS) {
- count++;
- iter->funcs->move_forward(iter TSRMLS_CC);
- }
- iter->funcs->dtor(iter TSRMLS_CC);
-
- RETURN_LONG(count);
-}
-/* }}} */
-
-static zend_function_entry spl_funcs_OuterIterator[] = {
- SPL_ABSTRACT_ME(OuterIterator, getInnerIterator, NULL)
- {NULL, NULL, NULL}
-};
-
-/* {{{ PHP_MINIT_FUNCTION(spl_iterators)
- */
-PHP_MINIT_FUNCTION(spl_iterators)
-{
- REGISTER_SPL_INTERFACE(RecursiveIterator);
- REGISTER_SPL_ITERATOR(RecursiveIterator);
-
- REGISTER_SPL_STD_CLASS_EX(RecursiveIteratorIterator, spl_RecursiveIteratorIterator_new, spl_funcs_RecursiveIteratorIterator);
- REGISTER_SPL_ITERATOR(RecursiveIteratorIterator);
-
- memcpy(&spl_handlers_rec_it_it, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
- spl_handlers_rec_it_it.get_method = spl_recursive_it_get_method;
- spl_handlers_rec_it_it.clone_obj = NULL;
-
- memcpy(&spl_handlers_dual_it, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
- spl_handlers_dual_it.get_method = spl_dual_it_get_method;
- /*spl_handlers_dual_it.call_method = spl_dual_it_call_method;*/
- spl_handlers_dual_it.clone_obj = NULL;
-
- spl_ce_RecursiveIteratorIterator->get_iterator = spl_recursive_it_get_iterator;
- spl_ce_RecursiveIteratorIterator->iterator_funcs.funcs = &spl_recursive_it_iterator_funcs;
-
- REGISTER_LONG_CONSTANT("RIT_LEAVES_ONLY", (long)RIT_LEAVES_ONLY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("RIT_SELF_FIRST", (long)RIT_SELF_FIRST, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("RIT_CHILD_FIRST", (long)RIT_CHILD_FIRST, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_SPL_STD_CLASS_EX(FilterIterator, spl_dual_it_new, spl_funcs_FilterIterator);
- REGISTER_SPL_ITERATOR(FilterIterator);
- spl_ce_FilterIterator->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS;
-
- REGISTER_SPL_SUB_CLASS_EX(ParentIterator, FilterIterator, spl_dual_it_new, spl_funcs_ParentIterator);
- REGISTER_SPL_IMPLEMENTS(ParentIterator, RecursiveIterator);
-
- REGISTER_SPL_INTERFACE(SeekableIterator);
- REGISTER_SPL_ITERATOR(SeekableIterator);
-
- REGISTER_SPL_STD_CLASS_EX(LimitIterator, spl_dual_it_new, spl_funcs_LimitIterator);
- REGISTER_SPL_ITERATOR(LimitIterator);
-
- REGISTER_SPL_STD_CLASS_EX(CachingIterator, spl_dual_it_new, spl_funcs_CachingIterator);
- REGISTER_SPL_ITERATOR(CachingIterator);
-
- REGISTER_LONG_CONSTANT("CIT_CALL_TOSTRING", (long)CIT_CALL_TOSTRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CIT_CATCH_GET_CHILD", (long)CIT_CATCH_GET_CHILD, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_SPL_SUB_CLASS_EX(CachingRecursiveIterator, CachingIterator, spl_dual_it_new, spl_funcs_CachingRecursiveIterator);
- REGISTER_SPL_IMPLEMENTS(CachingRecursiveIterator, RecursiveIterator);
-
- REGISTER_SPL_STD_CLASS_EX(IteratorIterator, spl_dual_it_new, spl_funcs_IteratorIterator);
- REGISTER_SPL_ITERATOR(IteratorIterator);
-
- REGISTER_SPL_STD_CLASS_EX(NoRewindIterator, spl_dual_it_new, spl_funcs_NoRewindIterator);
- REGISTER_SPL_ITERATOR(NoRewindIterator);
-
- REGISTER_SPL_INTERFACE(OuterIterator);
- REGISTER_SPL_ITERATOR(OuterIterator);
-
- REGISTER_SPL_STD_CLASS_EX(AppendIterator, spl_dual_it_new, spl_funcs_AppendIterator);
-
- REGISTER_SPL_IMPLEMENTS(RecursiveIteratorIterator, OuterIterator);
- REGISTER_SPL_IMPLEMENTS(CachingIterator, OuterIterator);
- REGISTER_SPL_IMPLEMENTS(FilterIterator, OuterIterator);
- REGISTER_SPL_IMPLEMENTS(LimitIterator, OuterIterator);
- REGISTER_SPL_IMPLEMENTS(IteratorIterator, OuterIterator);
- REGISTER_SPL_IMPLEMENTS(NoRewindIterator, OuterIterator);
- REGISTER_SPL_IMPLEMENTS(AppendIterator, OuterIterator);
-
- REGISTER_SPL_SUB_CLASS_EX(InfiniteIterator, IteratorIterator, spl_dual_it_new, spl_funcs_InfiniteIterator);
-
- REGISTER_SPL_STD_CLASS_EX(EmptyIterator, NULL, spl_funcs_EmptyIterator);
- REGISTER_SPL_ITERATOR(EmptyIterator);
-
- 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_iterators.h b/ext/spl/spl_iterators.h
deleted file mode 100755
index 1077ac8fec..0000000000
--- a/ext/spl/spl_iterators.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 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> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef SPL_ITERATORS_H
-#define SPL_ITERATORS_H
-
-#include "php.h"
-#include "php_spl.h"
-
-#define spl_ce_Traversable zend_ce_traversable
-#define spl_ce_Iterator zend_ce_iterator
-#define spl_ce_Aggregate zend_ce_aggregate
-#define spl_ce_ArrayAccess zend_ce_arrayaccess
-#define spl_ce_Serializeable zend_ce_serializeable
-
-extern PHPAPI zend_class_entry *spl_ce_RecursiveIterator;
-extern PHPAPI zend_class_entry *spl_ce_RecursiveIteratorIterator;
-extern PHPAPI zend_class_entry *spl_ce_FilterIterator;
-extern PHPAPI zend_class_entry *spl_ce_ParentIterator;
-extern PHPAPI zend_class_entry *spl_ce_SeekableIterator;
-extern PHPAPI zend_class_entry *spl_ce_LimitIterator;
-extern PHPAPI zend_class_entry *spl_ce_CachingIterator;
-extern PHPAPI zend_class_entry *spl_ce_CachingRecursiveIterator;
-extern PHPAPI zend_class_entry *spl_ce_OuterIterator;
-extern PHPAPI zend_class_entry *spl_ce_IteratorIterator;
-extern PHPAPI zend_class_entry *spl_ce_NoRewindIterator;
-extern PHPAPI zend_class_entry *spl_ce_InfiniteIterator;
-extern PHPAPI zend_class_entry *spl_ce_EmptyIterator;
-extern PHPAPI zend_class_entry *spl_ce_AppendIterator;
-
-PHP_MINIT_FUNCTION(spl_iterators);
-
-PHP_FUNCTION(iterator_to_array);
-PHP_FUNCTION(iterator_count);
-
-typedef enum {
- DIT_Default = 0,
- DIT_LimitIterator,
- DIT_CachingIterator,
- DIT_CachingRecursiveIterator,
- DIT_IteratorIterator,
- DIT_NoRewindIterator,
- DIT_InfiniteIterator,
- DIT_AppendIterator,
-} dual_it_type;
-
-enum {
- /* public */
- CIT_CALL_TOSTRING = 1,
- CIT_CATCH_GET_CHILD = 2,
- CIT_PUBLIC = CIT_CALL_TOSTRING|CIT_CATCH_GET_CHILD,
- /* private */
- CIT_VALID = 4,
- CIT_HAS_CHILDREN = 8
-};
-
-typedef struct _spl_dual_it_object {
- zend_object std;
- struct {
- zval *zobject;
- zend_class_entry *ce;
- zend_object *object;
- zend_object_iterator *iterator;
- } inner;
- struct {
- zval *data;
- char *str_key;
- uint str_key_len;
- ulong int_key;
- int key_type; /* HASH_KEY_IS_STRING or HASH_KEY_IS_LONG */
- int pos;
- } current;
- dual_it_type dit_type;
- union {
- struct {
- long offset;
- long count;
- } limit;
- struct {
- int flags; /* CIT_VALID, CIT_CALL_TOSTRING, CIT_CATCH_GET_CHILD */
- zval *zstr;
- zval *zchildren;
- } caching;
- struct {
- zval *zarrayit;
- zend_object_iterator *iterator;
- } append;
- } u;
-} spl_dual_it_object;
-
-#endif /* SPL_ITERATORS_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_observer.c b/ext/spl/spl_observer.c
deleted file mode 100755
index 9c12eb4673..0000000000
--- a/ext/spl/spl_observer.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 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> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "zend_interfaces.h"
-#include "zend_exceptions.h"
-
-#include "php_spl.h"
-#include "spl_functions.h"
-#include "spl_engine.h"
-#include "spl_observer.h"
-
-SPL_METHOD(Observer, update);
-SPL_METHOD(Subject, attach);
-SPL_METHOD(Subject, detach);
-SPL_METHOD(Subject, notify);
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_Observer_update, 0)
- ZEND_ARG_OBJ_INFO(0, subject, Subject, 0)
-ZEND_END_ARG_INFO();
-
-static zend_function_entry spl_funcs_Observer[] = {
- SPL_ABSTRACT_ME(Observer, update, arginfo_Observer_update)
- {NULL, NULL, NULL}
-};
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_Subject_attach, 0)
- ZEND_ARG_OBJ_INFO(0, observer, Observer, 0)
-ZEND_END_ARG_INFO();
-
-/*static
-ZEND_BEGIN_ARG_INFO_EX(arginfo_Subject_notify, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, ignore, Observer, 1)
-ZEND_END_ARG_INFO();*/
-
-static zend_function_entry spl_funcs_Subject[] = {
- SPL_ABSTRACT_ME(Subject, attach, arginfo_Subject_attach)
- SPL_ABSTRACT_ME(Subject, detach, arginfo_Subject_attach)
- SPL_ABSTRACT_ME(Subject, notify, NULL)
- {NULL, NULL, NULL}
-};
-
-PHPAPI zend_class_entry *spl_ce_Observer;
-PHPAPI zend_class_entry *spl_ce_Subject;
-
-/* {{{ PHP_MINIT_FUNCTION(spl_observer) */
-PHP_MINIT_FUNCTION(spl_observer)
-{
- REGISTER_SPL_INTERFACE(Observer);
- REGISTER_SPL_INTERFACE(Subject);
-
- 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_observer.h b/ext/spl/spl_observer.h
deleted file mode 100755
index 857116ec4d..0000000000
--- a/ext/spl/spl_observer.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 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> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef SPL_OBSERVER_H
-#define SPL_OBSERVER_H
-
-#include "php.h"
-#include "php_spl.h"
-
-extern PHPAPI zend_class_entry *spl_ce_Observer;
-extern PHPAPI zend_class_entry *spl_ce_Subject;
-
-PHP_MINIT_FUNCTION(spl_observer);
-
-#endif /* SPL_OBSERVER_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_sxe.c b/ext/spl/spl_sxe.c
deleted file mode 100755
index 325a5770b5..0000000000
--- a/ext/spl/spl_sxe.c
+++ /dev/null
@@ -1,178 +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> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "zend_interfaces.h"
-
-#include "php_spl.h"
-#include "spl_functions.h"
-#include "spl_engine.h"
-#include "spl_iterators.h"
-#include "spl_sxe.h"
-
-zend_class_entry *spl_ce_SimpleXMLIterator = NULL;
-
-#if HAVE_LIBXML && HAVE_SIMPLEXML
-
-#include "ext/simplexml/php_simplexml_exports.h"
-
-SPL_METHOD(SimpleXMLIterator, rewind) /* {{{ */
-{
- php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
-
- php_sxe_reset_iterator(sxe TSRMLS_CC);
-}
-/* }}} */
-
-SPL_METHOD(SimpleXMLIterator, valid) /* {{{ */
-{
- php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
-
- RETURN_BOOL(sxe->iter.data);
-}
-/* }}} */
-
-SPL_METHOD(SimpleXMLIterator, current) /* {{{ */
-{
- php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
-
- if (!sxe->iter.data) {
- return; /* return NULL */
- }
-
- RETURN_ZVAL(sxe->iter.data, 1, 0);
-}
-/* }}} */
-
-SPL_METHOD(SimpleXMLIterator, key) /* {{{ */
-{
- xmlNodePtr curnode;
- php_sxe_object *intern;
- php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
-
- if (!sxe->iter.data) {
- RETURN_FALSE;
- }
-
- intern = (php_sxe_object *)zend_object_store_get_object(sxe->iter.data TSRMLS_CC);
- if (intern != NULL && intern->node != NULL) {
- curnode = (xmlNodePtr)((php_libxml_node_ptr *)intern->node)->node;
- RETURN_STRINGL((char*)curnode->name, xmlStrlen(curnode->name), 1);
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-SPL_METHOD(SimpleXMLIterator, next) /* {{{ */
-{
- php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
-
- php_sxe_move_forward_iterator(sxe TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ hasChildren()
- */
-SPL_METHOD(SimpleXMLIterator, hasChildren)
-{
- php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
- php_sxe_object *child;
- xmlNodePtr node;
-
- if (!sxe->iter.data) {
- RETURN_FALSE;
- }
- child = php_sxe_fetch_object(sxe->iter.data TSRMLS_CC);
-
- GET_NODE(child, node);
- if (node) {
- node = node->children;
- }
- while (node && node->type != XML_ELEMENT_NODE) {
- node = node->next;
- }
- RETURN_BOOL(node ? 1 : 0);
-}
-/* }}} */
-
-/* {{{ getChildren()
- */
-SPL_METHOD(SimpleXMLIterator, getChildren)
-{
- php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
-
- if (!sxe->iter.data) {
- return; /* return NULL */
- }
- return_value->type = IS_OBJECT;
- return_value->value.obj = zend_objects_store_clone_obj(sxe->iter.data TSRMLS_CC);
-}
-
-static zend_function_entry spl_funcs_SimpleXMLIterator[] = {
- SPL_ME(SimpleXMLIterator, rewind, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(SimpleXMLIterator, valid, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(SimpleXMLIterator, current, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(SimpleXMLIterator, key, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(SimpleXMLIterator, next, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(SimpleXMLIterator, hasChildren, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(SimpleXMLIterator, getChildren, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-SPL_API PHP_MINIT_FUNCTION(spl_sxe) /* {{{ */
-{
- zend_class_entry *spl_ce_SimpleXML_Element = sxe_get_element_class_entry();
-
- if (!spl_ce_SimpleXML_Element) {
- return SUCCESS; /* SimpleXML must be initialized before */
- }
-
- REGISTER_SPL_SUB_CLASS_EX(SimpleXMLIterator, SimpleXML_Element, sxe_object_new, spl_funcs_SimpleXMLIterator);
- REGISTER_SPL_IMPLEMENTS(SimpleXMLIterator, RecursiveIterator);
-
- return SUCCESS;
-}
-/* }}} */
-
-#else /* HAVE_LIBXML && HAVE_SIMPLEXML */
-
-SPL_API PHP_MINIT_FUNCTION(spl_sxe) /* {{{ */
-{
- return SUCCESS;
-}
-
-#endif /* HAVE_LIBXML && HAVE_SIMPLEXML */
-
-/*
- * 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_sxe.h b/ext/spl/spl_sxe.h
deleted file mode 100755
index 7466808fdc..0000000000
--- a/ext/spl/spl_sxe.h
+++ /dev/null
@@ -1,40 +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> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef SPL_SXE_H
-#define SPL_SXE_H
-
-#include "php.h"
-#include "php_spl.h"
-
-extern zend_class_entry *spl_ce_SimpleXMLIterator;
-
-SPL_API PHP_MINIT_FUNCTION(spl_sxe);
-
-#endif /* SPL_SXE_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_001.phpt b/ext/spl/tests/array_001.phpt
deleted file mode 100755
index 1c7566ecb9..0000000000
--- a/ext/spl/tests/array_001.phpt
+++ /dev/null
@@ -1,103 +0,0 @@
---TEST--
-SPL: ArrayObject
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-
-$ar = array(0=>0, 1=>1);
-$ar = new ArrayObject($ar);
-
-var_dump($ar);
-
-$ar[2] = 2;
-var_dump($ar[2]);
-var_dump($ar["3"] = 3);
-
-var_dump(array_merge((array)$ar, array(4=>4, 5=>5)));
-
-var_dump($ar["a"] = "a");
-
-var_dump($ar);
-var_dump($ar[0]);
-var_dump($ar[6]);
-var_dump($ar["b"]);
-
-unset($ar[1]);
-unset($ar["3"]);
-unset($ar["a"]);
-unset($ar[7]);
-unset($ar["c"]);
-var_dump($ar);
-
-$ar[] = '3';
-$ar[] = 4;
-var_dump($ar);
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-object(ArrayObject)#1 (2) {
- [0]=>
- int(0)
- [1]=>
- int(1)
-}
-int(2)
-int(3)
-array(6) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
- [5]=>
- int(5)
-}
-string(1) "a"
-object(ArrayObject)#1 (5) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- ["a"]=>
- string(1) "a"
-}
-int(0)
-
-Notice: Undefined offset: 6 in %sarray_001.php on line %d
-NULL
-
-Notice: Undefined index: b in %sarray_001.php on line %d
-NULL
-
-Notice: Undefined offset: 7 in %sarray_001.php on line %d
-
-Notice: Undefined index: c in %sarray_001.php on line %d
-object(ArrayObject)#1 (2) {
- [0]=>
- int(0)
- [2]=>
- int(2)
-}
-object(ArrayObject)#1 (4) {
- [0]=>
- int(0)
- [2]=>
- int(2)
- [4]=>
- string(1) "3"
- [5]=>
- int(4)
-}
-===DONE===
diff --git a/ext/spl/tests/array_002.phpt b/ext/spl/tests/array_002.phpt
deleted file mode 100755
index 960253f335..0000000000
--- a/ext/spl/tests/array_002.phpt
+++ /dev/null
@@ -1,37 +0,0 @@
---TEST--
-SPL: ArrayObject copy constructor
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-
-$array = array('1' => 'one',
- '2' => 'two',
- '3' => 'three');
-
-$object = new ArrayObject($array);
-$object[] = 'four';
-
-$arrayObject = new ArrayObject($object);
-
-$arrayObject[] = 'five';
-
-var_dump($arrayObject);
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-object(ArrayObject)#%d (5) {
- [1]=>
- string(3) "one"
- [2]=>
- string(3) "two"
- [3]=>
- string(5) "three"
- [4]=>
- string(4) "four"
- [5]=>
- string(4) "five"
-}
-===DONE===
diff --git a/ext/spl/tests/array_003.phpt b/ext/spl/tests/array_003.phpt
deleted file mode 100755
index 386c7bcf7d..0000000000
--- a/ext/spl/tests/array_003.phpt
+++ /dev/null
@@ -1,61 +0,0 @@
---TEST--
-SPL: ArrayObject from object
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-
-// This test also needs to exclude the protected and private variables
-// since they cannot be accessed from the external object which iterates
-// them.
-
-class test
-{
- public $pub = "public";
- protected $pro = "protected";
- private $pri = "private";
-
- function __construct()
- {
- $this->imp = "implicit";
- }
-};
-
-$test = new test;
-$test->dyn = "dynamic";
-
-print_r($test);
-
-$object = new ArrayObject($test);
-
-print_r($object);
-
-foreach($test as $key => $val)
-{
- echo "$key => $val\n";
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-test Object
-(
- [pub] => public
- [pro:protected] => protected
- [pri:private] => private
- [imp] => implicit
- [dyn] => dynamic
-)
-ArrayObject Object
-(
- [pub] => public
- [pro:protected] => protected
- [pri:private] => private
- [imp] => implicit
- [dyn] => dynamic
-)
-pub => public
-imp => implicit
-dyn => dynamic
-===DONE===
diff --git a/ext/spl/tests/array_004.phpt b/ext/spl/tests/array_004.phpt
deleted file mode 100755
index e7abf2b1dc..0000000000
--- a/ext/spl/tests/array_004.phpt
+++ /dev/null
@@ -1,143 +0,0 @@
---TEST--
-SPL: ArrayIterator
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---INI--
-allow_call_time_pass_reference=1
---FILE--
-<?php
-
-echo "==Normal==\n";
-
-$arr = array(0=>0, 1=>1, 2=>2);
-$obj = new ArrayObject($arr);
-
-foreach($obj as $ak=>$av) {
- foreach($obj as $bk=>$bv) {
- if ($ak==0 && $bk==0) {
- $arr[0] = "modify";
- }
- echo "$ak=>$av - $bk=>$bv\n";
- }
-}
-
-echo "==UseRef==\n";
-
-$arr = array(0=>0, 1=>1, 2=>2);
-$obj = new ArrayObject(&$arr);
-
-foreach($obj as $ak=>$av) {
- foreach($obj as $bk=>$bv) {
- if ($ak==0 && $bk==0) {
- $arr[0] = "modify";
- }
- echo "$ak=>$av - $bk=>$bv\n";
- }
-}
-
-echo "==Modify==\n";
-
-$arr = array(0=>0, 1=>1, 2=>2);
-$obj = new ArrayObject(&$arr);
-
-foreach($obj as $ak=>$av) {
- foreach($obj as $bk=>$bv) {
- if ($ak==0 && $bk==0) {
- $arr[0] = "modify";
- }
- echo "$ak=>$av - $bk=>$bv\n";
- }
-}
-
-echo "==Delete==\n";
-
-$arr = array(0=>0, 1=>1, 2=>2);
-$obj = new ArrayObject(&$arr);
-
-foreach($obj as $ak=>$av) {
- foreach($obj as $bk=>$bv) {
- if ($ak==1 && $bk==1) {
- unset($arr[1]);
- }
- echo "$ak=>$av - $bk=>$bv\n";
- }
-}
-
-echo "==Change==\n";
-
-$arr = array(0=>0, 1=>1, 2=>2);
-$obj = new ArrayObject(&$arr);
-
-foreach($obj as $ak=>$av) {
- foreach($obj as $bk=>$bv) {
- if ($ak==1 && $bk==1) {
- $arr = NULL;
- }
- echo "$ak=>$av - $bk=>$bv\n";
- }
-}
-
-echo "Done\n";
-?>
---EXPECTF--
-==Normal==
-0=>0 - 0=>0
-0=>0 - 1=>1
-0=>0 - 2=>2
-1=>1 - 0=>0
-1=>1 - 1=>1
-1=>1 - 2=>2
-2=>2 - 0=>0
-2=>2 - 1=>1
-2=>2 - 2=>2
-==UseRef==
-0=>0 - 0=>0
-0=>0 - 1=>1
-0=>0 - 2=>2
-1=>1 - 0=>modify
-1=>1 - 1=>1
-1=>1 - 2=>2
-2=>2 - 0=>modify
-2=>2 - 1=>1
-2=>2 - 2=>2
-==Modify==
-0=>0 - 0=>0
-0=>0 - 1=>1
-0=>0 - 2=>2
-1=>1 - 0=>modify
-1=>1 - 1=>1
-1=>1 - 2=>2
-2=>2 - 0=>modify
-2=>2 - 1=>1
-2=>2 - 2=>2
-==Delete==
-0=>0 - 0=>0
-0=>0 - 1=>1
-0=>0 - 2=>2
-1=>1 - 0=>0
-1=>1 - 1=>1
-
-Notice: main(): ArrayIterator::next(): Array was modified outside object and internal position is no longer valid in %sarray_004.php on line %d
-1=>1 - 0=>0
-1=>1 - 2=>2
-
-Notice: main(): ArrayIterator::next(): Array was modified outside object and internal position is no longer valid in %sarray_004.php on line %d
-0=>0 - 0=>0
-0=>0 - 2=>2
-2=>2 - 0=>0
-2=>2 - 2=>2
-==Change==
-0=>0 - 0=>0
-0=>0 - 1=>1
-0=>0 - 2=>2
-1=>1 - 0=>0
-1=>1 - 1=>1
-
-Notice: main(): ArrayIterator::current(): Array was modified outside object and is no longer an array in %sarray_004.php on line %d
-
-Notice: main(): ArrayIterator::valid(): Array was modified outside object and is no longer an array in %sarray_004.php on line %d
-
-Notice: main(): ArrayIterator::current(): Array was modified outside object and is no longer an array in %sarray_004.php on line %d
-
-Notice: main(): ArrayIterator::valid(): Array was modified outside object and is no longer an array in %sarray_004.php on line %d
-Done
diff --git a/ext/spl/tests/array_005.phpt b/ext/spl/tests/array_005.phpt
deleted file mode 100755
index 9214a4c92b..0000000000
--- a/ext/spl/tests/array_005.phpt
+++ /dev/null
@@ -1,93 +0,0 @@
---TEST--
-SPL: ArrayObject/Iterator interaction
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-
-class Student
-{
- private $id;
- private $name;
-
- public function __construct($id, $name)
- {
- $this->id = $id;
- $this->name = $name;
- }
-
- public function __toString()
- {
- return $this->id . ', ' . $this->name;
- }
-
- public function getId()
- {
- return $this->id;
- }
-}
-
-class StudentIdFilter extends FilterIterator
-{
- private $id;
-
- public function __construct(ArrayObject $students, Student $other)
- {
- FilterIterator::__construct($students->getIterator());
- $this->id = $other->getId();
- }
-
- public function accept()
- {
- echo "ACCEPT ".$this->current()->getId()." == ".$this->id."\n";
- return $this->current()->getId() == $this->id;
- }
-}
-
-class StudentList implements IteratorAggregate
-{
- private $students;
-
- public function __construct()
- {
- $this->students = new ArrayObject(array());
- }
-
- public function add(Student $student)
- {
- if (!$this->contains($student)) {
- $this->students[] = $student;
- }
- }
-
- public function contains(Student $student)
- {
- foreach ($this->students as $s)
- {
- if ($s->getId() == $student->getId()) {
- return true;
- }
- }
- return false;
- }
-
- public function getIterator() {
- return $this->students->getIterator();
- }
-}
-
-$students = new StudentList();
-$students->add(new Student('01234123', 'Joe'));
-$students->add(new Student('00000014', 'Bob'));
-$students->add(new Student('00000014', 'Foo'));
-
-foreach ($students as $student) {
- echo $student, "\n";
-}
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-01234123, Joe
-00000014, Bob
-===DONE===
diff --git a/ext/spl/tests/array_006.phpt b/ext/spl/tests/array_006.phpt
deleted file mode 100755
index 5dd9bdec7a..0000000000
--- a/ext/spl/tests/array_006.phpt
+++ /dev/null
@@ -1,32 +0,0 @@
---TEST--
-SPL: ArrayIterator without ArrayObject
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---INI--
-allow_call_time_pass_reference=1
---FILE--
-<?php
-
-echo "==Normal==\n";
-
-$arr = array(0=>0, 1=>1, 2=>2);
-$obj = new ArrayIterator($arr);
-
-foreach($obj as $ak=>$av) {
- foreach($obj as $bk=>$bv) {
- if ($ak==0 && $bk==0) {
- $arr[0] = "modify";
- }
- echo "$ak=>$av - $bk=>$bv\n";
- }
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-==Normal==
-0=>0 - 0=>0
-0=>0 - 1=>1
-0=>0 - 2=>2
-===DONE===
diff --git a/ext/spl/tests/array_007.phpt b/ext/spl/tests/array_007.phpt
deleted file mode 100755
index 3e74e00da4..0000000000
--- a/ext/spl/tests/array_007.phpt
+++ /dev/null
@@ -1,65 +0,0 @@
---TEST--
-SPL: ArrayObject/Iterator from IteratorAggregate
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-
-// This test also needs to exclude the protected and private variables
-// since they cannot be accessed from the external object which iterates
-// them.
-
-class test implements IteratorAggregate
-{
- public $pub = "public";
- protected $pro = "protected";
- private $pri = "private";
-
- function __construct()
- {
- $this->imp = "implicit";
- }
-
- function getIterator()
- {
- $it = new ArrayObject($this);
- return $it->getIterator();
- }
-};
-
-$test = new test;
-$test->dyn = "dynamic";
-
-print_r($test);
-
-print_r($test->getIterator());
-
-foreach($test as $key => $val)
-{
- echo "$key => $val\n";
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-test Object
-(
- [pub] => public
- [pro:protected] => protected
- [pri:private] => private
- [imp] => implicit
- [dyn] => dynamic
-)
-ArrayIterator Object
-(
- [pub] => public
- [pro:protected] => protected
- [pri:private] => private
- [imp] => implicit
- [dyn] => dynamic
-)
-pub => public
-imp => implicit
-dyn => dynamic
-===DONE===
diff --git a/ext/spl/tests/array_008.phpt b/ext/spl/tests/array_008.phpt
deleted file mode 100755
index 613e324776..0000000000
--- a/ext/spl/tests/array_008.phpt
+++ /dev/null
@@ -1,62 +0,0 @@
---TEST--
-SPL: ArrayIterator and foreach reference
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---INI--
-allow_call_time_pass_reference=1
---FILE--
-<?php
-
-echo "==Normal==\n";
-
-$arr = array(0=>0, 1=>1, 2=>2);
-$obj = new ArrayObject($arr);
-
-foreach($obj as $ak=>&$av) {
- foreach($obj as $bk=>&$bv) {
- if ($ak==0 && $bk==0) {
- $bv = "modify";
- }
- echo "$ak=>$av - $bk=>$bv\n";
- }
-}
-
-echo "==UseRef==\n";
-
-$arr = array(0=>0, 1=>1, 2=>2);
-$obj = new ArrayObject(&$arr);
-
-foreach($obj as $ak=>&$av) {
- foreach($obj as $bk=>&$bv) {
- if ($ak==0 && $bk==0) {
- $bv = "modify";
- }
- echo "$ak=>$av - $bk=>$bv\n";
- }
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-==Normal==
-0=>modify - 0=>modify
-0=>modify - 1=>1
-0=>modify - 2=>2
-1=>1 - 0=>modify
-1=>1 - 1=>1
-1=>1 - 2=>2
-2=>2 - 0=>modify
-2=>2 - 1=>1
-2=>2 - 2=>2
-==UseRef==
-0=>modify - 0=>modify
-0=>modify - 1=>1
-0=>modify - 2=>2
-1=>1 - 0=>modify
-1=>1 - 1=>1
-1=>1 - 2=>2
-2=>2 - 0=>modify
-2=>2 - 1=>1
-2=>2 - 2=>2
-===DONE===
diff --git a/ext/spl/tests/array_009.phpt b/ext/spl/tests/array_009.phpt
deleted file mode 100755
index 5499caad69..0000000000
--- a/ext/spl/tests/array_009.phpt
+++ /dev/null
@@ -1,39 +0,0 @@
---TEST--
-SPL: ArrayIterator implementing RecursiveIterator
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-
-class RecursiceArrayIterator extends ArrayIterator implements RecursiveIterator
-{
- function hasChildren()
- {
- return is_array($this->current());
- }
-
- function getChildren()
- {
- return new RecursiceArrayIterator($this->current());
- }
-}
-
-$array = array(1, 2 => array(21, 22 => array(221, 222), 23 => array(231)), 3);
-
-$dir = new RecursiveIteratorIterator(new RecursiceArrayIterator($array), RIT_LEAVES_ONLY);
-
-foreach ($dir as $file) {
- print "$file\n";
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1
-21
-221
-222
-231
-3
-===DONE===
diff --git a/ext/spl/tests/array_010.phpt b/ext/spl/tests/array_010.phpt
deleted file mode 100755
index dae6b93d6d..0000000000
--- a/ext/spl/tests/array_010.phpt
+++ /dev/null
@@ -1,146 +0,0 @@
---TEST--
-SPL: ArrayIterator implements ArrayAccess
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-
-$obj = new ArrayObject(array('1st', 1, 2=>'3rd', '4th'=>4));
-
-var_dump($obj->getArrayCopy());
-
-echo "===EMPTY===\n";
-var_dump(empty($obj[0]));
-var_dump(empty($obj[1]));
-var_dump(empty($obj[2]));
-var_dump(empty($obj['4th']));
-var_dump(empty($obj['5th']));
-var_dump(empty($obj[6]));
-
-echo "===isset===\n";
-var_dump(isset($obj[0]));
-var_dump(isset($obj[1]));
-var_dump(isset($obj[2]));
-var_dump(isset($obj['4th']));
-var_dump(isset($obj['5th']));
-var_dump(isset($obj[6]));
-
-echo "===offsetGet===\n";
-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 "===offsetSet===\n";
-echo "WRITE 1\n";
-$obj[1] = 'Changed 1';
-var_dump($obj[1]);
-echo "WRITE 2\n";
-$obj['4th'] = 'Changed 4th';
-var_dump($obj['4th']);
-echo "WRITE 3\n";
-$obj['5th'] = 'Added 5th';
-var_dump($obj['5th']);
-echo "WRITE 4\n";
-$obj[6] = 'Added 6';
-var_dump($obj[6]);
-
-var_dump($obj[0]);
-var_dump($obj[2]);
-
-$x = $obj[6] = 'changed 6';
-var_dump($obj[6]);
-var_dump($x);
-
-echo "===unset===\n";
-var_dump($obj->getArrayCopy());
-unset($obj[2]);
-unset($obj['4th']);
-unset($obj[7]);
-unset($obj['8th']);
-var_dump($obj->getArrayCopy());
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-array(4) {
- [0]=>
- string(3) "1st"
- [1]=>
- int(1)
- [2]=>
- string(3) "3rd"
- ["4th"]=>
- int(4)
-}
-===EMPTY===
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(true)
-bool(true)
-===isset===
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(false)
-bool(false)
-===offsetGet===
-string(3) "1st"
-int(1)
-string(3) "3rd"
-int(4)
-
-Notice: Undefined index: 5th in %sarray_010.php on line %d
-NULL
-
-Notice: Undefined offset: 6 in %sarray_010.php on line %d
-NULL
-===offsetSet===
-WRITE 1
-string(9) "Changed 1"
-WRITE 2
-string(11) "Changed 4th"
-WRITE 3
-string(9) "Added 5th"
-WRITE 4
-string(7) "Added 6"
-string(3) "1st"
-string(3) "3rd"
-string(9) "changed 6"
-string(9) "changed 6"
-===unset===
-array(6) {
- [0]=>
- string(3) "1st"
- [1]=>
- string(9) "Changed 1"
- [2]=>
- string(3) "3rd"
- ["4th"]=>
- string(11) "Changed 4th"
- ["5th"]=>
- string(9) "Added 5th"
- [6]=>
- string(9) "changed 6"
-}
-
-Notice: Undefined offset: 7 in %sarray_010.php on line %d
-
-Notice: Undefined index: 8th in %sarray_010.php on line %d
-array(4) {
- [0]=>
- string(3) "1st"
- [1]=>
- string(9) "Changed 1"
- ["5th"]=>
- string(9) "Added 5th"
- [6]=>
- string(9) "changed 6"
-}
-===DONE===
diff --git a/ext/spl/tests/array_011.phpt b/ext/spl/tests/array_011.phpt
deleted file mode 100755
index 09b132cfef..0000000000
--- a/ext/spl/tests/array_011.phpt
+++ /dev/null
@@ -1,37 +0,0 @@
---TEST--
-SPL: ArrayIterator, LimitIterator and string keys
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-
-$a = array('zero' => 0, 'one' => 1, 'two' => 2, 'three' => 3, 'four' => 4, 'five' => 5);
-//foreach (new ArrayIterator($a) as $k => $v)
-foreach (new LimitIterator(new ArrayIterator($a), 1, 3) as $k => $v)
-{
- var_dump(array($k, $v));
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-array(2) {
- [0]=>
- string(3) "one"
- [1]=>
- int(1)
-}
-array(2) {
- [0]=>
- string(3) "two"
- [1]=>
- int(2)
-}
-array(2) {
- [0]=>
- string(5) "three"
- [1]=>
- int(3)
-}
-===DONE===
diff --git a/ext/spl/tests/array_012.phpt b/ext/spl/tests/array_012.phpt
deleted file mode 100755
index a8889654a5..0000000000
--- a/ext/spl/tests/array_012.phpt
+++ /dev/null
@@ -1,65 +0,0 @@
---TEST--
-SPL: ArrayIterator::count
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-
-echo "===Array===\n";
-
-$a = array('zero' => 0, 'one' => 1, 'two' => 2);
-$it = new ArrayIterator($a);
-
-var_dump($it->count());
-foreach($it as $key => $val)
-{
- echo "$key=>$val\n";
- var_dump($it->count());
-}
-var_dump($it->count());
-
-echo "===Object===\n";
-
-class test
-{
- public $zero = 0;
- protected $pro;
- public $one = 1;
- private $pri;
- public $two = 2;
-}
-
-$o = new test;
-$it = new ArrayIterator($o);
-
-var_dump($it->count());
-foreach($it as $key => $val)
-{
- echo "$key=>$val\n";
- var_dump($it->count());
-}
-var_dump($it->count());
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-===Array===
-int(3)
-zero=>0
-int(3)
-one=>1
-int(3)
-two=>2
-int(3)
-int(3)
-===Object===
-int(3)
-zero=>0
-int(3)
-one=>1
-int(3)
-two=>2
-int(3)
-int(3)
-===DONE===
diff --git a/ext/spl/tests/array_013.phpt b/ext/spl/tests/array_013.phpt
deleted file mode 100755
index 6d74bcb419..0000000000
--- a/ext/spl/tests/array_013.phpt
+++ /dev/null
@@ -1,81 +0,0 @@
---TEST--
-SPL: ArrayIterator::append
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-
-if (!class_exists('NoRewindIterator', false))
-{
- require_once(dirname(__FILE__) . '/../examples/norewinditerator.inc');
-}
-
-echo "===Array===\n";
-
-$a = array(0 => 'zero', 1 => 'one', 2 => 'two');
-$it = new ArrayIterator($a);
-
-foreach($it as $key => $val)
-{
- echo "$key=>$val\n";
-}
-
-echo "===Append===\n";
-
-$it->append('three');
-$it->append('four');
-
-foreach(new NoRewindIterator($it) as $key => $val)
-{
- echo "$key=>$val\n";
-}
-
-echo "===Object===\n";
-
-class test
-{
- public $zero = 0;
- protected $pro;
- public $one = 1;
- private $pri;
- public $two = 2;
-}
-
-$o = new test;
-$it = new ArrayIterator($o);
-
-foreach($it as $key => $val)
-{
- echo "$key=>$val\n";
-}
-
-echo "===Append===\n";
-
-$it->append('three');
-$it->append('four');
-
-foreach(new NoRewindIterator($it) as $key => $val)
-{
- echo "$key=>$val\n";
-}
-
-var_dump($o->{0}); /* doesn't wotk anyway */
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-===Array===
-0=>zero
-1=>one
-2=>two
-===Append===
-3=>three
-4=>four
-===Object===
-zero=>0
-one=>1
-two=>2
-===Append===
-
-Fatal error: ArrayIterator::append(): Cannot append properties to objects, use ArrayIterator::offsetSet() instead in %sarray_013.php on line %d
diff --git a/ext/spl/tests/array_014.phpt b/ext/spl/tests/array_014.phpt
deleted file mode 100755
index ad9bc6c4ac..0000000000
--- a/ext/spl/tests/array_014.phpt
+++ /dev/null
@@ -1,61 +0,0 @@
---TEST--
-SPL: ArrayIterator::seek()
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-
-$it = new ArrayIterator(range(0,10));
-var_dump($it->count());
-$it->seek(5);
-var_dump($it->current());
-$it->seek(4);
-var_dump($it->current());
-try
-{
- $it->seek(-1);
- var_dump($it->current());
-}
-catch(Exception $e)
-{
- echo $e->getMessage() . "\n";
-}
-
-try
-{
- $it->seek(12);
- var_dump($it->current());
-}
-catch(Exception $e)
-{
- echo $e->getMessage() . "\n";
-}
-
-$pos = 0;
-foreach($it as $v)
-{
- $it->seek($pos++);
- var_dump($v);
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-int(11)
-int(5)
-int(4)
-Seek position -1 is out of range
-Seek position 12 is out of range
-int(0)
-int(1)
-int(2)
-int(3)
-int(4)
-int(5)
-int(6)
-int(7)
-int(8)
-int(9)
-int(10)
-===DONE===
diff --git a/ext/spl/tests/array_015.phpt b/ext/spl/tests/array_015.phpt
deleted file mode 100755
index 0a82fc7a5d..0000000000
--- a/ext/spl/tests/array_015.phpt
+++ /dev/null
@@ -1,85 +0,0 @@
---TEST--
-SPL: ArrayIterator::next() with internal arrays
---FILE--
-<?php
-
-$ar = new ArrayObject();
-
-$ar[0] = 1;
-$ar[1] = 2;
-$ar[2] = 3;
-$ar[3] = 4;
-$ar[4] = 5;
-
-var_dump($ar);
-
-$it = $ar->getIterator();
-
-$ar->offsetUnset($it->key());
-$it->next();
-
-var_dump($it->current());
-var_dump($ar);
-
-foreach($it as $k => $v)
-{
- $ar->offsetUnset($k+1);
- echo "$k=>$v\n";
-}
-
-var_dump($ar);
-
-foreach($it as $k => $v)
-{
- $ar->offsetUnset($k);
- echo "$k=>$v\n";
-}
-
-var_dump($ar);
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-object(ArrayObject)#%d (5) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
-}
-
-Notice: ArrayIterator::next(): Array was modified outside object and internal position is no longer valid in %sarray_015.php on line %d
-int(2)
-object(ArrayObject)#%d (4) {
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
-}
-1=>2
-3=>4
-object(ArrayObject)#%d (2) {
- [1]=>
- int(2)
- [3]=>
- int(4)
-}
-1=>2
-
-Notice: main(): ArrayIterator::next(): Array was modified outside object and internal position is no longer valid in %sarray_015.php on line %d
-3=>4
-
-Notice: main(): ArrayIterator::next(): Array was modified outside object and internal position is no longer valid in %sarray_015.php on line %d
-object(ArrayObject)#%d (0) {
-}
-===DONE===
diff --git a/ext/spl/tests/array_016.phpt b/ext/spl/tests/array_016.phpt
deleted file mode 100755
index d4ea0ab39a..0000000000
--- a/ext/spl/tests/array_016.phpt
+++ /dev/null
@@ -1,34 +0,0 @@
---TEST--
-SPL: ArrayItaerator/Object and IteratorIterator
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-
-$it = new ArrayIterator(range(0,3));
-
-foreach(new IteratorIterator($it) as $v)
-{
- var_dump($v);
-}
-
-$it = new ArrayObject(range(0,3));
-
-foreach(new IteratorIterator($it) as $v)
-{
- var_dump($v);
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-int(0)
-int(1)
-int(2)
-int(3)
-int(0)
-int(1)
-int(2)
-int(3)
-===DONE===
diff --git a/ext/spl/tests/bug28822.phpt b/ext/spl/tests/bug28822.phpt
deleted file mode 100755
index 0cf5575367..0000000000
--- a/ext/spl/tests/bug28822.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Bug #28822 (ArrayObject::offsetExists() works inverted)
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-
-$array = new ArrayObject();
-$array->offsetSet('key', 'value');
-var_dump($array->offsetExists('key'));
-var_dump($array->offsetExists('nokey'));
-
-?>
-===DONE===
---EXPECT--
-bool(true)
-bool(false)
-===DONE===
diff --git a/ext/spl/tests/bug31185.phpt b/ext/spl/tests/bug31185.phpt
deleted file mode 100755
index b4f315b0b9..0000000000
--- a/ext/spl/tests/bug31185.phpt
+++ /dev/null
@@ -1,61 +0,0 @@
---TEST--
-Bug #31185 (Crash when exceptions thrown from ArrayAccess::offsetUnset())
---FILE--
-<?php
-
-class FooBar implements ArrayAccess {
- private $array = array();
-
- public function offsetExists($index) {
- return isset($this->array[$index]);
- }
-
- public function offsetGet($index) {
- return $this->array[$index];
- }
-
- public function offsetSet($index, $value) {
- echo __METHOD__ . "($index, $value)\n";
- $this->array[$index] = $value;
- }
-
- public function offsetUnset($index) {
- throw new Exception('FAIL');
- unset($this->array[$index]);
- }
-
-}
-
-$i = 0; $j = 0;
-$foo = new FooBar();
-$foo[$j++] = $i++;
-$foo[$j++] = $i++;
-$foo[$j++] = $i++;
-try
-{
- unset($foo[1]);
-}
-catch (Exception $e)
-{
- echo "CAUGHT: " . $e->getMessage() . "\n";
-}
-
-print_R($foo);
-?>
-===DONE===
---EXPECT--
-FooBar::offsetSet(0, 0)
-FooBar::offsetSet(1, 1)
-FooBar::offsetSet(2, 2)
-CAUGHT: FAIL
-FooBar Object
-(
- [array:private] => Array
- (
- [0] => 0
- [1] => 1
- [2] => 2
- )
-
-)
-===DONE===
diff --git a/ext/spl/tests/bug31346.phpt b/ext/spl/tests/bug31346.phpt
deleted file mode 100755
index 9b5618ec0e..0000000000
--- a/ext/spl/tests/bug31346.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-Bug #31486 (ArrayIterator::next segfaults)
---FILE--
-<?php
-$obj = new stdClass;
-$obj->var1=1;
-
-$ao = new ArrayObject($obj);
-
-$i = $ao->getIterator();
-
-$ao->offsetUnset($i->key());
-$i->next();
-
-?>
-===DONE===
---EXPECTF--
-Notice: ArrayIterator::next(): Array was modified outside object and internal position is no longer valid in %sbug31346.php on line %d
-===DONE===
diff --git a/ext/spl/tests/bug31348.phpt b/ext/spl/tests/bug31348.phpt
deleted file mode 100755
index 047e4b223a..0000000000
--- a/ext/spl/tests/bug31348.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-Bug #31348 (CachingIterator::rewind() leaks)
---FILE--
-<?php
-$a = Array("some","blah");
-$i = new ArrayIterator($a);
-
-$ci = new CachingIterator($i);
-
-$ci->rewind();
-
-?>
-===DONE===
---EXPECT--
-===DONE===
diff --git a/ext/spl/tests/bug31926.phpt b/ext/spl/tests/bug31926.phpt
deleted file mode 100755
index 428039b1cb..0000000000
--- a/ext/spl/tests/bug31926.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-Bug #31926 (php in free() error with RecursiveArrayIterator)
---FILE--
-<?php
-
-$array = array(0 => array('world'));
-
-class RecursiveArrayIterator extends ArrayIterator implements
-RecursiveIterator {
- function hasChildren() {
- return (is_array($this->current()));
- }
-
- function getChildren() {
- return new self($this->current());
- }
-}
-
-$it = new RecursiveIteratorIterator(new RecursiveArrayIterator($array));
-foreach($it as $key => $val) {
- var_dump($key, $val);
-}
-
-?>
---EXPECT--
-int(0)
-string(5) "world"
diff --git a/ext/spl/tests/bug32134.phpt b/ext/spl/tests/bug32134.phpt
deleted file mode 100755
index 5a880b321d..0000000000
--- a/ext/spl/tests/bug32134.phpt
+++ /dev/null
@@ -1,48 +0,0 @@
---TEST--
-Bug #32134 (Overloading offsetGet/offsetSet)
---FILE--
-<?php
-
-class myArray extends ArrayIterator
-{
-
- public function __construct($array = array())
- {
- parent::__construct($array);
- }
-
- public function offsetGet($index)
- {
- static $i = 0;
- echo __METHOD__ . "($index)\n";
- if (++$i > 3) exit(1);
- return parent::offsetGet($index);
- }
-
- public function offsetSet($index, $newval)
- {
- echo __METHOD__ . "($index,$newval)\n";
- return parent::offsetSet($index, $newval);
- }
-
-}
-
-$myArray = new myArray();
-
-$myArray->offsetSet('one', 'one');
-var_dump($myArray->offsetGet('one'));
-
-$myArray['two'] = 'two';
-var_dump($myArray['two']);
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-myArray::offsetSet(one,one)
-myArray::offsetGet(one)
-string(3) "one"
-myArray::offsetSet(two,two)
-myArray::offsetGet(two)
-string(3) "two"
-===DONE===
diff --git a/ext/spl/tests/bug32394.phpt b/ext/spl/tests/bug32394.phpt
deleted file mode 100755
index 8189b23f7a..0000000000
--- a/ext/spl/tests/bug32394.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Bug #32394 (offsetUnset() segfaults in a foreach)
---FILE--
-<?php
-
-$object = new ArrayIterator;
-$object->append(1);
-
-foreach($object as $key => $value)
-{
- $object->offsetUnset($key);
-}
-
-?>
-===DONE===
---EXPECT--
-===DONE===
diff --git a/ext/spl/tests/dit_001.phpt b/ext/spl/tests/dit_001.phpt
deleted file mode 100755
index f02291c77b..0000000000
--- a/ext/spl/tests/dit_001.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-SPL: Problem with casting to string
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-$d = new DirectoryIterator('.');
-var_dump($d);
-var_dump(is_string($d));
-preg_match('/x/', $d);
-var_dump(is_string($d));
-?>
-===DONE===
---EXPECTF--
-object(DirectoryIterator)#%d (0) {
-}
-bool(false)
-bool(false)
-===DONE===
diff --git a/ext/spl/tests/fileobject_001.phpt b/ext/spl/tests/fileobject_001.phpt
deleted file mode 100755
index 056c1e17f7..0000000000
--- a/ext/spl/tests/fileobject_001.phpt
+++ /dev/null
@@ -1,88 +0,0 @@
---TEST--
-SPL: FileObject::seek'ing
---FILE--
-<?php
-
-$o = new FileObject(dirname(__FILE__) . '/fileobject_001a.txt');
-
-var_dump($o->key());
-var_dump($o->current());
-$o->setFlags(FO_DROP_NEW_LINE);
-var_dump($o->key());
-var_dump($o->current());
-var_dump($o->key());
-$o->next();
-var_dump($o->key());
-var_dump($o->current());
-var_dump($o->key());
-$o->rewind();
-var_dump($o->key());
-var_dump($o->current());
-var_dump($o->key());
-$o->seek(4);
-var_dump($o->key());
-var_dump($o->current());
-var_dump($o->key());
-
-echo "===A===\n";
-foreach($o as $n => $l)
-{
- var_dump($n, $l);
-}
-
-echo "===B===\n";
-$o = new FileObject(dirname(__FILE__) . '/fileobject_001b.txt');
-$o->setFlags(FO_DROP_NEW_LINE);
-foreach($o as $n => $l)
-{
- var_dump($n, $l);
-}
-
-?>
-===DONE===
---EXPECT--
-int(0)
-string(2) "0
-"
-int(0)
-string(2) "0
-"
-int(0)
-int(1)
-string(1) "1"
-int(1)
-int(0)
-string(1) "0"
-int(0)
-int(4)
-string(1) "4"
-int(4)
-===A===
-int(0)
-string(1) "0"
-int(1)
-string(1) "1"
-int(2)
-string(1) "2"
-int(3)
-string(1) "3"
-int(4)
-string(1) "4"
-int(5)
-string(1) "5"
-int(6)
-string(0) ""
-===B===
-int(0)
-string(1) "0"
-int(1)
-string(1) "1"
-int(2)
-string(1) "2"
-int(3)
-string(1) "3"
-int(4)
-string(1) "4"
-int(5)
-string(1) "5"
-===DONE===
diff --git a/ext/spl/tests/fileobject_001a.txt b/ext/spl/tests/fileobject_001a.txt
deleted file mode 100755
index e8371f0060..0000000000
--- a/ext/spl/tests/fileobject_001a.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-0
-1
-2
-3
-4
-5
diff --git a/ext/spl/tests/fileobject_001b.txt b/ext/spl/tests/fileobject_001b.txt
deleted file mode 100755
index 0c4a8b5cd3..0000000000
--- a/ext/spl/tests/fileobject_001b.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-0
-1
-2
-3
-4
-5 \ No newline at end of file
diff --git a/ext/spl/tests/fileobject_002.phpt b/ext/spl/tests/fileobject_002.phpt
deleted file mode 100755
index f85b020503..0000000000
--- a/ext/spl/tests/fileobject_002.phpt
+++ /dev/null
@@ -1,122 +0,0 @@
---TEST--
-SPL: FileObject::fgetc
---FILE--
-<?php
-
-function test($name)
-{
- echo "===$name===\n";
-
- $o = new FileObject(dirname(__FILE__) . '/' . $name);
-
- var_dump($o->key());
- while(($c = $o->fgetc()) !== false)
- {
- var_dump($o->key(), $c, $o->eof());
- }
- echo "===EOF?===\n";
- var_dump($o->eof());
- var_dump($o->key());
- var_dump($o->eof());
-}
-
-test('fileobject_001a.txt');
-test('fileobject_001b.txt');
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-===fileobject_001a.txt===
-int(0)
-int(0)
-string(1) "0"
-bool(false)
-int(1)
-string(1) "
-"
-bool(false)
-int(1)
-string(1) "1"
-bool(false)
-int(2)
-string(1) "
-"
-bool(false)
-int(2)
-string(1) "2"
-bool(false)
-int(3)
-string(1) "
-"
-bool(false)
-int(3)
-string(1) "3"
-bool(false)
-int(4)
-string(1) "
-"
-bool(false)
-int(4)
-string(1) "4"
-bool(false)
-int(5)
-string(1) "
-"
-bool(false)
-int(5)
-string(1) "5"
-bool(false)
-int(6)
-string(1) "
-"
-bool(false)
-===EOF?===
-bool(true)
-int(6)
-bool(true)
-===fileobject_001b.txt===
-int(0)
-int(0)
-string(1) "0"
-bool(false)
-int(1)
-string(1) "
-"
-bool(false)
-int(1)
-string(1) "1"
-bool(false)
-int(2)
-string(1) "
-"
-bool(false)
-int(2)
-string(1) "2"
-bool(false)
-int(3)
-string(1) "
-"
-bool(false)
-int(3)
-string(1) "3"
-bool(false)
-int(4)
-string(1) "
-"
-bool(false)
-int(4)
-string(1) "4"
-bool(false)
-int(5)
-string(1) "
-"
-bool(false)
-int(5)
-string(1) "5"
-bool(false)
-===EOF?===
-bool(true)
-int(5)
-bool(true)
-===DONE===
diff --git a/ext/spl/tests/iterator_001.phpt b/ext/spl/tests/iterator_001.phpt
deleted file mode 100755
index 2239417778..0000000000
--- a/ext/spl/tests/iterator_001.phpt
+++ /dev/null
@@ -1,173 +0,0 @@
---TEST--
-SPL: Iterator aggregating inner iterator's methods
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-
-class NumericArrayIterator implements Iterator
-{
- protected $a;
- protected $i = 0;
-
- public function __construct($a)
- {
- echo __METHOD__ . "\n";
- $this->a = $a;
- }
-
- public function rewind()
- {
- echo __METHOD__ . "\n";
- $this->i = 0;
- }
-
- public function valid()
- {
- $ret = $this->i < count($this->a);
- echo __METHOD__ . '(' . ($ret ? 'true' : 'false') . ")\n";
- return $ret;
- }
-
- public function key()
- {
- echo __METHOD__ . "\n";
- return $this->i;
- }
-
- public function current()
- {
- echo __METHOD__ . "\n";
- return $this->a[$this->i];
- }
-
- public function next()
- {
- echo __METHOD__ . "\n";
- $this->i++;
- }
-
- public function greaterThan($comp)
- {
- echo get_class($this) . '::' . __FUNCTION__ . '(' . $comp . ")\n";
- return $this->current() > $comp;
- }
-}
-
-class SeekableNumericArrayIterator extends NumericArrayIterator implements SeekableIterator
-{
- public function seek($index)
- {
- if ($index < count($this->a)) {
- $this->i = $index;
- }
- echo __METHOD__ . '(' . $index . ")\n";
- }
-}
-
-$a = array(1, 2, 3, 4, 5);
-$it = new LimitIterator(new NumericArrayIterator($a), 1, 3);
-foreach ($it as $v)
-{
- print $v . ' is ' . ($it->greaterThan(2) ? 'greater than 2' : 'less than or equal 2') . "\n";
-}
-
-echo "===SEEKABLE===\n";
-$a = array(1, 2, 3, 4, 5);
-$it = new LimitIterator(new SeekableNumericArrayIterator($a), 1, 3);
-foreach($it as $v)
-{
- print $v . ' is ' . ($it->greaterThan(2) ? 'greater than 2' : 'less than or equal 2') . "\n";
-}
-
-echo "===STACKED===\n";
-echo "Shows '2 is greater than 2' because the test is actually done with the current value which is 3.\n";
-$a = array(1, 2, 3, 4, 5);
-$it = new CachingIterator(new LimitIterator(new SeekableNumericArrayIterator($a), 1, 3));
-foreach($it as $v)
-{
- print $v . ' is ' . ($it->greaterThan(2) ? 'greater than 2' : 'less than or equal 2') . "\n";
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-NumericArrayIterator::__construct
-NumericArrayIterator::rewind
-NumericArrayIterator::valid(true)
-NumericArrayIterator::next
-NumericArrayIterator::valid(true)
-NumericArrayIterator::valid(true)
-NumericArrayIterator::current
-NumericArrayIterator::key
-NumericArrayIterator::greaterThan(2)
-NumericArrayIterator::current
-2 is less than or equal 2
-NumericArrayIterator::next
-NumericArrayIterator::valid(true)
-NumericArrayIterator::current
-NumericArrayIterator::key
-NumericArrayIterator::greaterThan(2)
-NumericArrayIterator::current
-3 is greater than 2
-NumericArrayIterator::next
-NumericArrayIterator::valid(true)
-NumericArrayIterator::current
-NumericArrayIterator::key
-NumericArrayIterator::greaterThan(2)
-NumericArrayIterator::current
-4 is greater than 2
-NumericArrayIterator::next
-===SEEKABLE===
-NumericArrayIterator::__construct
-NumericArrayIterator::rewind
-SeekableNumericArrayIterator::seek(1)
-NumericArrayIterator::valid(true)
-NumericArrayIterator::current
-NumericArrayIterator::key
-SeekableNumericArrayIterator::greaterThan(2)
-NumericArrayIterator::current
-2 is less than or equal 2
-NumericArrayIterator::next
-NumericArrayIterator::valid(true)
-NumericArrayIterator::current
-NumericArrayIterator::key
-SeekableNumericArrayIterator::greaterThan(2)
-NumericArrayIterator::current
-3 is greater than 2
-NumericArrayIterator::next
-NumericArrayIterator::valid(true)
-NumericArrayIterator::current
-NumericArrayIterator::key
-SeekableNumericArrayIterator::greaterThan(2)
-NumericArrayIterator::current
-4 is greater than 2
-NumericArrayIterator::next
-===STACKED===
-Shows '2 is greater than 2' because the test is actually done with the current value which is 3.
-NumericArrayIterator::__construct
-NumericArrayIterator::rewind
-SeekableNumericArrayIterator::seek(1)
-NumericArrayIterator::valid(true)
-NumericArrayIterator::current
-NumericArrayIterator::key
-NumericArrayIterator::next
-NumericArrayIterator::valid(true)
-NumericArrayIterator::current
-NumericArrayIterator::key
-SeekableNumericArrayIterator::greaterThan(2)
-NumericArrayIterator::current
-2 is greater than 2
-NumericArrayIterator::next
-NumericArrayIterator::valid(true)
-NumericArrayIterator::current
-NumericArrayIterator::key
-SeekableNumericArrayIterator::greaterThan(2)
-NumericArrayIterator::current
-3 is greater than 2
-NumericArrayIterator::next
-SeekableNumericArrayIterator::greaterThan(2)
-NumericArrayIterator::current
-4 is greater than 2
-===DONE===
diff --git a/ext/spl/tests/iterator_002.phpt b/ext/spl/tests/iterator_002.phpt
deleted file mode 100755
index b481a0e00f..0000000000
--- a/ext/spl/tests/iterator_002.phpt
+++ /dev/null
@@ -1,57 +0,0 @@
---TEST--
-SPL: Iterator using getInnerIterator
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-
-class RecursiceArrayIterator extends ArrayIterator implements RecursiveIterator
-{
- function hasChildren()
- {
- return is_array($this->current());
- }
-
- function getChildren()
- {
- return new RecursiceArrayIterator($this->current());
- }
-}
-
-class CrashIterator extends FilterIterator implements RecursiveIterator
-{
- function accept()
- {
- return true;
- }
-
- function hasChildren()
- {
- return $this->getInnerIterator()->hasChildren();
- }
-
- function getChildren()
- {
- return new RecursiceArrayIterator($this->getInnerIterator()->current());
- }
-}
-
-$array = array(1, 2 => array(21, 22 => array(221, 222), 23 => array(231)), 3);
-
-$dir = new RecursiveIteratorIterator(new CrashIterator(new RecursiceArrayIterator($array)), RIT_LEAVES_ONLY);
-
-foreach ($dir as $file) {
- print "$file\n";
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1
-21
-221
-222
-231
-3
-===DONE===
diff --git a/ext/spl/tests/iterator_003.phpt b/ext/spl/tests/iterator_003.phpt
deleted file mode 100755
index c60776cb33..0000000000
--- a/ext/spl/tests/iterator_003.phpt
+++ /dev/null
@@ -1,97 +0,0 @@
---TEST--
-SPL: CachingIterator and __toString()
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-
-class Student
-{
- private $id;
- private $name;
-
- public function __construct($id, $name)
- {
- $this->id = $id;
- $this->name = $name;
- }
-
- public function __toString()
- {
- return $this->id . ', ' . $this->name;
- }
-
- public function getId()
- {
- return $this->id;
- }
-}
-
-class StudentIdFilter extends FilterIterator
-{
- private $id;
-
- public function __construct(ArrayObject $students, Student $other)
- {
- FilterIterator::__construct($students->getIterator());
- $this->id = $other->getId();
- }
-
- public function accept()
- {
- echo "ACCEPT ".$this->current()->getId()." == ".$this->id."\n";
- return $this->current()->getId() == $this->id;
- }
-}
-
-class StudentList implements IteratorAggregate
-{
- private $students;
-
- public function __construct()
- {
- $this->students = new ArrayObject(array());
- }
-
- public function add(Student $student)
- {
- if (!$this->contains($student)) {
- $this->students[] = $student;
- }
- }
-
- public function contains(Student $student)
- {
- foreach ($this->students as $s)
- {
- if ($s->getId() == $student->getId()) {
- return true;
- }
- }
- return false;
- }
-
- public function getIterator() {
- return new CachingIterator($this->students->getIterator(), true);
- }
-}
-
-$students = new StudentList();
-$students->add(new Student('01234123', 'Joe'));
-$students->add(new Student('00000014', 'Bob'));
-$students->add(new Student('00000014', 'Foo'));
-
-// The goal is to verify we can access the cached string value even if it was
-// generated by a call to __toString(). To check this we need to access the
-// iterator's __toString() method.
-$it = $students->getIterator();
-foreach ($it as $student) {
- echo $it->__toString(), "\n";
-}
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-01234123, Joe
-00000014, Bob
-===DONE===
diff --git a/ext/spl/tests/iterator_004.phpt b/ext/spl/tests/iterator_004.phpt
deleted file mode 100755
index 4e6006621b..0000000000
--- a/ext/spl/tests/iterator_004.phpt
+++ /dev/null
@@ -1,144 +0,0 @@
---TEST--
-SPL: SeekableIterator and string keys
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-
-class NumericArrayIterator implements Iterator
-{
- protected $a;
- protected $i;
-
- public function __construct($a)
- {
- echo __METHOD__ . "\n";
- $this->a = $a;
- }
-
- public function rewind()
- {
- echo __METHOD__ . "\n";
- $this->i = 0;
- }
-
- public function valid()
- {
- $ret = $this->i < count($this->a);
- echo __METHOD__ . '(' . ($ret ? 'true' : 'false') . ")\n";
- return $ret;
- }
-
- public function key()
- {
- echo __METHOD__ . "\n";
- return $this->i;
- }
-
- public function current()
- {
- echo __METHOD__ . "\n";
- return $this->a[$this->i];
- }
-
- public function next()
- {
- echo __METHOD__ . "\n";
- $this->i++;
- }
-}
-
-class SeekableNumericArrayIterator extends NumericArrayIterator implements SeekableIterator
-{
- public function seek($index)
- {
- if ($index < count($this->a)) {
- $this->i = $index;
- }
- echo __METHOD__ . '(' . $index . ")\n";
- }
-}
-
-$a = array(1, 2, 3, 4, 5);
-foreach (new LimitIterator(new NumericArrayIterator($a), 1, 3) as $v)
-{
- print "$v\n";
-}
-
-echo "===SEEKABLE===\n";
-$a = array(1, 2, 3, 4, 5);
-foreach(new LimitIterator(new SeekableNumericArrayIterator($a), 1, 3) as $v)
-{
- print "$v\n";
-}
-
-echo "===SEEKING===\n";
-$a = array(1, 2, 3, 4, 5);
-$l = new LimitIterator(new SeekableNumericArrayIterator($a));
-for($i = 1; $i < 4; $i++)
-{
- $l->seek($i);
- print $l->current() . "\n";
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-NumericArrayIterator::__construct
-NumericArrayIterator::rewind
-NumericArrayIterator::valid(true)
-NumericArrayIterator::next
-NumericArrayIterator::valid(true)
-NumericArrayIterator::valid(true)
-NumericArrayIterator::current
-NumericArrayIterator::key
-2
-NumericArrayIterator::next
-NumericArrayIterator::valid(true)
-NumericArrayIterator::current
-NumericArrayIterator::key
-3
-NumericArrayIterator::next
-NumericArrayIterator::valid(true)
-NumericArrayIterator::current
-NumericArrayIterator::key
-4
-NumericArrayIterator::next
-===SEEKABLE===
-NumericArrayIterator::__construct
-NumericArrayIterator::rewind
-SeekableNumericArrayIterator::seek(1)
-NumericArrayIterator::valid(true)
-NumericArrayIterator::current
-NumericArrayIterator::key
-2
-NumericArrayIterator::next
-NumericArrayIterator::valid(true)
-NumericArrayIterator::current
-NumericArrayIterator::key
-3
-NumericArrayIterator::next
-NumericArrayIterator::valid(true)
-NumericArrayIterator::current
-NumericArrayIterator::key
-4
-NumericArrayIterator::next
-===SEEKING===
-NumericArrayIterator::__construct
-SeekableNumericArrayIterator::seek(1)
-NumericArrayIterator::valid(true)
-NumericArrayIterator::current
-NumericArrayIterator::key
-2
-SeekableNumericArrayIterator::seek(2)
-NumericArrayIterator::valid(true)
-NumericArrayIterator::current
-NumericArrayIterator::key
-3
-SeekableNumericArrayIterator::seek(3)
-NumericArrayIterator::valid(true)
-NumericArrayIterator::current
-NumericArrayIterator::key
-4
-===DONE===
diff --git a/ext/spl/tests/iterator_005.phpt b/ext/spl/tests/iterator_005.phpt
deleted file mode 100755
index 4aae600169..0000000000
--- a/ext/spl/tests/iterator_005.phpt
+++ /dev/null
@@ -1,54 +0,0 @@
---TEST--
-SPL: IteratorIterator and ArrayIterator/Object
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-
-class ArrayIteratorEx extends ArrayIterator
-{
- function rewind()
- {
- echo __METHOD__ . "\n";
- return parent::rewind();
- }
-}
-
-$it = new ArrayIteratorEx(range(0,3));
-
-foreach(new IteratorIterator($it) as $v)
-{
- var_dump($v);
-}
-
-class ArrayObjectEx extends ArrayObject
-{
- function getIterator()
- {
- echo __METHOD__ . "\n";
- return parent::getIterator();
- }
-}
-
-$it = new ArrayObjectEx(range(0,3));
-
-foreach(new IteratorIterator($it) as $v)
-{
- var_dump($v);
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-ArrayIteratorEx::rewind
-int(0)
-int(1)
-int(2)
-int(3)
-ArrayObjectEx::getIterator
-int(0)
-int(1)
-int(2)
-int(3)
-===DONE===
diff --git a/ext/spl/tests/iterator_006.phpt b/ext/spl/tests/iterator_006.phpt
deleted file mode 100755
index 855741c711..0000000000
--- a/ext/spl/tests/iterator_006.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-SPL: IteratorIterator and SimpleXMlElement
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-
-$root = simplexml_load_string('<?xml version="1.0"?>
-<root>
- <child>Hello</child>
- <child>World</child>
-</root>
-');
-
-foreach (new IteratorIterator($root->child) as $child) {
- echo $child."\n";
-}
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-Hello
-World
-===DONE===
diff --git a/ext/spl/tests/iterator_007.phpt b/ext/spl/tests/iterator_007.phpt
deleted file mode 100755
index eb87977ac9..0000000000
--- a/ext/spl/tests/iterator_007.phpt
+++ /dev/null
@@ -1,168 +0,0 @@
---TEST--
-SPL: NoRewindIterator
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-
-class ArrayIteratorEx extends ArrayIterator
-{
- function rewind()
- {
- echo __METHOD__ . "\n";
- parent::rewind();
- }
- function valid()
- {
- echo __METHOD__ . "\n";
- return parent::valid();
- }
- function current()
- {
- echo __METHOD__ . "\n";
- return parent::current();
- }
- function key()
- {
- echo __METHOD__ . "\n";
- return parent::key();
- }
- function next()
- {
- echo __METHOD__ . "\n";
- parent::next();
- }
-}
-
-class NoRewindIteratorEx extends NoRewindIterator
-{
- function rewind()
- {
- echo __METHOD__ . "\n";
- parent::rewind();
- }
- function valid()
- {
- echo __METHOD__ . "\n";
- return parent::valid();
- }
- function current()
- {
- echo __METHOD__ . "\n";
- return parent::current();
- }
- function key()
- {
- echo __METHOD__ . "\n";
- return parent::key();
- }
- function next()
- {
- echo __METHOD__ . "\n";
- parent::next();
- }
-}
-
-$it = new NoRewindIteratorEx(new ArrayIteratorEx(range(0,3)));
-
-echo "===0===\n";
-foreach ($it->getInnerIterator() as $v) {
- var_dump($v);
-}
-
-echo "===1===\n";
-foreach ($it as $v) {
- var_dump($v);
-}
-
-$pos =0;
-
-$it = new NoRewindIteratorEx(new ArrayIteratorEx(range(0,3)));
-
-echo "===2===\n";
-foreach ($it as $v) {
- var_dump($v);
- if ($pos++ > 1) {
- break;
- }
-}
-
-echo "===3===\n";
-foreach ($it as $v) {
- var_dump($v);
-}
-
-echo "===4===\n";
-foreach ($it as $v) {
- var_dump($v);
-}
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-===0===
-ArrayIteratorEx::rewind
-ArrayIteratorEx::valid
-ArrayIteratorEx::current
-int(0)
-ArrayIteratorEx::next
-ArrayIteratorEx::valid
-ArrayIteratorEx::current
-int(1)
-ArrayIteratorEx::next
-ArrayIteratorEx::valid
-ArrayIteratorEx::current
-int(2)
-ArrayIteratorEx::next
-ArrayIteratorEx::valid
-ArrayIteratorEx::current
-int(3)
-ArrayIteratorEx::next
-ArrayIteratorEx::valid
-===1===
-NoRewindIteratorEx::rewind
-NoRewindIteratorEx::valid
-ArrayIteratorEx::valid
-===2===
-NoRewindIteratorEx::rewind
-NoRewindIteratorEx::valid
-ArrayIteratorEx::valid
-NoRewindIteratorEx::current
-ArrayIteratorEx::current
-int(0)
-NoRewindIteratorEx::next
-ArrayIteratorEx::next
-NoRewindIteratorEx::valid
-ArrayIteratorEx::valid
-NoRewindIteratorEx::current
-ArrayIteratorEx::current
-int(1)
-NoRewindIteratorEx::next
-ArrayIteratorEx::next
-NoRewindIteratorEx::valid
-ArrayIteratorEx::valid
-NoRewindIteratorEx::current
-ArrayIteratorEx::current
-int(2)
-===3===
-NoRewindIteratorEx::rewind
-NoRewindIteratorEx::valid
-ArrayIteratorEx::valid
-NoRewindIteratorEx::current
-int(2)
-NoRewindIteratorEx::next
-ArrayIteratorEx::next
-NoRewindIteratorEx::valid
-ArrayIteratorEx::valid
-NoRewindIteratorEx::current
-ArrayIteratorEx::current
-int(3)
-NoRewindIteratorEx::next
-ArrayIteratorEx::next
-NoRewindIteratorEx::valid
-ArrayIteratorEx::valid
-===4===
-NoRewindIteratorEx::rewind
-NoRewindIteratorEx::valid
-ArrayIteratorEx::valid
-===DONE===
diff --git a/ext/spl/tests/iterator_008.phpt b/ext/spl/tests/iterator_008.phpt
deleted file mode 100755
index 5f3c7d89df..0000000000
--- a/ext/spl/tests/iterator_008.phpt
+++ /dev/null
@@ -1,91 +0,0 @@
---TEST--
-SPL: InfiniteIterator
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-
-class ArrayIteratorEx extends ArrayIterator
-{
- function rewind()
- {
- echo __METHOD__ . "\n";
- parent::rewind();
- }
- function valid()
- {
- echo __METHOD__ . "\n";
- return parent::valid();
- }
- function current()
- {
- echo __METHOD__ . "\n";
- return parent::current();
- }
- function key()
- {
- echo __METHOD__ . "\n";
- return parent::key();
- }
- function next()
- {
- echo __METHOD__ . "\n";
- parent::next();
- }
-}
-
-$it = new InfiniteIterator(new ArrayIteratorEx(range(0,2)));
-
-$pos =0;
-
-foreach ($it as $v) {
- var_dump($v);
- if ($pos++ > 5) {
- break;
- }
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-ArrayIteratorEx::rewind
-ArrayIteratorEx::valid
-ArrayIteratorEx::current
-ArrayIteratorEx::key
-int(0)
-ArrayIteratorEx::next
-ArrayIteratorEx::valid
-ArrayIteratorEx::current
-ArrayIteratorEx::key
-int(1)
-ArrayIteratorEx::next
-ArrayIteratorEx::valid
-ArrayIteratorEx::current
-ArrayIteratorEx::key
-int(2)
-ArrayIteratorEx::next
-ArrayIteratorEx::valid
-ArrayIteratorEx::rewind
-ArrayIteratorEx::valid
-ArrayIteratorEx::current
-ArrayIteratorEx::key
-int(0)
-ArrayIteratorEx::next
-ArrayIteratorEx::valid
-ArrayIteratorEx::current
-ArrayIteratorEx::key
-int(1)
-ArrayIteratorEx::next
-ArrayIteratorEx::valid
-ArrayIteratorEx::current
-ArrayIteratorEx::key
-int(2)
-ArrayIteratorEx::next
-ArrayIteratorEx::valid
-ArrayIteratorEx::rewind
-ArrayIteratorEx::valid
-ArrayIteratorEx::current
-ArrayIteratorEx::key
-int(0)
-===DONE===
diff --git a/ext/spl/tests/iterator_009.phpt b/ext/spl/tests/iterator_009.phpt
deleted file mode 100755
index 27a3e0655f..0000000000
--- a/ext/spl/tests/iterator_009.phpt
+++ /dev/null
@@ -1,47 +0,0 @@
---TEST--
-SPL: EmptyIterator
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-
-class EmptyIteratorEx extends EmptyIterator
-{
- function rewind()
- {
- echo __METHOD__ . "\n";
- parent::rewind();
- }
- function valid()
- {
- echo __METHOD__ . "\n";
- return parent::valid();
- }
- function current()
- {
- echo __METHOD__ . "\n";
- return parent::current();
- }
- function key()
- {
- echo __METHOD__ . "\n";
- return parent::key();
- }
- function next()
- {
- echo __METHOD__ . "\n";
- parent::next();
- }
-}
-
-foreach (new EmptyIteratorEx() as $v) {
- var_dump($v);
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-EmptyIteratorEx::rewind
-EmptyIteratorEx::valid
-===DONE===
diff --git a/ext/spl/tests/iterator_010.phpt b/ext/spl/tests/iterator_010.phpt
deleted file mode 100755
index 39d1000f62..0000000000
--- a/ext/spl/tests/iterator_010.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-SPL: EmptyIterator
---FILE--
-<?php
-
-echo "===EmptyIterator===\n";
-
-foreach(new LimitIterator(new EmptyIterator(), 0, 3) as $key => $val)
-{
- echo "$key=>$val\n";
-}
-
-?>
-===DONE===
-<?php exit(0);
---EXPECTF--
-===EmptyIterator===
-===DONE===
diff --git a/ext/spl/tests/iterator_011.phpt b/ext/spl/tests/iterator_011.phpt
deleted file mode 100755
index fca159a20f..0000000000
--- a/ext/spl/tests/iterator_011.phpt
+++ /dev/null
@@ -1,51 +0,0 @@
---TEST--
-SPL: InfiniteIterator
---FILE--
-<?php
-
-echo "===EmptyIterator===\n";
-
-foreach(new LimitIterator(new InfiniteIterator(new EmptyIterator()), 0, 3) as $key=>$val)
-{
- echo "$key=>$val\n";
-}
-
-echo "===InfiniteIterator===\n";
-
-$it = new ArrayIterator(array(0 => 'A', 1 => 'B', 2 => 'C', 3 => 'D'));
-$it = new InfiniteIterator($it);
-$it = new LimitIterator($it, 2, 5);
-foreach($it as $val=>$key)
-{
- echo "$val=>$key\n";
-}
-
-echo "===Infinite/LimitIterator===\n";
-
-$it = new ArrayIterator(array(0 => 'A', 1 => 'B', 2 => 'C', 3 => 'D'));
-$it = new LimitIterator($it, 1, 2);
-$it = new InfiniteIterator($it);
-$it = new LimitIterator($it, 2, 5);
-foreach($it as $val=>$key)
-{
- echo "$val=>$key\n";
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-===EmptyIterator===
-===InfiniteIterator===
-2=>C
-3=>D
-0=>A
-1=>B
-2=>C
-===Infinite/LimitIterator===
-1=>B
-2=>C
-1=>B
-2=>C
-1=>B
-===DONE===
diff --git a/ext/spl/tests/iterator_012.phpt b/ext/spl/tests/iterator_012.phpt
deleted file mode 100755
index 09842b0988..0000000000
--- a/ext/spl/tests/iterator_012.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-SPL: NoRweindIterator
---FILE--
-<?php
-
-echo "===Current===\n";
-
-$it = new NoRewindIterator(new ArrayIterator(array(0 => 'A', 1 => 'B', 2 => 'C')));
-
-echo $it->key() . '=>' . $it->current() . "\n";
-
-echo "===Next===\n";
-
-$it->next();
-
-echo "===Foreach===\n";
-
-foreach($it as $key=>$val)
-{
- echo "$key=>$val\n";
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-===Current===
-0=>A
-===Next===
-===Foreach===
-1=>B
-2=>C
-===DONE===
diff --git a/ext/spl/tests/iterator_013.phpt b/ext/spl/tests/iterator_013.phpt
deleted file mode 100755
index 119631c000..0000000000
--- a/ext/spl/tests/iterator_013.phpt
+++ /dev/null
@@ -1,66 +0,0 @@
---TEST--
-SPL: AppendIterator
---FILE--
-<?php
-
-echo "===Empty===\n";
-
-$it = new AppendIterator;
-
-foreach($it as $key=>$val)
-{
- echo "$key=>$val\n";
-}
-
-echo "===Append===\n";
-
-$it->append(new ArrayIterator(array(0 => 'A', 1 => 'B')));
-
-foreach($it as $key=>$val)
-{
- echo "$key=>$val\n";
-}
-
-echo "===Rewind===\n";
-
-foreach($it as $key=>$val)
-{
- echo "$key=>$val\n";
-}
-
-echo "===Append===\n";
-
-$it->append(new ArrayIterator(array(2 => 'C', 3 => 'D')));
-
-foreach(new NoRewindIterator($it) as $key=>$val)
-{
- echo "$key=>$val\n";
-}
-
-echo "===Rewind===\n";
-
-foreach($it as $key=>$val)
-{
- echo "$key=>$val\n";
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-===Empty===
-===Append===
-0=>A
-1=>B
-===Rewind===
-0=>A
-1=>B
-===Append===
-2=>C
-3=>D
-===Rewind===
-0=>A
-1=>B
-2=>C
-3=>D
-===DONE===
diff --git a/ext/spl/tests/iterator_014.phpt b/ext/spl/tests/iterator_014.phpt
deleted file mode 100755
index f6e8ce9d01..0000000000
--- a/ext/spl/tests/iterator_014.phpt
+++ /dev/null
@@ -1,143 +0,0 @@
---TEST--
-SPL: RecursiveIteratorIterator and beginChildren/endChildren
---FILE--
-<?php
-
-class RecursiveArrayIterator extends ArrayIterator implements RecursiveIterator
-{
- function hasChildren()
- {
- return is_array($this->current());
- }
-
- function getChildren()
- {
- echo __METHOD__ . "\n";
- return new RecursiveArrayIterator($this->current());
- }
-
- function valid()
- {
- if (!parent::valid())
- {
- echo __METHOD__ . " = false\n";
- return false;
- }
- else
- {
- return true;
- }
- }
-}
-
-class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator
-{
- function rewind()
- {
- echo __METHOD__ . "\n";
- parent::rewind();
- }
-
- function valid()
- {
- echo __METHOD__ . "\n";
- return parent::valid();
- }
-
- function current()
- {
- echo __METHOD__ . "\n";
- return parent::current();
- }
-
- function key()
- {
- echo __METHOD__ . "\n";
- return parent::key();
- }
-
- function next()
- {
- echo __METHOD__ . "\n";
- parent::next();
- }
-
- function beginChildren()
- {
- echo __METHOD__ . "(".$this->getDepth().")\n";
- }
-
- function endChildren()
- {
- echo __METHOD__ . "(".$this->getDepth().")\n";
- }
-}
-
-foreach(new RecursiveArrayIteratorIterator(new RecursiveArrayIterator(array("a", array("ba", array("bba", "bbb"), array(array("bcaa"))), array("ca"), "d"))) as $k=>$v)
-{
- echo "$k=>$v\n";
-}
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-RecursiveArrayIteratorIterator::rewind
-RecursiveArrayIteratorIterator::valid
-RecursiveArrayIteratorIterator::current
-RecursiveArrayIteratorIterator::key
-0=>a
-RecursiveArrayIteratorIterator::next
-RecursiveArrayIterator::getChildren
-RecursiveArrayIteratorIterator::beginChildren(1)
-RecursiveArrayIteratorIterator::valid
-RecursiveArrayIteratorIterator::current
-RecursiveArrayIteratorIterator::key
-0=>ba
-RecursiveArrayIteratorIterator::next
-RecursiveArrayIterator::getChildren
-RecursiveArrayIteratorIterator::beginChildren(2)
-RecursiveArrayIteratorIterator::valid
-RecursiveArrayIteratorIterator::current
-RecursiveArrayIteratorIterator::key
-0=>bba
-RecursiveArrayIteratorIterator::next
-RecursiveArrayIteratorIterator::valid
-RecursiveArrayIteratorIterator::current
-RecursiveArrayIteratorIterator::key
-1=>bbb
-RecursiveArrayIteratorIterator::next
-RecursiveArrayIterator::valid = false
-RecursiveArrayIteratorIterator::endChildren(2)
-RecursiveArrayIterator::getChildren
-RecursiveArrayIteratorIterator::beginChildren(2)
-RecursiveArrayIterator::getChildren
-RecursiveArrayIteratorIterator::beginChildren(3)
-RecursiveArrayIteratorIterator::valid
-RecursiveArrayIteratorIterator::current
-RecursiveArrayIteratorIterator::key
-0=>bcaa
-RecursiveArrayIteratorIterator::next
-RecursiveArrayIterator::valid = false
-RecursiveArrayIteratorIterator::endChildren(3)
-RecursiveArrayIterator::valid = false
-RecursiveArrayIteratorIterator::endChildren(2)
-RecursiveArrayIterator::valid = false
-RecursiveArrayIteratorIterator::endChildren(1)
-RecursiveArrayIterator::getChildren
-RecursiveArrayIteratorIterator::beginChildren(1)
-RecursiveArrayIteratorIterator::valid
-RecursiveArrayIteratorIterator::current
-RecursiveArrayIteratorIterator::key
-0=>ca
-RecursiveArrayIteratorIterator::next
-RecursiveArrayIterator::valid = false
-RecursiveArrayIteratorIterator::endChildren(1)
-RecursiveArrayIteratorIterator::valid
-RecursiveArrayIteratorIterator::current
-RecursiveArrayIteratorIterator::key
-3=>d
-RecursiveArrayIteratorIterator::next
-RecursiveArrayIterator::valid = false
-RecursiveArrayIteratorIterator::valid
-RecursiveArrayIterator::valid = false
-===DONE===
diff --git a/ext/spl/tests/iterator_015.phpt b/ext/spl/tests/iterator_015.phpt
deleted file mode 100755
index 3a18efd80f..0000000000
--- a/ext/spl/tests/iterator_015.phpt
+++ /dev/null
@@ -1,75 +0,0 @@
---TEST--
-SPL: RecursiveIteratorIterator and beginChildren/endChildren
---FILE--
-<?php
-
-class RecursiveArrayIterator extends ArrayIterator implements RecursiveIterator
-{
- function hasChildren()
- {
- return is_array($this->current());
- }
-
- function getChildren()
- {
- return new RecursiveArrayIterator($this->current());
- }
-}
-
-class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator
-{
- function rewind()
- {
- echo "<ul>\n";
- parent::rewind();
- }
- function beginChildren()
- {
- echo str_repeat(' ',$this->getDepth())."<ul>\n";
- }
-
- function endChildren()
- {
- echo str_repeat(' ',$this->getDepth())."</ul>\n";
- }
- function valid()
- {
- if (!parent::valid()) {
- echo "<ul>\n";
- return false;
- }
- return true;
- }
-}
-
-$arr = array("a", array("ba", array("bba", "bbb"), array(array("bcaa"))), array("ca"), "d");
-$obj = new RecursiveArrayIterator($arr);
-$rit = new RecursiveArrayIteratorIterator($obj);
-foreach($rit as $k=>$v)
-{
- echo str_repeat(' ',$rit->getDepth()+1)."$k=>$v\n";
-}
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-<ul>
- 0=>a
- <ul>
- 0=>ba
- <ul>
- 0=>bba
- 1=>bbb
- </ul>
- <ul>
- <ul>
- 0=>bcaa
- </ul>
- </ul>
- </ul>
- <ul>
- 0=>ca
- </ul>
- 3=>d
-<ul>
-===DONE===
diff --git a/ext/spl/tests/iterator_016.phpt b/ext/spl/tests/iterator_016.phpt
deleted file mode 100755
index 6a811edf29..0000000000
--- a/ext/spl/tests/iterator_016.phpt
+++ /dev/null
@@ -1,89 +0,0 @@
---TEST--
-SPL: RecursiveIteratorIterator and beginChildren/endChildren
---FILE--
-<?php
-
-class RecursiveArrayIterator extends ArrayIterator implements RecursiveIterator
-{
- function hasChildren()
- {
- return is_array($this->current());
- }
-
- function getChildren()
- {
- return new RecursiveArrayIterator($this->current());
- }
-}
-
-class Menu extends ArrayObject
-{
- function getIterator()
- {
- echo __METHOD__ . "\n";
- return new RecursiveArrayIterator($this);
- }
-}
-
-class MenuOutput extends RecursiveIteratorIterator
-{
- function __construct(Menu $it)
- {
- parent::__construct($it);
- }
- function rewind()
- {
- echo "<ul>\n";
- parent::rewind();
- }
- function beginChildren()
- {
- echo str_repeat(' ',$this->getDepth())."<ul>\n";
- }
-
- function endChildren()
- {
- echo str_repeat(' ',$this->getDepth())."</ul>\n";
- }
- function valid()
- {
- if (!parent::valid()) {
- echo "<ul>\n";
- return false;
- }
- return true;
- }
-}
-
-$arr = array("a", array("ba", array("bba", "bbb"), array(array("bcaa"))), array("ca"), "d");
-$obj = new Menu($arr);
-$rit = new MenuOutput($obj);
-foreach($rit as $k=>$v)
-{
- echo str_repeat(' ',$rit->getDepth()+1)."$k=>$v\n";
-}
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-Menu::getIterator
-<ul>
- 0=>a
- <ul>
- 0=>ba
- <ul>
- 0=>bba
- 1=>bbb
- </ul>
- <ul>
- <ul>
- 0=>bcaa
- </ul>
- </ul>
- </ul>
- <ul>
- 0=>ca
- </ul>
- 3=>d
-<ul>
-===DONE===
diff --git a/ext/spl/tests/iterator_017.phpt b/ext/spl/tests/iterator_017.phpt
deleted file mode 100755
index 39d1000f62..0000000000
--- a/ext/spl/tests/iterator_017.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-SPL: EmptyIterator
---FILE--
-<?php
-
-echo "===EmptyIterator===\n";
-
-foreach(new LimitIterator(new EmptyIterator(), 0, 3) as $key => $val)
-{
- echo "$key=>$val\n";
-}
-
-?>
-===DONE===
-<?php exit(0);
---EXPECTF--
-===EmptyIterator===
-===DONE===
diff --git a/ext/spl/tests/iterator_018.phpt b/ext/spl/tests/iterator_018.phpt
deleted file mode 100755
index 9c234bb11d..0000000000
--- a/ext/spl/tests/iterator_018.phpt
+++ /dev/null
@@ -1,51 +0,0 @@
---TEST--
-SPL: InfiniteIterator
---FILE--
-<?php
-
-echo "===EmptyIterator===\n";
-
-foreach(new LimitIterator(new InfiniteIterator(new EmptyIterator()), 0, 3) as $key=>$val)
-{
- echo "$key=>$val\n";
-}
-
-echo "===InfiniteIterator===\n";
-
-$it = new ArrayIterator(array(0 => 'A', 1 => 'B', 2 => 'C', 3 => 'D'));
-$it = new InfiniteIterator($it);
-$it = new LimitIterator($it, 2, 5);
-foreach($it as $val=>$key)
-{
- echo "$val=>$key\n";
-}
-
-echo "===Infinite/LimitIterator===\n";
-
-$it = new ArrayIterator(array(0 => 'A', 1 => 'B', 2 => 'C', 3 => 'D'));
-$it = new LimitIterator($it, 1, 2);
-$it = new InfiniteIterator($it);
-$it = new LimitIterator($it, 2, 5);
-foreach($it as $val=>$key)
-{
- echo "$val=>$key\n";
-}
-
-?>
-===DONE===
-<?php exit(0);
---EXPECTF--
-===EmptyIterator===
-===InfiniteIterator===
-2=>C
-3=>D
-0=>A
-1=>B
-2=>C
-===Infinite/LimitIterator===
-1=>B
-2=>C
-1=>B
-2=>C
-1=>B
-===DONE===
diff --git a/ext/spl/tests/iterator_019.phpt b/ext/spl/tests/iterator_019.phpt
deleted file mode 100755
index 09842b0988..0000000000
--- a/ext/spl/tests/iterator_019.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-SPL: NoRweindIterator
---FILE--
-<?php
-
-echo "===Current===\n";
-
-$it = new NoRewindIterator(new ArrayIterator(array(0 => 'A', 1 => 'B', 2 => 'C')));
-
-echo $it->key() . '=>' . $it->current() . "\n";
-
-echo "===Next===\n";
-
-$it->next();
-
-echo "===Foreach===\n";
-
-foreach($it as $key=>$val)
-{
- echo "$key=>$val\n";
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-===Current===
-0=>A
-===Next===
-===Foreach===
-1=>B
-2=>C
-===DONE===
diff --git a/ext/spl/tests/iterator_020.phpt b/ext/spl/tests/iterator_020.phpt
deleted file mode 100755
index 119631c000..0000000000
--- a/ext/spl/tests/iterator_020.phpt
+++ /dev/null
@@ -1,66 +0,0 @@
---TEST--
-SPL: AppendIterator
---FILE--
-<?php
-
-echo "===Empty===\n";
-
-$it = new AppendIterator;
-
-foreach($it as $key=>$val)
-{
- echo "$key=>$val\n";
-}
-
-echo "===Append===\n";
-
-$it->append(new ArrayIterator(array(0 => 'A', 1 => 'B')));
-
-foreach($it as $key=>$val)
-{
- echo "$key=>$val\n";
-}
-
-echo "===Rewind===\n";
-
-foreach($it as $key=>$val)
-{
- echo "$key=>$val\n";
-}
-
-echo "===Append===\n";
-
-$it->append(new ArrayIterator(array(2 => 'C', 3 => 'D')));
-
-foreach(new NoRewindIterator($it) as $key=>$val)
-{
- echo "$key=>$val\n";
-}
-
-echo "===Rewind===\n";
-
-foreach($it as $key=>$val)
-{
- echo "$key=>$val\n";
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-===Empty===
-===Append===
-0=>A
-1=>B
-===Rewind===
-0=>A
-1=>B
-===Append===
-2=>C
-3=>D
-===Rewind===
-0=>A
-1=>B
-2=>C
-3=>D
-===DONE===
diff --git a/ext/spl/tests/iterator_021.phpt b/ext/spl/tests/iterator_021.phpt
deleted file mode 100755
index 115461d053..0000000000
--- a/ext/spl/tests/iterator_021.phpt
+++ /dev/null
@@ -1,185 +0,0 @@
---TEST--
-SPL: RecursiveIteratorIterator and hasChildren
---FILE--
-<?php
-
-class RecursiveArrayIterator extends ArrayIterator implements RecursiveIterator
-{
- function hasChildren()
- {
- return is_array($this->current());
- }
-
- function getChildren()
- {
- echo __METHOD__ . "\n";
- return new RecursiveArrayIterator($this->current());
- }
-
- function valid()
- {
- if (!parent::valid())
- {
- echo __METHOD__ . " = false\n";
- return false;
- }
- else
- {
- return true;
- }
- }
-}
-
-class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator
-{
- private $max_depth;
- private $over = 0;
- private $skip = false;
-
- function __construct($it, $max_depth)
- {
- $this->max_depth = $max_depth;
- parent::__construct($it);
- }
-
- function rewind()
- {
- echo __METHOD__ . "\n";
- $this->skip = false;
- parent::rewind();
- }
-
- function valid()
- {
- echo __METHOD__ . "\n";
- if ($this->skip)
- {
- $this->skip = false;
- $this->next();
- }
- return parent::valid();
- }
-
- function current()
- {
- echo __METHOD__ . "\n";
- return parent::current();
- }
-
- function key()
- {
- echo __METHOD__ . "\n";
- return parent::key();
- }
-
- function next()
- {
- echo __METHOD__ . "\n";
- parent::next();
- }
-
- function callHasChildren()
- {
- $this->skip = false;
- $has = parent::callHasChildren();
- $res = $this->getDepth() < $this->max_depth && $has;
- echo __METHOD__ . "(".$this->getDepth().") = ".($res?"yes":"no")."/".($has?"yes":"no")."\n";
- if ($has && !$res)
- {
- $this->over++;
- if ($this->over == 2) {
- $this->skip = true;
- }
- }
- return $res;
- }
-
- function beginChildren()
- {
- echo __METHOD__ . "(".$this->getDepth().")\n";
- }
-
- function endChildren()
- {
- echo __METHOD__ . "(".$this->getDepth().")\n";
- }
-}
-
-foreach(new RecursiveArrayIteratorIterator(new RecursiveArrayIterator(array("a", array("ba", array("bba", "bbb"), array(array("bcaa"), array("bcba"))), array("ca"), "d")), 2) as $k=>$v)
-{
- if (is_array($v)) $v = join('',$v);
- echo "$k=>$v\n";
-}
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-RecursiveArrayIteratorIterator::rewind
-RecursiveArrayIteratorIterator::callHasChildren(0) = no/no
-RecursiveArrayIteratorIterator::valid
-RecursiveArrayIteratorIterator::current
-RecursiveArrayIteratorIterator::key
-0=>a
-RecursiveArrayIteratorIterator::next
-RecursiveArrayIteratorIterator::callHasChildren(0) = yes/yes
-RecursiveArrayIterator::getChildren
-RecursiveArrayIteratorIterator::beginChildren(1)
-RecursiveArrayIteratorIterator::callHasChildren(1) = no/no
-RecursiveArrayIteratorIterator::valid
-RecursiveArrayIteratorIterator::current
-RecursiveArrayIteratorIterator::key
-0=>ba
-RecursiveArrayIteratorIterator::next
-RecursiveArrayIteratorIterator::callHasChildren(1) = yes/yes
-RecursiveArrayIterator::getChildren
-RecursiveArrayIteratorIterator::beginChildren(2)
-RecursiveArrayIteratorIterator::callHasChildren(2) = no/no
-RecursiveArrayIteratorIterator::valid
-RecursiveArrayIteratorIterator::current
-RecursiveArrayIteratorIterator::key
-0=>bba
-RecursiveArrayIteratorIterator::next
-RecursiveArrayIteratorIterator::callHasChildren(2) = no/no
-RecursiveArrayIteratorIterator::valid
-RecursiveArrayIteratorIterator::current
-RecursiveArrayIteratorIterator::key
-1=>bbb
-RecursiveArrayIteratorIterator::next
-RecursiveArrayIterator::valid = false
-RecursiveArrayIteratorIterator::endChildren(2)
-RecursiveArrayIteratorIterator::callHasChildren(1) = yes/yes
-RecursiveArrayIterator::getChildren
-RecursiveArrayIteratorIterator::beginChildren(2)
-RecursiveArrayIteratorIterator::callHasChildren(2) = no/yes
-RecursiveArrayIteratorIterator::valid
-RecursiveArrayIteratorIterator::current
-RecursiveArrayIteratorIterator::key
-0=>bcaa
-RecursiveArrayIteratorIterator::next
-RecursiveArrayIteratorIterator::callHasChildren(2) = no/yes
-RecursiveArrayIteratorIterator::valid
-RecursiveArrayIteratorIterator::next
-RecursiveArrayIterator::valid = false
-RecursiveArrayIteratorIterator::endChildren(2)
-RecursiveArrayIterator::valid = false
-RecursiveArrayIteratorIterator::endChildren(1)
-RecursiveArrayIteratorIterator::callHasChildren(0) = yes/yes
-RecursiveArrayIterator::getChildren
-RecursiveArrayIteratorIterator::beginChildren(1)
-RecursiveArrayIteratorIterator::callHasChildren(1) = no/no
-RecursiveArrayIteratorIterator::current
-RecursiveArrayIteratorIterator::key
-0=>ca
-RecursiveArrayIteratorIterator::next
-RecursiveArrayIterator::valid = false
-RecursiveArrayIteratorIterator::endChildren(1)
-RecursiveArrayIteratorIterator::callHasChildren(0) = no/no
-RecursiveArrayIteratorIterator::valid
-RecursiveArrayIteratorIterator::current
-RecursiveArrayIteratorIterator::key
-3=>d
-RecursiveArrayIteratorIterator::next
-RecursiveArrayIterator::valid = false
-RecursiveArrayIteratorIterator::valid
-RecursiveArrayIterator::valid = false
-===DONE===
diff --git a/ext/spl/tests/iterator_022.phpt b/ext/spl/tests/iterator_022.phpt
deleted file mode 100755
index 12bec48b15..0000000000
--- a/ext/spl/tests/iterator_022.phpt
+++ /dev/null
@@ -1,191 +0,0 @@
---TEST--
-SPL: RecursiveIteratorIterator and callHasChildren/callGetChildren
---FILE--
-<?php
-
-class RecursiveArrayIterator extends ArrayIterator implements RecursiveIterator
-{
- function hasChildren()
- {
- return is_array($this->current());
- }
-
- function getChildren()
- {
- echo __METHOD__ . "\n";
- return $this->current();
- }
-
- function valid()
- {
- if (!parent::valid())
- {
- echo __METHOD__ . " = false\n";
- return false;
- }
- else
- {
- return true;
- }
- }
-}
-
-class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator
-{
- private $max_depth;
- private $over = 0;
- private $skip = false;
-
- function __construct($it, $max_depth)
- {
- $this->max_depth = $max_depth;
- parent::__construct($it);
- }
-
- function rewind()
- {
- echo __METHOD__ . "\n";
- $this->skip = false;
- parent::rewind();
- }
-
- function valid()
- {
- echo __METHOD__ . "\n";
- if ($this->skip)
- {
- $this->skip = false;
- $this->next();
- }
- return parent::valid();
- }
-
- function current()
- {
- echo __METHOD__ . "\n";
- return parent::current();
- }
-
- function key()
- {
- echo __METHOD__ . "\n";
- return parent::key();
- }
-
- function next()
- {
- echo __METHOD__ . "\n";
- parent::next();
- }
-
- function callHasChildren()
- {
- $this->skip = false;
- $has = parent::callHasChildren();
- $res = $this->getDepth() < $this->max_depth && $has;
- echo __METHOD__ . "(".$this->getDepth().") = ".($res?"yes":"no")."/".($has?"yes":"no")."\n";
- if ($has && !$res)
- {
- $this->over++;
- if ($this->over == 2) {
- $this->skip = true;
- }
- }
- return $res;
- }
-
- function callGetChildren()
- {
- if ($this->over == 2)
- {
- echo __METHOD__ . "(skip)\n";
- return NULL;
- }
- echo __METHOD__ . "(ok:{$this->over})\n";
- return new RecursiveArrayIterator($this->current());
- }
-
- function beginChildren()
- {
- echo __METHOD__ . "(".$this->getDepth().")\n";
- }
-
- function endChildren()
- {
- echo __METHOD__ . "(".$this->getDepth().")\n";
- }
-}
-
-try
-{
- foreach(new RecursiveArrayIteratorIterator(new RecursiveArrayIterator(array("a", array("ba", array("bba", "bbb"), array(array("bcaa"), array("bcba"))), array("ca"), "d")), 2) as $k=>$v)
- {
- if (is_array($v)) $v = join('',$v);
- echo "$k=>$v\n";
- }
-}
-catch(UnexpectedValueException $e)
-{
- echo $e->getMessage() . "\n";
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-RecursiveArrayIteratorIterator::rewind
-RecursiveArrayIteratorIterator::callHasChildren(0) = no/no
-RecursiveArrayIteratorIterator::valid
-RecursiveArrayIteratorIterator::current
-RecursiveArrayIteratorIterator::key
-0=>a
-RecursiveArrayIteratorIterator::next
-RecursiveArrayIteratorIterator::callHasChildren(0) = yes/yes
-RecursiveArrayIteratorIterator::callGetChildren(ok:0)
-RecursiveArrayIteratorIterator::current
-RecursiveArrayIteratorIterator::beginChildren(1)
-RecursiveArrayIteratorIterator::callHasChildren(1) = no/no
-RecursiveArrayIteratorIterator::valid
-RecursiveArrayIteratorIterator::current
-RecursiveArrayIteratorIterator::key
-0=>ba
-RecursiveArrayIteratorIterator::next
-RecursiveArrayIteratorIterator::callHasChildren(1) = yes/yes
-RecursiveArrayIteratorIterator::callGetChildren(ok:0)
-RecursiveArrayIteratorIterator::current
-RecursiveArrayIteratorIterator::beginChildren(2)
-RecursiveArrayIteratorIterator::callHasChildren(2) = no/no
-RecursiveArrayIteratorIterator::valid
-RecursiveArrayIteratorIterator::current
-RecursiveArrayIteratorIterator::key
-0=>bba
-RecursiveArrayIteratorIterator::next
-RecursiveArrayIteratorIterator::callHasChildren(2) = no/no
-RecursiveArrayIteratorIterator::valid
-RecursiveArrayIteratorIterator::current
-RecursiveArrayIteratorIterator::key
-1=>bbb
-RecursiveArrayIteratorIterator::next
-RecursiveArrayIterator::valid = false
-RecursiveArrayIteratorIterator::endChildren(2)
-RecursiveArrayIteratorIterator::callHasChildren(1) = yes/yes
-RecursiveArrayIteratorIterator::callGetChildren(ok:0)
-RecursiveArrayIteratorIterator::current
-RecursiveArrayIteratorIterator::beginChildren(2)
-RecursiveArrayIteratorIterator::callHasChildren(2) = no/yes
-RecursiveArrayIteratorIterator::valid
-RecursiveArrayIteratorIterator::current
-RecursiveArrayIteratorIterator::key
-0=>bcaa
-RecursiveArrayIteratorIterator::next
-RecursiveArrayIteratorIterator::callHasChildren(2) = no/yes
-RecursiveArrayIteratorIterator::valid
-RecursiveArrayIteratorIterator::next
-RecursiveArrayIterator::valid = false
-RecursiveArrayIteratorIterator::endChildren(2)
-RecursiveArrayIterator::valid = false
-RecursiveArrayIteratorIterator::endChildren(1)
-RecursiveArrayIteratorIterator::callHasChildren(0) = yes/yes
-RecursiveArrayIteratorIterator::callGetChildren(skip)
-Objects returned by RecursiveIterator::getChildren() must implement RecursiveIterator
-===DONE===
diff --git a/ext/spl/tests/observer_001.phpt b/ext/spl/tests/observer_001.phpt
deleted file mode 100755
index 3b20e25bdc..0000000000
--- a/ext/spl/tests/observer_001.phpt
+++ /dev/null
@@ -1,116 +0,0 @@
---TEST--
-SPL: Observer and Subject (empty notify)
---FILE--
-<?php
-
-class ObserverImpl implements Observer
-{
- protected $name = '';
-
- function __construct($name = 'obj')
- {
- $this->name = '$' . $name;
- }
-
- function update(Subject $subject)
- {
- echo $this->name . '->' . __METHOD__ . '(' . $subject->getName() . ");\n";
- }
-
- function getName()
- {
- return $this->name;
- }
-}
-
-class SubjectImpl implements Subject
-{
- protected $name = '';
- protected $observers = array();
-
- function __construct($name = 'sub')
- {
- $this->name = '$' . $name;
- }
-
- function attach(Observer $observer)
- {
- echo '$sub->' . __METHOD__ . '(' . $observer->getName() . ");\n";
- if (!in_array($observer, $this->observers))
- {
- $this->observers[] = $observer;
- }
- }
-
- function detach(Observer $observer)
- {
- echo '$sub->' . __METHOD__ . '(' . $observer->getName() . ");\n";
- $idx = array_search($observer, $this->observers);
- if ($idx !== false)
- {
- unset($this->observers[$idx]);
- }
- }
-
- function notify()
- {
- echo '$sub->' . __METHOD__ . "();\n";
- foreach($this->observers as $observer)
- {
- $observer->update($this);
- }
- }
-
- function getName()
- {
- return $this->name;
- }
-}
-
-$sub = new SubjectImpl;
-
-$ob1 = new ObserverImpl("ob1");
-$ob2 = new ObserverImpl("ob2");
-$ob3 = new ObserverImpl("ob3");
-
-$sub->attach($ob1);
-$sub->attach($ob1);
-$sub->attach($ob2);
-$sub->attach($ob3);
-
-$sub->notify();
-
-$sub->detach($ob3);
-
-$sub->notify();
-
-$sub->detach($ob2);
-$sub->detach($ob1);
-
-$sub->notify();
-
-$sub->attach($ob3);
-
-$sub->notify();
-?>
-===DONE===
---EXPECT--
-$sub->SubjectImpl::attach($ob1);
-$sub->SubjectImpl::attach($ob1);
-$sub->SubjectImpl::attach($ob2);
-$sub->SubjectImpl::attach($ob3);
-$sub->SubjectImpl::notify();
-$ob1->ObserverImpl::update($sub);
-$ob2->ObserverImpl::update($sub);
-$ob3->ObserverImpl::update($sub);
-$sub->SubjectImpl::detach($ob3);
-$sub->SubjectImpl::notify();
-$ob1->ObserverImpl::update($sub);
-$ob2->ObserverImpl::update($sub);
-$sub->SubjectImpl::detach($ob2);
-$sub->SubjectImpl::detach($ob1);
-$sub->SubjectImpl::notify();
-$sub->SubjectImpl::attach($ob3);
-$sub->SubjectImpl::notify();
-$ob3->ObserverImpl::update($sub);
-===DONE===
diff --git a/ext/spl/tests/spl_001.phpt b/ext/spl/tests/spl_001.phpt
deleted file mode 100755
index e101272a84..0000000000
--- a/ext/spl/tests/spl_001.phpt
+++ /dev/null
@@ -1,34 +0,0 @@
---TEST--
-SPL: iterator_to_array() and iterator_count()
---FILE--
-<?php
-
-$it = new ArrayObject(array("x"=>1, 1=>2, 3=>3, 4, "1"=>5));
-
-$ar = iterator_to_array($it);
-
-var_dump(iterator_count($it));
-
-print_r($ar);
-
-foreach($ar as $v)
-{
- var_dump($v);
-}
-
-?>
-===DONE===
---EXPECT--
-int(4)
-Array
-(
- [x] => 1
- [1] => 5
- [3] => 3
- [4] => 4
-)
-int(1)
-int(5)
-int(3)
-int(4)
-===DONE===
diff --git a/ext/spl/tests/spl_002.phpt b/ext/spl/tests/spl_002.phpt
deleted file mode 100755
index d8b71b20cf..0000000000
--- a/ext/spl/tests/spl_002.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-SPL: Countable
---FILE--
-<?php
-
-class Test implements Countable
-{
- function count()
- {
- return 4;
- }
-};
-
-$a = new Test;
-
-var_dump(count($a));
-
-?>
-===DONE===
---EXPECT--
-int(4)
-===DONE===
diff --git a/ext/spl/tests/spl_003.phpt b/ext/spl/tests/spl_003.phpt
deleted file mode 100755
index cadf3b5a6c..0000000000
--- a/ext/spl/tests/spl_003.phpt
+++ /dev/null
@@ -1,76 +0,0 @@
---TEST--
-SPL: class_parents() and class_implements()
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
---FILE--
-<?php
-class a{}
-class b extends a{}
-class c extends b{}
-class d{}
-var_dump(class_parents(new c),
- class_parents("c"),
- class_parents(new b),
- class_parents("b"),
- class_parents("d"),
- class_parents("foo", 0),
- class_parents("foo", 1)
-);
-
-interface iface1{}
-interface iface2{}
-class f implements iface1, iface2{}
-var_dump(class_implements(new a),
- class_implements("a"),
- class_implements("aaa"),
- class_implements("bbb", 0)
-);
-
-function __autoload($cname) {
- var_dump($cname);
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-Warning: class_parents(): Class foo does not exist in %sspl_003.php on line %d
-string(3) "foo"
-
-Warning: class_parents(): Class foo does not exist and could not be loaded in %sspl_003.php on line %d
-array(2) {
- ["b"]=>
- string(1) "b"
- ["a"]=>
- string(1) "a"
-}
-array(2) {
- ["b"]=>
- string(1) "b"
- ["a"]=>
- string(1) "a"
-}
-array(1) {
- ["a"]=>
- string(1) "a"
-}
-array(1) {
- ["a"]=>
- string(1) "a"
-}
-array(0) {
-}
-bool(false)
-bool(false)
-string(3) "aaa"
-
-Warning: class_implements(): Class aaa does not exist and could not be loaded in %sspl_003.php on line %d
-
-Warning: class_implements(): Class bbb does not exist in %sspl_003.php on line %d
-array(0) {
-}
-array(0) {
-}
-bool(false)
-bool(false)
-===DONE=== \ No newline at end of file
diff --git a/ext/spl/tests/spl_autoload_001.phpt b/ext/spl/tests/spl_autoload_001.phpt
deleted file mode 100755
index 8d4c000473..0000000000
--- a/ext/spl/tests/spl_autoload_001.phpt
+++ /dev/null
@@ -1,136 +0,0 @@
---TEST--
-SPL: spl_autoload() and friends
---INI--
-include_path=.
---FILE--
-<?php
-
-echo "===EMPTY===\n";
-
-var_dump(spl_autoload_extensions());
-
-try
-{
- spl_autoload("TestClass");
-}
-catch(Exception $e)
-{
- echo 'Exception: ' . $e->getMessage() . "\n";
-}
-
-$test_exts = array(NULL, "1", ".inc,,.php.inc", "");
-
-foreach($test_exts as $exts)
-{
- echo "===($exts)===\n";
- try
- {
- spl_autoload("TestClass", $exts);
- }
- catch(Exception $e)
- {
- echo 'Exception: ' . $e->getMessage() . "\n";
- }
-}
-
-try
-{
- spl_autoload_extensions(".inc,.php.inc");
- spl_autoload("TestClass");
-}
-catch(Exception $e)
-{
- echo 'Exception: ' . $e->getMessage() . "\n";
-}
-
-function TestFunc1($classname)
-{
- echo __METHOD__ . "($classname)\n";
-}
-
-function TestFunc2($classname)
-{
- echo __METHOD__ . "($classname)\n";
-}
-
-echo "===SPL_AUTOLOAD()===\n";
-
-spl_autoload_register();
-
-try
-{
- var_dump(spl_autoload_extensions(".inc"));
- var_dump(class_exists("TestClass", true));
-}
-catch(Exception $e)
-{
- echo 'Exception: ' . $e->getMessage() . "\n";
-}
-
-echo "===REGISTER===\n";
-
-spl_autoload_unregister("spl_autoload");
-spl_autoload_register("TestFunc1");
-spl_autoload_register("TestFunc2");
-spl_autoload_register("TestFunc2"); /* 2nd call ignored */
-spl_autoload_extensions(".inc,.class.inc"); /* we do not have spl_autoload_registered yet */
-
-try
-{
- var_dump(class_exists("TestClass", true));
-}
-catch(Exception $e)
-{
- echo 'Exception: ' . $e->getMessage() . "\n";
-}
-
-echo "===LOAD===\n";
-
-spl_autoload_register("spl_autoload");
-var_dump(class_exists("TestClass", true));
-
-echo "===NOFUNCTION===\n";
-
-try
-{
- spl_autoload_register("unavailable_autoload_function");
-}
-catch(Exception $e)
-{
- echo 'Exception: ' . $e->getMessage() . "\n";
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-===EMPTY===
-string(13) ".inc,.inc.php"
-%stestclass.inc
-Exception: Class TestClass could not be loaded
-===()===
-Exception: Class TestClass could not be loaded
-===(1)===
-Exception: Class TestClass could not be loaded
-===(.inc,,.php.inc)===
-%stestclass
-%stestclass.php.inc
-Exception: Class TestClass could not be loaded
-===()===
-Exception: Class TestClass could not be loaded
-Exception: Class TestClass could not be loaded
-===SPL_AUTOLOAD()===
-string(4) ".inc"
-Exception: Class TestClass could not be loaded
-===REGISTER===
-TestFunc1(TestClass)
-TestFunc2(TestClass)
-bool(false)
-===LOAD===
-TestFunc1(TestClass)
-TestFunc2(TestClass)
-%stestclass.class.inc
-bool(true)
-===NOFUNCTION===
-Exception: Function 'unavailable_autoload_function' not found
-===DONE===
diff --git a/ext/spl/tests/spl_autoload_002.phpt b/ext/spl/tests/spl_autoload_002.phpt
deleted file mode 100755
index 21caa43bfa..0000000000
--- a/ext/spl/tests/spl_autoload_002.phpt
+++ /dev/null
@@ -1,68 +0,0 @@
---TEST--
-SPL: spl_autoloadfunctions()
---SKIPIF--
-<?php if (spl_autoload_functions() !== false) die('skip __autoload() registered by php.ini'); ?>
---FILE--
-<?php
-
-function SplAutoloadTest1($name) {}
-function SplAutoloadTest2($name) {}
-
-var_dump(spl_autoload_functions());
-
-spl_autoload_register();
-
-var_dump(spl_autoload_functions());
-
-spl_autoload_register('SplAutoloadTest1');
-spl_autoload_register('SplAutoloadTest2');
-spl_autoload_register('SplAutoloadTest1');
-
-var_dump(spl_autoload_functions());
-
-spl_autoload_unregister('SplAutoloadTest1');
-
-var_dump(spl_autoload_functions());
-
-spl_autoload_unregister('spl_autoload_call');
-
-var_dump(spl_autoload_functions());
-
-spl_autoload_register();
-
-var_dump(spl_autoload_functions());
-
-spl_autoload_unregister('spl_autoload');
-
-var_dump(spl_autoload_functions());
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-bool(false)
-array(1) {
- [0]=>
- string(12) "spl_autoload"
-}
-array(3) {
- [0]=>
- string(12) "spl_autoload"
- [1]=>
- string(16) "SplAutoloadTest1"
- [2]=>
- string(16) "SplAutoloadTest2"
-}
-array(2) {
- [0]=>
- string(12) "spl_autoload"
- [1]=>
- string(16) "SplAutoloadTest2"
-}
-bool(false)
-array(1) {
- [0]=>
- string(12) "spl_autoload"
-}
-bool(false)
-===DONE===
diff --git a/ext/spl/tests/spl_autoload_003.phpt b/ext/spl/tests/spl_autoload_003.phpt
deleted file mode 100755
index 00fdd2734f..0000000000
--- a/ext/spl/tests/spl_autoload_003.phpt
+++ /dev/null
@@ -1,44 +0,0 @@
---TEST--
-SPL: spl_autoload() and friends
---INI--
-include_path=.
---FILE--
-<?php
-
-function TestFunc1($classname)
-{
- echo __METHOD__ . "($classname)\n";
-}
-
-function TestFunc2($classname)
-{
- echo __METHOD__ . "($classname)\n";
- throw new Exception("Class $classname missing");
-}
-
-function TestFunc3($classname)
-{
- echo __METHOD__ . "($classname)\n";
-}
-
-spl_autoload_register("TestFunc1");
-spl_autoload_register("TestFunc2");
-spl_autoload_register("TestFunc3");
-
-try
-{
- var_dump(class_exists("TestClass", true));
-}
-catch(Exception $e)
-{
- echo 'Exception: ' . $e->getMessage() . "\n";
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-TestFunc1(TestClass)
-TestFunc2(TestClass)
-Exception: Class TestClass missing
-===DONE===
diff --git a/ext/spl/tests/sxe_001.phpt b/ext/spl/tests/sxe_001.phpt
deleted file mode 100755
index 88f83f2abe..0000000000
--- a/ext/spl/tests/sxe_001.phpt
+++ /dev/null
@@ -1,60 +0,0 @@
---TEST--
-SPL: SimpleXMLIterator
---SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
-<?php if (!extension_loaded("simplexml")) print "skip SimpleXML not present"; ?>
---FILE--
-<?php
-
-$xml =<<<EOF
-<?xml version='1.0'?>
-<!DOCTYPE sxe SYSTEM "notfound.dtd">
-<sxe id="elem1">
- <elem1 attr1='first'>
- <!-- comment -->
- <elem2>
- <elem3>
- <elem4>
- <?test processing instruction ?>
- </elem4>
- </elem3>
- </elem2>
- </elem1>
-</sxe>
-EOF;
-
-$sxe = simplexml_load_string($xml, 'SimpleXMLIterator');
-
-print_r($sxe);
-
-?>
-===DONE===
---EXPECT--
-SimpleXMLIterator Object
-(
- [elem1] => SimpleXMLIterator Object
- (
- [comment] => SimpleXMLIterator Object
- (
- )
-
- [elem2] => SimpleXMLIterator Object
- (
- [elem3] => SimpleXMLIterator Object
- (
- [elem4] => SimpleXMLIterator Object
- (
- [test] => SimpleXMLIterator Object
- (
- )
-
- )
-
- )
-
- )
-
- )
-
-)
-===DONE===
diff --git a/ext/spl/tests/sxe_002.phpt b/ext/spl/tests/sxe_002.phpt
deleted file mode 100755
index b230e8cd8d..0000000000
--- a/ext/spl/tests/sxe_002.phpt
+++ /dev/null
@@ -1,75 +0,0 @@
---TEST--
-SPL: SimpleXMLIterator and recursion
---SKIPIF--
-<?php
- if (!extension_loaded('simplexml')) print 'skip';
- if (!class_exists('RecursiveIteratorIterator')) print 'skip RecursiveIteratorIterator not available';
-?>
---FILE--
-<?php
-
-$xml =<<<EOF
-<?xml version='1.0'?>
-<!DOCTYPE sxe SYSTEM "notfound.dtd">
-<sxe id="elem1">
- Plain text.
- <elem1 attr1='first'>
- Bla bla 1.
- <!-- comment -->
- <elem2>
- Here we have some text data.
- <elem3>
- And here some more.
- <elem4>
- Wow once again.
- </elem4>
- </elem3>
- </elem2>
- </elem1>
- <elem11 attr2='second'>
- Bla bla 2.
- <elem111>
- Foo Bar
- </elem111>
- </elem11>
-</sxe>
-EOF;
-
-$sxe = simplexml_load_string($xml, 'SimpleXMLIterator');
-
-foreach(new RecursiveIteratorIterator($sxe, 1) as $name => $data) {
- var_dump($name);
- var_dump(get_class($data));
- var_dump(trim($data));
-}
-
-echo "===DUMP===\n";
-
-var_dump(get_class($sxe));
-var_dump(trim($sxe->elem1));
-
-?>
-===DONE===
---EXPECT--
-string(5) "elem1"
-string(17) "SimpleXMLIterator"
-string(10) "Bla bla 1."
-string(5) "elem2"
-string(17) "SimpleXMLIterator"
-string(28) "Here we have some text data."
-string(5) "elem3"
-string(17) "SimpleXMLIterator"
-string(19) "And here some more."
-string(5) "elem4"
-string(17) "SimpleXMLIterator"
-string(15) "Wow once again."
-string(6) "elem11"
-string(17) "SimpleXMLIterator"
-string(10) "Bla bla 2."
-string(7) "elem111"
-string(17) "SimpleXMLIterator"
-string(7) "Foo Bar"
-===DUMP===
-string(17) "SimpleXMLIterator"
-string(10) "Bla bla 1."
-===DONE===
diff --git a/ext/spl/tests/sxe_003.phpt b/ext/spl/tests/sxe_003.phpt
deleted file mode 100755
index aab7de7202..0000000000
--- a/ext/spl/tests/sxe_003.phpt
+++ /dev/null
@@ -1,77 +0,0 @@
---TEST--
-SPL: SimpleXMLIterator and getChildren()
---SKIPIF--
-<?php
- if (!extension_loaded('simplexml')) print 'skip';
- if (!class_exists('RecursiveIteratorIterator')) print 'skip RecursiveIteratorIterator not available';
-?>
---FILE--
-<?php
-
-$xml =<<<EOF
-<?xml version='1.0'?>
-<!DOCTYPE sxe SYSTEM "notfound.dtd">
-<sxe id="elem1">
- Plain text.
- <elem1 attr1='first'>
- Bla bla 1.
- <!-- comment -->
- <elem2>
- Here we have some text data.
- <elem3>
- And here some more.
- <elem4>
- Wow once again.
- </elem4>
- </elem3>
- </elem2>
- </elem1>
- <elem11 attr2='second'>
- Bla bla 2.
- <elem111>
- Foo Bar
- </elem111>
- </elem11>
-</sxe>
-EOF;
-
-$sxe = simplexml_load_string($xml, 'SimpleXMLIterator');
-
-foreach($sxe->getChildren() as $name => $data) {
- var_dump($name);
- var_dump(get_class($data));
- var_dump(trim($data));
-}
-
-echo "===RESET===\n";
-
-for ($sxe->rewind(); $sxe->valid(); $sxe->next()) {
- var_dump($sxe->hasChildren());
- var_dump(trim($sxe->key()));
- var_dump(trim($sxe->current()));
- foreach($sxe->getChildren() as $name => $data) {
- var_dump($name);
- var_dump(get_class($data));
- var_dump(trim($data));
- }
-}
-
-?>
-===DONE===
---EXPECTF--
-
-Warning: Invalid argument supplied for foreach() in %ssxe_003.php on line %d
-===RESET===
-bool(true)
-string(5) "elem1"
-string(10) "Bla bla 1."
-string(5) "elem2"
-string(17) "SimpleXMLIterator"
-string(28) "Here we have some text data."
-bool(true)
-string(6) "elem11"
-string(10) "Bla bla 2."
-string(7) "elem111"
-string(17) "SimpleXMLIterator"
-string(7) "Foo Bar"
-===DONE===
diff --git a/ext/spl/tests/sxe_004.phpt b/ext/spl/tests/sxe_004.phpt
deleted file mode 100755
index 20aa5dc8ca..0000000000
--- a/ext/spl/tests/sxe_004.phpt
+++ /dev/null
@@ -1,145 +0,0 @@
---TEST--
-SPL: SimpleXMLIterator and getChildren()
---SKIPIF--
-<?php
- if (!extension_loaded('simplexml')) print 'skip';
- if (!class_exists('RecursiveIteratorIterator')) print 'skip RecursiveIteratorIterator not available';
-?>
---FILE--
-<?php
-
-$xml =<<<EOF
-<?xml version='1.0'?>
-<!DOCTYPE sxe SYSTEM "notfound.dtd">
-<sxe id="elem1">
- Plain text.
- <elem1 attr1='first'>
- Bla bla 1.
- <!-- comment -->
- <elem2>
- Here we have some text data.
- <elem3>
- And here some more.
- <elem4>
- Wow once again.
- </elem4>
- </elem3>
- </elem2>
- </elem1>
- <elem11 attr2='second'>
- Bla bla 2.
- <elem111>
- Foo Bar
- </elem111>
- </elem11>
-</sxe>
-EOF;
-
-class SXETest extends SimpleXMLIterator
-{
- function rewind()
- {
- echo __METHOD__ . "\n";
- return parent::rewind();
- }
- function valid()
- {
- echo __METHOD__ . "\n";
- return parent::valid();
- }
- function current()
- {
- echo __METHOD__ . "\n";
- return parent::current();
- }
- function key()
- {
- echo __METHOD__ . "\n";
- return parent::key();
- }
- function next()
- {
- echo __METHOD__ . "\n";
- return parent::next();
- }
- function hasChildren()
- {
- echo __METHOD__ . "\n";
- return parent::hasChildren();
- }
- function getChildren()
- {
- echo __METHOD__ . "\n";
- return parent::getChildren();
- }
-}
-
-$sxe = new SXETest($xml);
-$rit = new RecursiveIteratorIterator($sxe, RIT_SELF_FIRST);
-
-foreach($rit as $data) {
- var_dump(get_class($data));
- var_dump(trim($data));
-}
-
-?>
-===DONE===
---EXPECTF--
-SXETest::rewind
-SXETest::valid
-SXETest::hasChildren
-SXETest::valid
-SXETest::current
-string(7) "SXETest"
-string(10) "Bla bla 1."
-SXETest::getChildren
-SXETest::rewind
-SXETest::valid
-SXETest::hasChildren
-SXETest::valid
-SXETest::current
-string(7) "SXETest"
-string(28) "Here we have some text data."
-SXETest::getChildren
-SXETest::rewind
-SXETest::valid
-SXETest::hasChildren
-SXETest::valid
-SXETest::current
-string(7) "SXETest"
-string(19) "And here some more."
-SXETest::getChildren
-SXETest::rewind
-SXETest::valid
-SXETest::hasChildren
-SXETest::valid
-SXETest::current
-string(7) "SXETest"
-string(15) "Wow once again."
-SXETest::next
-SXETest::valid
-SXETest::next
-SXETest::valid
-SXETest::next
-SXETest::valid
-SXETest::next
-SXETest::valid
-SXETest::hasChildren
-SXETest::valid
-SXETest::current
-string(7) "SXETest"
-string(10) "Bla bla 2."
-SXETest::getChildren
-SXETest::rewind
-SXETest::valid
-SXETest::hasChildren
-SXETest::valid
-SXETest::current
-string(7) "SXETest"
-string(7) "Foo Bar"
-SXETest::next
-SXETest::valid
-SXETest::next
-SXETest::valid
-SXETest::valid
-===DONE===
diff --git a/ext/spl/tests/testclass b/ext/spl/tests/testclass
deleted file mode 100755
index ceb24c877c..0000000000
--- a/ext/spl/tests/testclass
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-
-echo __FILE__ . "\n";
-
-?> \ No newline at end of file
diff --git a/ext/spl/tests/testclass.class.inc b/ext/spl/tests/testclass.class.inc
deleted file mode 100755
index f5fe7411fa..0000000000
--- a/ext/spl/tests/testclass.class.inc
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php
-
-echo __FILE__ . "\n";
-
-class TestClass
-{
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/tests/testclass.inc b/ext/spl/tests/testclass.inc
deleted file mode 100755
index ceb24c877c..0000000000
--- a/ext/spl/tests/testclass.inc
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-
-echo __FILE__ . "\n";
-
-?> \ No newline at end of file
diff --git a/ext/spl/tests/testclass.php.inc b/ext/spl/tests/testclass.php.inc
deleted file mode 100755
index ceb24c877c..0000000000
--- a/ext/spl/tests/testclass.php.inc
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-
-echo __FILE__ . "\n";
-
-?> \ No newline at end of file