[PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl spl_array.c /ext/spl/tests arrayObject_magicMethods6.phpt bug45622b.phpt

2009-05-21 Thread Arnaud Le Blanc
lbarnaudThu May 21 13:26:14 2009 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/spl/tests  bug45622b.phpt 

  Modified files:  
/php-src/ext/splspl_array.c 
/php-src/ext/spl/tests  arrayObject_magicMethods6.phpt 
  Log:
  MFH: Better fix for #45622 (patch by robinf at php do net)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.39r2=1.71.2.17.2.13.2.40diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.39 
php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.40
--- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.39 Thu Mar 19 03:01:37 2009
+++ php-src/ext/spl/spl_array.c Thu May 21 13:26:14 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.71.2.17.2.13.2.39 2009/03/19 03:01:37 colder Exp $ */
+/* $Id: spl_array.c,v 1.71.2.17.2.13.2.40 2009/05/21 13:26:14 lbarnaud Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -745,12 +745,12 @@
 {
spl_array_object *intern = 
(spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
 
-   if (std_object_handlers.has_property(object, member, has_set_exists 
TSRMLS_CC)) {
-   return 1;
-   } else if ((intern-ar_flags  SPL_ARRAY_ARRAY_AS_PROPS) != 0) {
+   if ((intern-ar_flags  SPL_ARRAY_ARRAY_AS_PROPS) != 0
+!std_object_handlers.has_property(object, member, 2 TSRMLS_CC)) {
return spl_array_has_dimension(object, member, has_set_exists 
TSRMLS_CC);
}
-   return 0;
+   return std_object_handlers.has_property(object, member, has_set_exists 
TSRMLS_CC);
+
 } /* }}} */
 
 static void spl_array_unset_property(zval *object, zval *member TSRMLS_DC) /* 
{{{ */
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/arrayObject_magicMethods6.phpt?r1=1.1.4.2r2=1.1.4.3diff_format=u
Index: php-src/ext/spl/tests/arrayObject_magicMethods6.phpt
diff -u php-src/ext/spl/tests/arrayObject_magicMethods6.phpt:1.1.4.2 
php-src/ext/spl/tests/arrayObject_magicMethods6.phpt:1.1.4.3
--- php-src/ext/spl/tests/arrayObject_magicMethods6.phpt:1.1.4.2Fri Oct 
17 14:34:55 2008
+++ php-src/ext/spl/tests/arrayObject_magicMethods6.phptThu May 21 
13:26:14 2009
@@ -143,11 +143,8 @@
 }
 
 -- isset existent, non-existent and dynamic:
-In UsesMagic::__isset(a)
 bool(true)
-In UsesMagic::__isset(nonexistent)
 bool(false)
-In UsesMagic::__isset(dynamic)
 bool(true)
   Original wrapped object:
 object(C)#1 (5) {

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug45622b.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/bug45622b.phpt
+++ php-src/ext/spl/tests/bug45622b.phpt
--TEST--
Ensure fix to bug45622 doesn't cause __isset() to be called when 
ArrayObject::ARRAY_AS_PROPS is used.
--FILE--
?php
class UsesMagic extends ArrayObject {
function __get($n) {  echo In  . __METHOD__ . !\n; }
function __set($n, $v) {  echo In  . __METHOD__ . !\n; }
function __isset($n)   {  echo In  . __METHOD__ . !\n; }
function __unset($n)   {  echo In  . __METHOD__ . !\n; }
}
$ao = new UsesMagic(array(), ArrayObject::ARRAY_AS_PROPS);

echo Doesn't trigger __get.\n;
echo $ao-prop1;

echo Doesn't trigger __set.\n;
$ao-prop2 = 'foo';

echo Doesn't trigger __unset.\n;
unset($ao-prop3);

echo Shouldn't trigger __isset.\n;
isset($ao-prop4);
?
--EXPECTF--
Doesn't trigger __get.

Notice: Undefined index:  prop1 in %s on line 11
Doesn't trigger __set.
Doesn't trigger __unset.

Notice: Undefined index:  prop3 in %s on line 17
Shouldn't trigger __isset.


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



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

