summaryrefslogtreecommitdiff
path: root/ext/spl
diff options
context:
space:
mode:
authorMark A. Hershberger <mah@debian.(none)>2009-03-25 00:39:08 -0400
committerMark A. Hershberger <mah@debian.(none)>2009-03-25 00:39:08 -0400
commit993e1866df547532a05ab6db76c9ff5aefc9a3df (patch)
tree169d3bde0974235d3cde164786ef6f381a4749a7 /ext/spl
parent1f589a2bd44ba835ad1b009a5d83abd453724829 (diff)
downloadphp-993e1866df547532a05ab6db76c9ff5aefc9a3df.tar.gz
Imported Upstream version 5.2.6upstream/5.2.6
Diffstat (limited to 'ext/spl')
-rwxr-xr-xext/spl/examples/findfile.inc2
-rwxr-xr-xext/spl/examples/tree.php2
-rwxr-xr-xext/spl/internal/splobjectstorage.inc4
-rwxr-xr-xext/spl/php_spl.c4
-rwxr-xr-xext/spl/php_spl.h2
-rwxr-xr-xext/spl/spl.php334
-rwxr-xr-xext/spl/spl_array.c4
-rwxr-xr-xext/spl/spl_array.h4
-rwxr-xr-xext/spl/spl_directory.c54
-rwxr-xr-xext/spl/spl_directory.h14
-rwxr-xr-xext/spl/spl_engine.c2
-rwxr-xr-xext/spl/spl_engine.h4
-rwxr-xr-xext/spl/spl_exceptions.c4
-rwxr-xr-xext/spl/spl_exceptions.h4
-rwxr-xr-xext/spl/spl_functions.c4
-rwxr-xr-xext/spl/spl_functions.h4
-rwxr-xr-xext/spl/spl_iterators.c13
-rwxr-xr-xext/spl/spl_iterators.h8
-rwxr-xr-xext/spl/spl_observer.c4
-rwxr-xr-xext/spl/spl_observer.h4
-rwxr-xr-xext/spl/spl_sxe.c4
-rwxr-xr-xext/spl/spl_sxe.h4
-rw-r--r--ext/spl/tests/bug41828.phpt21
-rwxr-xr-xext/spl/tests/dit_002.phpt50
24 files changed, 321 insertions, 233 deletions
diff --git a/ext/spl/examples/findfile.inc b/ext/spl/examples/findfile.inc
index 05d525a3f..02ab79243 100755
--- a/ext/spl/examples/findfile.inc
+++ b/ext/spl/examples/findfile.inc
@@ -33,7 +33,7 @@ class FindFile extends FilterIterator
function __construct($path, $file)
{
$this->file = $file;
- $list = split(';', $path);
+ $list = split(PATH_SEPARATOR, $path);
if (count($list) <= 1) {
parent::__construct(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)));
} else {
diff --git a/ext/spl/examples/tree.php b/ext/spl/examples/tree.php
index 6005263cc..7c630e823 100755
--- a/ext/spl/examples/tree.php
+++ b/ext/spl/examples/tree.php
@@ -37,4 +37,4 @@ foreach(new DirectoryGraphIterator($argv[1]) as $file)
echo $file . "\n";
}
-?> \ No newline at end of file
+?>
diff --git a/ext/spl/internal/splobjectstorage.inc b/ext/spl/internal/splobjectstorage.inc
index b01a85096..a6adafb67 100755
--- a/ext/spl/internal/splobjectstorage.inc
+++ b/ext/spl/internal/splobjectstorage.inc
@@ -13,7 +13,7 @@
* @brief Object storage
* @author Marcus Boerger
* @version 1.0
- * @since PHP 6.0
+ * @since PHP 5.1.2
*
* This container allows to store objects uniquly without the need to compare
* them one by one. This is only possible internally. The code represenation
@@ -115,4 +115,4 @@ class SplObjectStorage implements Iterator, Countable
}
}
-?> \ No newline at end of file
+?>
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index 3f1ed7995..e4a09684a 100755
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_spl.c,v 1.52.2.28.2.17 2007/05/19 18:40:27 iliaa Exp $ */
+/* $Id: php_spl.c,v 1.52.2.28.2.18 2007/12/31 07:20:11 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/spl/php_spl.h b/ext/spl/php_spl.h
index 7c44f5855..09bd521f1 100755
--- a/ext/spl/php_spl.h
+++ b/ext/spl/php_spl.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/spl/spl.php b/ext/spl/spl.php
index bb6af7e05..43c29e987 100755
--- a/ext/spl/spl.php
+++ b/ext/spl/spl.php
@@ -13,25 +13,25 @@
*
* 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
+ * 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
+ *
+ * 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 extends Iterator
* - interface OuterIterator extends Iterator
* - class RecursiveIteratorIterator implements OuterIterator
@@ -48,32 +48,32 @@
* - class AppendIterator implements OuterIterator
* - class RegexIterator extends FilterIterator
* - class RecursiveRegexIterator extends RegexIterator implements RecursiveIterator
- *
+ *
* 2) Directories and Files
- *
+ *
* SPL offers two advanced directory and file handling classes:
- *
+ *
* - class SplFileInfo
* - class DirectoryIterator extends SplFileInfo implements Iterator
* - class RecursiveDirectoryIterator extends DirectoryIterator implements RecursiveIterator
* - class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIterator
- *
+ *
* 3) XML
- *
+ *
* SPL offers an advanced XML handling class:
- *
+ *
* - class SimpleXMLIterator extends simplexml_element implements RecursiveIterator
- *
+ *
* 4) Array Overloading
- *
+ *
* SPL offers advanced Array overloading:
- *
+ *
* - class ArrayObject implements IteratorAggregate, ArrayAccess, Countable
* - class ArrayIterator implements Iterator, ArrayAccess, Countable, SeekableIterator
* - class RecursiveArrayIterator extends ArrayIterator implements RecursiveIterator
- *
+ *
* As the above suggest an ArrayObject creates an ArrayIterator when it comes to
- * iteration (e.g. ArrayObject instance used inside foreach).
+ * iteration (e.g. ArrayObject instance used inside foreach).
*
* 5) Counting
*
@@ -81,7 +81,7 @@
*
* 6) Exception%s
*
- * SPL provides a set of standard Exception classes each meant to indicate a
+ * SPL provides a set of standard Exception classes each meant to indicate a
* certain problem type.
*
* - class LogicException extends Exception
@@ -107,10 +107,10 @@
*
* 8) @ref Examples
*
- * The classes and interfaces in this group are contained as PHP code in the
+ * 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.
- *
+ *
* 9) Some articles about SPL:
* - <a href="http://www.phpro.org/tutorials/Introduction-to-SPL.html">Introduction to Standard PHP Library (SPL)</a>
* - <a href="http://www.sitepoint.com/article/php5-standard-library/1">Introducing PHP 5's Standard Library</a>
@@ -131,7 +131,7 @@
* - Debug session 2 <a href="http://talks.somabo.de/200509_toronto_iterator_debug_session_1.pps">[pps]</a>, <a href="http://talks.somabo.de/200509_toronto_iterator_debug_session_1.pdf">[pdf]</a>, <a href="http://taks.somabo.de/200411_php_conference_frankfrurt_iterator_debug_session.swf">[swf]</a>
* - Debug session 3 <a href="http://talks.somabo.de/200509_toronto_iterator_debug_session_2.pps">[pps]</a>, <a href="http://talks.somabo.de/200509_toronto_iterator_debug_session_2.pdf">[pdf]</a>
*
- * You can download this documentation as a chm file
+ * 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 - 2007
@@ -139,19 +139,19 @@
/** @defgroup ZendEngine Zend engine classes
*
- * The classes and interfaces in this group are contained in the c-code of
+ * 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
+ * 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
+ * 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.
*/
@@ -173,13 +173,13 @@ function spl_autoload(string $class_name, string $file_extensions = NULL) {/**/}
*/
function spl_autoload_call(string $class_name) {/**/};
-/** @ingroup SPL
+/** @ingroup SPL
* @brief Register and return default file extensions for spl_autoload
* @since PHP 5.1
*
- * @param file_extensions optional comma separated list of extensions to use in
+ * @param file_extensions optional comma separated list of extensions to use in
* default autoload function. If not given just return the current list.
- * @return comma separated list of file extensions to use in default autoload
+ * @return comma separated list of file extensions to use in default autoload
* function.
*/
function spl_autoload_extensions($file_extensions) {/**/};
@@ -196,7 +196,7 @@ function spl_autoload_functions() {/**/};
* @brief Register given function as autoload implementation
* @since PHP 5.1
*
- * @param autoload_function name of function or array of object/class and
+ * @param autoload_function name of function or array of object/class and
* function name to register as autoload function.
* @param throw whether to throw or issue an error on failure.
*/
@@ -206,7 +206,7 @@ function spl_autoload_register(string $autoload_function = "spl_autoload", $thro
* @brief Unregister given function as autoload implementation
* @since PHP 5.1
*
- * @param autoload_function name of function or array of object/class and
+ * @param autoload_function name of function or array of object/class and
* function name to unregister as autoload function.
*/
function spl_autoload_unregister(string $autoload_function = "spl_autoload") {/**/};
@@ -214,7 +214,7 @@ function spl_autoload_unregister(string $autoload_function = "spl_autoload") {/*
/** @ingroup SPL
* @brief Return an array of classes and interfaces in SPL
*
- * @return array containing the names of all clsses and interfaces defined in
+ * @return array containing the names of all clsses and interfaces defined in
* extension SPL
*/
function spl_classes() {/**/};
@@ -244,26 +244,26 @@ function iterator_to_array(Traversable $it, $use_keys = true) {/**/};
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;
+ 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() {}
+ final private function __clone() {}
/** Construct an exception
*
@@ -279,55 +279,55 @@ class Exception
$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;
- }
+ final public function getMessage()
+ {
+ return $this->message;
+ }
/** @return the code passed to the constructor
*/
- final public function getCode()
- {
- return $this->code;
- }
+ 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;
- }
+ final public function getFile()
+ {
+ return $this->file;
+ }
/** @return the line number where the exception was thrown
*/
- final public function getLine()
- {
- return $this->line;
- }
+ final public function getLine()
+ {
+ return $this->line;
+ }
/** @return the stack trace as array
*/
- final public function getTrace()
- {
- return $this->trace;
- }
+ final public function getTrace()
+ {
+ return $this->trace;
+ }
/** @return the stack trace as string
*/
- final public function getTraceAsString()
- {
- }
+ final public function getTraceAsString()
+ {
+ }
/** @return string represenation of exception
*/
- public function __toString()
- {
- return $this->string;
- }
+ public function __toString()
+ {
+ return $this->string;
+ }
}
/** @ingroup SPL
@@ -360,7 +360,7 @@ class BadMethodCallException extends BadFunctionCallException
* @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
+ * This kind of exception should be used to inform about domain erors in
* mathematical sense.
*
* @see RangeException
@@ -383,7 +383,7 @@ class InvalidArgumentException extends LogicException
* @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
+ * 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
@@ -403,7 +403,7 @@ class OutOfRangeException extends LogicException
}
/** @ingroup SPL
- * @brief Exception thrown for errors that are only detectable at runtime.
+ * @brief Exception thrown for errors that are only detectable at runtime.
* @since PHP 5.1
*/
class RuntimeException extends Exception
@@ -457,7 +457,7 @@ class UnderflowException extends RuntimeException
*
* 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.
+ * or buffer related errors.
*
* @see InvalidArgumentException
*/
@@ -496,14 +496,14 @@ interface ArrayAccess
* @since PHP 5.0
*
* Abstract base interface that cannot be implemented alone. Instead it
- * must be implemented by either IteratorAggregate or Iterator.
+ * must be implemented by either IteratorAggregate or Iterator.
*
- * @note Internal classes that implement this interface can be used in a
+ * @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
+ * in PHP scripts. Either IteratorAggregate or Iterator must be used
* instead.
*/
interface Traversable
@@ -515,7 +515,7 @@ interface Traversable
* @since PHP 5.0
*
* @note This is an engine internal interface.
- */
+ */
interface IteratorAggregate extends Traversable
{
/** @return an Iterator for the implementing object.
@@ -527,7 +527,7 @@ interface IteratorAggregate extends Traversable
* @brief Basic iterator
* @since PHP 5.0
*
- * Interface for external iterators or objects that can be iterated
+ * Interface for external iterators or objects that can be iterated
* themselves internally.
*
* @note This is an engine internal interface.
@@ -569,8 +569,8 @@ interface Countable
/** @ingroup ZendEngine
* @brief Interface for customized serializing
* @since 5.1
- *
- * Classes that implement this interface no longer support __sleep() and
+ *
+ * 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
@@ -584,10 +584,10 @@ interface Serializable
* @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);
@@ -598,7 +598,7 @@ interface Serializable
* @since PHP 5.0
* @version 1.2
*
- * This array wrapper allows to recursively iterate over Arrays and public
+ * This array wrapper allows to recursively iterate over Arrays and public
* Object properties.
*
* @see ArrayIterator
@@ -621,14 +621,14 @@ class ArrayObject implements IteratorAggregate, ArrayAccess, Countable
function __construct($array, $flags = 0, $iterator_class = "ArrayIterator") {/**/}
/** Set behavior flags.
- *
+ *
* @param $flags bitmask as follows:
* 0 set: properties of the object have their normal functionality
* when accessed as list (var_dump, foreach, etc.)
* 1 set: array indices can be accessed as properties in read/write
*/
function setFlags($flags) {/**/}
-
+
/** @return current flags
*/
function getFlags() {/**/}
@@ -636,27 +636,27 @@ class ArrayObject implements IteratorAggregate, ArrayAccess, Countable
/** Sort the entries by values.
*/
function asort() {/**/}
-
+
/** Sort the entries by key.
*/
function ksort() {/**/}
-
+
/** Sort the entries by values using user defined function.
*/
function uasort(mixed cmp_function) {/**/}
-
+
/** Sort the entries by key using user defined function.
*/
function uksort(mixed cmp_function) {/**/}
-
+
/** Sort the entries by values using "natural order" algorithm.
*/
function natsort() {/**/}
-
+
/** Sort the entries by values using case insensitive "natural order" algorithm.
*/
function natcasesort() {/**/}
-
+
/** @param $array new array or object
*/
function exchangeArray($array) {/**/}
@@ -668,44 +668,44 @@ class ArrayObject implements IteratorAggregate, ArrayAccess, Countable
/** @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
+ * @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
+ * @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() {/**/}
-
+
/* @param $iterator_class new class used in getIterator()
*/
function setIteratorClass($itertor_class) {/**/}
-
+
/* @return class used in getIterator()
*/
function getIteratorClass() {/**/}
@@ -719,9 +719,9 @@ class ArrayObject implements IteratorAggregate, ArrayAccess, Countable
* 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()
+ * 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
@@ -741,7 +741,7 @@ class ArrayIterator implements SeekableIterator, ArrayAccess, Countable
function __construct($array, $flags = 0) {/**/}
/** Set behavior flags.
- *
+ *
* @param $flags bitmask as follows:
* 0 set: properties of the object have their normal functionality
* when accessed as list (var_dump, foreach, etc.)
@@ -757,56 +757,56 @@ class ArrayIterator implements SeekableIterator, ArrayAccess, Countable
/** Sort the entries by values.
*/
function asort() {/**/}
-
+
/** Sort the entries by key.
*/
function ksort() {/**/}
-
+
/** Sort the entries by values using user defined function.
*/
function uasort(mixed cmp_function) {/**/}
-
+
/** Sort the entries by key using user defined function.
*/
function uksort(mixed cmp_function) {/**/}
-
+
/** Sort the entries by values using "natural order" algorithm.
*/
function natsort() {/**/}
-
+
/** Sort the entries by values using case insensitive "natural order" algorithm.
*/
function natcasesort() {/**/}
-
+
/** @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
+ * @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
+ * @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
@@ -821,16 +821,16 @@ class ArrayIterator implements SeekableIterator, ArrayAccess, Countable
/** @copydoc Iterator::rewind */
function rewind() {/**/}
-
+
/** @copydoc Iterator::valid */
function valid() {/**/}
-
+
/** @copydoc Iterator::current */
function current() {/**/}
-
+
/** @copydoc Iterator::key */
function key() {/**/}
-
+
/** @copydoc Iterator::next */
function next() {/**/}
}
@@ -839,7 +839,7 @@ class ArrayIterator implements SeekableIterator, ArrayAccess, Countable
* @brief File info class
* @since PHP 5.1.3
*/
-class SplFileInfo
+class SplFileInfo
{
/** Construct a file info object
*
@@ -849,11 +849,11 @@ class SplFileInfo
/** @return the path part only.
*/
- function getPath() {/**/}
+ function getPath() {/**/}
/** @return the filename only.
*/
- function getFilename() {/**/}
+ function getFilename() {/**/}
/** @return SplFileInfo created for the file
* @param class_name name of class to instantiate
@@ -863,7 +863,7 @@ class SplFileInfo
/** @return The current entries path and file name.
*/
- function getPathname() {/**/}
+ function getPathname() {/**/}
/** @return SplFileInfo created for the path
* @param class_name name of class to instantiate
@@ -925,7 +925,7 @@ class SplFileInfo
/** @return Whether the current entry is a directory.
*/
- function isDir() {/**/}
+ function isDir() {/**/}
/** @return whether the current entry is a link.
*/
@@ -938,7 +938,7 @@ class SplFileInfo
/** @return The resolved path
*/
function getRealPath() {/**/}
-
+
/** @return getPathname()
*/
function __toString() {/**/}
@@ -948,7 +948,7 @@ class SplFileInfo
* @param mode open mode
* @param use_include_path whether to search include paths (don't use)
* @param context resource context to pased to open function
- * @throw RuntimeException if file cannot be opened (e.g. insufficient
+ * @throw RuntimeException if file cannot be opened (e.g. insufficient
* access rights).
* @return The opened file as a SplFileObject instance
*
@@ -958,7 +958,7 @@ class SplFileInfo
*/
function openFile($mode = 'r', $use_include_path = false, $context = NULL) {/**/}
- /** @param class_name name of class used with openFile(). Must be derived
+ /** @param class_name name of class used with openFile(). Must be derived
* from SPLFileObject.
*/
function setFileClass(string class_name = "SplFileObject") {/**/}
@@ -984,10 +984,10 @@ class DirectoryIterator extends SplFileInfo implements Iterator
/** @copydoc Iterator::rewind */
function rewind() {/**/}
-
+
/** @copydoc Iterator::valid */
function valid() {/**/}
-
+
/** @return index of entry
*/
function key() {/**/}
@@ -1001,7 +1001,7 @@ class DirectoryIterator extends SplFileInfo implements Iterator
/** @return Whether the current entry is either '.' or '..'.
*/
- function isDot() {/**/}
+ function isDot() {/**/}
/** @return whether the current entry is a link.
*/
@@ -1019,17 +1019,25 @@ class DirectoryIterator extends SplFileInfo implements Iterator
*/
class RecursiveDirectoryIterator extends DirectoryIterator implements RecursiveIterator
{
- const CURRENT_AS_FILEINFO 0x00000010; /* make RecursiveDirectoryTree::current() return SplFileInfo */
- const KEY_AS_FILENAME 0x00000020; /* make RecursiveDirectoryTree::key() return getFilename() */
- const NEW_CURRENT_AND_KEY 0x00000030; /* CURRENT_AS_FILEINFO + KEY_AS_FILENAME */
+ const CURRENT_AS_FILEINFO 0x00000000; /* make RecursiveDirectoryTree::current() return SplFileInfo */
+ const CURRENT_AS_SELF 0x00000010; /* make RecursiveDirectoryTree::current() return getSelf() */
+ const CURRENT_AS_PATHNAME 0x00000020; /* make RecursiveDirectoryTree::current() return getPathname() */
+
+ const KEY_AS_PATHNAME 0x00000000; /* make RecursiveDirectoryTree::key() return getPathname() */
+ const KEY_AS_FILENAME 0x00000100; /* make RecursiveDirectoryTree::key() return getFilename() */
+
+ const NEW_CURRENT_AND_KEY 0x00000100; /* CURRENT_AS_FILEINFO + KEY_AS_FILENAME */
/** Construct a directory iterator from a path-string.
*
* @param $path directory to iterate.
* @param $flags open flags
* - CURRENT_AS_FILEINFO
+ * - CURRENT_AS_SELF
+ * - CURRENT_AS_PATHNAME
+ * - KEY_AS_PATHNAME
* - KEY_AS_FILENAME
- * - NEW_CURRENT_AND_KEY
+ * - NEW_CURRENT_AND_KEY
*/
function __construct($path, $flags = 0) {/**/}
@@ -1043,11 +1051,11 @@ class RecursiveDirectoryIterator extends DirectoryIterator implements RecursiveI
/** @return whether the current is a directory (not '.' or '..').
*/
- function hasChildren() {/**/}
+ function hasChildren() {/**/}
/** @return a RecursiveDirectoryIterator for the current entry.
*/
- function getChildren() {/**/}
+ function getChildren() {/**/}
/** @return sub path only (without main path)
*/
@@ -1062,7 +1070,7 @@ class RecursiveDirectoryIterator extends DirectoryIterator implements RecursiveI
* @brief recursive SimpleXML_Element iterator
* @since PHP 5.0
*
- * The SimpleXMLIterator implements the RecursiveIterator interface. This
+ * 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
@@ -1073,11 +1081,11 @@ class SimpleXMLIterator extends SimpleXMLElement implements RecursiveIterator, C
{
/** @return whether the current node has sub nodes.
*/
- function hasChildren() {/**/}
+ function hasChildren() {/**/}
/** @return a SimpleXMLIterator for the current node.
*/
- function getChildren() {/**/}
+ function getChildren() {/**/}
/** @return number of elements/attributes seen with foreach()
*/
@@ -1085,16 +1093,16 @@ class SimpleXMLIterator extends SimpleXMLElement implements RecursiveIterator, C
/** @copydoc Iterator::rewind */
function rewind() {/**/}
-
+
/** @copydoc Iterator::valid */
function valid() {/**/}
-
+
/** @copydoc Iterator::current */
function current() {/**/}
-
+
/** @copydoc Iterator::key */
function key() {/**/}
-
+
/** @copydoc Iterator::next */
function next() {/**/}
}
@@ -1126,16 +1134,16 @@ interface SplSubject
{
/** @param $observer new observer to attach
*/
- function attach(SplObserver $observer);
+ function attach(SplObserver $observer);
/** @param $observer existing observer to detach
* @note a non attached observer shouldn't result in a warning or similar
*/
- function detach(SplObserver $observer);
+ function detach(SplObserver $observer);
/** Notify all observers
*/
- function notify();
+ function notify();
}
?>
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 4f409a0f7..e6d89019d 100755
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_array.c,v 1.71.2.17.2.14 2007/10/18 05:26:55 helly Exp $ */
+/* $Id: spl_array.c,v 1.71.2.17.2.15 2007/12/31 07:20:11 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
diff --git a/ext/spl/spl_array.h b/ext/spl/spl_array.h
index 0dc6d0073..4c6e49b97 100755
--- a/ext/spl/spl_array.h
+++ b/ext/spl/spl_array.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_array.h,v 1.13.2.2.2.4 2007/02/08 22:54:34 helly Exp $ */
+/* $Id: spl_array.h,v 1.13.2.2.2.5 2007/12/31 07:20:11 sebastian Exp $ */
#ifndef SPL_ARRAY_H
#define SPL_ARRAY_H
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index 930b83385..f62b261b9 100755
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_directory.c,v 1.45.2.27.2.23 2007/09/22 15:55:35 iliaa Exp $ */
+/* $Id: spl_directory.c,v 1.45.2.27.2.26 2008/02/13 12:23:26 helly Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -484,7 +484,7 @@ SPL_METHOD(DirectoryIterator, __construct)
intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
spl_filesystem_dir_open(intern, path TSRMLS_CC);
intern->u.dir.is_recursive = instanceof_function(intern->std.ce, spl_ce_RecursiveDirectoryIterator TSRMLS_CC) ? 1 : 0;
- intern->flags = 0;
+ intern->flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_SELF;
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
}
@@ -661,7 +661,7 @@ SPL_METHOD(RecursiveDirectoryIterator, key)
{
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- if (intern->flags & SPL_FILE_DIR_KEY_AS_FILENAME) {
+ if (SPL_FILE_DIR_KEY(intern, SPL_FILE_DIR_KEY_AS_FILENAME)) {
RETURN_STRING(intern->u.dir.entry.d_name, 1);
} else {
spl_filesystem_object_get_file_name(intern TSRMLS_CC);
@@ -676,10 +676,10 @@ SPL_METHOD(RecursiveDirectoryIterator, current)
{
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- if (intern->flags & SPL_FILE_DIR_CURRENT_AS_PATHNAME) {
+ if (SPL_FILE_DIR_CURRENT(intern, SPL_FILE_DIR_CURRENT_AS_PATHNAME)) {
spl_filesystem_object_get_file_name(intern TSRMLS_CC);
RETURN_STRINGL(intern->file_name, intern->file_name_len, 1);
- } else if (intern->flags & SPL_FILE_DIR_CURRENT_AS_FILEINFO) {
+ } else if (SPL_FILE_DIR_CURRENT(intern, SPL_FILE_DIR_CURRENT_AS_FILEINFO)) {
spl_filesystem_object_get_file_name(intern TSRMLS_CC);
spl_filesystem_object_create_type(0, intern, SPL_FS_INFO, NULL, return_value TSRMLS_CC);
} else {
@@ -962,7 +962,7 @@ SPL_METHOD(RecursiveDirectoryIterator, __construct)
spl_filesystem_object *intern;
char *path;
int len;
- long flags = SPL_FILE_DIR_CURRENT_AS_FILEINFO;
+ long flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO;
php_set_error_handling(EH_THROW, spl_ce_UnexpectedValueException TSRMLS_CC);
@@ -1104,7 +1104,7 @@ SPL_METHOD(RecursiveDirectoryIterator, getSubPathname)
}
/* }}} */
-/* define an overloaded iterator structure */
+/* {{{ define an overloaded iterator structure */
typedef struct {
zend_object_iterator intern;
zval *current;
@@ -1128,6 +1128,7 @@ zend_object_iterator_funcs spl_filesystem_dir_it_funcs = {
spl_filesystem_dir_it_move_forward,
spl_filesystem_dir_it_rewind
};
+/* }}} */
/* {{{ spl_ce_dir_get_iterator */
zend_object_iterator *spl_filesystem_dir_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC)
@@ -1162,7 +1163,7 @@ static void spl_filesystem_dir_it_dtor(zend_object_iterator *iter TSRMLS_DC)
efree(iterator);
}
/* }}} */
-
+
/* {{{ spl_filesystem_dir_it_valid */
static int spl_filesystem_dir_it_valid(zend_object_iterator *iter TSRMLS_DC)
{
@@ -1173,7 +1174,6 @@ static int spl_filesystem_dir_it_valid(zend_object_iterator *iter TSRMLS_DC)
}
/* }}} */
-
/* {{{ spl_filesystem_dir_it_current_data */
static void spl_filesystem_dir_it_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC)
{
@@ -1240,21 +1240,21 @@ static void spl_filesystem_tree_it_dtor(zend_object_iterator *iter TSRMLS_DC)
efree(iterator);
}
/* }}} */
-
+
/* {{{ spl_filesystem_tree_it_current_data */
static void spl_filesystem_tree_it_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC)
{
spl_filesystem_dir_it *iterator = (spl_filesystem_dir_it *)iter;
spl_filesystem_object *object = iterator->object;
- if (object->flags & SPL_FILE_DIR_CURRENT_AS_PATHNAME) {
+ if (SPL_FILE_DIR_CURRENT(object, SPL_FILE_DIR_CURRENT_AS_PATHNAME)) {
if (!iterator->current) {
ALLOC_INIT_ZVAL(iterator->current);
spl_filesystem_object_get_file_name(object TSRMLS_CC);
ZVAL_STRINGL(iterator->current, object->file_name, object->file_name_len, 1);
}
*data = &iterator->current;
- } else if (object->flags & SPL_FILE_DIR_CURRENT_AS_FILEINFO) {
+ } else if (SPL_FILE_DIR_CURRENT(object, SPL_FILE_DIR_CURRENT_AS_FILEINFO)) {
if (!iterator->current) {
ALLOC_INIT_ZVAL(iterator->current);
spl_filesystem_object_get_file_name(object TSRMLS_CC);
@@ -1273,7 +1273,7 @@ static int spl_filesystem_tree_it_current_key(zend_object_iterator *iter, char *
spl_filesystem_dir_it *iterator = (spl_filesystem_dir_it *)iter;
spl_filesystem_object *object = iterator->object;
- if (object->flags & SPL_FILE_DIR_KEY_AS_FILENAME) {
+ if (SPL_FILE_DIR_KEY(object, SPL_FILE_DIR_KEY_AS_FILENAME)) {
*str_key_len = strlen(object->u.dir.entry.d_name) + 1;
*str_key = estrndup(object->u.dir.entry.d_name, *str_key_len - 1);
} else {
@@ -1330,7 +1330,7 @@ static void spl_filesystem_tree_it_rewind(zend_object_iterator *iter TSRMLS_DC)
}
/* }}} */
-/* iterator handler table */
+/* {{{ iterator handler table */
zend_object_iterator_funcs spl_filesystem_tree_it_funcs = {
spl_filesystem_tree_it_dtor,
spl_filesystem_dir_it_valid,
@@ -1339,6 +1339,7 @@ zend_object_iterator_funcs spl_filesystem_tree_it_funcs = {
spl_filesystem_tree_it_move_forward,
spl_filesystem_tree_it_rewind
};
+/* }}} */
/* {{{ spl_ce_dir_get_iterator */
zend_object_iterator *spl_filesystem_tree_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC)
@@ -1383,7 +1384,7 @@ static int spl_filesystem_object_cast(zval *readobj, zval *writeobj, int type TS
}
/* }}} */
-/* declare method parameters */
+/* {{{ declare method parameters */
/* supply a name and default to call by parameter */
static
ZEND_BEGIN_ARG_INFO(arginfo_info___construct, 0)
@@ -1444,7 +1445,7 @@ static zend_function_entry spl_SplFileInfo_functions[] = {
};
static
-ZEND_BEGIN_ARG_INFO(arginfo_dir___construct, 0)
+ZEND_BEGIN_ARG_INFO(arginfo_dir___construct, 0)
ZEND_ARG_INFO(0, path)
ZEND_END_ARG_INFO()
@@ -1487,6 +1488,7 @@ static zend_function_entry spl_RecursiveDirectoryIterator_functions[] = {
SPL_ME(RecursiveDirectoryIterator, getSubPathname,NULL, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
+/* }}} */
static int spl_filesystem_file_read(spl_filesystem_object *intern, int silent TSRMLS_DC) /* {{{ */
{
@@ -1582,12 +1584,12 @@ static int spl_filesystem_file_call(spl_filesystem_object *intern, zend_function
return result;
} /* }}} */
-#define FileFunctionCall(func_name, pass_num_args, arg2) \
+#define FileFunctionCall(func_name, pass_num_args, arg2) /* {{{ */ \
{ \
zend_function *func_ptr; \
zend_hash_find(EG(function_table), #func_name, sizeof(#func_name), (void **) &func_ptr); \
spl_filesystem_file_call(intern, func_ptr, pass_num_args, return_value, arg2 TSRMLS_CC); \
-}
+} /* }}} */
static int spl_filesystem_file_read_csv(spl_filesystem_object *intern, char delimiter, char enclosure, zval *return_value TSRMLS_DC) /* {{{ */
{
@@ -1667,7 +1669,7 @@ static int spl_filesystem_file_is_empty_line(spl_filesystem_object *intern TSRML
case IS_STRING:
return Z_STRLEN_P(intern->u.file.current_zval) == 0;
case IS_ARRAY:
- if ((intern->flags & SPL_FILE_OBJECT_READ_CSV)
+ if ((intern->flags & SPL_FILE_OBJECT_READ_CSV)
&& zend_hash_num_elements(Z_ARRVAL_P(intern->u.file.current_zval)) == 1) {
zval ** first = Z_ARRVAL_P(intern->u.file.current_zval)->pListHead->pData;
@@ -2045,7 +2047,6 @@ SPL_METHOD(SplFileObject, fflush)
RETURN_BOOL(!php_stream_flush(intern->u.file.stream));
} /* }}} */
-
/* {{{ proto int SplFileObject::ftell()
Return current file position */
SPL_METHOD(SplFileObject, ftell)
@@ -2227,17 +2228,17 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object___construct, 0, 0, 1)
ZEND_END_ARG_INFO()
static
-ZEND_BEGIN_ARG_INFO(arginfo_file_object_setFlags, 0)
+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_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_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()
@@ -2347,9 +2348,9 @@ PHP_MINIT_FUNCTION(spl_directory)
REGISTER_SPL_CLASS_CONST_LONG(RecursiveDirectoryIterator, "CURRENT_MODE_MASK", SPL_FILE_DIR_CURRENT_MODE_MASK);
REGISTER_SPL_CLASS_CONST_LONG(RecursiveDirectoryIterator, "CURRENT_AS_PATHNAME", SPL_FILE_DIR_CURRENT_AS_PATHNAME);
REGISTER_SPL_CLASS_CONST_LONG(RecursiveDirectoryIterator, "CURRENT_AS_FILEINFO", SPL_FILE_DIR_CURRENT_AS_FILEINFO);
- REGISTER_SPL_CLASS_CONST_LONG(RecursiveDirectoryIterator, "CURRENT_AS_SELF", 0);
+ REGISTER_SPL_CLASS_CONST_LONG(RecursiveDirectoryIterator, "CURRENT_AS_SELF", SPL_FILE_DIR_CURRENT_AS_SELF);
REGISTER_SPL_CLASS_CONST_LONG(RecursiveDirectoryIterator, "KEY_MODE_MASK", SPL_FILE_DIR_KEY_MODE_MASK);
- REGISTER_SPL_CLASS_CONST_LONG(RecursiveDirectoryIterator, "KEY_AS_PATHNAME", 0);
+ REGISTER_SPL_CLASS_CONST_LONG(RecursiveDirectoryIterator, "KEY_AS_PATHNAME", SPL_FILE_DIR_KEY_AS_PATHNAME);
REGISTER_SPL_CLASS_CONST_LONG(RecursiveDirectoryIterator, "KEY_AS_FILENAME", SPL_FILE_DIR_KEY_AS_FILENAME);
REGISTER_SPL_CLASS_CONST_LONG(RecursiveDirectoryIterator, "NEW_CURRENT_AND_KEY", SPL_FILE_DIR_KEY_AS_FILENAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO);
@@ -2369,7 +2370,6 @@ PHP_MINIT_FUNCTION(spl_directory)
}
/* }}} */
-
/*
* Local variables:
* tab-width: 4
diff --git a/ext/spl/spl_directory.h b/ext/spl/spl_directory.h
index 222ac5b59..cce07fd93 100755
--- a/ext/spl/spl_directory.h
+++ b/ext/spl/spl_directory.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_directory.h,v 1.12.2.5.2.4 2007/01/01 09:36:07 sebastian Exp $ */
+/* $Id: spl_directory.h,v 1.12.2.5.2.10 2008/02/13 12:23:26 helly Exp $ */
#ifndef SPL_DIRECTORY_H
#define SPL_DIRECTORY_H
@@ -35,7 +35,7 @@ PHP_MINIT_FUNCTION(spl_directory);
typedef enum {
SPL_FS_INFO, /* must be 0 */
SPL_FS_DIR,
- SPL_FS_FILE,
+ SPL_FS_FILE
} SPL_FS_OBJ_TYPE;
typedef struct _spl_filesystem_object spl_filesystem_object;
@@ -55,7 +55,7 @@ struct _spl_filesystem_object {
char *path;
int path_len;
char *file_name;
- int file_name_len;
+ int file_name_len;
SPL_FS_OBJ_TYPE type;
long flags;
zend_class_entry *file_class;
@@ -93,12 +93,16 @@ struct _spl_filesystem_object {
#define SPL_FILE_OBJECT_SKIP_EMPTY 0x00000006 /* skip empty lines */
#define SPL_FILE_OBJECT_READ_CSV 0x00000008 /* read via fgetcsv */
-#define SPL_FILE_DIR_CURRENT_AS_FILEINFO 0x00000010 /* make RecursiveDirectoryTree::current() return SplFileInfo */
+#define SPL_FILE_DIR_CURRENT_AS_FILEINFO 0x00000000 /* make RecursiveDirectoryTree::current() return SplFileInfo */
+#define SPL_FILE_DIR_CURRENT_AS_SELF 0x00000010 /* make RecursiveDirectoryTree::current() return getSelf() */
#define SPL_FILE_DIR_CURRENT_AS_PATHNAME 0x00000020 /* make RecursiveDirectoryTree::current() return getPathname() */
#define SPL_FILE_DIR_CURRENT_MODE_MASK 0x000000F0 /* mask RecursiveDirectoryTree::current() */
+#define SPL_FILE_DIR_CURRENT(intern,mode) ((intern->flags&SPL_FILE_DIR_CURRENT_MODE_MASK)==mode)
+#define SPL_FILE_DIR_KEY_AS_PATHNAME 0x00000000 /* make RecursiveDirectoryTree::key() return getPathname() */
#define SPL_FILE_DIR_KEY_AS_FILENAME 0x00000100 /* make RecursiveDirectoryTree::key() return getFilename() */
#define SPL_FILE_DIR_KEY_MODE_MASK 0x00000F00 /* mask RecursiveDirectoryTree::key() */
+#define SPL_FILE_DIR_KEY(intern,mode) ((intern->flags&SPL_FILE_DIR_KEY_MODE_MASK)==mode)
#endif /* SPL_DIRECTORY_H */
diff --git a/ext/spl/spl_engine.c b/ext/spl/spl_engine.c
index 9404e8e24..00bacdf3a 100755
--- a/ext/spl/spl_engine.c
+++ b/ext/spl/spl_engine.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/spl/spl_engine.h b/ext/spl/spl_engine.h
index ecb42d304..d4a9ef47e 100755
--- a/ext/spl/spl_engine.h
+++ b/ext/spl/spl_engine.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_engine.h,v 1.19.2.3.2.1 2007/01/01 09:36:07 sebastian Exp $ */
+/* $Id: spl_engine.h,v 1.19.2.3.2.2 2007/12/31 07:20:11 sebastian Exp $ */
#ifndef SPL_ENGINE_H
#define SPL_ENGINE_H
diff --git a/ext/spl/spl_exceptions.c b/ext/spl/spl_exceptions.c
index 081341312..fdbfb0069 100755
--- a/ext/spl/spl_exceptions.c
+++ b/ext/spl/spl_exceptions.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_exceptions.c,v 1.6.2.1.2.2 2007/01/01 09:36:07 sebastian Exp $ */
+/* $Id: spl_exceptions.c,v 1.6.2.1.2.3 2007/12/31 07:20:11 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
diff --git a/ext/spl/spl_exceptions.h b/ext/spl/spl_exceptions.h
index 34811f876..9133b7076 100755
--- a/ext/spl/spl_exceptions.h
+++ b/ext/spl/spl_exceptions.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_exceptions.h,v 1.5.2.1.2.1 2007/01/01 09:36:07 sebastian Exp $ */
+/* $Id: spl_exceptions.h,v 1.5.2.1.2.2 2007/12/31 07:20:11 sebastian Exp $ */
#ifndef SPL_EXCEPTIONS_H
#define SPL_EXCEPTIONS_H
diff --git a/ext/spl/spl_functions.c b/ext/spl/spl_functions.c
index e1fedcb0f..b7bb476ab 100755
--- a/ext/spl/spl_functions.c
+++ b/ext/spl/spl_functions.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_functions.c,v 1.28.2.3.2.3 2007/01/01 09:36:07 sebastian Exp $ */
+/* $Id: spl_functions.c,v 1.28.2.3.2.4 2007/12/31 07:20:11 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/spl/spl_functions.h b/ext/spl/spl_functions.h
index 0a82a74da..19529a4c9 100755
--- a/ext/spl/spl_functions.h
+++ b/ext/spl/spl_functions.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_functions.h,v 1.19.2.3.2.2 2007/01/01 09:36:07 sebastian Exp $ */
+/* $Id: spl_functions.h,v 1.19.2.3.2.3 2007/12/31 07:20:11 sebastian Exp $ */
#ifndef PHP_FUNCTIONS_H
#define PHP_FUNCTIONS_H
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index 8bd107bbf..0160b5042 100755
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_iterators.c,v 1.73.2.30.2.29 2007/10/18 05:26:55 helly Exp $ */
+/* $Id: spl_iterators.c,v 1.73.2.30.2.31 2008/03/12 13:24:24 colder Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -693,8 +693,13 @@ static union _zend_function *spl_recursive_it_get_method(zval **object_ptr, char
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;
-
+ zval *zobj;
+
+ if (!object->iterators) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "The %s instance wasn't initialized properly", Z_OBJCE_PP(object_ptr)->name);
+ }
+ 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) {
diff --git a/ext/spl/spl_iterators.h b/ext/spl/spl_iterators.h
index 26c21693d..104676911 100755
--- a/ext/spl/spl_iterators.h
+++ b/ext/spl/spl_iterators.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_iterators.h,v 1.18.2.7.2.12 2007/05/11 00:15:25 helly Exp $ */
+/* $Id: spl_iterators.h,v 1.18.2.7.2.14 2007/12/31 07:20:11 sebastian Exp $ */
#ifndef SPL_ITERATORS_H
#define SPL_ITERATORS_H
@@ -94,7 +94,7 @@ enum {
enum {
/* public */
REGIT_USE_KEY = 0x00000001,
- REGIT_INVERTED = 0x00000002,
+ REGIT_INVERTED = 0x00000002
};
typedef enum {
@@ -103,7 +103,7 @@ typedef enum {
REGIT_MODE_ALL_MATCHES,
REGIT_MODE_SPLIT,
REGIT_MODE_REPLACE,
- REGIT_MODE_MAX,
+ REGIT_MODE_MAX
} regex_mode;
typedef struct _spl_dual_it_object {
diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c
index 27903e504..39a293b0f 100755
--- a/ext/spl/spl_observer.c
+++ b/ext/spl/spl_observer.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is SplSubject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_observer.c,v 1.2.2.6.2.3 2007/02/08 22:14:25 helly Exp $ */
+/* $Id: spl_observer.c,v 1.2.2.6.2.4 2007/12/31 07:20:11 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
diff --git a/ext/spl/spl_observer.h b/ext/spl/spl_observer.h
index b6924ebd8..a1d7d5621 100755
--- a/ext/spl/spl_observer.h
+++ b/ext/spl/spl_observer.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_observer.h,v 1.2.2.2.2.1 2007/01/01 09:36:07 sebastian Exp $ */
+/* $Id: spl_observer.h,v 1.2.2.2.2.2 2007/12/31 07:20:11 sebastian Exp $ */
#ifndef SPL_OBSERVER_H
#define SPL_OBSERVER_H
diff --git a/ext/spl/spl_sxe.c b/ext/spl/spl_sxe.c
index b7a5eac99..e5fda429f 100755
--- a/ext/spl/spl_sxe.c
+++ b/ext/spl/spl_sxe.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_sxe.c,v 1.8.2.5.2.2 2007/08/14 12:10:46 rrichards Exp $ */
+/* $Id: spl_sxe.c,v 1.8.2.5.2.3 2007/12/31 07:20:11 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
diff --git a/ext/spl/spl_sxe.h b/ext/spl/spl_sxe.h
index c7c77392e..64ff2d225 100755
--- a/ext/spl/spl_sxe.h
+++ b/ext/spl/spl_sxe.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_sxe.h,v 1.4.2.1.2.1 2007/01/01 09:36:07 sebastian Exp $ */
+/* $Id: spl_sxe.h,v 1.4.2.1.2.2 2007/12/31 07:20:11 sebastian Exp $ */
#ifndef SPL_SXE_H
#define SPL_SXE_H
diff --git a/ext/spl/tests/bug41828.phpt b/ext/spl/tests/bug41828.phpt
new file mode 100644
index 000000000..6053e0e44
--- /dev/null
+++ b/ext/spl/tests/bug41828.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #41828 (Segfault if extended constructor of RecursiveIterator doesn't call its parent)
+--FILE--
+<?php
+class foo extends RecursiveIteratorIterator {
+
+ public function __construct($str) {
+ }
+
+ public function bar() {
+ }
+}
+
+$foo = new foo("This is bar");
+echo $foo->bar();
+
+?>
+==DONE==
+<?php exit(0); ?>
+--EXPECTF--
+Fatal error: main(): The foo instance wasn't initialized properly in %s on line %d
diff --git a/ext/spl/tests/dit_002.phpt b/ext/spl/tests/dit_002.phpt
new file mode 100755
index 000000000..f18d1198d
--- /dev/null
+++ b/ext/spl/tests/dit_002.phpt
@@ -0,0 +1,50 @@
+--TEST--
+SPL: DirectoryIterator defaults
+--SKIPIF--
+<?php if (!extension_loaded("spl")) print "skip"; ?>
+--FILE--
+<?php
+
+$classes = array(
+ 'DirectoryIterator' => 0,
+ 'RecursiveDirectoryIterator' => 1,
+);
+
+foreach ($classes as $class => $flags) {
+ echo "===$class===\n";
+ $ref = new ReflectionClass($class);
+ $obj = $ref->newInstance('.');
+ echo get_class($obj->current()) . "\n";
+ if ($flags)
+ {
+ $flags = array(
+ RecursiveDirectoryIterator::CURRENT_AS_FILEINFO => 0,
+ RecursiveDirectoryIterator::CURRENT_AS_SELF => 0,
+ RecursiveDirectoryIterator::CURRENT_AS_PATHNAME => 1,
+ );
+ foreach($flags as $flag => $isstring) {
+ $obj = $ref->newInstance('.', $flag);
+ if ($isstring) {
+ $val = $obj->current();
+ if (is_string($val)) {
+ var_dump(true);
+ } else {
+ var_dump($val);
+ }
+ } else {
+ echo get_class($obj->current()) . "\n";
+ }
+ }
+ }
+}
+?>
+===DONE===
+--EXPECT--
+===DirectoryIterator===
+DirectoryIterator
+===RecursiveDirectoryIterator===
+SplFileInfo
+SplFileInfo
+RecursiveDirectoryIterator
+bool(true)
+===DONE===