[PHP-CVS-DAILY] cvs: ZendEngine2 / ChangeLog

2004-04-28 Thread changelog
changelog   Wed Apr 28 20:36:07 2004 EDT

  Modified files:  
/ZendEngine2ChangeLog 
  Log:
  ChangeLog update
  
http://cvs.php.net/diff.php/ZendEngine2/ChangeLog?r1=1.459r2=1.460ty=u
Index: ZendEngine2/ChangeLog
diff -u ZendEngine2/ChangeLog:1.459 ZendEngine2/ChangeLog:1.460
--- ZendEngine2/ChangeLog:1.459 Tue Apr 27 20:33:46 2004
+++ ZendEngine2/ChangeLog   Wed Apr 28 20:36:06 2004
@@ -1,3 +1,8 @@
+2004-04-28  Marcus Boerger  [EMAIL PROTECTED]
+
+* zend_exceptions.h:
+  Fix c++ builds
+
 2004-04-27  Marcus Boerger  [EMAIL PROTECTED]
 
 * zend_builtin_functions.c:
@@ -4518,7 +4523,7 @@
 2003-06-10  Jani Taskinen  [EMAIL PROTECTED]
 
 * zend_multiply.h:
-  - Missing $Id: ChangeLog,v 1.459 2004/04/28 00:33:46 changelog Exp $ tag
+  - Missing $Id: ChangeLog,v 1.460 2004/04/29 00:36:06 changelog Exp $ tag
 
 2003-06-10  James Cox  [EMAIL PROTECTED]
 
@@ -6242,7 +6247,7 @@
   zend_types.h
   zend_variables.c
   zend_variables.h:
-  - Added some missing CVS $Id: ChangeLog,v 1.459 2004/04/28 00:33:46 changelog 
Exp $ tags, headers and footers.
+  - Added some missing CVS $Id: ChangeLog,v 1.460 2004/04/29 00:36:06 changelog 
Exp $ tags, headers and footers.
 
 2003-01-30  Ilia Alshanetsky  [EMAIL PROTECTED]
 


[PHP-CVS] cvs: php-src /ext/com_dotnet com_com.c com_extension.c com_handlers.c com_saproxy.c php_com_dotnet_internal.h

2004-04-28 Thread Wez Furlong
wez Wed Apr 28 04:23:23 2004 EDT

  Modified files:  
/php-src/ext/com_dotnet com_com.c com_extension.c com_handlers.c 
com_saproxy.c php_com_dotnet_internal.h 
  Log:
  Fix for Bug #28161 (and probably others that I can't find in the bug db;
  the search interface sucks).
  
  Expand the proxy object so it can handle psuedo array style properties.
  
  ASP/VB code like this:
  
headObj.Attribute(RID) = rid 
  
  can be expressed like this in PHP:
  
$headObj-Attribute['RID'] = $rid;
  
  In theory, this feature can be used for multi dimensional properties:
  
headObj.Attribute(RID, Foo) = rid;
  
  like this:
  
$headObj-Attribute['RID']['Foo'] = $rid;
  
  
  http://cvs.php.net/diff.php/php-src/ext/com_dotnet/com_com.c?r1=1.11r2=1.12ty=u
Index: php-src/ext/com_dotnet/com_com.c
diff -u php-src/ext/com_dotnet/com_com.c:1.11 php-src/ext/com_dotnet/com_com.c:1.12
--- php-src/ext/com_dotnet/com_com.c:1.11   Thu Feb 12 05:43:19 2004
+++ php-src/ext/com_dotnet/com_com.cWed Apr 28 04:23:22 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: com_com.c,v 1.11 2004/02/12 10:43:19 zeev Exp $ */
+/* $Id: com_com.c,v 1.12 2004/04/28 08:23:22 wez Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -333,6 +333,17 @@
spprintf(msg, 0, Parameter %d: %s, arg_err, desc);
LocalFree(desc);
break;
+
+   case DISP_E_BADPARAMCOUNT:
+   if ((disp_params-cArgs + disp_params-cNamedArgs == 
0)  (flags == DISPATCH_PROPERTYGET)) {
+   /* if getting a property and they are missing 
all parameters,
+* we want to create a proxy object for them; 
so lets not create an
+* exception here */
+   msg = NULL;
+   break;
+   }
+   /* else fall through */
+   
default:
desc = php_win_err(hr);
spprintf(msg, 0, Error %s, desc);
@@ -557,6 +568,10 @@
efree(vargs);
}
 
