[PHP-CVS] cvs: php-src(PHP_5_2) /ext/spl spl.php spl_directory.c spl_directory.h /ext/spl/tests dit_002.phpt

2008-02-13 Thread Marcus Boerger
helly   Wed Feb 13 12:23:26 2008 UTC

  Added files: (Branch: PHP_5_2)
/php-src/ext/spl/tests  dit_002.phpt 

  Modified files:  
/php-src/ext/splspl.php spl_directory.c spl_directory.h 
  Log:
  - MFH Make this behave like in = 5.2.5 and test for it
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl.php?r1=1.49.2.11.2.9r2=1.49.2.11.2.10diff_format=u
Index: php-src/ext/spl/spl.php
diff -u php-src/ext/spl/spl.php:1.49.2.11.2.9 
php-src/ext/spl/spl.php:1.49.2.11.2.10
--- php-src/ext/spl/spl.php:1.49.2.11.2.9   Mon Feb  4 21:37:55 2008
+++ php-src/ext/spl/spl.php Wed Feb 13 12:23:26 2008
@@ -1019,8 +1019,8 @@
  */
 class RecursiveDirectoryIterator extends DirectoryIterator implements 
RecursiveIterator
 {
-   const CURRENT_AS_SELF   0x; /* make 
RecursiveDirectoryTree::current() return getSelf() */
-   const CURRENT_AS_FILEINFO   0x0010; /* make 
RecursiveDirectoryTree::current() return SplFileInfo */
+   const CURRENT_AS_FILEINFO   0x; /* make 
RecursiveDirectoryTree::current() return SplFileInfo */
+   const CURRENT_AS_SELF   0x0010; /* make 
RecursiveDirectoryTree::current() return getSelf() */
const CURRENT_AS_PATHNAME   0x0020; /* make 
RecursiveDirectoryTree::current() return getPathname() */
 
const KEY_AS_PATHNAME   0x; /* make 
RecursiveDirectoryTree::key() return getPathname() */
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.45.2.27.2.25r2=1.45.2.27.2.26diff_format=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.45.2.27.2.25 
php-src/ext/spl/spl_directory.c:1.45.2.27.2.26
--- php-src/ext/spl/spl_directory.c:1.45.2.27.2.25  Mon Feb  4 20:43:50 2008
+++ php-src/ext/spl/spl_directory.c Wed Feb 13 12:23:26 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_directory.c,v 1.45.2.27.2.25 2008/02/04 20:43:50 helly 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
@@ -962,7 +962,7 @@
spl_filesystem_object *intern;
char *path;
int len;
-   long flags = 0;
+   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);
 
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.h?r1=1.12.2.5.2.9r2=1.12.2.5.2.10diff_format=u
Index: php-src/ext/spl/spl_directory.h
diff -u php-src/ext/spl/spl_directory.h:1.12.2.5.2.9 
php-src/ext/spl/spl_directory.h:1.12.2.5.2.10
--- php-src/ext/spl/spl_directory.h:1.12.2.5.2.9Mon Feb  4 21:49:44 2008
+++ php-src/ext/spl/spl_directory.h Wed Feb 13 12:23:26 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_directory.h,v 1.12.2.5.2.9 2008/02/04 21:49:44 helly 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
@@ -93,8 +93,8 @@
 #define SPL_FILE_OBJECT_SKIP_EMPTY 0x0006 /* skip empty lines */
 #define SPL_FILE_OBJECT_READ_CSV   0x0008 /* read via fgetcsv */
 
-#define SPL_FILE_DIR_CURRENT_AS_SELF   0x /* make 
RecursiveDirectoryTree::current() return getSelf() */
-#define SPL_FILE_DIR_CURRENT_AS_FILEINFO   0x0010 /* make 
RecursiveDirectoryTree::current() return SplFileInfo */
+#define SPL_FILE_DIR_CURRENT_AS_FILEINFO   0x /* make 
RecursiveDirectoryTree::current() return SplFileInfo */
+#define SPL_FILE_DIR_CURRENT_AS_SELF   0x0010 /* make 
RecursiveDirectoryTree::current() return getSelf() */
 #define SPL_FILE_DIR_CURRENT_AS_PATHNAME   0x0020 /* make 
RecursiveDirectoryTree::current() return getPathname() */
 #define SPL_FILE_DIR_CURRENT_MODE_MASK 0x00F0 /* mask 
RecursiveDirectoryTree::current() */
 #define SPL_FILE_DIR_CURRENT(intern,mode)  
((intern-flagsSPL_FILE_DIR_CURRENT_MODE_MASK)==mode)

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/dit_002.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/dit_002.phpt
+++ php-src/ext/spl/tests/dit_002.phpt
--TEST--
SPL: DirectoryIterator defaults
--SKIPIF--
?php if (!extension_loaded(spl)) print skip; ?
--FILE--
?php

$classes = array(
'DirectoryIterator' = 0,
'FilesystemIterator' = 1,
'RecursiveDirectoryIterator' = 1,
'GlobIterator' = 1,
);

foreach ($classes as $class = $flags) {
echo ===$class===\n;
$ref = new ReflectionClass($class);
$obj = $ref-newInstance('glob://*');
echo get_class($obj-current()) . \n;
if ($flags)
{
var_dump($obj-getFlags());
$flags = array(
FilesystemIterator::CURRENT_AS_FILEINFO = 0,
FilesystemIterator::CURRENT_AS_SELF = 

[PHP-CVS] cvs: php-src(PHP_5_2) /ext/spl spl.php spl_directory.c spl_directory.h

2008-02-04 Thread Marcus Boerger
helly   Mon Feb  4 20:43:51 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/splspl.php spl_directory.c spl_directory.h 
  Log:
  - MFH Flag handling and documentation
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl.php?r1=1.49.2.11.2.7r2=1.49.2.11.2.8diff_format=u
Index: php-src/ext/spl/spl.php
diff -u php-src/ext/spl/spl.php:1.49.2.11.2.7 
php-src/ext/spl/spl.php:1.49.2.11.2.8
--- php-src/ext/spl/spl.php:1.49.2.11.2.7   Sun Apr 22 17:13:52 2007
+++ php-src/ext/spl/spl.php Mon Feb  4 20:43:50 2008
@@ -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