2009-01-27 Thread Antony Dovgal
tony2001Tue Jan 27 14:50:27 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/splspl_array.c 
  Log:
  fix compile warning
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.37r2=1.71.2.17.2.13.2.38diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.37 
php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.38
--- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.37 Wed Dec 31 11:15:43 2008
+++ php-src/ext/spl/spl_array.c Tue Jan 27 14:50:27 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.71.2.17.2.13.2.37 2008/12/31 11:15:43 sebastian Exp $ 
*/
+/* $Id: spl_array.c,v 1.71.2.17.2.13.2.38 2009/01/27 14:50:27 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -1725,7 +1725,7 @@
zval *zdata;
php_unserialize_data_t *before;
MAKE_STD_ZVAL(zdata);
-   ZVAL_STRINGL(zdata, buf, buf_len, 1);
+   ZVAL_STRINGL(zdata, (char *)buf, buf_len, 1);
 
before = intern-unserialize_data;
intern-unserialize_data = (php_unserialize_data_t *)data;



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



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

2008-10-17 Thread Antony Dovgal
tony2001Fri Oct 17 22:09:45 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/splspl_array.c 
  Log:
  MFH: fix memleak
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.27r2=1.71.2.17.2.13.2.28diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.27 
php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.28
--- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.27 Sun Oct  5 14:20:55 2008
+++ php-src/ext/spl/spl_array.c Fri Oct 17 22:09:44 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.71.2.17.2.13.2.27 2008/10/05 14:20:55 colder Exp $ */
+/* $Id: spl_array.c,v 1.71.2.17.2.13.2.28 2008/10/17 22:09:44 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -1260,6 +1260,8 @@

if (use_arg) {
if (ZEND_NUM_ARGS() != 1 || 
zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, 
z, arg) == FAILURE) {
+   Z_TYPE_P(tmp) = IS_NULL;
+   zval_ptr_dtor(tmp);
zend_throw_exception(spl_ce_BadMethodCallException, 
Function expects exactly one argument, 0 TSRMLS_CC);
return;
}



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



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

2008-08-25 Thread Jani Taskinen
janiMon Aug 25 19:07:20 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/splspl_array.c 
  Log:
  MFH
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.22r2=1.71.2.17.2.13.2.23diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.22 
php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.23
--- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.22 Mon Aug 25 18:40:44 2008
+++ php-src/ext/spl/spl_array.c Mon Aug 25 19:07:20 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.71.2.17.2.13.2.22 2008/08/25 18:40:44 colder Exp $ */
+/* $Id: spl_array.c,v 1.71.2.17.2.13.2.23 2008/08/25 19:07:20 jani Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -539,7 +539,7 @@
 
 /* {{{ proto bool ArrayObject::offsetExists(mixed $index)
proto bool ArrayIterator::offsetExists(mixed $index)
- Returns whether the requested $index exists. */
+   Returns whether the requested $index exists. */
 SPL_METHOD(Array, offsetExists)
 {
zval *index;
@@ -551,7 +551,7 @@
 
 /* {{{ proto mixed ArrayObject::offsetGet(mixed $index)
proto mixed ArrayIterator::offsetGet(mixed $index)
- Returns the value at the specified $index. */
+   Returns the value at the specified $index. */
 SPL_METHOD(Array, offsetGet)
 {
zval *index, *value;
@@ -564,7 +564,7 @@
 
 /* {{{ proto void ArrayObject::offsetSet(mixed $index, mixed $newval)
proto void ArrayIterator::offsetSet(mixed $index, mixed $newval)
- Sets the value at the specified $index to $newval. */
+   Sets the value at the specified $index to $newval. */
 SPL_METHOD(Array, offsetSet)
 {
zval *index, *value;
@@ -598,7 +598,7 @@
 
 /* {{{ proto void ArrayObject::append(mixed $newval)
proto void ArrayIterator::append(mixed $newval)
- Appends the value (cannot be called for objects). */
+   Appends the value (cannot be called for objects). */
 SPL_METHOD(Array, append)
 {
zval *value;
@@ -611,7 +611,7 @@
 
 /* {{{ proto void ArrayObject::offsetUnset(mixed $index)
proto void ArrayIterator::offsetUnset(mixed $index)
- Unsets the value at the specified $index. */
+   Unsets the value at the specified $index. */
 SPL_METHOD(Array, offsetUnset)
 {
zval *index;
@@ -623,7 +623,7 @@
 
 /* {{{ proto array ArrayObject::getArrayCopy()
   proto array ArrayIterator::getArrayCopy()
- Return a copy of the contained array */
+   Return a copy of the contained array */
 SPL_METHOD(Array, getArrayCopy)
 {
zval *object = getThis(), *tmp;
@@ -985,7 +985,7 @@
 
 /* {{{ proto void ArrayObject::__construct(array|object ar = array() [, int 
flags = 0 [, string iterator_class = ArrayIterator]])
proto void ArrayIterator::__construct(array|object ar = array() [, int 
flags = 0])
- Cronstructs a new array iterator from a path. */
+   Constructs a new array iterator from a path. */
 SPL_METHOD(Array, __construct)
 {
zval *object = getThis();
@@ -1135,7 +1135,7 @@
 /* }}} */
 
 /* {{{ proto void ArrayIterator::seek(int $position)
- Seek to position. */
+   Seek to position. */
 SPL_METHOD(Array, seek)
 {
long opos, position;
@@ -1219,7 +1219,7 @@
 
 /* {{{ proto int ArrayObject::count()
proto int ArrayIterator::count()
- Return the number of elements in the Iterator. */
+   Return the number of elements in the Iterator. */
 SPL_METHOD(Array, count)
 {
long count;
@@ -1261,32 +1261,32 @@
 
 /* {{{ proto int ArrayObject::asort()
proto int ArrayIterator::asort()
- Sort the entries by values. */
+   Sort the entries by values. */
 SPL_ARRAY_METHOD(Array, asort, 0) /* }}} */
 
 /* {{{ proto int ArrayObject::ksort()
proto int ArrayIterator::ksort()
- Sort the entries by key. */
+   Sort the entries by key. */
 SPL_ARRAY_METHOD(Array, ksort, 0) /* }}} */
 
 /* {{{ proto int ArrayObject::uasort(callback cmp_function)
proto int ArrayIterator::uasort(callback cmp_function)
- Sort the entries by values user defined function. */
+   Sort the entries by values user defined function. */
 SPL_ARRAY_METHOD(Array, uasort, 1) /* }}} */
 
 /* {{{ proto int ArrayObject::uksort(callback cmp_function)
proto int ArrayIterator::uksort(callback cmp_function)
- Sort the entries by key using user defined function. */
+   Sort the entries by key using user defined function. */
 SPL_ARRAY_METHOD(Array, uksort, 1) /* }}} */
 
 /* {{{ proto int ArrayObject::natsort()
proto int ArrayIterator::natsort()
- Sort the entries by values using natural order algorithm. */
+   Sort the entries by values using natural order algorithm. */
 SPL_ARRAY_METHOD(Array, natsort, 0) /* }}} */
 
 /* {{{ proto int ArrayObject::natcasesort()
proto int ArrayIterator::natcasesort()
- Sort the entries by key using case insensitive natural order algorithm. */
+   Sort the entries by key using case insensitive natural 

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

2008-08-25 Thread Rob Richards
rrichards   Mon Aug 25 19:38:04 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/splspl_array.c 
  Log:
  no zstr in 5_3
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.23r2=1.71.2.17.2.13.2.24diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.23 
php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.24
--- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.23 Mon Aug 25 19:07:20 2008
+++ php-src/ext/spl/spl_array.c Mon Aug 25 19:38:04 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.71.2.17.2.13.2.23 2008/08/25 19:07:20 jani Exp $ */
+/* $Id: spl_array.c,v 1.71.2.17.2.13.2.24 2008/08/25 19:38:04 rrichards Exp $ 
*/
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -1663,7 +1663,7 @@
}
 } /* }}} */
 
-int spl_array_unserialize(zval **object, zend_class_entry *ce, int type, const 
zstr buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC) /* {{{ */
+int spl_array_unserialize(zval **object, zend_class_entry *ce, const unsigned 
char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC)
 {
spl_array_object *intern;
 
@@ -1674,7 +1674,7 @@
zval *zdata;
php_unserialize_data_t *before;
MAKE_STD_ZVAL(zdata);
-   ZVAL_ZSTRL(zdata, type, buf, buf_len, 1);
+   ZVAL_STRINGL(zdata, buf, buf_len, 1);
 
before = intern-unserialize_data;
intern-unserialize_data = (php_unserialize_data_t *)data;



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



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

2008-08-25 Thread Jani Taskinen
Not only it was fubar in CS sense, it DOES NOT EVEN COMPILE... Guilty person has 
been notified privately..


--Jani


Jani Taskinen kirjoitti:

janiMon Aug 25 19:07:20 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/spl	spl_array.c 
  Log:

  MFH
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.22r2=1.71.2.17.2.13.2.23diff_format=u

Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.22 
php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.23
--- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.22 Mon Aug 25 18:40:44 2008
+++ php-src/ext/spl/spl_array.c Mon Aug 25 19:07:20 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.71.2.17.2.13.2.22 2008/08/25 18:40:44 colder Exp $ */

+/* $Id: spl_array.c,v 1.71.2.17.2.13.2.23 2008/08/25 19:07:20 jani Exp $ */
 
 #ifdef HAVE_CONFIG_H

 # include config.h
@@ -539,7 +539,7 @@
 
 /* {{{ proto bool ArrayObject::offsetExists(mixed $index)

proto bool ArrayIterator::offsetExists(mixed $index)
- Returns whether the requested $index exists. */
+   Returns whether the requested $index exists. */
 SPL_METHOD(Array, offsetExists)
 {
zval *index;
@@ -551,7 +551,7 @@
 
 /* {{{ proto mixed ArrayObject::offsetGet(mixed $index)

proto mixed ArrayIterator::offsetGet(mixed $index)
- Returns the value at the specified $index. */
+   Returns the value at the specified $index. */
 SPL_METHOD(Array, offsetGet)
 {
zval *index, *value;
@@ -564,7 +564,7 @@
 
 /* {{{ proto void ArrayObject::offsetSet(mixed $index, mixed $newval)

proto void ArrayIterator::offsetSet(mixed $index, mixed $newval)
- Sets the value at the specified $index to $newval. */
+   Sets the value at the specified $index to $newval. */
 SPL_METHOD(Array, offsetSet)
 {
zval *index, *value;
@@ -598,7 +598,7 @@
 
 /* {{{ proto void ArrayObject::append(mixed $newval)

proto void ArrayIterator::append(mixed $newval)
- Appends the value (cannot be called for objects). */
+   Appends the value (cannot be called for objects). */
 SPL_METHOD(Array, append)
 {
zval *value;
@@ -611,7 +611,7 @@
 
 /* {{{ proto void ArrayObject::offsetUnset(mixed $index)

proto void ArrayIterator::offsetUnset(mixed $index)
- Unsets the value at the specified $index. */
+   Unsets the value at the specified $index. */
 SPL_METHOD(Array, offsetUnset)
 {
zval *index;
@@ -623,7 +623,7 @@
 
 /* {{{ proto array ArrayObject::getArrayCopy()

   proto array ArrayIterator::getArrayCopy()
- Return a copy of the contained array */
+   Return a copy of the contained array */
 SPL_METHOD(Array, getArrayCopy)
 {
zval *object = getThis(), *tmp;
@@ -985,7 +985,7 @@
 
 /* {{{ proto void ArrayObject::__construct(array|object ar = array() [, int flags = 0 [, string iterator_class = ArrayIterator]])

proto void ArrayIterator::__construct(array|object ar = array() [, int 
flags = 0])
- Cronstructs a new array iterator from a path. */
+   Constructs a new array iterator from a path. */
 SPL_METHOD(Array, __construct)
 {
zval *object = getThis();
@@ -1135,7 +1135,7 @@
 /* }}} */
 
 /* {{{ proto void ArrayIterator::seek(int $position)

- Seek to position. */
+   Seek to position. */
 SPL_METHOD(Array, seek)
 {
long opos, position;
@@ -1219,7 +1219,7 @@
 
 /* {{{ proto int ArrayObject::count()

proto int ArrayIterator::count()
- Return the number of elements in the Iterator. */
+   Return the number of elements in the Iterator. */
 SPL_METHOD(Array, count)
 {
long count;
@@ -1261,32 +1261,32 @@
 
 /* {{{ proto int ArrayObject::asort()

proto int ArrayIterator::asort()
- Sort the entries by values. */
+   Sort the entries by values. */
 SPL_ARRAY_METHOD(Array, asort, 0) /* }}} */
 
 /* {{{ proto int ArrayObject::ksort()

proto int ArrayIterator::ksort()
- Sort the entries by key. */
+   Sort the entries by key. */
 SPL_ARRAY_METHOD(Array, ksort, 0) /* }}} */
 
 /* {{{ proto int ArrayObject::uasort(callback cmp_function)

proto int ArrayIterator::uasort(callback cmp_function)
- Sort the entries by values user defined function. */
+   Sort the entries by values user defined function. */
 SPL_ARRAY_METHOD(Array, uasort, 1) /* }}} */
 
 /* {{{ proto int ArrayObject::uksort(callback cmp_function)

proto int ArrayIterator::uksort(callback cmp_function)
- Sort the entries by key using user defined function. */
+   Sort the entries by key using user defined function. */
 SPL_ARRAY_METHOD(Array, uksort, 1) /* }}} */
 
 /* {{{ proto int ArrayObject::natsort()

proto int ArrayIterator::natsort()
- Sort the entries by values using natural order algorithm. */
+   Sort the entries by values using natural order algorithm. */
 SPL_ARRAY_METHOD(Array, natsort, 0) /* }}} */
 
 /* {{{ proto int ArrayObject::natcasesort()

proto int 

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl spl_array.c /ext/spl/tests arrayObject_exchangeArray_basic1.phpt arrayObject_exchangeArray_basic2.phpt

2008-08-04 Thread Robin Fernandes
robinf  Mon Aug  4 11:45:21 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/spl/tests  arrayObject_exchangeArray_basic1.phpt 
arrayObject_exchangeArray_basic2.phpt 

  Modified files:  
/php-src/ext/splspl_array.c 
  Log:
  Improve ArrayObject::exchangeArray() behaviour with objects and CoW 
references (see http://turl.ca/exarr ).
  http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.19r2=1.71.2.17.2.13.2.20diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.19 
php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.20
--- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.19 Sat Jul 26 12:34:10 2008
+++ php-src/ext/spl/spl_array.c Mon Aug  4 11:45:21 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.71.2.17.2.13.2.19 2008/07/26 12:34:10 lbarnaud Exp $ */
+/* $Id: spl_array.c,v 1.71.2.17.2.13.2.20 2008/08/04 11:45:21 robinf Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -892,6 +892,51 @@
 }
 /* }}} */
 
+/* {{{ spl_array_set_array */
+static void spl_array_set_array(zval *object, spl_array_object *intern, zval 
**array, long ar_flags, int just_array TSRMLS_DC) {
+
+   if (Z_TYPE_PP(array) == IS_ARRAY) {
+   SEPARATE_ZVAL_IF_NOT_REF(array);
+   }
+
+   if (Z_TYPE_PP(array) == IS_OBJECT  (Z_OBJ_HT_PP(array) == 
spl_handler_ArrayObject || Z_OBJ_HT_PP(array) == spl_handler_ArrayIterator)) {
+   zval_ptr_dtor(intern-array);
+   if (just_array) {
+   spl_array_object *other = 
(spl_array_object*)zend_object_store_get_object(*array TSRMLS_CC);
+   ar_flags = other-ar_flags  ~SPL_ARRAY_INT_MASK;
+   }   
+   ar_flags |= SPL_ARRAY_USE_OTHER;
+   intern-array = *array;
+   } else {
+   if (Z_TYPE_PP(array) != IS_OBJECT  Z_TYPE_PP(array) != 
IS_ARRAY) {
+   php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
+   zend_throw_exception(spl_ce_InvalidArgumentException, 
Passed variable is not an array or object, using empty array instead, 0 
TSRMLS_CC);
+   return;
+   }
+   zval_ptr_dtor(intern-array);
+   intern-array = *array;
+   }
+   if (object == *array) {
+   intern-ar_flags |= SPL_ARRAY_IS_SELF;
+   intern-ar_flags = ~SPL_ARRAY_USE_OTHER;
+   } else {
+   intern-ar_flags = ~SPL_ARRAY_IS_SELF;
+   }
+   intern-ar_flags |= ar_flags;
+   Z_ADDREF_P(intern-array);
+   if (Z_TYPE_PP(array) == IS_OBJECT) {
+   zend_object_get_properties_t handler = Z_OBJ_HANDLER_PP(array, 
get_properties);
+   if ((handler != std_object_handlers.get_properties  handler 
!= spl_array_get_properties)
+   || !spl_array_get_hash_table(intern, 0 TSRMLS_CC)) {
+   php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
+   
zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, 
Overloaded object of type %s is not compatible with %s, 
Z_OBJCE_PP(array)-name, intern-std.ce-name);
+   }
+   }
+
+   spl_array_rewind(intern TSRMLS_CC);
+}
+/* }}} */
+
 /* iterator handler table */
 zend_object_iterator_funcs spl_array_it_funcs = {
spl_array_it_dtor,
@@ -949,10 +994,6 @@
return;
}
 
-   if (Z_TYPE_PP(array) == IS_ARRAY) {
-   SEPARATE_ZVAL_IF_NOT_REF(array);
-   }
-
if (ZEND_NUM_ARGS()  2) {
if (zend_lookup_class(class_name, class_name_len, 
pce_get_iterator TSRMLS_CC) == FAILURE) {
zend_throw_exception(spl_ce_InvalidArgumentException, 
A class that implements Iterator must be specified, 0 TSRMLS_CC);
@@ -964,43 +1005,7 @@
 
ar_flags = ~SPL_ARRAY_INT_MASK;
 
-   if (Z_TYPE_PP(array) == IS_OBJECT  (Z_OBJ_HT_PP(array) == 
spl_handler_ArrayObject || Z_OBJ_HT_PP(array) == spl_handler_ArrayIterator)) {
-   zval_ptr_dtor(intern-array);
-   if (ZEND_NUM_ARGS() == 1)
-   {
-   spl_array_object *other = 
(spl_array_object*)zend_object_store_get_object(*array TSRMLS_CC);
-   ar_flags = other-ar_flags  ~SPL_ARRAY_INT_MASK;
-   }   
-   ar_flags |= SPL_ARRAY_USE_OTHER;
-   intern-array = *array;
-   } else {
-   if (Z_TYPE_PP(array) != IS_OBJECT  Z_TYPE_PP(array) != 
IS_ARRAY) {
-   php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
-   zend_throw_exception(spl_ce_InvalidArgumentException, 
Passed variable is not an array or object, using empty array instead, 0 
TSRMLS_CC);
-   return;
- 

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

2008-07-20 Thread Etienne Kneuss
colder  Sun Jul 20 16:32:55 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/splspl_array.c 
  Log:
  MFH: Fix build for solaris
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.16r2=1.71.2.17.2.13.2.17diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.16 
php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.17
--- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.16 Sat Jul 19 13:13:57 2008
+++ php-src/ext/spl/spl_array.c Sun Jul 20 16:32:55 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.71.2.17.2.13.2.16 2008/07/19 13:13:57 colder Exp $ */
+/* $Id: spl_array.c,v 1.71.2.17.2.13.2.17 2008/07/20 16:32:55 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -1176,7 +1176,7 @@
zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, Seek 
position %ld is out of range, opos);
 } /* }}} */
 
-int inline spl_array_object_count_elements_helper(spl_array_object *intern, 
long *count TSRMLS_DC) /* {{{ */
+int static spl_array_object_count_elements_helper(spl_array_object *intern, 
long *count TSRMLS_DC) /* {{{ */
 {
HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
HashPosition pos;



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



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

2008-07-19 Thread Etienne Kneuss
colder  Sat Jul 19 13:13:57 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/splspl_array.c 
  Log:
  MFH: Fix valgrind errors in array_method, and possibly #45349 (Thanks tony 
for the patch)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.15r2=1.71.2.17.2.13.2.16diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.15 
php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.16
--- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.15 Sun Jul  6 23:45:55 2008
+++ php-src/ext/spl/spl_array.c Sat Jul 19 13:13:57 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.71.2.17.2.13.2.15 2008/07/06 23:45:55 colder Exp $ */
+/* $Id: spl_array.c,v 1.71.2.17.2.13.2.16 2008/07/19 13:13:57 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -1242,21 +1242,23 @@
 {
spl_array_object *intern = 
(spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
-   zval tmp, *arg;
+   zval *tmp, *arg;

-   INIT_PZVAL(tmp);
-   Z_TYPE(tmp) = IS_ARRAY;
-   Z_ARRVAL(tmp) = aht;
+   MAKE_STD_ZVAL(tmp);
+   Z_TYPE_P(tmp) = IS_ARRAY;
+   Z_ARRVAL_P(tmp) = aht;

if (use_arg) {
if (ZEND_NUM_ARGS() != 1 || 
zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, 
z, arg) == FAILURE) {
zend_throw_exception(spl_ce_BadMethodCallException, 
Function expects exactly one argument, 0 TSRMLS_CC);
return;
}
-   zend_call_method(NULL, NULL, NULL, fname, fname_len, 
return_value_ptr, 2, tmp, arg TSRMLS_CC);
+   zend_call_method(NULL, NULL, NULL, fname, fname_len, 
return_value_ptr, 2, tmp, arg TSRMLS_CC);
} else {
-   zend_call_method(NULL, NULL, NULL, fname, fname_len, 
return_value_ptr, 1, tmp, NULL TSRMLS_CC);
+   zend_call_method(NULL, NULL, NULL, fname, fname_len, 
return_value_ptr, 1, tmp, NULL TSRMLS_CC);
}
+   Z_TYPE_P(tmp) = IS_NULL; /* we want to destroy the zval, not the 
hashtable */
+   zval_ptr_dtor(tmp);
 } /* }}} */
 
 #define SPL_ARRAY_METHOD(cname, fname, use_arg) \



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl spl_array.c spl_dllist.c spl_fixedarray.c spl_heap.c /ext/spl/tests array_024.phpt dllist_008.phpt fixedarray_018.phpt heap_010.phpt sxe_004.phpt sxe_005.phpt

2008-07-06 Thread Etienne Kneuss
colder  Sun Jul  6 23:45:56 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/spl/tests  array_024.phpt dllist_008.phpt 
fixedarray_018.phpt heap_010.phpt 

  Modified files:  
/php-src/ext/splspl_array.c spl_dllist.c spl_fixedarray.c 
spl_heap.c 
/php-src/ext/spl/tests  sxe_004.phpt sxe_005.phpt 
  Log:
  MFH: First part of count/handlers related fixes
  http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.14r2=1.71.2.17.2.13.2.15diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.14 
php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.15
--- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.14 Tue May  6 23:08:06 2008
+++ php-src/ext/spl/spl_array.c Sun Jul  6 23:45:55 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.71.2.17.2.13.2.14 2008/05/06 23:08:06 colder Exp $ */
+/* $Id: spl_array.c,v 1.71.2.17.2.13.2.15 2008/07/06 23:45:55 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -65,10 +65,11 @@
HashPosition  pos;
int   ar_flags;
int   is_self;
-   zend_function *   fptr_offset_get;
-   zend_function *   fptr_offset_set;
-   zend_function *   fptr_offset_has;
-   zend_function *   fptr_offset_del;
+   zend_function *fptr_offset_get;
+   zend_function *fptr_offset_set;
+   zend_function *fptr_offset_has;
+   zend_function *fptr_offset_del;
+   zend_function *fptr_count;
zend_class_entry* ce_get_iterator;
 } spl_array_object;
 
@@ -201,6 +202,10 @@
if (intern-fptr_offset_del-common.scope == parent) {
intern-fptr_offset_del = NULL;
}
+   zend_hash_find(class_type-function_table, count,
sizeof(count),(void **) intern-fptr_count);
+   if (intern-fptr_count-common.scope == parent) {
+   intern-fptr_count = NULL;
+   }
}
/* Cache iterator functions if ArrayIterator or derived. Check 
current's */
/* cache since only current is always required */
@@ -1171,9 +1176,8 @@
zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, Seek 
position %ld is out of range, opos);
 } /* }}} */
 
-int spl_array_object_count_elements(zval *object, long *count TSRMLS_DC) /* 
{{{ */
+int inline spl_array_object_count_elements_helper(spl_array_object *intern, 
long *count TSRMLS_DC) /* {{{ */
 {
-   spl_array_object *intern = 
(spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
HashPosition pos;
 
@@ -1200,14 +1204,37 @@
}
 } /* }}} */
 
+int spl_array_object_count_elements(zval *object, long *count TSRMLS_DC) /* 
{{{ */
+{
+   spl_array_object *intern = 
(spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
+
+   if (intern-fptr_count) {
+   zval *rv;
+   zend_call_method_with_0_params(object, intern-std.ce, 
intern-fptr_count, count, rv);
+   if (rv) {
+   zval_ptr_dtor(intern-retval);
+   MAKE_STD_ZVAL(intern-retval);
+   ZVAL_ZVAL(intern-retval, rv, 1, 1);
+   convert_to_long(intern-retval);
+   *count = (long) Z_LVAL_P(intern-retval);
+   return SUCCESS;
+   }
+   *count = 0;
+   return FAILURE;
+   }
+   return spl_array_object_count_elements_helper(intern, count TSRMLS_CC);
+} /* }}} */
+
 /* {{{ proto int ArrayObject::count()
proto int ArrayIterator::count()
  Return the number of elements in the Iterator. */
 SPL_METHOD(Array, count)
 {
long count;
+   spl_array_object *intern = 
(spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
+
+   spl_array_object_count_elements_helper(intern, count TSRMLS_CC);
 
-   spl_array_object_count_elements(getThis(), count TSRMLS_CC);
RETURN_LONG(count);
 } /* }}} */
 
@@ -1226,9 +1253,9 @@
zend_throw_exception(spl_ce_BadMethodCallException, 
Function expects exactly one argument, 0 TSRMLS_CC);
return;
}
-   zend_call_method(NULL, NULL, NULL, fname, fname_len, 
return_value, 2, tmp, arg TSRMLS_CC);
+   zend_call_method(NULL, NULL, NULL, fname, fname_len, 
return_value_ptr, 2, tmp, arg TSRMLS_CC);
} else {
-   zend_call_method(NULL, NULL, NULL, fname, fname_len, 
return_value, 1, tmp, NULL TSRMLS_CC);
+   zend_call_method(NULL, NULL, NULL, fname, fname_len, 
return_value_ptr, 1, tmp, NULL TSRMLS_CC);
}
 } /* }}} */
 

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl spl_array.c /ext/spl/tests bug38618.phpt

2008-05-06 Thread Etienne Kneuss
colder  Tue May  6 23:08:07 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/splspl_array.c 
/php-src/ext/spl/tests  bug38618.phpt 
  Log:
  Add consistency with the flag
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.13r2=1.71.2.17.2.13.2.14diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.13 
php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.14
--- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.13 Mon Feb  4 16:48:06 2008
+++ php-src/ext/spl/spl_array.c Tue May  6 23:08:06 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.71.2.17.2.13.2.13 2008/02/04 16:48:06 helly Exp $ */
+/* $Id: spl_array.c,v 1.71.2.17.2.13.2.14 2008/05/06 23:08:06 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -947,9 +947,6 @@
 
if (Z_TYPE_PP(array) == IS_ARRAY) {
SEPARATE_ZVAL_IF_NOT_REF(array);
-   if (ZEND_NUM_ARGS()  2) {
-   ar_flags |= SPL_ARRAY_CHILD_ARRAYS_ONLY;
-   }
}
 
if (ZEND_NUM_ARGS()  2) {
@@ -1737,11 +1734,12 @@
 
REGISTER_SPL_CLASS_CONST_LONG(ArrayObject,   STD_PROP_LIST,
SPL_ARRAY_STD_PROP_LIST);
REGISTER_SPL_CLASS_CONST_LONG(ArrayObject,   ARRAY_AS_PROPS,   
SPL_ARRAY_ARRAY_AS_PROPS);
-   REGISTER_SPL_CLASS_CONST_LONG(ArrayObject,   
CHILD_ARRAYS_ONLY,SPL_ARRAY_CHILD_ARRAYS_ONLY);
 
REGISTER_SPL_CLASS_CONST_LONG(ArrayIterator, STD_PROP_LIST,
SPL_ARRAY_STD_PROP_LIST);
REGISTER_SPL_CLASS_CONST_LONG(ArrayIterator, ARRAY_AS_PROPS,   
SPL_ARRAY_ARRAY_AS_PROPS);
-   REGISTER_SPL_CLASS_CONST_LONG(ArrayIterator, 
CHILD_ARRAYS_ONLY,SPL_ARRAY_CHILD_ARRAYS_ONLY);
+
+   REGISTER_SPL_CLASS_CONST_LONG(RecursiveArrayIterator, 
CHILD_ARRAYS_ONLY, SPL_ARRAY_CHILD_ARRAYS_ONLY);
+
return SUCCESS;
 }
 /* }}} */
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug38618.phpt?r1=1.1.2.1r2=1.1.2.2diff_format=u
Index: php-src/ext/spl/tests/bug38618.phpt
diff -u php-src/ext/spl/tests/bug38618.phpt:1.1.2.1 
php-src/ext/spl/tests/bug38618.phpt:1.1.2.2
--- php-src/ext/spl/tests/bug38618.phpt:1.1.2.1 Wed Dec  5 15:56:41 2007
+++ php-src/ext/spl/tests/bug38618.phpt Tue May  6 23:08:06 2008
@@ -81,8 +81,8 @@
 
 test_array($array, 'Protected Property');
 
-test_array($array, 'Public Property New', ArrayIterator::CHILD_ARRAYS_ONLY);
-test_array($array, 'Protected Property New', ArrayIterator::CHILD_ARRAYS_ONLY);
+test_array($array, 'Public Property New', 
RecursiveArrayIterator::CHILD_ARRAYS_ONLY);
+test_array($array, 'Protected Property New', 
RecursiveArrayIterator::CHILD_ARRAYS_ONLY);
 ?
 ===DONE===
 ?php exit(0); ?



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



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

2008-02-04 Thread Marcus Boerger
helly   Mon Feb  4 16:48:06 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/splspl_array.c 
  Log:
  - CS/WS
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.12r2=1.71.2.17.2.13.2.13diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.12 
php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.13
--- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.12 Mon Dec 31 07:17:14 2007
+++ php-src/ext/spl/spl_array.c Mon Feb  4 16:48:06 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.71.2.17.2.13.2.12 2007/12/31 07:17:14 sebastian Exp $ 
*/
+/* $Id: spl_array.c,v 1.71.2.17.2.13.2.13 2008/02/04 16:48:06 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -1214,7 +1214,7 @@
RETURN_LONG(count);
 } /* }}} */
 
-static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int 
fname_len, int use_arg)
+static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int 
fname_len, int use_arg) /* {{{ */
 {
spl_array_object *intern = 
(spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
@@ -1233,7 +1233,7 @@
} else {
zend_call_method(NULL, NULL, NULL, fname, fname_len, 
return_value, 1, tmp, NULL TSRMLS_CC);
}
-}
+} /* }}} */
 
 #define SPL_ARRAY_METHOD(cname, fname, use_arg) \
 SPL_METHOD(cname, fname) \
@@ -1483,7 +1483,6 @@
}
 
RETURN_NULL();
-   
 } /* }}} */
 
 /* {{{ proto void ArrayObject::unserialize(string serialized)

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



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

2007-12-17 Thread Marcus Boerger
helly   Mon Dec 17 13:46:28 2007 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/splspl_array.c 
  Log:
  - Fix folding
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.9r2=1.71.2.17.2.13.2.10diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.9 
php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.10
--- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.9  Sun Dec 16 18:31:07 2007
+++ php-src/ext/spl/spl_array.c Mon Dec 17 13:46:27 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.71.2.17.2.13.2.9 2007/12/16 18:31:07 bjori Exp $ */
+/* $Id: spl_array.c,v 1.71.2.17.2.13.2.10 2007/12/17 13:46:27 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -598,7 +598,7 @@
spl_array_unset_dimension_ex(0, getThis(), index TSRMLS_CC);
 } /* }}} */
 
-/* {{ proto array ArrayObject::getArrayCopy()
+/* {{{ proto array ArrayObject::getArrayCopy()
   proto array ArrayIterator::getArrayCopy()
  Return a copy of the contained array */
 SPL_METHOD(Array, getArrayCopy)

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



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

2007-12-17 Thread Ilia Alshanetsky
iliaa   Mon Dec 17 19:00:08 2007 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/splspl_array.c 
  Log:
  Kill unused vars
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.10r2=1.71.2.17.2.13.2.11diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.10 
php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.11
--- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.10 Mon Dec 17 13:46:27 2007
+++ php-src/ext/spl/spl_array.c Mon Dec 17 19:00:07 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.71.2.17.2.13.2.10 2007/12/17 13:46:27 helly Exp $ */
+/* $Id: spl_array.c,v 1.71.2.17.2.13.2.11 2007/12/17 19:00:07 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -1446,8 +1446,7 @@
zval *object = getThis();
spl_array_object *intern = 
(spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
-   zval **entry, members, *pmembers;
-   HashPosition  pos;
+   zval members, *pmembers;
php_serialize_data_t var_hash;
smart_str buf = {0};
 
@@ -1498,7 +1497,7 @@
int buf_len;
const unsigned char *p, *s;
php_unserialize_data_t var_hash;
-   zval *pentry, *pmembers, *pflags = NULL;
+   zval *pmembers, *pflags = NULL;
long flags;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, buf, 
buf_len) == FAILURE) {

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



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

2007-12-16 Thread Hannes Magnusson
bjori   Sun Dec 16 18:31:07 2007 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/splspl_array.c 
  Log:
  Fix typo
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.8r2=1.71.2.17.2.13.2.9diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.8 
php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.9
--- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.8  Wed Dec 12 03:29:31 2007
+++ php-src/ext/spl/spl_array.c Sun Dec 16 18:31:07 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.71.2.17.2.13.2.8 2007/12/12 03:29:31 davidc Exp $ */
+/* $Id: spl_array.c,v 1.71.2.17.2.13.2.9 2007/12/16 18:31:07 bjori Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -1269,7 +1269,7 @@
 /* {{{ proto int ArrayObject::natcasesort()
proto int ArrayIterator::natcasesort()
  Sort the entries by key using case insensitive natural order algorithm. */
-SPL_ARRAY_METHOD(Array, natcasesort, 0) /* }}} /
+SPL_ARRAY_METHOD(Array, natcasesort, 0) /* }}} */
 
 /* {{{ proto mixed|NULL ArrayIterator::current()
Return current array entry */

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



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

2007-12-11 Thread David Coallier
davidc  Wed Dec 12 03:29:32 2007 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/splspl_array.c 
  Log:
  - Nitpicking, using same code (without unicode handling) than in HEAD
just removed useless } else {
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.7r2=1.71.2.17.2.13.2.8diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.7 
php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.8
--- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.7  Fri Dec  7 13:33:10 2007
+++ php-src/ext/spl/spl_array.c Wed Dec 12 03:29:31 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.71.2.17.2.13.2.7 2007/12/07 13:33:10 rrichards Exp $ */
+/* $Id: spl_array.c,v 1.71.2.17.2.13.2.8 2007/12/12 03:29:31 davidc Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -1481,9 +1481,9 @@
 
if (buf.c) {
RETURN_STRINGL(buf.c, buf.len, 0);
-   } else {
-   RETURN_NULL();
}
+
+   RETURN_NULL();

 } /* }}} */
 

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



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

2007-12-07 Thread Rob Richards
rrichards   Fri Dec  7 13:33:11 2007 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/splspl_array.c 
  Log:
  fix win build
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.6r2=1.71.2.17.2.13.2.7diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.6 
php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.7
--- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.6  Thu Dec  6 16:04:17 2007
+++ php-src/ext/spl/spl_array.c Fri Dec  7 13:33:10 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.71.2.17.2.13.2.6 2007/12/06 16:04:17 helly Exp $ */
+/* $Id: spl_array.c,v 1.71.2.17.2.13.2.7 2007/12/07 13:33:10 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -1446,17 +1446,16 @@
zval *object = getThis();
spl_array_object *intern = 
(spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
+   zval **entry, members, *pmembers;
+   HashPosition  pos;
+   php_serialize_data_t var_hash;
+   smart_str buf = {0};
 
if (!aht) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, Array was modified 
outside object and is no longer an array);
return;
}
 
-   zval **entry, members, *pmembers;
-   HashPosition  pos;
-   php_serialize_data_t var_hash;
-   smart_str buf = {0};
-
PHP_VAR_SERIALIZE_INIT(var_hash);
 
/* storage */

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



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

2007-12-06 Thread Marcus Boerger
helly   Thu Dec  6 16:04:17 2007 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/splspl_array.c 
  Log:
  - Fix for #41528 (Classes extending ArrayObject do not serialize correctly)
  http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.5r2=1.71.2.17.2.13.2.6diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.5 
php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.6
--- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.5  Wed Dec  5 15:56:40 2007
+++ php-src/ext/spl/spl_array.c Thu Dec  6 16:04:17 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.71.2.17.2.13.2.5 2007/12/05 15:56:40 helly Exp $ */
+/* $Id: spl_array.c,v 1.71.2.17.2.13.2.6 2007/12/06 16:04:17 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -25,6 +25,8 @@
 #include php.h
 #include php_ini.h
 #include ext/standard/info.h
+#include ext/standard/php_var.h
+#include ext/standard/php_smart_str.h
 #include zend_interfaces.h
 #include zend_exceptions.h
 
@@ -54,7 +56,7 @@
 #define SPL_ARRAY_IS_SELF0x0200
 #define SPL_ARRAY_USE_OTHER  0x0400
 #define SPL_ARRAY_INT_MASK   0x
-#define SPL_ARRAY_CLONE_MASK 0x03FF
+#define SPL_ARRAY_CLONE_MASK 0x0300
 
 typedef struct _spl_array_object {
zend_object   std;
@@ -70,7 +72,7 @@
zend_class_entry* ce_get_iterator;
 } spl_array_object;
 
-static inline HashTable *spl_array_get_hash_table(spl_array_object* intern, 
int check_std_props TSRMLS_DC) {
+static inline HashTable *spl_array_get_hash_table(spl_array_object* intern, 
int check_std_props TSRMLS_DC) { /* {{{ */
if ((intern-ar_flags  SPL_ARRAY_IS_SELF) != 0) {
return intern-std.properties;
} else if ((intern-ar_flags  SPL_ARRAY_USE_OTHER)  (check_std_props 
== 0 || (intern-ar_flags  SPL_ARRAY_STD_PROP_LIST) == 0)  
Z_TYPE_P(intern-array) == IS_OBJECT) {
@@ -81,7 +83,7 @@
} else {
return HASH_OF(intern-array);
}
-}
+} /* }}} */
 
 SPL_API int spl_hash_verify_pos(spl_array_object * intern TSRMLS_DC) /* {{{ */
 {
@@ -1348,7 +1350,7 @@
 
spl_array_next(intern TSRMLS_CC);
 }
-/* }}} */
+/* }}} */ 
 
 /* {{{ proto bool ArrayIterator::valid()
Check whether array contains more entries */
@@ -1436,6 +1438,152 @@
 }
 /* }}} */
 
+/* {{{ proto string ArrayObject::serialize()
+ * serialize the object
+ */
+SPL_METHOD(Array, serialize)
+{
+   zval *object = getThis();
+   spl_array_object *intern = 
(spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
+   HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
+
+   if (!aht) {
+   php_error_docref(NULL TSRMLS_CC, E_NOTICE, Array was modified 
outside object and is no longer an array);
+   return;
+   }
+
+   zval **entry, members, *pmembers;
+   HashPosition  pos;
+   php_serialize_data_t var_hash;
+   smart_str buf = {0};
+
+   PHP_VAR_SERIALIZE_INIT(var_hash);
+
+   /* storage */
+   smart_str_appendl(buf, x:i:, 4);
+   smart_str_append_long(buf, (intern-ar_flags  SPL_ARRAY_CLONE_MASK));
+   smart_str_appendc(buf, ';');
+
+   if (!(intern-ar_flags  SPL_ARRAY_IS_SELF)) {
+   php_var_serialize(buf, intern-array, var_hash TSRMLS_CC);
+   smart_str_appendc(buf, ';');
+   }
+
+   /* members */
+   smart_str_appendl(buf, m:, 2);
+   INIT_PZVAL(members);
+   Z_ARRVAL(members) = intern-std.properties;
+   Z_TYPE(members) = IS_ARRAY;
+   pmembers = members;
+   php_var_serialize(buf, pmembers, var_hash TSRMLS_CC); /* finishes 
the string */
+
+   /* done */
+   PHP_VAR_SERIALIZE_DESTROY(var_hash);
+
+   if (buf.c) {
+   RETURN_STRINGL(buf.c, buf.len, 0);
+   } else {
+   RETURN_NULL();
+   }
+   
+} /* }}} */
+
+/* {{{ proto void ArrayObject::unserialize(string serialized)
+ * unserialize the object
+ */
+SPL_METHOD(Array, unserialize)
+{
+   spl_array_object *intern = 
(spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
+
+   char *buf;
+   int buf_len;
+   const unsigned char *p, *s;
+   php_unserialize_data_t var_hash;
+   zval *pentry, *pmembers, *pflags = NULL;
+   long flags;
+   
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, buf, 
buf_len) == FAILURE) {
+   return;
+   }
+
+   if (buf_len == 0) {
+   zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 
TSRMLS_CC, Empty serialized string cannot be empty);
+   return;
+   }
+
+   /* storage */
+   s = p = (const unsigned char*)buf;
+   PHP_VAR_UNSERIALIZE_INIT(var_hash);
+
+   if (*p!= 'x' || *++p != ':') {
+   goto outexcept;
+   }
+   ++p;
+
+  

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl spl_array.c /ext/spl/tests bug38618.phpt

2007-12-05 Thread Marcus Boerger
helly   Wed Dec  5 15:56:41 2007 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/spl/tests  bug38618.phpt 

  Modified files:  
/php-src/ext/splspl_array.c 
  Log:
  - Fixing #38618 by:
  - [DOC] ArrayIterator::CHILD_ARRAYS_ONLY, ArrayObject::CHILD_ARRAYS_ONLY
Passing this flag in the ctor prevents ArrayIterator from following
objects in ArrayObject::getIterator(), ArrayIterator::hasChildren(),
ArrayIterator::getChildren().
The exact behavior might change:
  - should the flag be set by default
  - should the flag be changed to have a negative effect
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.4r2=1.71.2.17.2.13.2.5diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.4 
php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.5
--- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.4  Fri Nov  2 19:40:38 2007
+++ php-src/ext/spl/spl_array.c Wed Dec  5 15:56:40 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.71.2.17.2.13.2.4 2007/11/02 19:40:38 jani Exp $ */
+/* $Id: spl_array.c,v 1.71.2.17.2.13.2.5 2007/12/05 15:56:40 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -44,6 +44,7 @@
 
 #define SPL_ARRAY_STD_PROP_LIST  0x0001
 #define SPL_ARRAY_ARRAY_AS_PROPS 0x0002
+#define SPL_ARRAY_CHILD_ARRAYS_ONLY  0x0004
 #define SPL_ARRAY_OVERLOADED_REWIND  0x0001
 #define SPL_ARRAY_OVERLOADED_VALID   0x0002
 #define SPL_ARRAY_OVERLOADED_KEY 0x0004
@@ -53,7 +54,7 @@
 #define SPL_ARRAY_IS_SELF0x0200
 #define SPL_ARRAY_USE_OTHER  0x0400
 #define SPL_ARRAY_INT_MASK   0x
-#define SPL_ARRAY_CLONE_MASK 0x0307
+#define SPL_ARRAY_CLONE_MASK 0x03FF
 
 typedef struct _spl_array_object {
zend_object   std;
@@ -119,7 +120,7 @@
 
 zend_object_iterator *spl_array_get_iterator(zend_class_entry *ce, zval 
*object, int by_ref TSRMLS_DC);
 
-/* {{{ spl_array_object_new */
+/* {{{ spl_array_object_new_ex */
 static zend_object_value spl_array_object_new_ex(zend_class_entry *class_type, 
spl_array_object **obj, zval *orig, int clone_orig TSRMLS_DC)
 {
zend_object_value retval;
@@ -944,6 +945,9 @@
 
if (Z_TYPE_PP(array) == IS_ARRAY) {
SEPARATE_ZVAL_IF_NOT_REF(array);
+   if (ZEND_NUM_ARGS()  2) {
+   ar_flags |= SPL_ARRAY_CHILD_ARRAYS_ONLY;
+   }
}
 
if (ZEND_NUM_ARGS()  2) {
@@ -997,7 +1001,7 @@
 
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
 }
-/* }}} */
+ /* }}} */
 
 /* {{{ proto void ArrayObject::setIteratorClass(string iterator_class)
Set the class used in getIterator. */
@@ -1238,32 +1242,32 @@
 /* {{{ proto int ArrayObject::asort()
proto int ArrayIterator::asort()
  Sort the entries by values. */
-SPL_ARRAY_METHOD(Array, asort, 0)
+SPL_ARRAY_METHOD(Array, asort, 0) /* }}} */
 
 /* {{{ proto int ArrayObject::ksort()
proto int ArrayIterator::ksort()
  Sort the entries by key. */
-SPL_ARRAY_METHOD(Array, ksort, 0)
+SPL_ARRAY_METHOD(Array, ksort, 0) /* }}} */
 
 /* {{{ proto int ArrayObject::uasort(callback cmp_function)
proto int ArrayIterator::uasort(callback cmp_function)
  Sort the entries by values user defined function. */
-SPL_ARRAY_METHOD(Array, uasort, 1)
+SPL_ARRAY_METHOD(Array, uasort, 1) /* }}} */
 
 /* {{{ proto int ArrayObject::uksort(callback cmp_function)
proto int ArrayIterator::uksort(callback cmp_function)
  Sort the entries by key using user defined function. */
-SPL_ARRAY_METHOD(Array, uksort, 1)
+SPL_ARRAY_METHOD(Array, uksort, 1) /* }}} */
 
 /* {{{ proto int ArrayObject::natsort()
proto int ArrayIterator::natsort()
  Sort the entries by values using natural order algorithm. */
-SPL_ARRAY_METHOD(Array, natsort, 0)
+SPL_ARRAY_METHOD(Array, natsort, 0) /* }}} */
 
 /* {{{ proto int ArrayObject::natcasesort()
proto int ArrayIterator::natcasesort()
  Sort the entries by key using case insensitive natural order algorithm. */
-SPL_ARRAY_METHOD(Array, natcasesort, 0)
+SPL_ARRAY_METHOD(Array, natcasesort, 0) /* }}} /
 
 /* {{{ proto mixed|NULL ArrayIterator::current()
Return current array entry */
@@ -1296,7 +1300,7 @@
 SPL_METHOD(Array, key)
 {
spl_array_iterator_key(getThis(), return_value TSRMLS_CC);
-}
+} /* }}} */
 
 void spl_array_iterator_key(zval *object, zval *return_value TSRMLS_DC) /* {{{ 
*/
 {
@@ -1390,7 +1394,7 @@
RETURN_FALSE;
}
 
-   RETURN_BOOL(Z_TYPE_PP(entry) == IS_ARRAY || Z_TYPE_PP(entry) == 
IS_OBJECT);
+   RETURN_BOOL(Z_TYPE_PP(entry) == IS_ARRAY || (Z_TYPE_PP(entry) == 
IS_OBJECT  (intern-ar_flags  SPL_ARRAY_CHILD_ARRAYS_ONLY) == 0));
 }
 /* }}} */
 
@@ -1416,17 +1420,23 @@
return;
}
 
-   if (Z_TYPE_PP(entry) 

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl spl_array.c /ext/spl/tests bug42654.phpt

2007-10-17 Thread Marcus Boerger
helly   Thu Oct 18 03:55:43 2007 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/spl/tests  bug42654.phpt 

  Modified files:  
/php-src/ext/splspl_array.c 
  Log:
  - Fix #42654 (maybe also a bunch of others)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.2r2=1.71.2.17.2.13.2.3diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.2 
php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.3
--- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.2  Sun Oct  7 05:22:06 2007
+++ php-src/ext/spl/spl_array.c Thu Oct 18 03:55:42 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.71.2.17.2.13.2.2 2007/10/07 05:22:06 davidw Exp $ */
+/* $Id: spl_array.c,v 1.71.2.17.2.13.2.3 2007/10/18 03:55:42 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -1365,7 +1365,7 @@
Create a sub iterator for the current element (same class as $this) */
 SPL_METHOD(Array, getChildren)
 {
-   zval *object = getThis(), **entry;
+   zval *object = getThis(), **entry, *flags;
spl_array_object *intern = 
(spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
 
@@ -1387,7 +1387,10 @@
RETURN_ZVAL(*entry, 0, 0);
}
 
-   spl_instantiate_arg_ex1(Z_OBJCE_P(getThis()), return_value, 0, *entry 
TSRMLS_CC);
+  MAKE_STD_ZVAL(flags);
+  ZVAL_LONG(flags, SPL_ARRAY_USE_OTHER);
+   spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), return_value, 0, *entry, 
flags TSRMLS_CC);
+   zval_ptr_dtor(flags);
 }
 /* }}} */
 

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug42654.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/bug42654.phpt
+++ php-src/ext/spl/tests/bug42654.phpt

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