+   /* a bit strange this, but... */
+   if (hr == DISP_E_BADPARAMCOUNT)
+   return hr;
+   
return SUCCEEDED(hr) ? SUCCESS : FAILURE;
 }
 
http://cvs.php.net/diff.php/php-src/ext/com_dotnet/com_extension.c?r1=1.9r2=1.10ty=u
Index: php-src/ext/com_dotnet/com_extension.c
diff -u php-src/ext/com_dotnet/com_extension.c:1.9 
php-src/ext/com_dotnet/com_extension.c:1.10
--- php-src/ext/com_dotnet/com_extension.c:1.9  Thu Feb 12 05:43:19 2004
+++ php-src/ext/com_dotnet/com_extension.c  Wed Apr 28 04:23:22 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: com_extension.c,v 1.9 2004/02/12 10:43:19 zeev Exp $ */
+/* $Id: com_extension.c,v 1.10 2004/04/28 08:23:22 wez Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -197,18 +197,16 @@
INIT_CLASS_ENTRY(ce, com_safearray_proxy, NULL);
php_com_saproxy_class_entry = zend_register_internal_class(ce TSRMLS_CC);
php_com_saproxy_class_entry-ce_flags |= ZEND_ACC_FINAL;
-// php_com_saproxy_class_entry-constructor-common.fn_flags |= 
ZEND_ACC_PROTECTED;
+   php_com_saproxy_class_entry-constructor-common.fn_flags |= 
ZEND_ACC_PROTECTED;
php_com_saproxy_class_entry-get_iterator = php_com_saproxy_iter_get;

INIT_CLASS_ENTRY(ce, variant, NULL);
ce.create_object = php_com_object_new;
-// ce.get_iterator = php_com_iter_get;
php_com_variant_class_entry = zend_register_internal_class(ce TSRMLS_CC);
php_com_variant_class_entry-get_iterator = php_com_iter_get;
 
INIT_CLASS_ENTRY(ce, com, NULL);
ce.create_object = php_com_object_new;
-// ce.get_iterator = php_com_iter_get;
tmp = zend_register_internal_class_ex(ce, php_com_variant_class_entry, 
variant TSRMLS_CC);
tmp-get_iterator = php_com_iter_get;
 
@@ -217,7 +215,6 @@
 #if HAVE_MSCOREE_H
INIT_CLASS_ENTRY(ce, dotnet, NULL);
ce.create_object = php_com_object_new;
-// ce.get_iterator = php_com_iter_get;
tmp = zend_register_internal_class_ex(ce, php_com_variant_class_entry, 
variant TSRMLS_CC);
tmp-get_iterator = php_com_iter_get;
 #endif
http://cvs.php.net/diff.php/php-src/ext/com_dotnet/com_handlers.c?r1=1.18r2=1.19ty=u
Index: php-src/ext/com_dotnet/com_handlers.c
diff -u php-src/ext/com_dotnet/com_handlers.c:1.18 
php-src/ext/com_dotnet/com_handlers.c:1.19
--- php-src/ext/com_dotnet/com_handlers.c:1.18  Mon Mar 22 17:47:05 2004
+++ php-src/ext/com_dotnet/com_handlers.c

[PHP-CVS] cvs: php-src /ext/xsl/tests xslt008.phpt xslt009.phpt

2004-04-28 Thread Ilia Alshanetsky
iliaa   Wed Apr 28 11:14:48 2004 EDT

  Modified files:  
/php-src/ext/xsl/tests  xslt008.phpt xslt009.phpt 
  Log:
  Added missing skip condition.
  
  
http://cvs.php.net/diff.php/php-src/ext/xsl/tests/xslt008.phpt?r1=1.4r2=1.5ty=u
Index: php-src/ext/xsl/tests/xslt008.phpt
diff -u php-src/ext/xsl/tests/xslt008.phpt:1.4 php-src/ext/xsl/tests/xslt008.phpt:1.5
--- php-src/ext/xsl/tests/xslt008.phpt:1.4  Mon Jan 19 12:38:47 2004
+++ php-src/ext/xsl/tests/xslt008.phpt  Wed Apr 28 11:14:47 2004
@@ -1,7 +1,10 @@
 --TEST--
 Test 8: Stream Wrapper Includes
 --SKIPIF--
-?php require_once('skipif.inc'); ?
+?php
+   require_once('skipif.inc');
+   if (!extension_loaded('zlib')) die('skip zlib extension not available');
+?
 --FILE--
 ?php
 echo Test 8: Stream Wrapper Includes ;
http://cvs.php.net/diff.php/php-src/ext/xsl/tests/xslt009.phpt?r1=1.1r2=1.2ty=u
Index: php-src/ext/xsl/tests/xslt009.phpt
diff -u php-src/ext/xsl/tests/xslt009.phpt:1.1 php-src/ext/xsl/tests/xslt009.phpt:1.2
--- php-src/ext/xsl/tests/xslt009.phpt:1.1  Mon Oct 27 10:12:20 2003
+++ php-src/ext/xsl/tests/xslt009.phpt  Wed Apr 28 11:14:47 2004
@@ -1,7 +1,10 @@
 --TEST--
 Test 9: Stream Wrapper XPath-Document() 
 --SKIPIF--
-?php require_once('skipif.inc'); ?
+?php
+   require_once('skipif.inc');
+   if (!extension_loaded('zlib')) die('skip zlib extension not available');
+?
 --FILE--
 ?php
 echo Test 9: Stream Wrapper XPath-Document();

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/spl spl.php /ext/spl/examples appenditerator.inc findfile.inc findfile.php /ext/spl/tests array_005.phpt array_009.phpt array_011.phpt caching_iterator_str.phpt iterator_001.phpt iterator_002.phpt iterator_003.phpt iterator_004.phpt iterator_aggregation.phpt iterator_get_inner.phpt limititerator.phpt

2004-04-28 Thread Marcus Boerger
helly   Wed Apr 28 15:58:48 2004 EDT

  Added files: 
/php-src/ext/spl/tests  iterator_001.phpt iterator_002.phpt 
iterator_003.phpt iterator_004.phpt 

  Removed files:   
/php-src/ext/spl/tests  caching_iterator_str.phpt 
iterator_aggregation.phpt 
iterator_get_inner.phpt limititerator.phpt 

  Modified files:  
/php-src/ext/splspl.php 
/php-src/ext/spl/examples   appenditerator.inc findfile.inc 
findfile.php 
/php-src/ext/spl/tests  array_005.phpt array_009.phpt array_011.phpt 
  Log:
  - DOS 2 UNIX
  
  http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.18r2=1.19ty=u
Index: php-src/ext/spl/spl.php
diff -u php-src/ext/spl/spl.php:1.18 php-src/ext/spl/spl.php:1.19
--- php-src/ext/spl/spl.php:1.18Tue Apr 27 11:39:33 2004
+++ php-src/ext/spl/spl.php Wed Apr 28 15:58:47 2004
@@ -1,447 +1,447 @@
-?php
-
-/** Standard PHP Library
- *
- * (c) Marcus Boerger, 2003 - 2004
- */
-
-/** 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.
- */
-interface Traversable
-{
-}
-
-/** Interface to create an external Iterator.
- *
- * \note This is an engine internal interface.
- */ 
-interface IteratorAggregate implements Traversable
-{
-   /** Return an Iterator for the implementing object.
-*/
-   function getIterator();
-}
-
-/** Interface for external iterators or objects that can be iterated 
- * themselves internally.
- *
- * \note This is an engine internal interface.
- */
-interface Iterator implements Traversable
-{
-   /** Rewind the Iterator to the first element.
-*/
+?php
+
+/** Standard PHP Library
+ *
+ * (c) Marcus Boerger, 2003 - 2004
+ */
+
+/** 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.
+ */
+interface Traversable
+{
+}
+
+/** Interface to create an external Iterator.
+ *
+ * \note This is an engine internal interface.
+ */ 
+interface IteratorAggregate implements Traversable
+{
+   /** Return an Iterator for the implementing object.
+*/
+   function getIterator();
+}
+
+/** Interface for external iterators or objects that can be iterated 
+ * themselves internally.
+ *
+ * \note This is an engine internal interface.
+ */
+interface Iterator implements Traversable
+{
+   /** Rewind the Iterator to the first element.
+*/
function rewind();
-
-   /** Return the current element.
-*/
+
+   /** Return the current element.
+*/
function current();
-
-   /** Return the key of the current element.
-*/
+
+   /** Return the key of the current element.
+*/
function key();
-
-   /** Move forward to next element.
-*/
+
+   /** Move forward to next element.
+*/
function next();
-
-   /** Check if there is a current element after calls to rewind() or next().
-*/
+
+   /** Check if there is a current element after calls to rewind() or next().
+*/
function valid();
-}
-
-/** Interface for recursive traversal to be used with 
- * RecursiveIteratorIterator.
- */
-interface RecursiveIterator implements Iterator
-{
-   /** \return whether current element can be iterated itself.
- */
-   function hasChildren();
-
-   /** \return an object that recursively iterates the current element.
-* This object must implement RecursiveIterator.
-*/
-   function getChildren();
-}
-
-/** Class for recursive traversal. 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 Iterator
-{
-   /** Construct an instance form a RecursiveIterator.
-*
-* \param $iterator inner root iterator
-* \param $mode one of
-*- RIT_LEAVES_ONLY do not return elements that can be recursed.
-*- RIT_SELF_FIRST  show elements before their sub elements.
-*- RIT_CHILD_FIRST show elements after their sub elements-
-*
-* \note If you want to see only those elements which have sub elements then
-*   use a ParentIterator.
-

[PHP-CVS] cvs: php-src /ext/spl/examples/tests .cvsignore examples.inc iterators_001.phpt iterators_002.phpt

2004-04-28 Thread Marcus Boerger
helly   Wed Apr 28 16:10:21 2004 EDT

  Added files: 
/php-src/ext/spl/examples/tests .cvsignore examples.inc 
iterators_001.phpt 
iterators_002.phpt 
  Log:
  - Add tests for the examples
  
  

http://cvs.php.net/co.php/php-src/ext/spl/examples/tests/.cvsignore?r=1.1p=1
Index: php-src/ext/spl/examples/tests/.cvsignore
+++ php-src/ext/spl/examples/tests/.cvsignore
phpt.*
*.diff
*.log
*.exp
*.out
*.php

http://cvs.php.net/co.php/php-src/ext/spl/examples/tests/examples.inc?r=1.1p=1
Index: php-src/ext/spl/examples/tests/examples.inc
+++ php-src/ext/spl/examples/tests/examples.inc
?php

class IncludeFiles extends ArrayIterator
{
function __construct($path, $classes)
{
parent::__construct();
foreach($classes as $c)
{
$this-append($path . '/' . strtolower($c) . '.inc');
}
}
}

$classes = array(
'EmptyIterator',
'InfiniteIterator',
);

foreach (new IncludeFiles(dirname(__FILE__). '/..', $classes) as $file)
{
require_once($file);
}

?
http://cvs.php.net/co.php/php-src/ext/spl/examples/tests/iterators_001.phpt?r=1.1p=1
Index: php-src/ext/spl/examples/tests/iterators_001.phpt
+++ php-src/ext/spl/examples/tests/iterators_001.phpt
--TEST--
SPL: EmptyIterator
--FILE--
?php

require_once('examples.inc');

echo ===EmptyIterator===\n;

foreach(new LimitIterator(new EmptyIterator(), 0, 3) as $key = $val)
{
echo $key=$val\n;
}

?
===DONE===
?php exit(0);
--EXPECTF--
===EmptyIterator===
===DONE===

http://cvs.php.net/co.php/php-src/ext/spl/examples/tests/iterators_002.phpt?r=1.1p=1
Index: php-src/ext/spl/examples/tests/iterators_002.phpt
+++ php-src/ext/spl/examples/tests/iterators_002.phpt
--TEST--
SPL: InfiniteIterator
--FILE--
?php

require_once('examples.inc');

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===

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/spl spl_array.c

2004-04-28 Thread Marcus Boerger
helly   Wed Apr 28 17:45:41 2004 EDT

  Modified files:  
/php-src/ext/splspl_array.c 
  Log:
  Count() was missing
  
http://cvs.php.net/diff.php/php-src/ext/spl/spl_array.c?r1=1.41r2=1.42ty=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.41 php-src/ext/spl/spl_array.c:1.42
--- php-src/ext/spl/spl_array.c:1.41Tue Apr 27 11:42:45 2004
+++ php-src/ext/spl/spl_array.c Wed Apr 28 17:45:41 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.41 2004/04/27 15:42:45 helly Exp $ */
+/* $Id: spl_array.c,v 1.42 2004/04/28 21:45:41 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -47,6 +47,7 @@
 SPL_METHOD(Array, append);
 SPL_METHOD(Array, getArrayCopy);
 SPL_METHOD(Array, seek);
+SPL_METHOD(Array, count);
 
 static
 ZEND_BEGIN_ARG_INFO(arginfo_array___construct, 0)
@@ -83,6 +84,7 @@
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)
{NULL, NULL, NULL}
 };
 
@@ -100,6 +102,7 @@
SPL_ME(Array, append,arginfo_array_append,ZEND_ACC_PUBLIC)
SPL_ME(Array, getArrayCopy,  NULL, ZEND_ACC_PUBLIC)
SPL_ME(Array, seek,  arginfo_array_seek,ZEND_ACC_PUBLIC)
+   SPL_ME(Array, count, NULL, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
 };
 
@@ -716,6 +719,24 @@
while (position--  0  spl_array_next(intern TSRMLS_CC));
 } /* }}} */
 
+/* {{{ proto bool ArrayObject::count()
+ Return the number of elements in the Iterator. */
+SPL_METHOD(Array, count)
+{
+   long position;
+   zval *object = getThis();
+   spl_array_object *intern = 
(spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
+   HashTable *aht = HASH_OF(intern-array);
+   HashPosition pos;
+
+   if (!aht) {
+   php_error_docref(NULL TSRMLS_CC, E_NOTICE, Array was modified outside 
object and is no longer an array);
+   RETURN_LONG(0);
+   }
+
+   RETURN_LONG(zend_hash_num_elements(aht));
+} /* }}} */
+
 /* {{{ proto mixed|NULL ArrayIterator::current()
Return current array entry */
 SPL_METHOD(Array, current)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/spl/examples appenditerator.inc norewinditerator.inc /ext/spl/examples/tests examples.inc iterators_003.phpt iterators_004.phpt

2004-04-28 Thread Marcus Boerger
helly   Wed Apr 28 17:52:51 2004 EDT

  Added files: 
/php-src/ext/spl/examples   norewinditerator.inc 
/php-src/ext/spl/examples/tests iterators_003.phpt 
iterators_004.phpt 

  Modified files:  
/php-src/ext/spl/examples   appenditerator.inc 
/php-src/ext/spl/examples/tests examples.inc 
  Log:
  - More examples
  
  
http://cvs.php.net/diff.php/php-src/ext/spl/examples/appenditerator.inc?r1=1.3r2=1.4ty=u
Index: php-src/ext/spl/examples/appenditerator.inc
diff -u php-src/ext/spl/examples/appenditerator.inc:1.3 
php-src/ext/spl/examples/appenditerator.inc:1.4
--- php-src/ext/spl/examples/appenditerator.inc:1.3 Wed Apr 28 15:58:47 2004
+++ php-src/ext/spl/examples/appenditerator.inc Wed Apr 28 17:52:51 2004
@@ -18,6 +18,11 @@
function append(Iterator $it)
{
$this-iterators-append($it);
+   if (!$this-valid())
+   {
+   $this-iterators-seek($this-iterators-count() - 1);
+   $this-iterators-current()-rewind();
+   }
}
 
function getInnerIterator()
@@ -30,7 +35,7 @@
$this-iterators-rewind();
if ($this-iterators-valid())
{
-   $this-iterators-rewind();
+   $this-getInnerIterator()-rewind();
}
}
 
http://cvs.php.net/diff.php/php-src/ext/spl/examples/tests/examples.inc?r1=1.1r2=1.2ty=u
Index: php-src/ext/spl/examples/tests/examples.inc
diff -u php-src/ext/spl/examples/tests/examples.inc:1.1 
php-src/ext/spl/examples/tests/examples.inc:1.2
--- php-src/ext/spl/examples/tests/examples.inc:1.1 Wed Apr 28 16:10:21 2004
+++ php-src/ext/spl/examples/tests/examples.inc Wed Apr 28 17:52:51 2004
@@ -15,6 +15,8 @@
 $classes = array(
'EmptyIterator',
'InfiniteIterator',
+   'AppendIterator',
+   'NoRewindIterator',
 );
 
 foreach (new IncludeFiles(dirname(__FILE__). '/..', $classes) as $file)

http://cvs.php.net/co.php/php-src/ext/spl/examples/norewinditerator.inc?r=1.1p=1
Index: php-src/ext/spl/examples/norewinditerator.inc
+++ php-src/ext/spl/examples/norewinditerator.inc
?php

/**
 * @brief   An Iterator that doesn't call rewind
 * @author  Marcus Boerger
 * @version 1.0
 *
 */
class NoRewindIterator implements Iterator
{
protected $it;

function __construct(Iterator $it)
{
$this-it = $it;
}

function rewind()
{
// nothing to do
}

function valid()
{
return $this-it-valid();
}

function current()
{
return $this-it-current();
}

function key()
{
return $this-it-key();
}

function next()
{
$this-it-next();
}
}

?
http://cvs.php.net/co.php/php-src/ext/spl/examples/tests/iterators_003.phpt?r=1.1p=1
Index: php-src/ext/spl/examples/tests/iterators_003.phpt
+++ php-src/ext/spl/examples/tests/iterators_003.phpt
--TEST--
SPL: NoRweindIterator
--FILE--
?php

require_once('examples.inc');

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===

http://cvs.php.net/co.php/php-src/ext/spl/examples/tests/iterators_004.phpt?r=1.1p=1
Index: php-src/ext/spl/examples/tests/iterators_004.phpt
+++ php-src/ext/spl/examples/tests/iterators_004.phpt
--TEST--
SPL: AppendIterator
--FILE--
?php

require_once('examples.inc');

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===

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src /ext/spl spl_array.c

2004-04-28 Thread Jon Parise
On Wed, Apr 28, 2004 at 09:45:41PM -, Marcus Boerger wrote:

 +/* {{{ proto bool ArrayObject::count()
 + Return the number of elements in the Iterator. */
 +SPL_METHOD(Array, count)
 +{
 + long position;
 + zval *object = getThis();
 + spl_array_object *intern = 
 (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
 + HashTable *aht = HASH_OF(intern-array);
 + HashPosition pos;
 +
 + if (!aht) {
 + php_error_docref(NULL TSRMLS_CC, E_NOTICE, Array was modified outside 
 object and is no longer an array);
 + RETURN_LONG(0);
 + }
 +
 + RETURN_LONG(zend_hash_num_elements(aht));
 +} /* }}} */
 +
  /* {{{ proto mixed|NULL ArrayIterator::current()
 Return current array entry */
  SPL_METHOD(Array, current)
 
It looks like both 'long position' and 'HashPosition pos' are unused
in this function.

-- 
Jon Parise ([EMAIL PROTECTED]) :: The PHP Project (http://www.php.net/)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/com_dotnet com_extension.c

2004-04-28 Thread Wez Furlong
wez Wed Apr 28 19:24:34 2004 EDT

  Modified files:  
/php-src/ext/com_dotnet com_extension.c 
  Log:
  Should have tested this change before committing.
  
  
http://cvs.php.net/diff.php/php-src/ext/com_dotnet/com_extension.c?r1=1.10r2=1.11ty=u
Index: php-src/ext/com_dotnet/com_extension.c
diff -u php-src/ext/com_dotnet/com_extension.c:1.10 
php-src/ext/com_dotnet/com_extension.c:1.11
--- php-src/ext/com_dotnet/com_extension.c:1.10 Wed Apr 28 04:23:22 2004
+++ php-src/ext/com_dotnet/com_extension.c  Wed Apr 28 19:24:33 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: com_extension.c,v 1.10 2004/04/28 08:23:22 wez Exp $ */
+/* $Id: com_extension.c,v 1.11 2004/04/28 23:24:33 wez Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -197,7 +197,7 @@
INIT_CLASS_ENTRY(ce, com_safearray_proxy, NULL);
php_com_saproxy_class_entry = zend_register_internal_class(ce TSRMLS_CC);
php_com_saproxy_class_entry-ce_flags |= ZEND_ACC_FINAL;
-   php_com_saproxy_class_entry-constructor-common.fn_flags |= 
ZEND_ACC_PROTECTED;
+// php_com_saproxy_class_entry-constructor-common.fn_flags |= 
ZEND_ACC_PROTECTED;
php_com_saproxy_class_entry-get_iterator = php_com_saproxy_iter_get;

INIT_CLASS_ENTRY(ce, variant, NULL);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /win32/build config.w32.h.in confutils.js

2004-04-28 Thread Wez Furlong
wez Wed Apr 28 20:17:10 2004 EDT

  Modified files:  
/php-src/win32/buildconfig.w32.h.in confutils.js 
  Log:
  Add --disable-all switch, which will force all arguments to no if
  they are not specified explicitly. (like the snapshot build, but in
  reverse).
  
  
  
http://cvs.php.net/diff.php/php-src/win32/build/config.w32.h.in?r1=1.4r2=1.5ty=u
Index: php-src/win32/build/config.w32.h.in
diff -u php-src/win32/build/config.w32.h.in:1.4 php-src/win32/build/config.w32.h.in:1.5
--- php-src/win32/build/config.w32.h.in:1.4 Mon Mar 29 13:58:28 2004
+++ php-src/win32/build/config.w32.h.in Wed Apr 28 20:17:09 2004
@@ -1,6 +1,6 @@
 /*
Build Configuration Template for Win32.
-   $Id: config.w32.h.in,v 1.4 2004/03/29 18:58:28 helly Exp $
+   $Id: config.w32.h.in,v 1.5 2004/04/29 00:17:09 wez Exp $
 */
 
 /* Default PHP / PEAR directories */
@@ -29,7 +29,6 @@
 #define MAGIC_QUOTES 0
 #define USE_CONFIG_FILE 1
 #define DEFAULT_SHORT_OPEN_TAG 1
-#define ENABLE_PATHINFO_CHECK 1
 
 /* Platform-Specific Configuration. Should not be changed. */
 #define PHP_SIGCHILD 0
http://cvs.php.net/diff.php/php-src/win32/build/confutils.js?r1=1.39r2=1.40ty=u
Index: php-src/win32/build/confutils.js
diff -u php-src/win32/build/confutils.js:1.39 php-src/win32/build/confutils.js:1.40
--- php-src/win32/build/confutils.js:1.39   Thu Apr 15 12:09:36 2004
+++ php-src/win32/build/confutils.jsWed Apr 28 20:17:09 2004
@@ -17,7 +17,7 @@
   +--+
 */
 
-// $Id: confutils.js,v 1.39 2004/04/15 16:09:36 wez Exp $
+// $Id: confutils.js,v 1.40 2004/04/29 00:17:09 wez Exp $
 
 var STDOUT = WScript.StdOut;
 var STDERR = WScript.StdErr;
@@ -251,6 +251,7 @@
var configure_help_mode = false;
var analyzed = false;
var nice = cscript /nologo configure.js ;
+   var disable_all = false;

args = WScript.Arguments;
for (i = 0; i  args.length; i++) {
@@ -260,6 +261,11 @@
configure_help_mode = true;
break;
}
+   if (arg == --disable-all) {
+   disable_all = true;
+   continue;
+   }
+
// If it is --foo=bar, split on the equals sign
arg = arg.split(=, 2);
argname = arg[0];
@@ -345,6 +351,7 @@
 'pcre-regex', 'fastcgi', 'force-cgi-redirect',
 'path-info-check', 'zts', 'ipv6'
);
+   var force;
 
// Now set any defaults we might have missed out earlier
for (i = 0; i  configure_args.length; i++) {
@@ -358,7 +365,6 @@
// Don't trust a default yes answer for a non-core module
// in a snapshot build
if (PHP_SNAPSHOT_BUILD != no  argval == yes  !shared) {
-   var force;
 
force = true;
for (j = 0; j  snapshot_build_exclusions.length; j++) {
@@ -386,8 +392,6 @@
}

if (PHP_SNAPSHOT_BUILD != no  argval == no) {
-   var force;
-
force = true;
for (j = 0; j  snapshot_build_exclusions.length; j++) {
if (snapshot_build_exclusions[j] == arg.optname) {
@@ -401,6 +405,21 @@
shared = true;
}
}
+
+   if (disable_all) {
+   force = true;
+   for (j = 0; j  snapshot_build_exclusions.length; j++) {
+   if (snapshot_build_exclusions[j] == arg.optname) {
+   force = false;
+   break;
+   }
+   }
+   if (force) {
+   argval = no;
+   shared = false;
+   }
+   }
+
eval(PHP_ + arg.symval +  = argval;);
eval(PHP_ + arg.symval + _SHARED = shared;);
}

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php