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

2007-11-13 Thread Etienne Kneuss
colder  Tue Nov 13 23:37:09 2007 UTC

  Modified files:  
/php-src/ext/soap   soap.c 
  Log:
  Fix typos
  
http://cvs.php.net/viewvc.cgi/php-src/ext/soap/soap.c?r1=1.237r2=1.238diff_format=u
Index: php-src/ext/soap/soap.c
diff -u php-src/ext/soap/soap.c:1.237 php-src/ext/soap/soap.c:1.238
--- php-src/ext/soap/soap.c:1.237   Tue Nov 13 15:10:28 2007
+++ php-src/ext/soap/soap.c Tue Nov 13 23:37:09 2007
@@ -17,7 +17,7 @@
   |  Dmitry Stogov [EMAIL PROTECTED] |
   +--+
 */
-/* $Id: soap.c,v 1.237 2007/11/13 15:10:28 dmitry Exp $ */
+/* $Id: soap.c,v 1.238 2007/11/13 23:37:09 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -2671,7 +2671,7 @@
client-uri = 
soap_unicode_to_string(Z_USTRVAL_PP(tmp), Z_USTRLEN_PP(tmp) TSRMLS_CC);
}
} else {
-   php_error_docref(NULL TSRMLS_CC, E_ERROR, 
'uri' option is requred in nonWSDL mode);
+   php_error_docref(NULL TSRMLS_CC, E_ERROR, 
'uri' option is required in nonWSDL mode);
return;
}
 
@@ -2701,7 +2701,7 @@
client-location = 
soap_unicode_to_string(Z_USTRVAL_PP(tmp), Z_USTRLEN_PP(tmp) TSRMLS_CC);
}
} else if (wsdl == NULL) {
-   php_error_docref(NULL TSRMLS_CC, E_ERROR, 'location' 
option is requred in nonWSDL mode);
+   php_error_docref(NULL TSRMLS_CC, E_ERROR, 'location' 
option is required in nonWSDL mode);
return;
}
 
@@ -2854,7 +2854,7 @@
}
 
} else if (wsdl == NULL) {
-   php_error_docref(NULL TSRMLS_CC, E_ERROR, 'location' and 'uri' 
options are requred in nonWSDL mode);
+   php_error_docref(NULL TSRMLS_CC, E_ERROR, 'location' and 'uri' 
options are required in nonWSDL mode);
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/soap soap.c

2007-11-13 Thread Etienne Kneuss
colder  Tue Nov 13 23:44:29 2007 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/soap   soap.c 
  Log:
  MFH: fix typos
  
http://cvs.php.net/viewvc.cgi/php-src/ext/soap/soap.c?r1=1.156.2.28.2.30.2.7r2=1.156.2.28.2.30.2.8diff_format=u
Index: php-src/ext/soap/soap.c
diff -u php-src/ext/soap/soap.c:1.156.2.28.2.30.2.7 
php-src/ext/soap/soap.c:1.156.2.28.2.30.2.8
--- php-src/ext/soap/soap.c:1.156.2.28.2.30.2.7 Tue Nov 13 15:10:16 2007
+++ php-src/ext/soap/soap.c Tue Nov 13 23:44:28 2007
@@ -17,7 +17,7 @@
   |  Dmitry Stogov [EMAIL PROTECTED] |
   +--+
 */
-/* $Id: soap.c,v 1.156.2.28.2.30.2.7 2007/11/13 15:10:16 dmitry Exp $ */
+/* $Id: soap.c,v 1.156.2.28.2.30.2.8 2007/11/13 23:44:28 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -2310,7 +2310,7 @@
Z_TYPE_PP(tmp) == IS_STRING) {
add_property_stringl(this_ptr, uri, 
Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
} else {
-   php_error_docref(NULL TSRMLS_CC, E_ERROR, 
'uri' option is requred in nonWSDL mode);
+   php_error_docref(NULL TSRMLS_CC, E_ERROR, 
'uri' option is required in nonWSDL mode);
return;
}
 
@@ -2336,7 +2336,7 @@
Z_TYPE_PP(tmp) == IS_STRING) {
add_property_stringl(this_ptr, location, 
Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
} else if (wsdl == NULL) {
-   php_error_docref(NULL TSRMLS_CC, E_ERROR, 'location' 
option is requred in nonWSDL mode);
+   php_error_docref(NULL TSRMLS_CC, E_ERROR, 'location' 
option is required in nonWSDL mode);
return;
}
 
@@ -2464,7 +2464,7 @@
}
 
} else if (wsdl == NULL) {
-   php_error_docref(NULL TSRMLS_CC, E_ERROR, 'location' and 'uri' 
options are requred in nonWSDL mode);
+   php_error_docref(NULL TSRMLS_CC, E_ERROR, 'location' and 'uri' 
options are required in nonWSDL mode);
return;
}
 

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

2007-12-14 Thread Etienne Kneuss
colder  Fri Dec 14 22:52:53 2007 UTC

  Modified files:  
/php-src/ext/splspl_array.c 
  Log:
  Fix folding
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.132r2=1.133diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.132 php-src/ext/spl/spl_array.c:1.133
--- php-src/ext/spl/spl_array.c:1.132   Thu Oct 18 05:19:13 2007
+++ php-src/ext/spl/spl_array.c Fri Dec 14 22:52:53 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.132 2007/10/18 05:19:13 helly Exp $ */
+/* $Id: spl_array.c,v 1.133 2007/12/14 22:52:53 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -1232,31 +1232,37 @@
proto int ArrayIterator::asort() U
  Sort the entries by values. */
 SPL_ARRAY_METHOD(Array, asort, 0)
+/* }}} */
 
 /* {{{ proto int ArrayObject::ksort() U
proto int ArrayIterator::ksort() U
  Sort the entries by key. */
 SPL_ARRAY_METHOD(Array, ksort, 0)
+/* }}} */
 
 /* {{{ proto int ArrayObject::uasort(callback cmp_function) U
proto int ArrayIterator::uasort(callback cmp_function) U
  Sort the entries by values user defined function. */
 SPL_ARRAY_METHOD(Array, uasort, 1)
+/* }}} */
 
 /* {{{ proto int ArrayObject::uksort(callback cmp_function) U
proto int ArrayIterator::uksort(callback cmp_function) U
  Sort the entries by key using user defined function. */
 SPL_ARRAY_METHOD(Array, uksort, 1)
+/* }}} */
 
 /* {{{ proto int ArrayObject::natsort() U
proto int ArrayIterator::natsort() U
  Sort the entries by values using natural order algorithm. */
 SPL_ARRAY_METHOD(Array, natsort, 0)
+/* }}} */
 
 /* {{{ proto int ArrayObject::natcasesort() U
proto int ArrayIterator::natcasesort() U
  Sort the entries by key using case insensitive natural order algorithm. */
 SPL_ARRAY_METHOD(Array, natcasesort, 0)
+/* }}} */
 
 /* {{{ proto mixed|NULL ArrayIterator::current() U
Return current array entry */
@@ -1324,6 +1330,7 @@
 {
spl_array_iterator_key(getThis(), return_value TSRMLS_CC);
 }
+/* }}} */
 
 /* {{{ proto void ArrayIterator::next() U
Move to next 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 CREDITS config.m4 config.w32 php_spl.c spl_dllist.c spl_dllist.h /ext/spl/tests dllist_001.phpt dllist_002.phpt dllist_003.phpt dllist_004.phpt dllist_005.php

2008-01-15 Thread Etienne Kneuss
colder  Tue Jan 15 09:38:15 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/splspl_dllist.c spl_dllist.h 
/php-src/ext/spl/tests  dllist_001.phpt dllist_002.phpt 
dllist_003.phpt dllist_004.phpt 
dllist_005.phpt dllist_006.phpt 

  Modified files:  
/php-src/ext/splCREDITS config.m4 config.w32 php_spl.c 
  Log:
  MFH: Implement splDoublyLinkedList, splQueue, splStack classes in SPL
  http://cvs.php.net/viewvc.cgi/php-src/ext/spl/CREDITS?r1=1.1.1.1r2=1.1.1.1.8.1diff_format=u
Index: php-src/ext/spl/CREDITS
diff -u php-src/ext/spl/CREDITS:1.1.1.1 php-src/ext/spl/CREDITS:1.1.1.1.8.1
--- php-src/ext/spl/CREDITS:1.1.1.1 Thu May  1 23:28:28 2003
+++ php-src/ext/spl/CREDITS Tue Jan 15 09:38:15 2008
@@ -1,2 +1,2 @@
 SPL
-Marcus Boerger
+Marcus Boerger, Etienne Kneuss
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/config.m4?r1=1.13.2.4.2.3r2=1.13.2.4.2.3.2.1diff_format=u
Index: php-src/ext/spl/config.m4
diff -u php-src/ext/spl/config.m4:1.13.2.4.2.3 
php-src/ext/spl/config.m4:1.13.2.4.2.3.2.1
--- php-src/ext/spl/config.m4:1.13.2.4.2.3  Mon Dec  4 18:01:53 2006
+++ php-src/ext/spl/config.m4   Tue Jan 15 09:38:15 2008
@@ -1,4 +1,4 @@
-dnl $Id: config.m4,v 1.13.2.4.2.3 2006/12/04 18:01:53 tony2001 Exp $
+dnl $Id: config.m4,v 1.13.2.4.2.3.2.1 2008/01/15 09:38:15 colder Exp $
 dnl config.m4 for extension SPL
 
 PHP_ARG_ENABLE(spl, enable SPL suppport,
@@ -26,7 +26,7 @@
   CPPFLAGS=$old_CPPFLAGS
   AC_DEFINE_UNQUOTED(HAVE_PACKED_OBJECT_VALUE, $ac_result, [Whether struct 
_zend_object_value is packed])
   AC_DEFINE(HAVE_SPL, 1, [Whether you want SPL (Standard PHP Library) 
support]) 
-  PHP_NEW_EXTENSION(spl, php_spl.c spl_functions.c spl_engine.c 
spl_iterators.c spl_array.c spl_directory.c spl_sxe.c spl_exceptions.c 
spl_observer.c, no)
-  PHP_INSTALL_HEADERS([ext/spl], [php_spl.h spl_array.h spl_directory.h 
spl_engine.h spl_exceptions.h spl_functions.h spl_iterators.h spl_observer.h 
spl_sxe.h])
+  PHP_NEW_EXTENSION(spl, php_spl.c spl_functions.c spl_engine.c 
spl_iterators.c spl_array.c spl_directory.c spl_sxe.c spl_exceptions.c 
spl_observer.c spl_dllist.c, no)
+  PHP_INSTALL_HEADERS([ext/spl], [php_spl.h spl_array.h spl_directory.h 
spl_engine.h spl_exceptions.h spl_functions.h spl_iterators.h spl_observer.h 
spl_sxe.h spl_dllist.h])
   PHP_ADD_EXTENSION_DEP(spl, pcre, true)
 fi
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/config.w32?r1=1.7r2=1.7.6.1diff_format=u
Index: php-src/ext/spl/config.w32
diff -u php-src/ext/spl/config.w32:1.7 php-src/ext/spl/config.w32:1.7.6.1
--- php-src/ext/spl/config.w32:1.7  Tue Feb  8 20:42:47 2005
+++ php-src/ext/spl/config.w32  Tue Jan 15 09:38:15 2008
@@ -1,4 +1,4 @@
-// $Id: config.w32,v 1.7 2005/02/08 20:42:47 helly Exp $
+// $Id: config.w32,v 1.7.6.1 2008/01/15 09:38:15 colder Exp $
 // vim:ft=javascript
 
 ARG_ENABLE(spl, SPL (Standard PHP Library) support, yes);
@@ -7,6 +7,6 @@
if (PHP_SPL_SHARED) {
ERROR(SPL cannot be compiled as a shared ext);
}
-   EXTENSION(spl, php_spl.c spl_functions.c spl_engine.c 
spl_iterators.c spl_array.c spl_directory.c spl_sxe.c spl_exceptions.c 
spl_observer.c);
+   EXTENSION(spl, php_spl.c spl_functions.c spl_engine.c 
spl_iterators.c spl_array.c spl_directory.c spl_sxe.c spl_exceptions.c 
spl_observer.c spl_dllist.c);
AC_DEFINE('HAVE_SPL', 1);
 }
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.52.2.28.2.17.2.6r2=1.52.2.28.2.17.2.7diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.52.2.28.2.17.2.6 
php-src/ext/spl/php_spl.c:1.52.2.28.2.17.2.7
--- php-src/ext/spl/php_spl.c:1.52.2.28.2.17.2.6Mon Dec 31 07:17:14 2007
+++ php-src/ext/spl/php_spl.c   Tue Jan 15 09:38:15 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.52.2.28.2.17.2.6 2007/12/31 07:17:14 sebastian Exp $ */
+/* $Id: php_spl.c,v 1.52.2.28.2.17.2.7 2008/01/15 09:38:15 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -35,6 +35,7 @@
 #include spl_sxe.h
 #include spl_exceptions.h
 #include spl_observer.h
+#include spl_dllist.h
 #include zend_exceptions.h
 #include zend_interfaces.h
 #include ext/standard/md5.h
@@ -160,6 +161,9 @@
SPL_ADD_CLASS(AppendIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(ArrayIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(ArrayObject, z_list, sub, allow, ce_flags); \
+   SPL_ADD_CLASS(SplDoublyLinkedList, z_list, sub, allow, ce_flags); \
+   SPL_ADD_CLASS(SplQueue, z_list, sub, allow, ce_flags); \
+   SPL_ADD_CLASS(SplStack, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(BadFunctionCallException, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(BadMethodCallException, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(CachingIterator, z_list, sub, allow

[PHP-CVS] cvs: php-src /ext/spl spl_dllist.h

2008-01-15 Thread Etienne Kneuss
colder  Tue Jan 15 09:44:01 2008 UTC

  Modified files:  
/php-src/ext/splspl_dllist.h 
  Log:
  Bump year
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_dllist.h?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/spl/spl_dllist.h
diff -u php-src/ext/spl/spl_dllist.h:1.1 php-src/ext/spl/spl_dllist.h:1.2
--- php-src/ext/spl/spl_dllist.h:1.1Tue Jan 15 09:37:50 2008
+++ php-src/ext/spl/spl_dllist.hTue Jan 15 09:44:01 2008
@@ -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_dllist.h,v 1.1 2008/01/15 09:37:50 colder Exp $ */
+/* $Id: spl_dllist.h,v 1.2 2008/01/15 09:44:01 colder Exp $ */
 
 #ifndef SPL_DLLIST_H
 #define SPL_DLLIST_H

-- 
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_dllist.h

2008-01-15 Thread Etienne Kneuss
colder  Tue Jan 15 09:44:07 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/splspl_dllist.h 
  Log:
  MFH: Bump year
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_dllist.h?r1=1.1.2.2r2=1.1.2.3diff_format=u
Index: php-src/ext/spl/spl_dllist.h
diff -u php-src/ext/spl/spl_dllist.h:1.1.2.2 
php-src/ext/spl/spl_dllist.h:1.1.2.3
--- php-src/ext/spl/spl_dllist.h:1.1.2.2Tue Jan 15 09:38:15 2008
+++ php-src/ext/spl/spl_dllist.hTue Jan 15 09:44:07 2008
@@ -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_dllist.h,v 1.1.2.2 2008/01/15 09:38:15 colder Exp $ */
+/* $Id: spl_dllist.h,v 1.1.2.3 2008/01/15 09:44:07 colder Exp $ */
 
 #ifndef SPL_DLLIST_H
 #define SPL_DLLIST_H

-- 
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_dllist.c /ext/spl/tests dllist_001.phpt dllist_004.phpt dllist_005.phpt

2008-01-15 Thread Etienne Kneuss
colder  Tue Jan 15 12:17:35 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/splspl_dllist.c 
/php-src/ext/spl/tests  dllist_001.phpt dllist_004.phpt 
dllist_005.phpt 
  Log:
  Fix ZTS build, fix tests
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_dllist.c?r1=1.1.2.2r2=1.1.2.3diff_format=u
Index: php-src/ext/spl/spl_dllist.c
diff -u php-src/ext/spl/spl_dllist.c:1.1.2.2 
php-src/ext/spl/spl_dllist.c:1.1.2.3
--- php-src/ext/spl/spl_dllist.c:1.1.2.2Tue Jan 15 09:38:15 2008
+++ php-src/ext/spl/spl_dllist.cTue Jan 15 12:17:35 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_dllist.c,v 1.1.2.2 2008/01/15 09:38:15 colder Exp $ */
+/* $Id: spl_dllist.c,v 1.1.2.3 2008/01/15 12:17:35 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -668,7 +668,7 @@
}
 
intern = (spl_dllist_object*)zend_object_store_get_object(getThis() 
TSRMLS_CC);
-   index  = spl_dllist_offset_convert(zindex);
+   index  = spl_dllist_offset_convert(zindex TSRMLS_CC);
 
RETURN_BOOL(index = 0  index  intern-llist-count);
 } /* }}} */
@@ -687,7 +687,7 @@
}
 
intern = (spl_dllist_object*)zend_object_store_get_object(getThis() 
TSRMLS_CC);
-   index  = spl_dllist_offset_convert(zindex);
+   index  = spl_dllist_offset_convert(zindex TSRMLS_CC);
 
 if (index  0 || index = intern-llist-count) {
zend_throw_exception(spl_ce_OutOfRangeException, Offset out of 
range, 0 TSRMLS_CC);
@@ -727,7 +727,7 @@
long   index;
spl_ptr_llist_element *element;
 
-   index = spl_dllist_offset_convert(zindex);
+   index = spl_dllist_offset_convert(zindex TSRMLS_CC);
 
if (index  0 || index = intern-llist-count) {
zend_throw_exception(spl_ce_OutOfRangeException, 
Offset out of range, 0 TSRMLS_CC);
@@ -763,7 +763,7 @@
}
 
intern = (spl_dllist_object*)zend_object_store_get_object(getThis() 
TSRMLS_CC);
-   index  = (int)spl_dllist_offset_convert(zindex);
+   index  = (int)spl_dllist_offset_convert(zindex TSRMLS_CC);
 llist  = intern-llist;
 
 if (index  0 || index = intern-llist-count) {
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/dllist_001.phpt?r1=1.1.2.2r2=1.1.2.3diff_format=u
Index: php-src/ext/spl/tests/dllist_001.phpt
diff -u php-src/ext/spl/tests/dllist_001.phpt:1.1.2.2 
php-src/ext/spl/tests/dllist_001.phpt:1.1.2.3
--- php-src/ext/spl/tests/dllist_001.phpt:1.1.2.2   Tue Jan 15 09:38:15 2008
+++ php-src/ext/spl/tests/dllist_001.phpt   Tue Jan 15 12:17:35 2008
@@ -2,6 +2,8 @@
 SPL: DoublyLinkedList: std operations
 --SKIPIF--
 ?php if (!extension_loaded(spl)) print skip; ?
+--INI--
+allow_call_time_pass_reference=1
 --FILE--
 ?php
 $dll = new SplDoublyLinkedList();
@@ -59,9 +61,6 @@
 ===DONE===
 ?php exit(0); ?
 --EXPECTF--
-Warning: Call-time pass-by-reference has been deprecated; If you would like to 
pass it by reference, modify the declaration of [runtime function name]().  If 
you would like to enable call-time pass-by-reference, you can set 
allow_call_time_pass_reference to true in your INI file in %s on line %d
-
-Warning: Call-time pass-by-reference has been deprecated; If you would like to 
pass it by reference, modify the declaration of [runtime function name]().  If 
you would like to enable call-time pass-by-reference, you can set 
allow_call_time_pass_reference to true in your INI file in %s on line %d
 Exception: Can't pop from an empty datastructure
 Exception: Can't shift from an empty datastructure
 3
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/dllist_004.phpt?r1=1.1.2.2r2=1.1.2.3diff_format=u
Index: php-src/ext/spl/tests/dllist_004.phpt
diff -u php-src/ext/spl/tests/dllist_004.phpt:1.1.2.2 
php-src/ext/spl/tests/dllist_004.phpt:1.1.2.3
--- php-src/ext/spl/tests/dllist_004.phpt:1.1.2.2   Tue Jan 15 09:38:15 2008
+++ php-src/ext/spl/tests/dllist_004.phpt   Tue Jan 15 12:17:35 2008
@@ -2,6 +2,8 @@
 SPL: DoublyLinkedList: Stacks
 --SKIPIF--
 ?php if (!extension_loaded(spl)) print skip; ?
+--INI--
+allow_call_time_pass_reference=1
 --FILE--
 ?php
 $stack = new SplStack();
@@ -53,7 +55,6 @@
 ===DONE===
 ?php exit(0); ?
 --EXPECTF--
-Warning: Call-time pass-by-reference has been deprecated; If you would like to 
pass it by reference, modify the declaration of [runtime function name]().  If 
you would like to enable call-time pass-by-reference, you can set 
allow_call_time_pass_reference to true in your INI file in %s on line %d
 Exception: Can't pop from an empty datastructure
 Exception: Can't shift from an empty datastructure
 3
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/dllist_005.phpt?r1=1.1.2.2r2=1.1.2.3diff_format=u
Index: php-src/ext/spl/tests/dllist_005.phpt
diff -u php-src/ext/spl/tests/dllist_005.phpt:1.1.2.2 

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

2008-01-15 Thread Etienne Kneuss
colder  Tue Jan 15 12:17:09 2008 UTC

  Modified files:  
/php-src/ext/splspl_dllist.c 
  Log:
  Fix ZTS build
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_dllist.c?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/spl/spl_dllist.c
diff -u php-src/ext/spl/spl_dllist.c:1.1 php-src/ext/spl/spl_dllist.c:1.2
--- php-src/ext/spl/spl_dllist.c:1.1Tue Jan 15 09:37:50 2008
+++ php-src/ext/spl/spl_dllist.cTue Jan 15 12:17:09 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_dllist.c,v 1.1 2008/01/15 09:37:50 colder Exp $ */
+/* $Id: spl_dllist.c,v 1.2 2008/01/15 12:17:09 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -671,7 +671,7 @@
}
 
intern = (spl_dllist_object*)zend_object_store_get_object(getThis() 
TSRMLS_CC);
-   index  = spl_dllist_offset_convert(zindex);
+   index  = spl_dllist_offset_convert(zindex TSRMLS_CC);
 
RETURN_BOOL(index = 0  index  intern-llist-count);
 } /* }}} */
@@ -690,7 +690,7 @@
}
 
intern = (spl_dllist_object*)zend_object_store_get_object(getThis() 
TSRMLS_CC);
-   index  = spl_dllist_offset_convert(zindex);
+   index  = spl_dllist_offset_convert(zindex TSRMLS_CC);
 
 if (index  0 || index = intern-llist-count) {
zend_throw_exception(spl_ce_OutOfRangeException, Offset out of 
range, 0 TSRMLS_CC);
@@ -730,7 +730,7 @@
long   index;
spl_ptr_llist_element *element;
 
-   index = spl_dllist_offset_convert(zindex);
+   index = spl_dllist_offset_convert(zindex TSRMLS_CC);
 
if (index  0 || index = intern-llist-count) {
zend_throw_exception(spl_ce_OutOfRangeException, 
Offset out of range, 0 TSRMLS_CC);
@@ -766,7 +766,7 @@
}
 
intern = (spl_dllist_object*)zend_object_store_get_object(getThis() 
TSRMLS_CC);
-   index  = (int)spl_dllist_offset_convert(zindex);
+   index  = (int)spl_dllist_offset_convert(zindex TSRMLS_CC);
 llist  = intern-llist;
 
 if (index  0 || index = intern-llist-count) {

-- 
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_dllist.c /ext/spl/tests dllist_006.phpt

2008-01-20 Thread Etienne Kneuss
colder  Sun Jan 20 13:26:03 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/splspl_dllist.c 
/php-src/ext/spl/tests  dllist_006.phpt 
  Log:
  MFH: Fix mem errors
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_dllist.c?r1=1.1.2.4r2=1.1.2.5diff_format=u
Index: php-src/ext/spl/spl_dllist.c
diff -u php-src/ext/spl/spl_dllist.c:1.1.2.4 
php-src/ext/spl/spl_dllist.c:1.1.2.5
--- php-src/ext/spl/spl_dllist.c:1.1.2.4Tue Jan 15 15:46:20 2008
+++ php-src/ext/spl/spl_dllist.cSun Jan 20 13:26:03 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_dllist.c,v 1.1.2.4 2008/01/15 15:46:20 rrichards Exp $ */
+/* $Id: spl_dllist.c,v 1.1.2.5 2008/01/20 13:26:03 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -39,18 +39,12 @@
 PHPAPI zend_class_entry  *spl_ce_SplQueue;
 PHPAPI zend_class_entry  *spl_ce_SplStack;
 
-#define SPL_LLIST_DELREF(elem, dtor) if(!--(elem)-rc) { \
-   if(dtor) { \
-   dtor(elem); \
-   } \
+#define SPL_LLIST_DELREF(elem) if(!--(elem)-rc) { \
efree(elem); \
elem = NULL; \
 }
 
-#define SPL_LLIST_CHECK_DELREF(elem, dtor) if((elem)  !--(elem)-rc) { \
-   if(dtor) { \
-   dtor(elem); \
-   } \
+#define SPL_LLIST_CHECK_DELREF(elem) if((elem)  !--(elem)-rc) { \
efree(elem); \
elem = NULL; \
 }
@@ -113,7 +107,11 @@
 
 /* {{{  spl_ptr_llist */
 static void spl_ptr_llist_zval_dtor(spl_ptr_llist_element *elem) { /* {{{ */
-   zval_ptr_dtor((zval **)elem-data);
+   if (elem-data) {
+   zval_ptr_dtor((zval **)elem-data);
+   elem-data = NULL;
+   }
+
 }
 /* }}} */
 
@@ -148,7 +146,10 @@
 
while (current) {
next = current-next;
-   SPL_LLIST_DELREF(current, dtor);
+   if(current  dtor) {
+   dtor(current);
+   }
+   SPL_LLIST_DELREF(current);
current = next;
}
 
@@ -225,7 +226,6 @@
 {
void *data;
spl_ptr_llist_element*tail = llist-tail;
-   spl_ptr_llist_dtor_func   dtor = NULL;
 
if (tail == NULL) {
return NULL;
@@ -240,8 +240,9 @@
llist-tail = tail-prev;
llist-count--;
data = tail-data;
+   tail-data = NULL;
 
-   SPL_LLIST_DELREF(tail, dtor);
+   SPL_LLIST_DELREF(tail);
 
return data;
 }
@@ -275,7 +276,6 @@
 {
void*data;
spl_ptr_llist_element   *head = llist-head;
-   spl_ptr_llist_dtor_func  dtor = NULL;
 
if (head == NULL) {
return NULL;
@@ -290,8 +290,9 @@
llist-head = head-next;
llist-count--;
data = head-data;
+   head-data = NULL;
 
-   SPL_LLIST_DELREF(head, dtor);
+   SPL_LLIST_DELREF(head);
 
return data;
 }
@@ -664,8 +665,7 @@
return Z_LVAL_P(offset);
}
}
-   zend_throw_exception(spl_ce_OutOfRangeException, Invalid offset, 0 
TSRMLS_CC);
-   return 0;
+   return -1;
 } 
 /* }}} */
 
@@ -704,7 +704,7 @@
index  = spl_dllist_offset_convert(zindex TSRMLS_CC);
 
 if (index  0 || index = intern-llist-count) {
-   zend_throw_exception(spl_ce_OutOfRangeException, Offset out of 
range, 0 TSRMLS_CC);
+   zend_throw_exception(spl_ce_OutOfRangeException, Offset 
invalid or out of range, 0 TSRMLS_CC);
return;
}
 
@@ -744,7 +744,7 @@
index = spl_dllist_offset_convert(zindex TSRMLS_CC);
 
if (index  0 || index = intern-llist-count) {
-   zend_throw_exception(spl_ce_OutOfRangeException, 
Offset out of range, 0 TSRMLS_CC);
+   zend_throw_exception(spl_ce_OutOfRangeException, 
Offset invalid or out of range, 0 TSRMLS_CC);
return;
}
 
@@ -804,7 +804,11 @@
}
/* finally, delete the element */
llist-count--;
-   SPL_LLIST_DELREF(element, llist-dtor);
+
+   if(llist-dtor) {
+   llist-dtor(element);
+   }
+   SPL_LLIST_DELREF(element);
} else {
zend_throw_exception(spl_ce_OutOfRangeException, Offset 
invalid, 0 TSRMLS_CC);
return;
@@ -815,7 +819,7 @@
 {
spl_dllist_it *iterator = (spl_dllist_it *)iter;
 
-   SPL_LLIST_CHECK_DELREF(iterator-traverse_pointer, 
iterator-object-llist-dtor);
+   SPL_LLIST_CHECK_DELREF(iterator-traverse_pointer);
 
zend_user_it_invalidate_current(iter TSRMLS_CC);
zval_ptr_dtor((zval**)iterator-intern.it.data);
@@ -838,7 +842,7 @@
spl_dllist_it *iterator = (spl_dllist_it *)iter;
spl_ptr_llist_element *element  = iterator-traverse_pointer;
 
-   if (element == NULL) {
+  

[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/spl spl.php /ext/spl/internal spldoublylinkedlist.inc splqueue.inc splstack.inc

2008-01-21 Thread Etienne Kneuss
colder  Mon Jan 21 21:55:55 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/spl/internal   spldoublylinkedlist.inc splqueue.inc 
splstack.inc 

  Modified files:  
/php-srcNEWS 
/php-src/ext/splspl.php 
  Log:
  MFH: Add doxygen docs for SplDoublyLinkedList, SplStack, SplQueue
  http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.81r2=1.2027.2.547.2.965.2.82diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.81 
php-src/NEWS:1.2027.2.547.2.965.2.82
--- php-src/NEWS:1.2027.2.547.2.965.2.81Mon Jan 21 19:39:55 2008
+++ php-src/NEWSMon Jan 21 21:55:54 2008
@@ -41,6 +41,7 @@
 - Added + and * specifiers to zend_parse_parameters(). (Andrei)
 - Added DateTime::setTimestamp() to set a unix timestamp without
   invoking the date parser. (Scott)
+- Added SplDoublyLinkedList, SplStack, SplQueue classes. (Etienne)
 
 - Removed the experimental RPL (master/slave) functions from mysqli. (Andrey)
 
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl.php?r1=1.49.2.11.2.7r2=1.49.2.11.2.7.2.1diff_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.7.2.1
--- 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 Jan 21 21:55:55 2008
@@ -105,13 +105,21 @@
  * - interface SplSubject
  * - class SplObjectStorage
  *
- * 8) @ref Examples
+ * 8) Datastructures
+ *
+ * SPL proposes a set of datastructures implemented internally.
+ *
+ * - class SplDoublyLinkedList
+ * - class SplStack extends SplDoublyLinkedList
+ * - class SplQueue extends SplDoublyLinkedList
+ *
+ * 9) @ref Examples
  *
  * 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:
+ * 10) 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
  * - a 
href=http://www.ramikayyali.com/archives/2005/02/25/iterators;Iterators in 
PHP5/a
@@ -120,13 +128,13 @@
  * - a 
href=http://www.devshed.com/c/a/PHP/The-Standard-PHP-Library-Part-2/;The 
Standard PHP Library, Part 2/a
  * - a 
href=http://www.professionelle-softwareentwicklung-mit-php5.de/erste_auflage/oop.iterators.spl.html;Die
 Standard PHP Library (SPL) [german]/a
  *
- * 10) Talks on SPL:
+ * 11) Talks on SPL:
  * - SPL Update a 
href=http://talks.somabo.de/200702_vancouver_spl_update.pps;[pps]/a, a 
href=http://talks.somabo.de/200702_vancouver_spl_update.pdf;[pdf]/a
  * - Happy SPLing a 
href=http://talks.somabo.de/200509_toronto_happy_spling.pps;[pps]/a, a 
href=http://talks.somabo.de/200509_toronto_happy_spling.pdf;[pdf]/a
  * - From engine overloading to SPL a 
href=http://talks.somabo.de/200505_cancun_from_engine_overloading_to_spl.pps;[pps]/a,
 a 
href=http://talks.somabo.de/200505_cancun_from_engine_overloading_to_spl.pdf;[pdf]/a
  * - SPL for the masses a 
href=http://talks.somabo.de/200504_php_quebec_spl_for_the_masses.pps;[pps]/a,
 a 
href=http://talks.somabo.de/200504_php_quebec_spl_for_the_masses.pdf;[pdf]/a
  *
- * 11) Debug sessions:
+ * 12) Debug sessions:
  * - Debug session 1 a 
href=200407_oscon_introduction_to_iterators_debug.pps[pps]/a, a 
href=200407_oscon_introduction_to_iterators_debug.pdf[pdf]/a
  * - 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

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/internal/spldoublylinkedlist.inc?view=markuprev=1.1
Index: php-src/ext/spl/internal/spldoublylinkedlist.inc
+++ php-src/ext/spl/internal/spldoublylinkedlist.inc
?php

/** @file spldoublylinkedlist.inc
 * @ingroup SPL
 * @brief class SplDoublyLinkedList
 * @author  Etienne Kneuss
 * @date2008
 *
 * SPL - Standard PHP Library
 */

/** @ingroup SPL
 * @brief Doubly Linked List
 * @since PHP 5.3
 *
 * The SplDoublyLinkedList class provides the main functionnalities of a
 * doubly linked list (DLL).
 */
class SplDoublyLinkedList implements Traversable, ArrayAccess, Countable
{

/** Iterator mode
 * @see setIteratorMode
 */
const IT_MODE_LIFO = 0x0001;

/** Iterator mode
 * @see setIteratorMode
 */
const IT_MODE_FIFO = 0x;


/** Iterator mode
 * @see

[PHP-CVS] cvs: php-src /ext/spl spl_dllist.c /ext/spl/tests dllist_007.phpt

2008-01-26 Thread Etienne Kneuss
colder  Sat Jan 26 18:06:51 2008 UTC

  Added files: 
/php-src/ext/spl/tests  dllist_007.phpt 

  Modified files:  
/php-src/ext/splspl_dllist.c 
  Log:
  Iterator implementation for SplDoublyLinkedList, SplStack, SplQueue
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_dllist.c?r1=1.5r2=1.6diff_format=u
Index: php-src/ext/spl/spl_dllist.c
diff -u php-src/ext/spl/spl_dllist.c:1.5 php-src/ext/spl/spl_dllist.c:1.6
--- php-src/ext/spl/spl_dllist.c:1.5Tue Jan 22 19:51:11 2008
+++ php-src/ext/spl/spl_dllist.cSat Jan 26 18:06:51 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_dllist.c,v 1.5 2008/01/22 19:51:11 colder Exp $ */
+/* $Id: spl_dllist.c,v 1.6 2008/01/26 18:06:51 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -877,6 +877,67 @@
 }
 /* }}} */
 
+static void spl_dllist_it_helper_rewind(spl_ptr_llist_element 
**traverse_pointer_ptr, int *traverse_position_ptr, spl_ptr_llist *llist, int 
flags TSRMLS_DC) /* {{{ */
+{
+   SPL_LLIST_CHECK_DELREF(*traverse_pointer_ptr);
+
+   if (flags  SPL_DLLIST_IT_LIFO) {
+   *traverse_position_ptr = llist-count-1;
+   *traverse_pointer_ptr  = llist-tail;
+   } else {
+   *traverse_position_ptr = 0;
+   *traverse_pointer_ptr  = llist-head;
+   }
+
+   SPL_LLIST_CHECK_ADDREF(*traverse_pointer_ptr);
+}
+/* }}} */
+
+static void spl_dllist_it_helper_move_forward(spl_ptr_llist_element 
**traverse_pointer_ptr, int *traverse_position_ptr, spl_ptr_llist *llist, int 
flags TSRMLS_DC) /* {{{ */
+{
+   if (*traverse_pointer_ptr) {
+   spl_ptr_llist_element *old = *traverse_pointer_ptr;
+
+   if (flags  SPL_DLLIST_IT_LIFO) {
+   *traverse_pointer_ptr = old-prev;
+   (*traverse_position_ptr)--;
+
+   if (flags  SPL_DLLIST_IT_DELETE) {
+   zval *prev = (zval *)spl_ptr_llist_pop(llist);
+
+   if (prev) {
+   zval_ptr_dtor((zval **)prev);
+   }
+   }
+   } else {
+   *traverse_pointer_ptr = old-next;
+   (*traverse_position_ptr)++;
+
+   if (flags  SPL_DLLIST_IT_DELETE) {
+   zval *prev = (zval *)spl_ptr_llist_shift(llist);
+
+   if (prev) {
+   zval_ptr_dtor((zval **)prev);
+   }
+   }
+   }
+
+   SPL_LLIST_DELREF(old);
+   SPL_LLIST_CHECK_ADDREF(*traverse_pointer_ptr);
+   }
+}
+/* }}} */
+
+static void spl_dllist_it_rewind(zend_object_iterator *iter TSRMLS_DC) /* {{{ 
*/
+{
+   spl_dllist_it *iterator = (spl_dllist_it *)iter;
+   spl_dllist_object *object   = iterator-object;
+   spl_ptr_llist *llist= object-llist;
+
+   spl_dllist_it_helper_rewind(iterator-traverse_pointer, 
iterator-traverse_position, llist, object-flags TSRMLS_CC);
+}
+/* }}} */
+
 static int spl_dllist_it_valid(zend_object_iterator *iter TSRMLS_DC) /* {{{ */
 {
spl_dllist_it *iterator = (spl_dllist_it *)iter;
@@ -915,56 +976,63 @@
 
zend_user_it_invalidate_current(iter TSRMLS_CC);
 
-   if (iterator-traverse_pointer) {
-   spl_ptr_llist_element *old = iterator-traverse_pointer;
+   spl_dllist_it_helper_move_forward(iterator-traverse_pointer, 
iterator-traverse_position, object-llist, object-flags TSRMLS_CC);
+}
+/* }}} */
 
-   if (iterator-flags  SPL_DLLIST_IT_LIFO) {
-   iterator-traverse_pointer = old-prev;
-   iterator-traverse_position--;
+/* {{{  proto int SplDoublyLinkedList::key() U
+   Return current array key */
+SPL_METHOD(SplDoublyLinkedList, key)
+{
+   spl_dllist_object *intern = 
(spl_dllist_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
 
-   if (iterator-flags  SPL_DLLIST_IT_DELETE) {
-   zval *prev = (zval 
*)spl_ptr_llist_pop(object-llist);
+   RETURN_LONG(intern-traverse_position);
+}
+/* }}} */
 
-   if (prev) {
-   zval_ptr_dtor((zval **)prev);
-   }
-   }
-   } else {
-   iterator-traverse_pointer = old-next;
-   iterator-traverse_position++;
+/* {{{ proto void SplDoublyLinkedList::next() U
+   Move to next entry */
+SPL_METHOD(SplDoublyLinkedList, next)
+{
+   spl_dllist_object *intern = 
(spl_dllist_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
 
-   if (iterator-flags  SPL_DLLIST_IT_DELETE) {
-   

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

2008-01-26 Thread Etienne Kneuss
colder  Sat Jan 26 23:04:43 2008 UTC

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

  Modified files:  
/php-src/ext/splspl_dllist.c 
  Log:
  MFH: Iterator implementation in SplDoublyLinkedList, SplStack, SplQueue
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_dllist.c?r1=1.1.2.6r2=1.1.2.7diff_format=u
Index: php-src/ext/spl/spl_dllist.c
diff -u php-src/ext/spl/spl_dllist.c:1.1.2.6 
php-src/ext/spl/spl_dllist.c:1.1.2.7
--- php-src/ext/spl/spl_dllist.c:1.1.2.6Tue Jan 22 19:55:31 2008
+++ php-src/ext/spl/spl_dllist.cSat Jan 26 23:04:43 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_dllist.c,v 1.1.2.6 2008/01/22 19:55:31 colder Exp $ */
+/* $Id: spl_dllist.c,v 1.1.2.7 2008/01/26 23:04:43 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -874,6 +874,67 @@
 }
 /* }}} */
 
+static void spl_dllist_it_helper_rewind(spl_ptr_llist_element 
**traverse_pointer_ptr, int *traverse_position_ptr, spl_ptr_llist *llist, int 
flags TSRMLS_DC) /* {{{ */
+{
+   SPL_LLIST_CHECK_DELREF(*traverse_pointer_ptr);
+
+   if (flags  SPL_DLLIST_IT_LIFO) {
+   *traverse_position_ptr = llist-count-1;
+   *traverse_pointer_ptr  = llist-tail;
+   } else {
+   *traverse_position_ptr = 0;
+   *traverse_pointer_ptr  = llist-head;
+   }
+
+   SPL_LLIST_CHECK_ADDREF(*traverse_pointer_ptr);
+}
+/* }}} */
+
+static void spl_dllist_it_helper_move_forward(spl_ptr_llist_element 
**traverse_pointer_ptr, int *traverse_position_ptr, spl_ptr_llist *llist, int 
flags TSRMLS_DC) /* {{{ */
+{
+   if (*traverse_pointer_ptr) {
+   spl_ptr_llist_element *old = *traverse_pointer_ptr;
+
+   if (flags  SPL_DLLIST_IT_LIFO) {
+   *traverse_pointer_ptr = old-prev;
+   (*traverse_position_ptr)--;
+
+   if (flags  SPL_DLLIST_IT_DELETE) {
+   zval *prev = (zval *)spl_ptr_llist_pop(llist);
+
+   if (prev) {
+   zval_ptr_dtor((zval **)prev);
+   }
+   }
+   } else {
+   *traverse_pointer_ptr = old-next;
+   (*traverse_position_ptr)++;
+
+   if (flags  SPL_DLLIST_IT_DELETE) {
+   zval *prev = (zval *)spl_ptr_llist_shift(llist);
+
+   if (prev) {
+   zval_ptr_dtor((zval **)prev);
+   }
+   }
+   }
+
+   SPL_LLIST_DELREF(old);
+   SPL_LLIST_CHECK_ADDREF(*traverse_pointer_ptr);
+   }
+}
+/* }}} */
+
+static void spl_dllist_it_rewind(zend_object_iterator *iter TSRMLS_DC) /* {{{ 
*/
+{
+   spl_dllist_it *iterator = (spl_dllist_it *)iter;
+   spl_dllist_object *object   = iterator-object;
+   spl_ptr_llist *llist= object-llist;
+
+   spl_dllist_it_helper_rewind(iterator-traverse_pointer, 
iterator-traverse_position, llist, object-flags TSRMLS_CC);
+}
+/* }}} */
+
 static int spl_dllist_it_valid(zend_object_iterator *iter TSRMLS_DC) /* {{{ */
 {
spl_dllist_it *iterator = (spl_dllist_it *)iter;
@@ -912,56 +973,63 @@
 
zend_user_it_invalidate_current(iter TSRMLS_CC);
 
-   if (iterator-traverse_pointer) {
-   spl_ptr_llist_element *old = iterator-traverse_pointer;
+   spl_dllist_it_helper_move_forward(iterator-traverse_pointer, 
iterator-traverse_position, object-llist, object-flags TSRMLS_CC);
+}
+/* }}} */
 
-   if (iterator-flags  SPL_DLLIST_IT_LIFO) {
-   iterator-traverse_pointer = old-prev;
-   iterator-traverse_position--;
+/* {{{  proto int SplDoublyLinkedList::key() U
+   Return current array key */
+SPL_METHOD(SplDoublyLinkedList, key)
+{
+   spl_dllist_object *intern = 
(spl_dllist_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
 
-   if (iterator-flags  SPL_DLLIST_IT_DELETE) {
-   zval *prev = (zval 
*)spl_ptr_llist_pop(object-llist);
+   RETURN_LONG(intern-traverse_position);
+}
+/* }}} */
 
-   if (prev) {
-   zval_ptr_dtor((zval **)prev);
-   }
-   }
-   } else {
-   iterator-traverse_pointer = old-next;
-   iterator-traverse_position++;
+/* {{{ proto void SplDoublyLinkedList::next() U
+   Move to next entry */
+SPL_METHOD(SplDoublyLinkedList, next)
+{
+   spl_dllist_object *intern = 
(spl_dllist_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
 
-   if 

[PHP-CVS] cvs: php-src /ext/spl spl_dllist.c /ext/spl/internal spldoublylinkedlist.inc splqueue.inc splstack.inc /ext/spl/tests dllist_003.phpt

2008-01-27 Thread Etienne Kneuss
colder  Sun Jan 27 13:54:32 2008 UTC

  Modified files:  
/php-src/ext/splspl_dllist.c 
/php-src/ext/spl/tests  dllist_003.phpt 
/php-src/ext/spl/internal   spldoublylinkedlist.inc splqueue.inc 
splstack.inc 
  Log:
  -Pointer doesn't move if we're moving forward and shifting at the same time
  -Userland implementation
  -Doxygen doc
  http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_dllist.c?r1=1.6r2=1.7diff_format=u
Index: php-src/ext/spl/spl_dllist.c
diff -u php-src/ext/spl/spl_dllist.c:1.6 php-src/ext/spl/spl_dllist.c:1.7
--- php-src/ext/spl/spl_dllist.c:1.6Sat Jan 26 18:06:51 2008
+++ php-src/ext/spl/spl_dllist.cSun Jan 27 13:54:32 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_dllist.c,v 1.6 2008/01/26 18:06:51 colder Exp $ */
+/* $Id: spl_dllist.c,v 1.7 2008/01/27 13:54:32 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -911,14 +911,14 @@
}
} else {
*traverse_pointer_ptr = old-next;
-   (*traverse_position_ptr)++;
-
if (flags  SPL_DLLIST_IT_DELETE) {
zval *prev = (zval *)spl_ptr_llist_shift(llist);
 
if (prev) {
zval_ptr_dtor((zval **)prev);
}
+   } else {
+   (*traverse_position_ptr)++;
}
}
 
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/dllist_003.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/spl/tests/dllist_003.phpt
diff -u php-src/ext/spl/tests/dllist_003.phpt:1.1 
php-src/ext/spl/tests/dllist_003.phpt:1.2
--- php-src/ext/spl/tests/dllist_003.phpt:1.1   Tue Jan 15 09:37:50 2008
+++ php-src/ext/spl/tests/dllist_003.phpt   Sun Jan 27 13:54:32 2008
@@ -39,7 +39,7 @@
 2=4
 int(3)
 0=2
-1=3
-2=4
+0=3
+0=4
 int(0)
 ===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/internal/spldoublylinkedlist.inc?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/spl/internal/spldoublylinkedlist.inc
diff -u php-src/ext/spl/internal/spldoublylinkedlist.inc:1.1 
php-src/ext/spl/internal/spldoublylinkedlist.inc:1.2
--- php-src/ext/spl/internal/spldoublylinkedlist.inc:1.1Mon Jan 21 
21:54:00 2008
+++ php-src/ext/spl/internal/spldoublylinkedlist.incSun Jan 27 13:54:32 2008
@@ -1,5 +1,4 @@
 ?php
-
 /** @file spldoublylinkedlist.inc
  * @ingroup SPL
  * @brief class SplDoublyLinkedList
@@ -13,23 +12,29 @@
  * @brief Doubly Linked List
  * @since PHP 5.3
  *
- * The SplDoublyLinkedList class provides the main functionnalities of a
+ * The SplDoublyLinkedList class provides the main functionalities of a
  * doubly linked list (DLL).
+ * @note The following userland implementation of Iterator is a bit different
+ *from the internal one. Internally, iterators generated by nested 
+ *foreachs are independant, while they share the same traverse pointer 
+ *in userland.
  */
-class SplDoublyLinkedList implements Traversable, ArrayAccess, Countable
+class SplDoublyLinkedList implements Iterator, ArrayAccess, Countable
 {
+   protected $_llist   = array();
+   protected $_it_mode = 0;
+   protected $_it_pos  = 0;
 
/** Iterator mode
 * @see setIteratorMode
 */
-   const IT_MODE_LIFO = 0x0001;
+   const IT_MODE_LIFO = 0x0002;
 
/** Iterator mode
 * @see setIteratorMode
 */
const IT_MODE_FIFO = 0x;
 
-
/** Iterator mode
 * @see setIteratorMode
 */
@@ -38,41 +43,75 @@
/** Iterator mode
 * @see setIteratorMode
 */
-   const IT_MODE_DELETE   = 0x0002;
+   const IT_MODE_DELETE   = 0x0001;
 
/** @return the element popped from the end of the DLL.
+* @throw RuntimeException If the datastructure is empty.
 */
-   function pop() {/**/}
+   public function pop()
+   {
+   if (count($this-_llist) == 0) {
+   throw new RuntimeException(Can't pop from an empty 
datastructure);
+   }
+   return array_pop($this-_llist);
+   }
 
/** @return the element shifted from the beginning of the DLL.
+* @throw RuntimeException If the datastructure is empty.
 */
-   function shift() {/**/}
+   public function shift()
+   {
+   if (count($this-_llist) == 0) {
+   throw new RuntimeException(Can't shift from an empty 
datastructure);
+   }
+   return array_shift($this-_llist);
+   }
 
/** Pushes an element to the end of the DLL.
 * @param $data variable to add to the DLL.
 */
-   function push($data) {/**/}
+   public function 

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl/internal spldoublylinkedlist.inc

2008-01-27 Thread Etienne Kneuss
colder  Sun Jan 27 14:08:06 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/spl/internal   spldoublylinkedlist.inc 
  Log:
  MFH: Typo
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/internal/spldoublylinkedlist.inc?r1=1.1.2.3r2=1.1.2.4diff_format=u
Index: php-src/ext/spl/internal/spldoublylinkedlist.inc
diff -u php-src/ext/spl/internal/spldoublylinkedlist.inc:1.1.2.3 
php-src/ext/spl/internal/spldoublylinkedlist.inc:1.1.2.4
--- php-src/ext/spl/internal/spldoublylinkedlist.inc:1.1.2.3Sun Jan 27 
13:59:51 2008
+++ php-src/ext/spl/internal/spldoublylinkedlist.incSun Jan 27 14:08:06 2008
@@ -16,7 +16,7 @@
  * doubly linked list (DLL).
  * @note The following userland implementation of Iterator is a bit different
  *from the internal one. Internally, iterators generated by nested 
- *foreachs are independant, while they share the same traverse pointer 
+ *foreachs are independent, while they share the same traverse pointer 
  *in userland.
  */
 class SplDoublyLinkedList implements Iterator, ArrayAccess, Countable

-- 
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_dllist.c /ext/spl/internal spldoublylinkedlist.inc splqueue.inc splstack.inc /ext/spl/tests dllist_003.phpt

2008-01-27 Thread Etienne Kneuss
colder  Sun Jan 27 13:59:51 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/splspl_dllist.c 
/php-src/ext/spl/tests  dllist_003.phpt 
/php-src/ext/spl/internal   spldoublylinkedlist.inc splqueue.inc 
splstack.inc 
  Log:
  MFH: -Pointer doesn't move if we're moving forward and shifting at the same 
time
  -Userland implementation
  -Doxygen doc
  http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_dllist.c?r1=1.1.2.7r2=1.1.2.8diff_format=u
Index: php-src/ext/spl/spl_dllist.c
diff -u php-src/ext/spl/spl_dllist.c:1.1.2.7 
php-src/ext/spl/spl_dllist.c:1.1.2.8
--- php-src/ext/spl/spl_dllist.c:1.1.2.7Sat Jan 26 23:04:43 2008
+++ php-src/ext/spl/spl_dllist.cSun Jan 27 13:59:51 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_dllist.c,v 1.1.2.7 2008/01/26 23:04:43 colder Exp $ */
+/* $Id: spl_dllist.c,v 1.1.2.8 2008/01/27 13:59:51 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -908,7 +908,6 @@
}
} else {
*traverse_pointer_ptr = old-next;
-   (*traverse_position_ptr)++;
 
if (flags  SPL_DLLIST_IT_DELETE) {
zval *prev = (zval *)spl_ptr_llist_shift(llist);
@@ -916,6 +915,8 @@
if (prev) {
zval_ptr_dtor((zval **)prev);
}
+   } else {
+   (*traverse_position_ptr)++;
}
}
 
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/dllist_003.phpt?r1=1.1.2.2r2=1.1.2.3diff_format=u
Index: php-src/ext/spl/tests/dllist_003.phpt
diff -u php-src/ext/spl/tests/dllist_003.phpt:1.1.2.2 
php-src/ext/spl/tests/dllist_003.phpt:1.1.2.3
--- php-src/ext/spl/tests/dllist_003.phpt:1.1.2.2   Tue Jan 15 09:38:15 2008
+++ php-src/ext/spl/tests/dllist_003.phpt   Sun Jan 27 13:59:51 2008
@@ -39,7 +39,7 @@
 2=4
 int(3)
 0=2
-1=3
-2=4
+0=3
+0=4
 int(0)
 ===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/internal/spldoublylinkedlist.inc?r1=1.1.2.2r2=1.1.2.3diff_format=u
Index: php-src/ext/spl/internal/spldoublylinkedlist.inc
diff -u php-src/ext/spl/internal/spldoublylinkedlist.inc:1.1.2.2 
php-src/ext/spl/internal/spldoublylinkedlist.inc:1.1.2.3
--- php-src/ext/spl/internal/spldoublylinkedlist.inc:1.1.2.2Mon Jan 21 
21:55:55 2008
+++ php-src/ext/spl/internal/spldoublylinkedlist.incSun Jan 27 13:59:51 2008
@@ -1,5 +1,4 @@
 ?php
-
 /** @file spldoublylinkedlist.inc
  * @ingroup SPL
  * @brief class SplDoublyLinkedList
@@ -13,23 +12,29 @@
  * @brief Doubly Linked List
  * @since PHP 5.3
  *
- * The SplDoublyLinkedList class provides the main functionnalities of a
+ * The SplDoublyLinkedList class provides the main functionalities of a
  * doubly linked list (DLL).
+ * @note The following userland implementation of Iterator is a bit different
+ *from the internal one. Internally, iterators generated by nested 
+ *foreachs are independant, while they share the same traverse pointer 
+ *in userland.
  */
-class SplDoublyLinkedList implements Traversable, ArrayAccess, Countable
+class SplDoublyLinkedList implements Iterator, ArrayAccess, Countable
 {
+   protected $_llist   = array();
+   protected $_it_mode = 0;
+   protected $_it_pos  = 0;
 
/** Iterator mode
 * @see setIteratorMode
 */
-   const IT_MODE_LIFO = 0x0001;
+   const IT_MODE_LIFO = 0x0002;
 
/** Iterator mode
 * @see setIteratorMode
 */
const IT_MODE_FIFO = 0x;
 
-
/** Iterator mode
 * @see setIteratorMode
 */
@@ -38,41 +43,75 @@
/** Iterator mode
 * @see setIteratorMode
 */
-   const IT_MODE_DELETE   = 0x0002;
+   const IT_MODE_DELETE   = 0x0001;
 
/** @return the element popped from the end of the DLL.
+* @throw RuntimeException If the datastructure is empty.
 */
-   function pop() {/**/}
+   public function pop()
+   {
+   if (count($this-_llist) == 0) {
+   throw new RuntimeException(Can't pop from an empty 
datastructure);
+   }
+   return array_pop($this-_llist);
+   }
 
/** @return the element shifted from the beginning of the DLL.
+* @throw RuntimeException If the datastructure is empty.
 */
-   function shift() {/**/}
+   public function shift()
+   {
+   if (count($this-_llist) == 0) {
+   throw new RuntimeException(Can't shift from an empty 
datastructure);
+   }
+   return array_shift($this-_llist);
+   }
 
/** Pushes an element to the end of the DLL.
 * @param 

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

2008-02-10 Thread Etienne Kneuss
colder  Sun Feb 10 14:07:40 2008 UTC

  Modified files:  
/php-src/ext/splspl_dllist.c 
  Log:
  Cosmetics, move stuff around, ws
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_dllist.c?r1=1.7r2=1.8diff_format=u
Index: php-src/ext/spl/spl_dllist.c
diff -u php-src/ext/spl/spl_dllist.c:1.7 php-src/ext/spl/spl_dllist.c:1.8
--- php-src/ext/spl/spl_dllist.c:1.7Sun Jan 27 13:54:32 2008
+++ php-src/ext/spl/spl_dllist.cSun Feb 10 14:07:40 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_dllist.c,v 1.7 2008/01/27 13:54:32 colder Exp $ */
+/* $Id: spl_dllist.c,v 1.8 2008/02/10 14:07:40 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -314,25 +314,6 @@
 }
 /* }}} */
 
-static void spl_dllist_object_free_storage(void *object TSRMLS_DC) /* {{{ */
-{
-   spl_dllist_object *intern = (spl_dllist_object *)object;
-   zval  *tmp= NULL;
-
-   zend_object_std_dtor(intern-std TSRMLS_CC);
-
-   while(intern-llist-count  0) {
-   tmp = (zval *)spl_ptr_llist_pop(intern-llist);
-   zval_ptr_dtor(tmp);
-   }
-
-   spl_ptr_llist_destroy(intern-llist);
-   zval_ptr_dtor(intern-retval);
-
-   efree(object);
-}
-/* }}} */
-
 static void spl_ptr_llist_copy(spl_ptr_llist *from, spl_ptr_llist *to) /* {{{ 
*/
 {
spl_ptr_llist_element   *current = from-head, *next;
@@ -356,6 +337,25 @@
 
 zend_object_iterator *spl_dllist_get_iterator(zend_class_entry *ce, zval 
*object, int by_ref TSRMLS_DC);
 
+static void spl_dllist_object_free_storage(void *object TSRMLS_DC) /* {{{ */
+{
+   spl_dllist_object *intern = (spl_dllist_object *)object;
+   zval  *tmp= NULL;
+
+   zend_object_std_dtor(intern-std TSRMLS_CC);
+
+   while(intern-llist-count  0) {
+   tmp = (zval *)spl_ptr_llist_pop(intern-llist);
+   zval_ptr_dtor(tmp);
+   }
+
+   spl_ptr_llist_destroy(intern-llist);
+   zval_ptr_dtor(intern-retval);
+
+   efree(object);
+}
+/* }}} */
+
 static zend_object_value spl_dllist_object_new_ex(zend_class_entry 
*class_type, spl_dllist_object **obj, zval *orig, int clone_orig TSRMLS_DC) /* 
{{{ */
 {
zend_object_value  retval;
@@ -1056,13 +1056,13 @@
return NULL;
}
 
-   iterator = emalloc(sizeof(spl_dllist_it));
-
Z_ADDREF_P(object);
-   iterator-intern.it.data = (void*)object;
-   iterator-intern.it.funcs = spl_dllist_it_funcs;
-   iterator-intern.ce = ce;
-   iterator-intern.value = NULL;
+
+   iterator = emalloc(sizeof(spl_dllist_it));
+   iterator-intern.it.data = (void*)object;
+   iterator-intern.it.funcs= spl_dllist_it_funcs;
+   iterator-intern.ce  = ce;
+   iterator-intern.value   = NULL;
iterator-traverse_position  = dllist_object-traverse_position;
iterator-traverse_pointer   = dllist_object-traverse_pointer;
iterator-flags  = dllist_object-flags  
SPL_DLLIST_IT_MASK;

-- 
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_dllist.c

2008-02-11 Thread Etienne Kneuss
colder  Mon Feb 11 16:39:20 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/splspl_dllist.c 
  Log:
  MFH: Provide ctod/dtor with TSRM
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_dllist.c?r1=1.1.2.9r2=1.1.2.10diff_format=u
Index: php-src/ext/spl/spl_dllist.c
diff -u php-src/ext/spl/spl_dllist.c:1.1.2.9 
php-src/ext/spl/spl_dllist.c:1.1.2.10
--- php-src/ext/spl/spl_dllist.c:1.1.2.9Mon Feb 11 13:59:23 2008
+++ php-src/ext/spl/spl_dllist.cMon Feb 11 16:39:20 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_dllist.c,v 1.1.2.9 2008/02/11 13:59:23 colder Exp $ */
+/* $Id: spl_dllist.c,v 1.1.2.10 2008/02/11 16:39:20 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -30,7 +30,6 @@
 #include spl_functions.h
 #include spl_engine.h
 #include spl_iterators.h
-#include spl_array.h
 #include spl_dllist.h
 #include spl_exceptions.h
 
@@ -68,8 +67,8 @@
void  *data;
 } spl_ptr_llist_element;
 
-typedef void (*spl_ptr_llist_dtor_func)(spl_ptr_llist_element *);
-typedef void (*spl_ptr_llist_ctor_func)(spl_ptr_llist_element *);
+typedef void (*spl_ptr_llist_dtor_func)(spl_ptr_llist_element * TSRMLS_DC);
+typedef void (*spl_ptr_llist_ctor_func)(spl_ptr_llist_element * TSRMLS_DC);
 
 typedef struct _spl_ptr_llist {
spl_ptr_llist_element   *head;
@@ -106,14 +105,14 @@
 };
 
 /* {{{  spl_ptr_llist */
-static void spl_ptr_llist_zval_dtor(spl_ptr_llist_element *elem) { /* {{{ */
+static void spl_ptr_llist_zval_dtor(spl_ptr_llist_element *elem TSRMLS_DC) { 
/* {{{ */
if (elem-data) {
zval_ptr_dtor((zval **)elem-data);
}
 }
 /* }}} */
 
-static void spl_ptr_llist_zval_ctor(spl_ptr_llist_element *elem) { /* {{{ */
+static void spl_ptr_llist_zval_ctor(spl_ptr_llist_element *elem TSRMLS_DC) { 
/* {{{ */
Z_ADDREF_P((zval *)elem-data);
 }
 /* }}} */
@@ -138,7 +137,7 @@
 }
 /* }}} */
 
-static void spl_ptr_llist_destroy(spl_ptr_llist *llist) /* {{{ */
+static void spl_ptr_llist_destroy(spl_ptr_llist *llist TSRMLS_DC) /* {{{ */
 {
spl_ptr_llist_element   *current = llist-head, *next;
spl_ptr_llist_dtor_func  dtor= llist-dtor;
@@ -146,7 +145,7 @@
while (current) {
next = current-next;
if(current  dtor) {
-   dtor(current);
+   dtor(current TSRMLS_CC);
}
SPL_LLIST_DELREF(current);
current = next;
@@ -181,7 +180,7 @@
 }
 /* }}} */
 
-static void spl_ptr_llist_unshift(spl_ptr_llist *llist, void *data) /* {{{ */
+static void spl_ptr_llist_unshift(spl_ptr_llist *llist, void *data TSRMLS_DC) 
/* {{{ */
 {
spl_ptr_llist_element *elem = emalloc(sizeof(spl_ptr_llist_element));
 
@@ -200,12 +199,12 @@
llist-count++;
 
if (llist-ctor) {
-   llist-ctor(elem);
+   llist-ctor(elem TSRMLS_CC);
}
 }
 /* }}} */
 
-static void spl_ptr_llist_push(spl_ptr_llist *llist, void *data) /* {{{ */
+static void spl_ptr_llist_push(spl_ptr_llist *llist, void *data TSRMLS_DC) /* 
{{{ */
 {
spl_ptr_llist_element *elem = emalloc(sizeof(spl_ptr_llist_element));
 
@@ -224,12 +223,12 @@
llist-count++;
 
if (llist-ctor) {
-   llist-ctor(elem);
+   llist-ctor(elem TSRMLS_CC);
}
 }
 /* }}} */
 
-static void *spl_ptr_llist_pop(spl_ptr_llist *llist) /* {{{ */
+static void *spl_ptr_llist_pop(spl_ptr_llist *llist TSRMLS_DC) /* {{{ */
 {
void *data;
spl_ptr_llist_element*tail = llist-tail;
@@ -249,7 +248,7 @@
data = tail-data;
 
if (llist-dtor) {
-   llist-dtor(tail);
+   llist-dtor(tail TSRMLS_CC);
}
 
tail-data = NULL;
@@ -284,7 +283,7 @@
 }
 /* }}} */
 
-static void *spl_ptr_llist_shift(spl_ptr_llist *llist) /* {{{ */
+static void *spl_ptr_llist_shift(spl_ptr_llist *llist TSRMLS_DC) /* {{{ */
 {
void*data;
spl_ptr_llist_element   *head = llist-head;
@@ -304,7 +303,7 @@
data = head-data;
 
if (llist-dtor) {
-   llist-dtor(head);
+   llist-dtor(head TSRMLS_CC);
}
head-data = NULL;
 
@@ -314,7 +313,7 @@
 }
 /* }}} */
 
-static void spl_ptr_llist_copy(spl_ptr_llist *from, spl_ptr_llist *to) /* {{{ 
*/
+static void spl_ptr_llist_copy(spl_ptr_llist *from, spl_ptr_llist *to 
TSRMLS_DC) /* {{{ */
 {
spl_ptr_llist_element   *current = from-head, *next;
spl_ptr_llist_ctor_func  ctor= from-ctor;
@@ -323,10 +322,10 @@
next = current-next;
 
if (ctor) {
-   ctor(current);
+   ctor(current TSRMLS_CC);
}
 
-   spl_ptr_llist_push(to, current-data);
+   spl_ptr_llist_push(to, current-data TSRMLS_CC);

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

2008-02-11 Thread Etienne Kneuss
colder  Mon Feb 11 13:59:24 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/splspl_dllist.c 
  Log:
  MFH: cosmetics
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_dllist.c?r1=1.1.2.8r2=1.1.2.9diff_format=u
Index: php-src/ext/spl/spl_dllist.c
diff -u php-src/ext/spl/spl_dllist.c:1.1.2.8 
php-src/ext/spl/spl_dllist.c:1.1.2.9
--- php-src/ext/spl/spl_dllist.c:1.1.2.8Sun Jan 27 13:59:51 2008
+++ php-src/ext/spl/spl_dllist.cMon Feb 11 13:59:23 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_dllist.c,v 1.1.2.8 2008/01/27 13:59:51 colder Exp $ */
+/* $Id: spl_dllist.c,v 1.1.2.9 2008/02/11 13:59:23 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -314,25 +314,6 @@
 }
 /* }}} */
 
-static void spl_dllist_object_free_storage(void *object TSRMLS_DC) /* {{{ */
-{
-   spl_dllist_object *intern = (spl_dllist_object *)object;
-   zval  *tmp= NULL;
-
-   zend_object_std_dtor(intern-std TSRMLS_CC);
-
-   while(intern-llist-count  0) {
-   tmp = (zval *)spl_ptr_llist_pop(intern-llist);
-   zval_ptr_dtor(tmp);
-   }
-
-   spl_ptr_llist_destroy(intern-llist);
-   zval_ptr_dtor(intern-retval);
-
-   efree(object);
-}
-/* }}} */
-
 static void spl_ptr_llist_copy(spl_ptr_llist *from, spl_ptr_llist *to) /* {{{ 
*/
 {
spl_ptr_llist_element   *current = from-head, *next;
@@ -354,6 +335,25 @@
 
 /* }}} */
 
+static void spl_dllist_object_free_storage(void *object TSRMLS_DC) /* {{{ */
+{
+   spl_dllist_object *intern = (spl_dllist_object *)object;
+   zval  *tmp= NULL;
+
+   zend_object_std_dtor(intern-std TSRMLS_CC);
+
+   while(intern-llist-count  0) {
+   tmp = (zval *)spl_ptr_llist_pop(intern-llist);
+   zval_ptr_dtor(tmp);
+   }
+
+   spl_ptr_llist_destroy(intern-llist);
+   zval_ptr_dtor(intern-retval);
+
+   efree(object);
+}
+/* }}} */
+
 zend_object_iterator *spl_dllist_get_iterator(zend_class_entry *ce, zval 
*object, int by_ref TSRMLS_DC);
 
 static zend_object_value spl_dllist_object_new_ex(zend_class_entry 
*class_type, spl_dllist_object **obj, zval *orig, int clone_orig TSRMLS_DC) /* 
{{{ */
@@ -1054,20 +1054,20 @@
return NULL;
}
 
-   iterator = emalloc(sizeof(spl_dllist_it));
-
Z_ADDREF_P(object);
-   iterator-intern.it.data = (void*)object;
-   iterator-intern.it.funcs = spl_dllist_it_funcs;
-   iterator-intern.ce = ce;
-   iterator-intern.value = NULL;
+
+   iterator = emalloc(sizeof(spl_dllist_it));
+   iterator-intern.it.data = (void*)object;
+   iterator-intern.it.funcs= spl_dllist_it_funcs;
+   iterator-intern.ce  = ce;
+   iterator-intern.value   = NULL;
iterator-traverse_position  = dllist_object-traverse_position;
iterator-traverse_pointer   = dllist_object-traverse_pointer;
iterator-flags  = dllist_object-flags  
SPL_DLLIST_IT_MASK;
+   iterator-object = dllist_object;
 
SPL_LLIST_CHECK_ADDREF(iterator-traverse_pointer);
 
-   iterator-object = dllist_object;
 
return (zend_object_iterator*)iterator;
 }

-- 
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_dllist.c

2008-02-11 Thread Etienne Kneuss
colder  Mon Feb 11 16:38:01 2008 UTC

  Modified files:  
/php-src/ext/splspl_dllist.c 
  Log:
  Provide ctod/dtor with TSRM
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_dllist.c?r1=1.8r2=1.9diff_format=u
Index: php-src/ext/spl/spl_dllist.c
diff -u php-src/ext/spl/spl_dllist.c:1.8 php-src/ext/spl/spl_dllist.c:1.9
--- php-src/ext/spl/spl_dllist.c:1.8Sun Feb 10 14:07:40 2008
+++ php-src/ext/spl/spl_dllist.cMon Feb 11 16:38:01 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_dllist.c,v 1.8 2008/02/10 14:07:40 colder Exp $ */
+/* $Id: spl_dllist.c,v 1.9 2008/02/11 16:38:01 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -30,7 +30,6 @@
 #include spl_functions.h
 #include spl_engine.h
 #include spl_iterators.h
-#include spl_array.h
 #include spl_dllist.h
 #include spl_exceptions.h
 
@@ -68,8 +67,8 @@
void  *data;
 } spl_ptr_llist_element;
 
-typedef void (*spl_ptr_llist_dtor_func)(spl_ptr_llist_element *);
-typedef void (*spl_ptr_llist_ctor_func)(spl_ptr_llist_element *);
+typedef void (*spl_ptr_llist_dtor_func)(spl_ptr_llist_element * TSRMLS_DC);
+typedef void (*spl_ptr_llist_ctor_func)(spl_ptr_llist_element * TSRMLS_DC);
 
 typedef struct _spl_ptr_llist {
spl_ptr_llist_element   *head;
@@ -106,14 +105,14 @@
 };
 
 /* {{{  spl_ptr_llist */
-static void spl_ptr_llist_zval_dtor(spl_ptr_llist_element *elem) { /* {{{ */
+static void spl_ptr_llist_zval_dtor(spl_ptr_llist_element *elem TSRMLS_DC) { 
/* {{{ */
if (elem-data) {
zval_ptr_dtor((zval **)elem-data);
}
 }
 /* }}} */
 
-static void spl_ptr_llist_zval_ctor(spl_ptr_llist_element *elem) { /* {{{ */
+static void spl_ptr_llist_zval_ctor(spl_ptr_llist_element *elem TSRMLS_DC) { 
/* {{{ */
Z_ADDREF_P((zval *)elem-data);
 }
 /* }}} */
@@ -138,7 +137,7 @@
 }
 /* }}} */
 
-static void spl_ptr_llist_destroy(spl_ptr_llist *llist) /* {{{ */
+static void spl_ptr_llist_destroy(spl_ptr_llist *llist TSRMLS_DC) /* {{{ */
 {
spl_ptr_llist_element   *current = llist-head, *next;
spl_ptr_llist_dtor_func  dtor= llist-dtor;
@@ -146,7 +145,7 @@
while (current) {
next = current-next;
if(current  dtor) {
-   dtor(current);
+   dtor(current TSRMLS_CC);
}
SPL_LLIST_DELREF(current);
current = next;
@@ -181,7 +180,7 @@
 }
 /* }}} */
 
-static void spl_ptr_llist_unshift(spl_ptr_llist *llist, void *data) /* {{{ */
+static void spl_ptr_llist_unshift(spl_ptr_llist *llist, void *data TSRMLS_DC) 
/* {{{ */
 {
spl_ptr_llist_element *elem = emalloc(sizeof(spl_ptr_llist_element));
 
@@ -200,12 +199,12 @@
llist-count++;
 
if (llist-ctor) {
-   llist-ctor(elem);
+   llist-ctor(elem TSRMLS_CC);
}
 }
 /* }}} */
 
-static void spl_ptr_llist_push(spl_ptr_llist *llist, void *data) /* {{{ */
+static void spl_ptr_llist_push(spl_ptr_llist *llist, void *data TSRMLS_DC) /* 
{{{ */
 {
spl_ptr_llist_element *elem = emalloc(sizeof(spl_ptr_llist_element));
 
@@ -224,12 +223,12 @@
llist-count++;
 
if (llist-ctor) {
-   llist-ctor(elem);
+   llist-ctor(elem TSRMLS_CC);
}
 }
 /* }}} */
 
-static void *spl_ptr_llist_pop(spl_ptr_llist *llist) /* {{{ */
+static void *spl_ptr_llist_pop(spl_ptr_llist *llist TSRMLS_DC) /* {{{ */
 {
void *data;
spl_ptr_llist_element*tail = llist-tail;
@@ -249,7 +248,7 @@
data = tail-data;
 
if (llist-dtor) {
-   llist-dtor(tail);
+   llist-dtor(tail TSRMLS_CC);
}
 
tail-data = NULL;
@@ -284,7 +283,7 @@
 }
 /* }}} */
 
-static void *spl_ptr_llist_shift(spl_ptr_llist *llist) /* {{{ */
+static void *spl_ptr_llist_shift(spl_ptr_llist *llist TSRMLS_DC) /* {{{ */
 {
void*data;
spl_ptr_llist_element   *head = llist-head;
@@ -304,7 +303,7 @@
data = head-data;
 
if (llist-dtor) {
-   llist-dtor(head);
+   llist-dtor(head TSRMLS_CC);
}
head-data = NULL;
 
@@ -314,7 +313,7 @@
 }
 /* }}} */
 
-static void spl_ptr_llist_copy(spl_ptr_llist *from, spl_ptr_llist *to) /* {{{ 
*/
+static void spl_ptr_llist_copy(spl_ptr_llist *from, spl_ptr_llist *to 
TSRMLS_DC) /* {{{ */
 {
spl_ptr_llist_element   *current = from-head, *next;
spl_ptr_llist_ctor_func  ctor= from-ctor;
@@ -323,10 +322,10 @@
next = current-next;
 
if (ctor) {
-   ctor(current);
+   ctor(current TSRMLS_CC);
}
 
-   spl_ptr_llist_push(to, current-data);
+   spl_ptr_llist_push(to, current-data TSRMLS_CC);
current = next;
}
 
@@ -345,11 

[PHP-CVS] cvs: php-src /ext/standard string.c /ext/standard/tests/strings substr.phpt substr_compare.phpt

2008-02-13 Thread Etienne Kneuss
colder  Wed Feb 13 16:59:56 2008 UTC

  Modified files:  
/php-src/ext/standard   string.c 
/php-src/ext/standard/tests/strings substr.phpt substr_compare.phpt 
  Log:
  Fix inconcistencies between substr and substr_compare
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.667r2=1.668diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.667 php-src/ext/standard/string.c:1.668
--- php-src/ext/standard/string.c:1.667 Tue Feb 12 01:03:43 2008
+++ php-src/ext/standard/string.c   Wed Feb 13 16:59:56 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.667 2008/02/12 01:03:43 stas Exp $ */
+/* $Id: string.c,v 1.668 2008/02/13 16:59:56 colder Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -7985,10 +7985,6 @@
--len;
}
 
-   if (len  0) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
The specified segment exceeds string length);
-   RETURN_FALSE;
-   }
} else {
end_offset = s1_len;
}
@@ -8006,14 +8002,13 @@
offset = (offset  0) ? 0 : offset;
}
 
-   if (offset  s1_len) {
+   if (offset = s1_len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, The start 
position cannot exceed initial string length);
RETURN_FALSE;
}
 
if (len  s1_len - offset) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, The 
specified segment exceeds string length);
-   RETURN_FALSE;
+   len = s1_len - offset;
}
 
cmp_len = (uint) (len ? len : MAX(s2_len, (s1_len - offset)));
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/substr.phpt?r1=1.3r2=1.4diff_format=u
Index: php-src/ext/standard/tests/strings/substr.phpt
diff -u php-src/ext/standard/tests/strings/substr.phpt:1.3 
php-src/ext/standard/tests/strings/substr.phpt:1.4
--- php-src/ext/standard/tests/strings/substr.phpt:1.3  Mon Jul  9 11:38:34 2007
+++ php-src/ext/standard/tests/strings/substr.phpt  Wed Feb 13 16:59:56 2008
@@ -75,6 +75,10 @@
 /* String with international characters */
 echo (\n*** Testing for string with international characters ***\n);
 var_dump (substr('\xIñtërnâtiônàlizætiøn',3) );
+
+/* start 0  -start  length */
+echo \n*** Start before the first char ***\n;
+var_dump (substr(abcd , -8) );
  
 echo\nDone;
 
@@ -218,6 +222,9 @@
 *** Testing for string with international characters ***
 string(26) ñtërnâtiônàlizætiøn
 
+*** Start before the first char ***
+string(4) abcd
+
 Done
 --UEXPECTF--
 *** Testing for error conditions ***
@@ -358,4 +365,7 @@
 *** Testing for string with international characters ***
 unicode(26) ñtërnâtiônàlizætiøn
 
+*** Start before the first char ***
+string(4) abcd
+
 Done
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/substr_compare.phpt?r1=1.6r2=1.7diff_format=u
Index: php-src/ext/standard/tests/strings/substr_compare.phpt
diff -u php-src/ext/standard/tests/strings/substr_compare.phpt:1.6 
php-src/ext/standard/tests/strings/substr_compare.phpt:1.7
--- php-src/ext/standard/tests/strings/substr_compare.phpt:1.6  Fri Apr 20 
21:37:31 2007
+++ php-src/ext/standard/tests/strings/substr_compare.phpt  Wed Feb 13 
16:59:56 2008
@@ -9,6 +9,7 @@
 var_dump(substr_compare(abcde, bc, 1, 3));
 var_dump(substr_compare(abcde, cd, 1, 2));
 var_dump(substr_compare(abcde, abc, 5, 1));
+var_dump(substr_compare(abcde, abcdef, -10, 10));
 
 var_dump(substr_compare(abcde, -1, 0, NULL, new stdClass));
 echo Test\n;
@@ -24,8 +25,9 @@
 int(1)
 int(-1)
 
-Warning: substr_compare(): The specified segment exceeds string length in %s 
on line %d
+Warning: substr_compare(): The start position cannot exceed initial string 
length in %s on line %d
 bool(false)
+int(0)
 
 Warning: substr_compare() expects parameter 5 to be boolean, object given in 
%s on line %d
 bool(false)
@@ -44,8 +46,9 @@
 int(1)
 int(-1)
 
-Warning: substr_compare(): The specified segment exceeds string length in %s 
on line %d
+Warning: substr_compare(): The start position cannot exceed initial string 
length in %s on line %d
 bool(false)
+int(0)
 
 Warning: substr_compare() expects parameter 5 to be boolean, object given in 
%s on line %d
 bool(false)

-- 
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/standard string.c /ext/standard/tests/strings substr.phpt substr_compare.phpt

2008-02-13 Thread Etienne Kneuss
colder  Wed Feb 13 17:02:16 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   string.c 
/php-src/ext/standard/tests/strings substr.phpt substr_compare.phpt 
  Log:
  MFH: Fix inconcistencies between substr and substr_compare
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69.2.16r2=1.445.2.14.2.69.2.17diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.16 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.17
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.16  Tue Feb 12 00:21:15 2008
+++ php-src/ext/standard/string.c   Wed Feb 13 17:02:15 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.16 2008/02/12 00:21:15 stas Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.17 2008/02/13 17:02:15 colder Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -2172,8 +2172,10 @@
}

f = Z_LVAL_PP(from);
-   if (f  Z_STRLEN_PP(str) || (f  0  -f  Z_STRLEN_PP(str))) {
+   if (f  Z_STRLEN_PP(str)) {
RETURN_FALSE;
+   } else if (f  0  -f  Z_STRLEN_PP(str)) {
+   f = 0;
}
 
if (l  0  (l + Z_STRLEN_PP(str) - f)  0) {
@@ -5245,14 +5247,13 @@
offset = (offset  0) ? 0 : offset;
}
 
-   if (offset  s1_len) {
+   if (offset = s1_len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, The start position 
cannot exceed initial string length);
RETURN_FALSE;
}
 
if (len  s1_len - offset) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, The length cannot 
exceed initial string length);
-   RETURN_FALSE;
+   len = s1_len - offset;
}
 
cmp_len = (uint) (len ? len : MAX(s2_len, (s1_len - offset)));
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/substr.phpt?r1=1.1.2.1r2=1.1.2.1.2.1diff_format=u
Index: php-src/ext/standard/tests/strings/substr.phpt
diff -u php-src/ext/standard/tests/strings/substr.phpt:1.1.2.1 
php-src/ext/standard/tests/strings/substr.phpt:1.1.2.1.2.1
--- php-src/ext/standard/tests/strings/substr.phpt:1.1.2.1  Sat May 12 
10:15:02 2007
+++ php-src/ext/standard/tests/strings/substr.phpt  Wed Feb 13 17:02:16 2008
@@ -72,6 +72,10 @@
 /* String with international characters */
 echo (\n*** Testing for string with international characters ***\n);
 var_dump (substr('\xIñtërnâtiônàlizætiøn',3) );
+
+/* start 0  -start  length */
+echo \n*** Start before the first char ***\n;
+var_dump (substr(abcd , -8) );
  
 echo\nDone;
 
@@ -215,4 +219,7 @@
 *** Testing for string with international characters ***
 string(26) ñtërnâtiônàlizætiøn
 
+*** Start before the first char ***
+string(4) abcd
+
 Done
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/substr_compare.phpt?r1=1.1.2.2.2.1r2=1.1.2.2.2.1.2.1diff_format=u
Index: php-src/ext/standard/tests/strings/substr_compare.phpt
diff -u php-src/ext/standard/tests/strings/substr_compare.phpt:1.1.2.2.2.1 
php-src/ext/standard/tests/strings/substr_compare.phpt:1.1.2.2.2.1.2.1
--- php-src/ext/standard/tests/strings/substr_compare.phpt:1.1.2.2.2.1  Fri Mar 
 9 09:45:14 2007
+++ php-src/ext/standard/tests/strings/substr_compare.phpt  Wed Feb 13 
17:02:16 2008
@@ -9,6 +9,7 @@
 var_dump(substr_compare(abcde, bc, 1, 3));
 var_dump(substr_compare(abcde, cd, 1, 2));
 var_dump(substr_compare(abcde, abc, 5, 1));
+var_dump(substr_compare(abcde, abcdef, -10, 10));
 
 var_dump(substr_compare(abcde, -1, 0, NULL, new stdClass));
 echo Test\n;
@@ -24,8 +25,9 @@
 int(1)
 int(-1)
 
-Warning: substr_compare(): The length cannot exceed initial string length in 
%s on line %d
+Warning: substr_compare(): The start position cannot exceed initial string 
length in %s on line %d
 bool(false)
+int(0)
 
 Warning: substr_compare() expects parameter 5 to be boolean, object given in 
%s on line %d
 bool(false)

-- 
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_dllist.c

2008-02-18 Thread Etienne Kneuss
colder  Tue Feb 19 00:04:21 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/splspl_dllist.c 
  Log:
  MFH: Add debug_info handler to SplDoublyLinkedList/Stack/Queue to make them 
var_dump friendly
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_dllist.c?r1=1.1.2.10r2=1.1.2.11diff_format=u
Index: php-src/ext/spl/spl_dllist.c
diff -u php-src/ext/spl/spl_dllist.c:1.1.2.10 
php-src/ext/spl/spl_dllist.c:1.1.2.11
--- php-src/ext/spl/spl_dllist.c:1.1.2.10   Mon Feb 11 16:39:20 2008
+++ php-src/ext/spl/spl_dllist.cTue Feb 19 00:04:20 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_dllist.c,v 1.1.2.10 2008/02/11 16:39:20 colder Exp $ */
+/* $Id: spl_dllist.c,v 1.1.2.11 2008/02/19 00:04:20 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -473,6 +473,51 @@
 } 
 /* }}} */
 
+static HashTable* spl_dllist_object_get_debug_info(zval *obj, int *is_temp 
TSRMLS_DC) /*  */
+{
+   spl_dllist_object *intern  = 
(spl_dllist_object*)zend_object_store_get_object(obj TSRMLS_CC);
+   spl_ptr_llist_element *current = intern-llist-head, *next;
+   HashTable *rv;
+   zval *tmp, zrv, *dllist_array;
+   char *pnstr;
+   int  pnlen;
+   int  i = 0;;
+
+   *is_temp = 1;
+
+   ALLOC_HASHTABLE(rv);
+   ZEND_INIT_SYMTABLE_EX(rv, 
zend_hash_num_elements(intern-std.properties) + 1, 0);
+
+   INIT_PZVAL(zrv);
+   Z_ARRVAL(zrv) = rv;
+
+   zend_hash_copy(rv, intern-std.properties, (copy_ctor_func_t) 
zval_add_ref, (void *) tmp, sizeof(zval *));
+
+   pnstr = spl_gen_private_prop_name(spl_ce_SplDoublyLinkedList, flags, 
sizeof(flags)-1, pnlen TSRMLS_CC);
+   add_assoc_long_ex(zrv, pnstr, pnlen+1, intern-flags);
+   efree(pnstr);
+
+   ALLOC_INIT_ZVAL(dllist_array);
+   array_init(dllist_array);
+
+   while (current) {
+   next = current-next;
+
+   add_index_zval(dllist_array, i, (zval *)current-data);
+   Z_ADDREF_P(current-data);
+   i++;
+
+   current = next;
+   }
+
+   pnstr = spl_gen_private_prop_name(spl_ce_SplDoublyLinkedList, dllist, 
sizeof(dllist)-1, pnlen TSRMLS_CC);
+   add_assoc_zval_ex(zrv, pnstr, pnlen+1, dllist_array);
+   efree(pnstr);
+
+   return rv;
+}
+/*  */
+
 /* {{{ proto bool SplDoublyLinkedList::push(mixed $value) U
   Push $value on the SplDoublyLinkedList */
 SPL_METHOD(SplDoublyLinkedList, push)
@@ -1129,8 +1174,9 @@
REGISTER_SPL_STD_CLASS_EX(SplDoublyLinkedList, spl_dllist_object_new, 
spl_funcs_SplDoublyLinkedList);
memcpy(spl_handler_SplDoublyLinkedList, 
zend_get_std_object_handlers(), sizeof(zend_object_handlers));
 
-   spl_handler_SplDoublyLinkedList.clone_obj = spl_dllist_object_clone;
+   spl_handler_SplDoublyLinkedList.clone_obj  = 
spl_dllist_object_clone;
spl_handler_SplDoublyLinkedList.count_elements = 
spl_dllist_object_count_elements;
+   spl_handler_SplDoublyLinkedList.get_debug_info = 
spl_dllist_object_get_debug_info;
 
REGISTER_SPL_CLASS_CONST_LONG(SplDoublyLinkedList, IT_MODE_LIFO,  
SPL_DLLIST_IT_LIFO);
REGISTER_SPL_CLASS_CONST_LONG(SplDoublyLinkedList, IT_MODE_FIFO,  0);

-- 
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_dllist.c

2008-02-18 Thread Etienne Kneuss
colder  Mon Feb 18 23:54:45 2008 UTC

  Modified files:  
/php-src/ext/splspl_dllist.c 
  Log:
  Add debug_info handler to SplDoublyLinkedList/Stack/Queue to make them 
var_dump friendly
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_dllist.c?r1=1.9r2=1.10diff_format=u
Index: php-src/ext/spl/spl_dllist.c
diff -u php-src/ext/spl/spl_dllist.c:1.9 php-src/ext/spl/spl_dllist.c:1.10
--- php-src/ext/spl/spl_dllist.c:1.9Mon Feb 11 16:38:01 2008
+++ php-src/ext/spl/spl_dllist.cMon Feb 18 23:54:45 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_dllist.c,v 1.9 2008/02/11 16:38:01 colder Exp $ */
+/* $Id: spl_dllist.c,v 1.10 2008/02/18 23:54:45 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -473,6 +473,51 @@
 } 
 /* }}} */
 
+static HashTable* spl_dllist_object_get_debug_info(zval *obj, int *is_temp 
TSRMLS_DC) /*  */
+{
+   spl_dllist_object *intern  = 
(spl_dllist_object*)zend_object_store_get_object(obj TSRMLS_CC);
+   spl_ptr_llist_element *current = intern-llist-head, *next;
+   HashTable *rv;
+   zval *tmp, zrv, *dllist_array;
+   zstr pnstr;
+   int  pnlen;
+   int  i = 0;;
+
+   *is_temp = 1;
+
+   ALLOC_HASHTABLE(rv);
+   ZEND_INIT_SYMTABLE_EX(rv, 
zend_hash_num_elements(intern-std.properties) + 1, 0);
+
+   INIT_PZVAL(zrv);
+   Z_ARRVAL(zrv) = rv;
+
+   zend_hash_copy(rv, intern-std.properties, (copy_ctor_func_t) 
zval_add_ref, (void *) tmp, sizeof(zval *));
+
+   pnstr = spl_gen_private_prop_name(spl_ce_SplDoublyLinkedList, flags, 
sizeof(flags)-1, pnlen TSRMLS_CC);
+   add_u_assoc_long_ex(zrv, ZEND_STR_TYPE, pnstr, pnlen+1, intern-flags);
+   efree(pnstr.v);
+
+   ALLOC_INIT_ZVAL(dllist_array);
+   array_init(dllist_array);
+
+   while (current) {
+   next = current-next;
+
+   add_index_zval(dllist_array, i, (zval *)current-data);
+   Z_ADDREF_P(current-data);
+   i++;
+
+   current = next;
+   }
+
+   pnstr = spl_gen_private_prop_name(spl_ce_SplDoublyLinkedList, dllist, 
sizeof(dllist)-1, pnlen TSRMLS_CC);
+   add_u_assoc_zval_ex(zrv, ZEND_STR_TYPE, pnstr, pnlen+1, dllist_array);
+   efree(pnstr.v);
+
+   return rv;
+}
+/*  */
+
 /* {{{ proto bool SplDoublyLinkedList::push(mixed $value) U
   Push $value on the SplDoublyLinkedList */
 SPL_METHOD(SplDoublyLinkedList, push)
@@ -1131,8 +1176,9 @@
REGISTER_SPL_STD_CLASS_EX(SplDoublyLinkedList, spl_dllist_object_new, 
spl_funcs_SplDoublyLinkedList);
memcpy(spl_handler_SplDoublyLinkedList, 
zend_get_std_object_handlers(), sizeof(zend_object_handlers));
 
-   spl_handler_SplDoublyLinkedList.clone_obj = spl_dllist_object_clone;
+   spl_handler_SplDoublyLinkedList.clone_obj  = 
spl_dllist_object_clone;
spl_handler_SplDoublyLinkedList.count_elements = 
spl_dllist_object_count_elements;
+   spl_handler_SplDoublyLinkedList.get_debug_info = 
spl_dllist_object_get_debug_info;
 
REGISTER_SPL_CLASS_CONST_LONG(SplDoublyLinkedList, IT_MODE_LIFO,  
SPL_DLLIST_IT_LIFO);
REGISTER_SPL_CLASS_CONST_LONG(SplDoublyLinkedList, IT_MODE_FIFO,  0);

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



[PHP-CVS] cvs: php-src /ext/spl config.m4 config.w32 php_spl.c spl_heap.c spl_heap.h /ext/spl/tests heap_001.phpt heap_002.phpt heap_003.phpt heap_004.phpt heap_005.phpt heap_006.phpt heap_007.phpt h

2008-02-25 Thread Etienne Kneuss
);
 
return SUCCESS;

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_heap.c?view=markuprev=1.1
Index: php-src/ext/spl/spl_heap.c
+++ php-src/ext/spl/spl_heap.c
/*
   +--+
   | PHP Version 5|
   +--+
   | 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|
   | available through the world-wide-web at the following url:   |
   | http://www.php.net/license/3_01.txt  |
   | If you did not receive a copy of the PHP license and are unable to   |
   | obtain it through the world-wide-web, please send a note to  |
   | [EMAIL PROTECTED] so we can mail you a copy immediately.   |
   +--+
   | Authors: Etienne Kneuss [EMAIL PROTECTED] |
   +--+
 */

/* $Id: spl_heap.c,v 1.1 2008/02/25 23:36:36 colder Exp $ */

#ifdef HAVE_CONFIG_H
# include config.h
#endif

#include php.h
#include zend_exceptions.h

#include php_spl.h
#include spl_functions.h
#include spl_engine.h
#include spl_iterators.h
#include spl_heap.h
#include spl_exceptions.h

#define PTR_HEAP_BLOCK_SIZE 64

#define SPL_HEAP_CORRUPTED   0x0001

#define SPL_PQUEUE_EXTR_MASK 0x0003
#define SPL_PQUEUE_EXTR_BOTH 0x0003
#define SPL_PQUEUE_EXTR_DATA 0x0001
#define SPL_PQUEUE_EXTR_PRIORITY 0x0002

zend_object_handlers spl_handler_SplHeap;
zend_object_handlers spl_handler_SplPriorityQueue;

PHPAPI zend_class_entry  *spl_ce_SplHeap;
PHPAPI zend_class_entry  *spl_ce_SplMaxHeap;
PHPAPI zend_class_entry  *spl_ce_SplMinHeap;
PHPAPI zend_class_entry  *spl_ce_SplPriorityQueue;

typedef void *spl_ptr_heap_element;

typedef void (*spl_ptr_heap_dtor_func)(spl_ptr_heap_element TSRMLS_DC);
typedef void (*spl_ptr_heap_ctor_func)(spl_ptr_heap_element TSRMLS_DC);
typedef int  (*spl_ptr_heap_cmp_func)(spl_ptr_heap_element, 
spl_ptr_heap_element, void* TSRMLS_DC);

typedef struct _spl_ptr_heap {
spl_ptr_heap_element   *elements;
spl_ptr_heap_ctor_func  ctor;
spl_ptr_heap_dtor_func  dtor;
spl_ptr_heap_cmp_func   cmp;
int count;
int max_size;
int flags;
} spl_ptr_heap;

typedef struct _spl_heap_object spl_heap_object;
typedef struct _spl_heap_it spl_heap_it;

struct _spl_heap_object {
zend_object std;
spl_ptr_heap   *heap;
zval   *retval;
int flags;
zend_class_entry   *ce_get_iterator;
zend_function  *fptr_cmp;
};

/* define an overloaded iterator structure */
struct _spl_heap_it {
zend_user_iterator  intern;
int flags;
spl_heap_object*object;
};

/* {{{  spl_ptr_heap */
static void spl_ptr_heap_zval_dtor(spl_ptr_heap_element elem TSRMLS_DC) { /* 
{{{ */
if (elem) {
zval_ptr_dtor((zval **)elem);
}
}
/* }}} */

static void spl_ptr_heap_zval_ctor(spl_ptr_heap_element elem TSRMLS_DC) { /* 
{{{ */
Z_ADDREF_P((zval *)elem);
}
/* }}} */

static int spl_ptr_heap_cmp_cb_helper(zval *object, spl_heap_object 
*heap_object, zval *a, zval *b, long *result TSRMLS_DC) { /* {{{ */
zval *result_p = NULL;

zend_call_method_with_2_params(object, heap_object-std.ce, 
heap_object-fptr_cmp, compare, result_p, a, b);

if (EG(exception)) {
return FAILURE;
}

convert_to_long(result_p);
*result = Z_LVAL_P(result_p);

zval_ptr_dtor(result_p);

return SUCCESS;
}
/* }}} */

static zval **spl_pqueue_extract_helper(zval **value, int flags) /* {{{ */
{
if ((flags  SPL_PQUEUE_EXTR_BOTH) == SPL_PQUEUE_EXTR_BOTH) {
return value;
} else if ((flags  SPL_PQUEUE_EXTR_BOTH)  0) {

if ((flags  SPL_PQUEUE_EXTR_DATA) == SPL_PQUEUE_EXTR_DATA) {
zval **data;
if (zend_hash_find(Z_ARRVAL_PP(value), data, 
sizeof(data), (void **) data) == SUCCESS) {
return data;
}
} else {
zval **priority;
if (zend_hash_find(Z_ARRVAL_PP(value), priority, 
sizeof(priority), (void **) priority) == SUCCESS) {
return priority

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl config.m4 config.w32 php_spl.c spl_heap.c spl_heap.h /ext/spl/tests heap_001.phpt heap_002.phpt heap_003.phpt heap_004.phpt heap_005.phpt heap_006.phpt heap_0

2008-02-25 Thread Etienne Kneuss
);
PHP_MINIT(spl_sxe)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(spl_dllist)(INIT_FUNC_ARGS_PASSTHRU);
+   PHP_MINIT(spl_heap)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(spl_observer)(INIT_FUNC_ARGS_PASSTHRU);
 
return SUCCESS;

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_heap.c?view=markuprev=1.1
Index: php-src/ext/spl/spl_heap.c
+++ php-src/ext/spl/spl_heap.c
/*
   +--+
   | PHP Version 5|
   +--+
   | 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|
   | available through the world-wide-web at the following url:   |
   | http://www.php.net/license/3_01.txt  |
   | If you did not receive a copy of the PHP license and are unable to   |
   | obtain it through the world-wide-web, please send a note to  |
   | [EMAIL PROTECTED] so we can mail you a copy immediately.   |
   +--+
   | Authors: Etienne Kneuss [EMAIL PROTECTED] |
   +--+
 */

/* $Id: spl_heap.c,v 1.1 2008/02/25 23:36:36 colder Exp $ */

#ifdef HAVE_CONFIG_H
# include config.h
#endif

#include php.h
#include zend_exceptions.h

#include php_spl.h
#include spl_functions.h
#include spl_engine.h
#include spl_iterators.h
#include spl_heap.h
#include spl_exceptions.h

#define PTR_HEAP_BLOCK_SIZE 64

#define SPL_HEAP_CORRUPTED   0x0001

#define SPL_PQUEUE_EXTR_MASK 0x0003
#define SPL_PQUEUE_EXTR_BOTH 0x0003
#define SPL_PQUEUE_EXTR_DATA 0x0001
#define SPL_PQUEUE_EXTR_PRIORITY 0x0002

zend_object_handlers spl_handler_SplHeap;
zend_object_handlers spl_handler_SplPriorityQueue;

PHPAPI zend_class_entry  *spl_ce_SplHeap;
PHPAPI zend_class_entry  *spl_ce_SplMaxHeap;
PHPAPI zend_class_entry  *spl_ce_SplMinHeap;
PHPAPI zend_class_entry  *spl_ce_SplPriorityQueue;

typedef void *spl_ptr_heap_element;

typedef void (*spl_ptr_heap_dtor_func)(spl_ptr_heap_element TSRMLS_DC);
typedef void (*spl_ptr_heap_ctor_func)(spl_ptr_heap_element TSRMLS_DC);
typedef int  (*spl_ptr_heap_cmp_func)(spl_ptr_heap_element, 
spl_ptr_heap_element, void* TSRMLS_DC);

typedef struct _spl_ptr_heap {
spl_ptr_heap_element   *elements;
spl_ptr_heap_ctor_func  ctor;
spl_ptr_heap_dtor_func  dtor;
spl_ptr_heap_cmp_func   cmp;
int count;
int max_size;
int flags;
} spl_ptr_heap;

typedef struct _spl_heap_object spl_heap_object;
typedef struct _spl_heap_it spl_heap_it;

struct _spl_heap_object {
zend_object std;
spl_ptr_heap   *heap;
zval   *retval;
int flags;
zend_class_entry   *ce_get_iterator;
zend_function  *fptr_cmp;
};

/* define an overloaded iterator structure */
struct _spl_heap_it {
zend_user_iterator  intern;
int flags;
spl_heap_object*object;
};

/* {{{  spl_ptr_heap */
static void spl_ptr_heap_zval_dtor(spl_ptr_heap_element elem TSRMLS_DC) { /* 
{{{ */
if (elem) {
zval_ptr_dtor((zval **)elem);
}
}
/* }}} */

static void spl_ptr_heap_zval_ctor(spl_ptr_heap_element elem TSRMLS_DC) { /* 
{{{ */
Z_ADDREF_P((zval *)elem);
}
/* }}} */

static int spl_ptr_heap_cmp_cb_helper(zval *object, spl_heap_object 
*heap_object, zval *a, zval *b, long *result TSRMLS_DC) { /* {{{ */
zval *result_p = NULL;

zend_call_method_with_2_params(object, heap_object-std.ce, 
heap_object-fptr_cmp, compare, result_p, a, b);

if (EG(exception)) {
return FAILURE;
}

convert_to_long(result_p);
*result = Z_LVAL_P(result_p);

zval_ptr_dtor(result_p);

return SUCCESS;
}
/* }}} */

static zval **spl_pqueue_extract_helper(zval **value, int flags) /* {{{ */
{
if ((flags  SPL_PQUEUE_EXTR_BOTH) == SPL_PQUEUE_EXTR_BOTH) {
return value;
} else if ((flags  SPL_PQUEUE_EXTR_BOTH)  0) {

if ((flags  SPL_PQUEUE_EXTR_DATA) == SPL_PQUEUE_EXTR_DATA) {
zval **data;
if (zend_hash_find(Z_ARRVAL_PP(value), data, 
sizeof(data), (void **) data) == SUCCESS) {
return data;
}
} else {
zval **priority

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

2008-02-25 Thread Etienne Kneuss
colder  Mon Feb 25 23:40:47 2008 UTC

  Modified files:  
/php-src/ext/splspl_heap.c 
  Log:
  Fix folding
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_heap.c?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/spl/spl_heap.c
diff -u php-src/ext/spl/spl_heap.c:1.1 php-src/ext/spl/spl_heap.c:1.2
--- php-src/ext/spl/spl_heap.c:1.1  Mon Feb 25 23:36:36 2008
+++ php-src/ext/spl/spl_heap.c  Mon Feb 25 23:40:47 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_heap.c,v 1.1 2008/02/25 23:36:36 colder Exp $ */
+/* $Id: spl_heap.c,v 1.2 2008/02/25 23:40:47 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -1181,6 +1181,8 @@
 
return SUCCESS;
 }
+/* }}} */
+
 /*
  * Local variables:
  * tab-width: 4

-- 
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_heap.c

2008-02-25 Thread Etienne Kneuss
colder  Mon Feb 25 23:41:04 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/splspl_heap.c 
  Log:
  MFH: Fix folding
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_heap.c?r1=1.1.2.2r2=1.1.2.3diff_format=u
Index: php-src/ext/spl/spl_heap.c
diff -u php-src/ext/spl/spl_heap.c:1.1.2.2 php-src/ext/spl/spl_heap.c:1.1.2.3
--- php-src/ext/spl/spl_heap.c:1.1.2.2  Mon Feb 25 23:39:08 2008
+++ php-src/ext/spl/spl_heap.c  Mon Feb 25 23:41:04 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_heap.c,v 1.1.2.2 2008/02/25 23:39:08 colder Exp $ */
+/* $Id: spl_heap.c,v 1.1.2.3 2008/02/25 23:41:04 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -1181,6 +1181,8 @@
 
return SUCCESS;
 }
+/* }}} */
+
 /*
  * Local variables:
  * tab-width: 4

-- 
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_heap.c

2008-02-29 Thread Etienne Kneuss
colder  Fri Feb 29 09:25:30 2008 UTC

  Modified files:  
/php-src/ext/splspl_heap.c 
  Log:
  Fix #44288 (Move declarations)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_heap.c?r1=1.2r2=1.3diff_format=u
Index: php-src/ext/spl/spl_heap.c
diff -u php-src/ext/spl/spl_heap.c:1.2 php-src/ext/spl/spl_heap.c:1.3
--- php-src/ext/spl/spl_heap.c:1.2  Mon Feb 25 23:40:47 2008
+++ php-src/ext/spl/spl_heap.c  Fri Feb 29 09:25:30 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_heap.c,v 1.2 2008/02/25 23:40:47 colder Exp $ */
+/* $Id: spl_heap.c,v 1.3 2008/02/29 09:25:30 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -273,13 +273,15 @@
 static spl_ptr_heap_element spl_ptr_heap_delete_top(spl_ptr_heap *heap, void 
*cmp_userdata TSRMLS_DC) { /* {{{ */
int i, j;
const int limit = (heap-count-1)/2;
+   spl_ptr_heap_element top;
+   spl_ptr_heap_element bottom;
 
if (heap-count == 0) {
return NULL;
}
 
-   spl_ptr_heap_element top= heap-elements[0];
-   spl_ptr_heap_element bottom = heap-elements[--heap-count];
+   top= heap-elements[0];
+   bottom = heap-elements[--heap-count];
 
for( i = 0; i  limit; i = j)
{
@@ -920,13 +922,14 @@
 {
zval *object   = (zval*)((zend_user_iterator 
*)iter)-it.data;
spl_heap_it  *iterator = (spl_heap_it *)iter;
+   spl_ptr_heap_element elem;
 
if (iterator-object-heap-flags  SPL_HEAP_CORRUPTED) {
zend_throw_exception(spl_ce_RuntimeException, Heap is 
corrupted, heap properties are no longer ensured., 0 TSRMLS_CC);
return;
}
 
-   spl_ptr_heap_element  elem = 
spl_ptr_heap_delete_top(iterator-object-heap, object TSRMLS_CC);
+   elem = spl_ptr_heap_delete_top(iterator-object-heap, object 
TSRMLS_CC);
 
if (elem != NULL) {
zval_ptr_dtor((zval **)elem);

-- 
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_heap.c

2008-02-29 Thread Etienne Kneuss
colder  Fri Feb 29 09:26:01 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/splspl_heap.c 
  Log:
  MFH: Fix #44288 (Move declarations)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_heap.c?r1=1.1.2.3r2=1.1.2.4diff_format=u
Index: php-src/ext/spl/spl_heap.c
diff -u php-src/ext/spl/spl_heap.c:1.1.2.3 php-src/ext/spl/spl_heap.c:1.1.2.4
--- php-src/ext/spl/spl_heap.c:1.1.2.3  Mon Feb 25 23:41:04 2008
+++ php-src/ext/spl/spl_heap.c  Fri Feb 29 09:26:01 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_heap.c,v 1.1.2.3 2008/02/25 23:41:04 colder Exp $ */
+/* $Id: spl_heap.c,v 1.1.2.4 2008/02/29 09:26:01 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -273,13 +273,15 @@
 static spl_ptr_heap_element spl_ptr_heap_delete_top(spl_ptr_heap *heap, void 
*cmp_userdata TSRMLS_DC) { /* {{{ */
int i, j;
const int limit = (heap-count-1)/2;
+   spl_ptr_heap_element top;
+   spl_ptr_heap_element bottom;
 
if (heap-count == 0) {
return NULL;
}
 
-   spl_ptr_heap_element top= heap-elements[0];
-   spl_ptr_heap_element bottom = heap-elements[--heap-count];
+   top= heap-elements[0];
+   bottom = heap-elements[--heap-count];
 
for( i = 0; i  limit; i = j)
{
@@ -920,13 +922,14 @@
 {
zval *object   = (zval*)((zend_user_iterator 
*)iter)-it.data;
spl_heap_it  *iterator = (spl_heap_it *)iter;
+   spl_ptr_heap_element elem;
 
if (iterator-object-heap-flags  SPL_HEAP_CORRUPTED) {
zend_throw_exception(spl_ce_RuntimeException, Heap is 
corrupted, heap properties are no longer ensured., 0 TSRMLS_CC);
return;
}
 
-   spl_ptr_heap_element  elem = 
spl_ptr_heap_delete_top(iterator-object-heap, object TSRMLS_CC);
+   elem = spl_ptr_heap_delete_top(iterator-object-heap, object 
TSRMLS_CC);
 
if (elem != NULL) {
zval_ptr_dtor((zval **)elem);

-- 
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) / NEWS

2008-02-29 Thread Etienne Kneuss
colder  Fri Feb 29 09:42:24 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-srcNEWS 
  Log:
  Heaps addition
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.119r2=1.2027.2.547.2.965.2.120diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.119 
php-src/NEWS:1.2027.2.547.2.965.2.120
--- php-src/NEWS:1.2027.2.547.2.965.2.119   Wed Feb 27 02:10:40 2008
+++ php-src/NEWSFri Feb 29 09:42:23 2008
@@ -44,6 +44,7 @@
   . Added SplDoublyLinkedList, SplStack, SplQueue classes. (Etienne)
   . Added FilesystemIterator. (Marcus)
   . Added GlobIterator. (Marcus)
+  . Added SplHeap, SplMinHeap, SplMaxHeap, SplPriorityQueue classes. (Etienne)
 - Add the ReflectionProperty::setAccessible() method that allows non-public
   property's values to be read through ::getValue(). (Derick)
 - Added ability to use Traversable objects instead of plain arrays in ext/soap.

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



[PHP-CVS] cvs: php-src /ext/spl/tests heap_008.phpt pqueue_004.phpt

2008-02-29 Thread Etienne Kneuss
colder  Fri Feb 29 13:45:19 2008 UTC

  Modified files:  
/php-src/ext/spl/tests  heap_008.phpt pqueue_004.phpt 
  Log:
  Fix tests in non-unicode mode
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/heap_008.phpt?r1=1.2r2=1.3diff_format=u
Index: php-src/ext/spl/tests/heap_008.phpt
diff -u php-src/ext/spl/tests/heap_008.phpt:1.2 
php-src/ext/spl/tests/heap_008.phpt:1.3
--- php-src/ext/spl/tests/heap_008.phpt:1.2 Thu Feb 28 15:40:34 2008
+++ php-src/ext/spl/tests/heap_008.phpt Fri Feb 29 13:45:19 2008
@@ -33,6 +33,7 @@
 int(1)
   }
 }
+===DONE===
 --UEXPECTF--
 object(SplMaxHeap)#1 (3) {
   [uflags:uSplHeap:private]=
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/pqueue_004.phpt?r1=1.2r2=1.3diff_format=u
Index: php-src/ext/spl/tests/pqueue_004.phpt
diff -u php-src/ext/spl/tests/pqueue_004.phpt:1.2 
php-src/ext/spl/tests/pqueue_004.phpt:1.3
--- php-src/ext/spl/tests/pqueue_004.phpt:1.2   Thu Feb 28 15:40:34 2008
+++ php-src/ext/spl/tests/pqueue_004.phpt   Fri Feb 29 13:45:19 2008
@@ -53,6 +53,7 @@
 }
   }
 }
+===DONE===
 --UEXPECTF--
 object(SplPriorityQueue)#1 (3) {
   [uflags:uSplPriorityQueue:private]=

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



[PHP-CVS] cvs: php-src /ext/spl php_spl.c /ext/spl/tests bug40091.phpt

2008-02-29 Thread Etienne Kneuss
colder  Fri Feb 29 13:48:09 2008 UTC

  Modified files:  
/php-src/ext/splphp_spl.c 
/php-src/ext/spl/tests  bug40091.phpt 
  Log:
  Fix #44144 (object methods as spl autoload functions returned correctly)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.126r2=1.127diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.126 php-src/ext/spl/php_spl.c:1.127
--- php-src/ext/spl/php_spl.c:1.126 Mon Feb 25 23:36:36 2008
+++ php-src/ext/spl/php_spl.c   Fri Feb 29 13:48:09 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.126 2008/02/25 23:36:36 colder Exp $ */
+/* $Id: php_spl.c,v 1.127 2008/02/29 13:48:09 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -606,8 +606,9 @@
  Return all registered __autoload() functionns */
 PHP_FUNCTION(spl_autoload_functions)
 {
-   zend_function *fptr, **func_ptr_ptr;
+   zend_function *fptr;
HashPosition function_pos;
+   autoload_func_info *alfi;
 
if (!EG(autoload_func)) {
if (zend_hash_find(EG(function_table), ZEND_AUTOLOAD_FUNC_NAME, 
sizeof(ZEND_AUTOLOAD_FUNC_NAME), (void **) fptr) == SUCCESS) {
@@ -624,17 +625,23 @@
array_init(return_value);
zend_hash_internal_pointer_reset_ex(SPL_G(autoload_functions), 
function_pos);
while(zend_hash_has_more_elements_ex(SPL_G(autoload_functions), 
function_pos) == SUCCESS) {
-   
zend_hash_get_current_data_ex(SPL_G(autoload_functions), (void **) 
func_ptr_ptr, function_pos);
-   if ((*func_ptr_ptr)-common.scope) {
+   
zend_hash_get_current_data_ex(SPL_G(autoload_functions), (void **) alfi, 
function_pos);
+   if (alfi-func_ptr-common.scope) {
zval *tmp;
MAKE_STD_ZVAL(tmp);
array_init(tmp);
 
-   add_next_index_text(tmp, 
(*func_ptr_ptr)-common.scope-name, 1);
-   add_next_index_text(tmp, 
(*func_ptr_ptr)-common.function_name, 1);
+   if (alfi-obj) {
+   Z_ADDREF_P(alfi-obj);
+   add_next_index_zval(tmp, alfi-obj);
+   } else {
+   add_next_index_text(tmp, 
alfi-ce-name, 1);
+   }
+   add_next_index_text(tmp, 
alfi-func_ptr-common.function_name, 1);
add_next_index_zval(return_value, tmp);
-   } else
-   add_next_index_text(return_value, 
(*func_ptr_ptr)-common.function_name, 1);
+   } else {
+   add_next_index_text(return_value, 
alfi-func_ptr-common.function_name, 1);
+   }
 
zend_hash_move_forward_ex(SPL_G(autoload_functions), 
function_pos);
}
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug40091.phpt?r1=1.2r2=1.3diff_format=u
Index: php-src/ext/spl/tests/bug40091.phpt
diff -u php-src/ext/spl/tests/bug40091.phpt:1.2 
php-src/ext/spl/tests/bug40091.phpt:1.3
--- php-src/ext/spl/tests/bug40091.phpt:1.2 Tue Nov  6 15:29:32 2007
+++ php-src/ext/spl/tests/bug40091.phpt Fri Feb 29 13:48:09 2008
@@ -25,13 +25,19 @@
 (
 [0] = Array
 (
-[0] = MyAutoloader
+[0] = MyAutoloader Object
+(
+)
+
 [1] = autoload
 )
 
 [1] = Array
 (
-[0] = MyAutoloader
+[0] = MyAutoloader Object
+(
+)
+
 [1] = autoload
 )
 

-- 
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 php_spl.c /ext/spl/tests bug40091.phpt

2008-02-29 Thread Etienne Kneuss
colder  Fri Feb 29 13:55:23 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/splphp_spl.c 
/php-src/ext/spl/tests  bug40091.phpt 
  Log:
  MFH: Fix #44144 (object methods as spl autoload functions returned correctly)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.52.2.28.2.17.2.13r2=1.52.2.28.2.17.2.14diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.52.2.28.2.17.2.13 
php-src/ext/spl/php_spl.c:1.52.2.28.2.17.2.14
--- php-src/ext/spl/php_spl.c:1.52.2.28.2.17.2.13   Mon Feb 25 23:39:08 2008
+++ php-src/ext/spl/php_spl.c   Fri Feb 29 13:55:23 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.52.2.28.2.17.2.13 2008/02/25 23:39:08 colder Exp $ */
+/* $Id: php_spl.c,v 1.52.2.28.2.17.2.14 2008/02/29 13:55:23 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -587,8 +587,9 @@
  Return all registered __autoload() functionns */
 PHP_FUNCTION(spl_autoload_functions)
 {
-   zend_function *fptr, **func_ptr_ptr;
+   zend_function *fptr;
HashPosition function_pos;
+   autoload_func_info *alfi;
 
if (!EG(autoload_func)) {
if (zend_hash_find(EG(function_table), ZEND_AUTOLOAD_FUNC_NAME, 
sizeof(ZEND_AUTOLOAD_FUNC_NAME), (void **) fptr) == SUCCESS) {
@@ -605,17 +606,22 @@
array_init(return_value);
zend_hash_internal_pointer_reset_ex(SPL_G(autoload_functions), 
function_pos);
while(zend_hash_has_more_elements_ex(SPL_G(autoload_functions), 
function_pos) == SUCCESS) {
-   
zend_hash_get_current_data_ex(SPL_G(autoload_functions), (void **) 
func_ptr_ptr, function_pos);
-   if ((*func_ptr_ptr)-common.scope) {
+   
zend_hash_get_current_data_ex(SPL_G(autoload_functions), (void **) alfi, 
function_pos);
+   if (alfi-func_ptr-common.scope) {
zval *tmp;
MAKE_STD_ZVAL(tmp);
array_init(tmp);
 
-   add_next_index_string(tmp, 
(*func_ptr_ptr)-common.scope-name, 1);
-   add_next_index_string(tmp, 
(*func_ptr_ptr)-common.function_name, 1);
+   if (alfi-obj) {
+   Z_ADDREF_P(alfi-obj);
+   add_next_index_zval(tmp, alfi-obj);
+   } else {
+   add_next_index_string(tmp, 
alfi-ce-name, 1);
+   }
+   add_next_index_string(tmp, 
alfi-func_ptr-common.function_name, 1);
add_next_index_zval(return_value, tmp);
} else
-   add_next_index_string(return_value, 
(*func_ptr_ptr)-common.function_name, 1);
+   add_next_index_string(return_value, 
alfi-func_ptr-common.function_name, 1);
 
zend_hash_move_forward_ex(SPL_G(autoload_functions), 
function_pos);
}
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug40091.phpt?r1=1.1.2.1r2=1.1.2.1.2.1diff_format=u
Index: php-src/ext/spl/tests/bug40091.phpt
diff -u php-src/ext/spl/tests/bug40091.phpt:1.1.2.1 
php-src/ext/spl/tests/bug40091.phpt:1.1.2.1.2.1
--- php-src/ext/spl/tests/bug40091.phpt:1.1.2.1 Wed Jan 10 18:14:37 2007
+++ php-src/ext/spl/tests/bug40091.phpt Fri Feb 29 13:55:23 2008
@@ -25,13 +25,19 @@
 (
 [0] = Array
 (
-[0] = MyAutoloader
+[0] = MyAutoloader Object
+(
+)
+
 [1] = autoload
 )
 
 [1] = Array
 (
-[0] = MyAutoloader
+[0] = MyAutoloader Object
+(
+)
+
 [1] = autoload
 )
 

-- 
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/standard/tests/general_functions bug44295.phpt /main main.c php.h php_globals.h

2008-03-08 Thread Etienne Kneuss
colder  Sat Mar  8 22:12:32 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/standard/tests/general_functions   bug44295.phpt 

  Modified files:  
/php-src/main   main.c php.h php_globals.h 
  Log:
  MFH: User error handlers no longer catch supressed errors
  
http://cvs.php.net/viewvc.cgi/php-src/main/main.c?r1=1.640.2.23.2.57.2.11r2=1.640.2.23.2.57.2.12diff_format=u
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.640.2.23.2.57.2.11 
php-src/main/main.c:1.640.2.23.2.57.2.12
--- php-src/main/main.c:1.640.2.23.2.57.2.11Wed Mar  5 13:34:12 2008
+++ php-src/main/main.c Sat Mar  8 22:12:32 2008
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: main.c,v 1.640.2.23.2.57.2.11 2008/03/05 13:34:12 dmitry Exp $ */
+/* $Id: main.c,v 1.640.2.23.2.57.2.12 2008/03/08 22:12:32 colder Exp $ */
 
 /* {{{ includes
  */
@@ -778,17 +778,15 @@
 /* {{{ php_suppress_errors */
 PHPAPI void php_set_error_handling(error_handling_t error_handling, 
zend_class_entry *exception_class TSRMLS_DC)
 {
-   PG(error_handling) = error_handling;
-   PG(exception_class) = exception_class;
-   if (PG(last_error_message)) {
-   free(PG(last_error_message));
-   PG(last_error_message) = NULL;
-   }
-   if (PG(last_error_file)) {
-   free(PG(last_error_file));
-   PG(last_error_file) = NULL;
+   EG(error_handling) = error_handling;
+   EG(exception_class) = exception_class;
+
+   if (error_handling == EH_NORMAL) {
+   EG(user_error_handler) = EG(user_error_handler_old);
+   } else {
+   EG(user_error_handler_old) = EG(user_error_handler);
+   EG(user_error_handler) = NULL;
}
-   PG(last_error_lineno) = 0;
 }
 /* }}} */
 
@@ -833,7 +831,7 @@
}
 
/* according to error handling mode, suppress error, throw exception or 
show it */
-   if (PG(error_handling) != EH_NORMAL) {
+   if (EG(error_handling) != EH_NORMAL) {
switch (type) {
case E_ERROR:
case E_CORE_ERROR:
@@ -854,8 +852,8 @@
/* throw an exception if we are in EH_THROW mode
 * but DO NOT overwrite a pending exception
 */
-   if (PG(error_handling) == EH_THROW  
!EG(exception)) {
-   
zend_throw_error_exception(PG(exception_class), buffer, 0, type TSRMLS_CC);
+   if (EG(error_handling) == EH_THROW  
!EG(exception)) {
+   
zend_throw_error_exception(EG(exception_class), buffer, 0, type TSRMLS_CC);
}
efree(buffer);
return;
@@ -1729,7 +1727,8 @@
PG(last_error_message) = NULL;
PG(last_error_file) = NULL;
PG(last_error_lineno) = 0;
-   PG(error_handling) = EH_NORMAL;
+   EG(error_handling)  = EH_NORMAL;
+   EG(exception_class) = NULL;
PG(disable_functions) = NULL;
PG(disable_classes) = NULL;
 
http://cvs.php.net/viewvc.cgi/php-src/main/php.h?r1=1.221.2.4.2.8.2.3r2=1.221.2.4.2.8.2.4diff_format=u
Index: php-src/main/php.h
diff -u php-src/main/php.h:1.221.2.4.2.8.2.3 
php-src/main/php.h:1.221.2.4.2.8.2.4
--- php-src/main/php.h:1.221.2.4.2.8.2.3Wed Jan 30 09:41:12 2008
+++ php-src/main/php.h  Sat Mar  8 22:12:32 2008
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: php.h,v 1.221.2.4.2.8.2.3 2008/01/30 09:41:12 dmitry Exp $ */
+/* $Id: php.h,v 1.221.2.4.2.8.2.4 2008/03/08 22:12:32 colder Exp $ */
 
 #ifndef PHP_H
 #define PHP_H
@@ -278,12 +278,7 @@
 END_EXTERN_C()
 
 #define php_error zend_error
-
-typedef enum {
-   EH_NORMAL = 0,
-   EH_SUPPRESS,
-   EH_THROW
-} error_handling_t;
+#define error_handling_t zend_error_handling_t
 
 BEGIN_EXTERN_C()
 PHPAPI void php_set_error_handling(error_handling_t error_handling, 
zend_class_entry *exception_class TSRMLS_DC);
http://cvs.php.net/viewvc.cgi/php-src/main/php_globals.h?r1=1.98.2.1.2.7.2.2r2=1.98.2.1.2.7.2.3diff_format=u
Index: php-src/main/php_globals.h
diff -u php-src/main/php_globals.h:1.98.2.1.2.7.2.2 
php-src/main/php_globals.h:1.98.2.1.2.7.2.3
--- php-src/main/php_globals.h:1.98.2.1.2.7.2.2 Mon Dec 31 07:17:17 2007
+++ php-src/main/php_globals.h  Sat Mar  8 22:12:32 2008
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: php_globals.h,v 1.98.2.1.2.7.2.2 2007/12/31 07:17:17 sebastian Exp $ */
+/* $Id: php_globals.h,v 1.98.2.1.2.7.2.3 2008/03/08 22:12:32 colder Exp $ */
 
 #ifndef PHP_GLOBALS_H
 #define PHP_GLOBALS_H
@@ -150,8 +150,6 @@
char *last_error_message;
char 

[PHP-CVS] cvs: php-src /ext/standard/tests/general_functions bug44295.phpt /main main.c php.h php_globals.h

2008-03-08 Thread Etienne Kneuss
colder  Sat Mar  8 22:17:32 2008 UTC

  Modified files:  
/php-src/ext/standard/tests/general_functions   bug44295.phpt 
/php-src/main   main.c php.h php_globals.h 
  Log:
  User error handlers no longer catch supressed errors
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/bug44295.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/standard/tests/general_functions/bug44295.phpt
diff -u /dev/null php-src/ext/standard/tests/general_functions/bug44295.phpt:1.2
--- /dev/null   Sat Mar  8 22:17:32 2008
+++ php-src/ext/standard/tests/general_functions/bug44295.phpt  Sat Mar  8 
22:17:32 2008
@@ -0,0 +1,26 @@
+--TEST--
+user defined error handler + set_error_handling(EH_THROW)
+--SKIPIF--
+?php if (!extension_loaded(spl) || is_dir('/this/path/does/not/exist')) 
die(skip); ?
+--FILE--
+?php
+$dir = '/this/path/does/not/exist';
+
+set_error_handler('my_error_handler');
+function my_error_handler() {$a = func_get_args(); print in error handler\n; 
}
+
+try {
+print before\n;
+$iter = new DirectoryIterator($dir);
+print get_class($iter) . \n;
+print after\n;
+} catch (Exception $e) {
+print in catch: .$e-getMessage().\n;
+}
+?
+==DONE==
+?php exit(0); ?
+--EXPECT--
+before
+in catch: DirectoryIterator::__construct(/this/path/does/not/exist): failed to 
open dir: No such file or directory
+==DONE==
http://cvs.php.net/viewvc.cgi/php-src/main/main.c?r1=1.762r2=1.763diff_format=u
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.762 php-src/main/main.c:1.763
--- php-src/main/main.c:1.762   Wed Mar  5 21:20:14 2008
+++ php-src/main/main.c Sat Mar  8 22:17:32 2008
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: main.c,v 1.762 2008/03/05 21:20:14 pajoye Exp $ */
+/* $Id: main.c,v 1.763 2008/03/08 22:17:32 colder Exp $ */
 
 /* {{{ includes
  */
@@ -878,17 +878,15 @@
 /* {{{ php_suppress_errors */
 PHPAPI void php_set_error_handling(error_handling_t error_handling, 
zend_class_entry *exception_class TSRMLS_DC)
 {
-   PG(error_handling) = error_handling;
-   PG(exception_class) = exception_class;
-   if (PG(last_error_message)) {
-   free(PG(last_error_message));
-   PG(last_error_message) = NULL;
-   }
-   if (PG(last_error_file)) {
-   free(PG(last_error_file));
-   PG(last_error_file) = NULL;
+   EG(error_handling) = error_handling;
+   EG(exception_class) = exception_class;
+
+   if (error_handling == EH_NORMAL) {
+   EG(user_error_handler) = EG(user_error_handler_old);
+   } else {
+   EG(user_error_handler_old) = EG(user_error_handler);
+   EG(user_error_handler) = NULL;
}
-   PG(last_error_lineno) = 0;
 }
 /* }}} */
 
@@ -933,7 +931,7 @@
}
 
/* according to error handling mode, suppress error, throw exception or 
show it */
-   if (PG(error_handling) != EH_NORMAL) {
+   if (EG(error_handling) != EH_NORMAL) {
switch (type) {
case E_ERROR:
case E_CORE_ERROR:
@@ -954,8 +952,8 @@
/* throw an exception if we are in EH_THROW mode
 * but DO NOT overwrite a pending exception
 */
-   if (PG(error_handling) == EH_THROW  
!EG(exception)) {
-   
zend_throw_error_exception(PG(exception_class), buffer, 0, type TSRMLS_CC);
+   if (EG(error_handling) == EH_THROW  
!EG(exception)) {
+   
zend_throw_error_exception(EG(exception_class), buffer, 0, type TSRMLS_CC);
}
efree(buffer);
return;
@@ -1847,7 +1845,8 @@
PG(last_error_message) = NULL;
PG(last_error_file) = NULL;
PG(last_error_lineno) = 0;
-   PG(error_handling) = EH_NORMAL;
+   EG(error_handling)  = EH_NORMAL;
+   EG(exception_class) = NULL;
PG(disable_functions) = NULL;
PG(disable_classes) = NULL;
PG(allow_url_fopen_list) = NULL;
http://cvs.php.net/viewvc.cgi/php-src/main/php.h?r1=1.242r2=1.243diff_format=u
Index: php-src/main/php.h
diff -u php-src/main/php.h:1.242 php-src/main/php.h:1.243
--- php-src/main/php.h:1.242Wed Jan 30 09:56:22 2008
+++ php-src/main/php.h  Sat Mar  8 22:17:32 2008
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: php.h,v 1.242 2008/01/30 09:56:22 dmitry Exp $ */
+/* $Id: php.h,v 1.243 2008/03/08 22:17:32 colder Exp $ */
 
 #ifndef PHP_H
 #define PHP_H
@@ -277,12 +277,7 @@
 END_EXTERN_C()
 
 #define php_error zend_error
-
-typedef enum {
-   EH_NORMAL = 0,
-   EH_SUPPRESS,
-   EH_THROW
-} error_handling_t;

[PHP-CVS] cvs: php-src(PHP_5_2) /ext/spl spl_iterators.c /ext/spl/tests bug41828.phpt

2008-03-12 Thread Etienne Kneuss
colder  Wed Mar 12 13:24:24 2008 UTC

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

  Modified files:  
/php-src/ext/splspl_iterators.c 
  Log:
  Fix bug #41828 (Fix crash on wrong instantiation)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.73.2.30.2.30r2=1.73.2.30.2.31diff_format=u
Index: php-src/ext/spl/spl_iterators.c
diff -u php-src/ext/spl/spl_iterators.c:1.73.2.30.2.30 
php-src/ext/spl/spl_iterators.c:1.73.2.30.2.31
--- php-src/ext/spl/spl_iterators.c:1.73.2.30.2.30  Mon Dec 31 07:20:11 2007
+++ php-src/ext/spl/spl_iterators.c Wed Mar 12 13:24:24 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_iterators.c,v 1.73.2.30.2.30 2007/12/31 07:20:11 sebastian 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 @@
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) {

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



-- 
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_iterators.c /ext/spl/tests bug41828.phpt

2008-03-12 Thread Etienne Kneuss
colder  Wed Mar 12 13:34:47 2008 UTC

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

  Modified files:  
/php-src/ext/splspl_iterators.c 
  Log:
  Fix bug #41828 (Fix crash on wrong instantiation)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.73.2.30.2.28.2.6r2=1.73.2.30.2.28.2.7diff_format=u
Index: php-src/ext/spl/spl_iterators.c
diff -u php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.6 
php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.7
--- php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.6  Thu Jan 10 10:11:33 2008
+++ php-src/ext/spl/spl_iterators.c Wed Mar 12 13:34:47 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.6 2008/01/10 10:11:33 helly Exp $ */
+/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.7 2008/03/12 13:34:47 colder Exp $ 
*/
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -699,8 +699,13 @@
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) {

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



-- 
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_iterators.c /ext/spl/tests bug41828.phpt

2008-03-12 Thread Etienne Kneuss
colder  Wed Mar 12 13:35:04 2008 UTC

  Modified files:  
/php-src/ext/splspl_iterators.c 
/php-src/ext/spl/tests  bug41828.phpt 
  Log:
  Fix bug #41828 (Fix crash on wrong instantiation)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.168r2=1.169diff_format=u
Index: php-src/ext/spl/spl_iterators.c
diff -u php-src/ext/spl/spl_iterators.c:1.168 
php-src/ext/spl/spl_iterators.c:1.169
--- php-src/ext/spl/spl_iterators.c:1.168   Thu Jan 10 10:11:21 2008
+++ php-src/ext/spl/spl_iterators.c Wed Mar 12 13:35:04 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_iterators.c,v 1.168 2008/01/10 10:11:21 helly Exp $ */
+/* $Id: spl_iterators.c,v 1.169 2008/03/12 13:35:04 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -702,8 +702,13 @@
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_u_hash_find(Z_OBJCE_P(zobj)-function_table, 
UG(unicode)?IS_UNICODE:IS_STRING, method, method_len+1, (void **) 
function_handler) == FAILURE) {
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug41828.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/spl/tests/bug41828.phpt
diff -u /dev/null php-src/ext/spl/tests/bug41828.phpt:1.2
--- /dev/null   Wed Mar 12 13:35:04 2008
+++ php-src/ext/spl/tests/bug41828.phpt Wed Mar 12 13:35:04 2008
@@ -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



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



[PHP-CVS] cvs: php-src /ext/standard basic_functions.c basic_functions.h /ext/standard/tests/class_object forward_static_call_001.phpt forward_static_call_002.phpt forward_static_call_003.phpt

2008-04-07 Thread Etienne Kneuss
colder  Mon Apr  7 10:39:43 2008 UTC

  Added files: 
/php-src/ext/standard/tests/class_object
forward_static_call_001.phpt 
forward_static_call_002.phpt 
forward_static_call_003.phpt 

  Modified files:  
/php-src/ext/standard   basic_functions.c basic_functions.h 
  Log:
  Implement forward_static_call(_array) to complete LSB. Patch by Mike Lively
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.892r2=1.893diff_format=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.892 
php-src/ext/standard/basic_functions.c:1.893
--- php-src/ext/standard/basic_functions.c:1.892Thu Mar 20 00:50:47 2008
+++ php-src/ext/standard/basic_functions.c  Mon Apr  7 10:39:43 2008
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: basic_functions.c,v 1.892 2008/03/20 00:50:47 dsp Exp $ */
+/* $Id: basic_functions.c,v 1.893 2008/04/07 10:39:43 colder Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -809,6 +809,19 @@
 ZEND_END_ARG_INFO()
 
 static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_forward_static_call, 0, 0, 1)
+   ZEND_ARG_INFO(0, function_name)
+   ZEND_ARG_INFO(0, parameter)
+   ZEND_ARG_INFO(0, ...)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_forward_static_call_array, 0, 0, 2)
+   ZEND_ARG_INFO(0, function_name)
+   ZEND_ARG_INFO(0, parameters) /* ARRAY_INFO(0, parameters, 1) */
+ZEND_END_ARG_INFO()
+
+static
 ZEND_BEGIN_ARG_INFO(arginfo_register_shutdown_function, 0)
ZEND_ARG_INFO(0, function_name)
 ZEND_END_ARG_INFO()
@@ -3398,6 +3411,8 @@
PHP_FE(call_user_func_array,
arginfo_call_user_func_array)
PHP_DEP_FE(call_user_method,
arginfo_call_user_method)
PHP_DEP_FE(call_user_method_array,  
arginfo_call_user_method_array)
+   PHP_FE(forward_static_call, 
arginfo_forward_static_call)
+   PHP_FE(forward_static_call_array,   
arginfo_forward_static_call_array)
PHP_FE(serialize,   
arginfo_serialize)
PHP_FE(unserialize, 
arginfo_unserialize)
 
@@ -5197,6 +5212,67 @@
 }
 /* }}} */
 
+/* {{{ proto mixed forward_static_call(mixed function_name [, mixed parmeter] 
[, mixed ...]) U
+   Call a user function which is the first parameter */
+PHP_FUNCTION(forward_static_call)
+{
+   zval *retval_ptr = NULL;
+   zend_fcall_info fci;
+   zend_fcall_info_cache fci_cache;
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, f*, fci, 
fci_cache, fci.params, fci.param_count) == FAILURE) {
+   return;
+   }
+
+   if (!EG(active_op_array)-scope) {
+   zend_error(E_ERROR, Cannot call forward_static_call() when no 
class scope is active);
+   }
+
+   fci.retval_ptr_ptr = retval_ptr;
+
+   if (EG(called_scope) 
+   instanceof_function(EG(called_scope), fci_cache.calling_scope 
TSRMLS_CC)) {
+   fci_cache.calling_scope = EG(called_scope);
+   }
+   
+   if (zend_call_function(fci, fci_cache TSRMLS_CC) == SUCCESS  
fci.retval_ptr_ptr  *fci.retval_ptr_ptr) {
+   COPY_PZVAL_TO_ZVAL(*return_value, *fci.retval_ptr_ptr);
+   }
+
+   if (fci.params) {
+   efree(fci.params);
+   }
+}
+/* }}} */
+
+/* {{{ proto mixed call_user_func_array(string function_name, array 
parameters) U
+   Call a user function which is the first parameter with the arguments 
contained in array */
+PHP_FUNCTION(forward_static_call_array)
+{
+   zval *params, *retval_ptr = NULL;
+   zend_fcall_info fci;
+   zend_fcall_info_cache fci_cache;
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, fa/, fci, 
fci_cache, params) == FAILURE) {
+   return;
+   }
+
+   zend_fcall_info_args(fci, params TSRMLS_CC);
+   fci.retval_ptr_ptr = retval_ptr;
+
+   if (EG(called_scope) 
+   instanceof_function(EG(called_scope), fci_cache.calling_scope 
TSRMLS_CC)) {
+   fci_cache.calling_scope = EG(called_scope);
+   }
+
+   if (zend_call_function(fci, fci_cache TSRMLS_CC) == SUCCESS  
fci.retval_ptr_ptr  *fci.retval_ptr_ptr) {
+  

[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/standard basic_functions.c basic_functions.h /ext/standard/tests/class_object forward_static_call_001.phpt forward_static_call_002.phpt forward_static_cal

2008-04-07 Thread Etienne Kneuss
colder  Mon Apr  7 10:44:59 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/standard/tests/class_object
forward_static_call_001.phpt 
forward_static_call_002.phpt 
forward_static_call_003.phpt 

  Modified files:  
/php-srcNEWS 
/php-src/ext/standard   basic_functions.c basic_functions.h 
  Log:
  MFH: Implement forward_static_call(_array) to complete LSB. Patch by Mike 
Lively
  http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.154r2=1.2027.2.547.2.965.2.155diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.154 
php-src/NEWS:1.2027.2.547.2.965.2.155
--- php-src/NEWS:1.2027.2.547.2.965.2.154   Sat Apr  5 23:50:21 2008
+++ php-src/NEWSMon Apr  7 10:44:59 2008
@@ -86,6 +86,7 @@
 - Added PREG_BAD_UTF8_OFFSET_ERROR constant. (Nuno)
 - Added request_order INI variable to control specifically $_REQUEST 
   behavior. (Stas)
+- Added forward_static_call(_array) to complete LSB. (Mike Lively)
 
 - Improved PHP runtime speed and memory usage:
   . Replaced flex based scanner with re2c based scanner. (Marcus, Nuno, Scott)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.725.2.31.2.64.2.23r2=1.725.2.31.2.64.2.24diff_format=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.725.2.31.2.64.2.23 
php-src/ext/standard/basic_functions.c:1.725.2.31.2.64.2.24
--- php-src/ext/standard/basic_functions.c:1.725.2.31.2.64.2.23 Thu Mar 20 
00:52:46 2008
+++ php-src/ext/standard/basic_functions.c  Mon Apr  7 10:44:59 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: basic_functions.c,v 1.725.2.31.2.64.2.23 2008/03/20 00:52:46 dsp Exp $ 
*/
+/* $Id: basic_functions.c,v 1.725.2.31.2.64.2.24 2008/04/07 10:44:59 colder 
Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -811,6 +811,19 @@
 ZEND_END_ARG_INFO()
 
 static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_forward_static_call, 0, 0, 1)
+   ZEND_ARG_INFO(0, function_name)
+   ZEND_ARG_INFO(0, parameter)
+   ZEND_ARG_INFO(0, ...)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_forward_static_call_array, 0, 0, 2)
+   ZEND_ARG_INFO(0, function_name)
+   ZEND_ARG_INFO(0, parameters) /* ARRAY_INFO(0, parameters, 1) */
+ZEND_END_ARG_INFO()
+
+static
 ZEND_BEGIN_ARG_INFO(arginfo_register_shutdown_function, 0)
ZEND_ARG_INFO(0, function_name)
 ZEND_END_ARG_INFO()
@@ -3364,6 +3377,8 @@
PHP_FE(call_user_func_array,
arginfo_call_user_func_array)
PHP_DEP_FE(call_user_method,
arginfo_call_user_method)
PHP_DEP_FE(call_user_method_array,  
arginfo_call_user_method_array)
+   PHP_FE(forward_static_call, 
arginfo_forward_static_call)
+   PHP_FE(forward_static_call_array,   
arginfo_forward_static_call_array)
PHP_FE(serialize,   
arginfo_serialize)
PHP_FE(unserialize, 
arginfo_unserialize)
 
@@ -5228,6 +5243,67 @@
 }
 /* }}} */
 
+/* {{{ proto mixed forward_static_call(mixed function_name [, mixed parmeter] 
[, mixed ...]) U
+   Call a user function which is the first parameter */
+PHP_FUNCTION(forward_static_call)
+{
+   zval *retval_ptr = NULL;
+   zend_fcall_info fci;
+   zend_fcall_info_cache fci_cache;
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, f*, fci, 
fci_cache, fci.params, fci.param_count) == FAILURE) {
+   return;
+   }
+
+   if (!EG(active_op_array)-scope) {
+   zend_error(E_ERROR, Cannot call forward_static_call() when no 
class scope is active);
+   }
+
+   fci.retval_ptr_ptr = retval_ptr;
+
+   if (EG(called_scope) 
+   instanceof_function(EG(called_scope), fci_cache.calling_scope 
TSRMLS_CC)) {
+   fci_cache.calling_scope = EG(called_scope);
+   }
+   
+   if (zend_call_function(fci, fci_cache TSRMLS_CC) == SUCCESS  
fci.retval_ptr_ptr  *fci.retval_ptr_ptr) {
+   COPY_PZVAL_TO_ZVAL(*return_value, *fci.retval_ptr_ptr);
+   }
+
+   if (fci.params) {
+   efree(fci.params);
+   }
+}
+/* }}} */
+
+/* {{{ proto mixed call_user_func_array(string 

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

2008-04-09 Thread Etienne Kneuss
colder  Wed Apr  9 19:00:48 2008 UTC

  Modified files:  
/php-src/ext/splspl_directory.c 
  Log:
  Fix #44511 (Ensure no exception was already thrown by php_stream_opendir)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.150r2=1.151diff_format=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.150 
php-src/ext/spl/spl_directory.c:1.151
--- php-src/ext/spl/spl_directory.c:1.150   Thu Mar 13 19:45:22 2008
+++ php-src/ext/spl/spl_directory.c Wed Apr  9 19:00:48 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_directory.c,v 1.150 2008/03/13 19:45:22 helly Exp $ */
+/* $Id: spl_directory.c,v 1.151 2008/04/09 19:00:48 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -236,7 +236,7 @@
}
intern-u.dir.index = 0;
 
-   if (intern-u.dir.dirp == NULL) {
+   if (EG(exception) || intern-u.dir.dirp == NULL) {
/* throw exception: should've been already happened */
intern-u.dir.entry.d_name[0] = '\0';
} else {



-- 
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_directory.c

2008-04-09 Thread Etienne Kneuss
colder  Wed Apr  9 19:01:13 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/splspl_directory.c 
  Log:
  MFH: Fix #44511 (Ensure no exception was already thrown by php_stream_opendir)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.45.2.27.2.23.2.18r2=1.45.2.27.2.23.2.19diff_format=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.18 
php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.19
--- php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.18 Thu Mar 13 19:46:44 2008
+++ php-src/ext/spl/spl_directory.c Wed Apr  9 19:01:12 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_directory.c,v 1.45.2.27.2.23.2.18 2008/03/13 19:46:44 helly Exp $ 
*/
+/* $Id: spl_directory.c,v 1.45.2.27.2.23.2.19 2008/04/09 19:01:12 colder Exp $ 
*/
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -215,7 +215,7 @@
}
intern-u.dir.index = 0;
 
-   if (intern-u.dir.dirp == NULL) {
+   if (EG(exception) || intern-u.dir.dirp == NULL) {
/* throw exception: should've been already happened */
intern-u.dir.entry.d_name[0] = '\0';
} else {



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



[PHP-CVS] cvs: php-src /ext/standard dns.c

2008-04-14 Thread Etienne Kneuss
colder  Mon Apr 14 16:49:30 2008 UTC

  Modified files:  
/php-src/ext/standard   dns.c 
  Log:
  Fix dns_check_proto (related to #44723)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.91r2=1.92diff_format=u
Index: php-src/ext/standard/dns.c
diff -u php-src/ext/standard/dns.c:1.91 php-src/ext/standard/dns.c:1.92
--- php-src/ext/standard/dns.c:1.91 Thu Jan 17 14:12:36 2008
+++ php-src/ext/standard/dns.c  Mon Apr 14 16:49:30 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: dns.c,v 1.91 2008/01/17 14:12:36 iliaa Exp $ */
+/* $Id: dns.c,v 1.92 2008/04/14 16:49:30 colder Exp $ */
 
 /* {{{ includes */
 #include php.h
@@ -247,7 +247,7 @@
 
 #if HAVE_RES_SEARCH  !(defined(__BEOS__)||defined(PHP_WIN32) || 
defined(NETWARE))
 
-/* {{{ proto int dns_check_record(string host [, string type]) U
+/* {{{ proto bool dns_check_record(string host [, string type]) U
Check DNS records corresponding to a given Internet host name or IP address 
*/
 PHP_FUNCTION(dns_check_record)
 {



-- 
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/standard dns.c

2008-04-14 Thread Etienne Kneuss
colder  Mon Apr 14 16:50:11 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   dns.c 
  Log:
  MFH: Fix dns_check_proto (related to #44723)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.70.2.7.2.5.2.4r2=1.70.2.7.2.5.2.5diff_format=u
Index: php-src/ext/standard/dns.c
diff -u php-src/ext/standard/dns.c:1.70.2.7.2.5.2.4 
php-src/ext/standard/dns.c:1.70.2.7.2.5.2.5
--- php-src/ext/standard/dns.c:1.70.2.7.2.5.2.4 Thu Jan 17 14:12:12 2008
+++ php-src/ext/standard/dns.c  Mon Apr 14 16:50:11 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: dns.c,v 1.70.2.7.2.5.2.4 2008/01/17 14:12:12 iliaa Exp $ */
+/* $Id: dns.c,v 1.70.2.7.2.5.2.5 2008/04/14 16:50:11 colder Exp $ */
 
 /* {{{ includes */
 #include php.h
@@ -247,7 +247,7 @@
 
 #if HAVE_RES_SEARCH  !(defined(__BEOS__)||defined(PHP_WIN32) || 
defined(NETWARE))
 
-/* {{{ proto int dns_check_record(string host [, string type])
+/* {{{ proto bool dns_check_record(string host [, string type])
Check DNS records corresponding to a given Internet host name or IP address 
*/
 PHP_FUNCTION(dns_check_record)
 {



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



[PHP-CVS] cvs: php-src /ext/simplexml simplexml.c /ext/simplexml/tests 035.phpt

2008-05-03 Thread Etienne Kneuss
colder  Sat May  3 15:09:24 2008 UTC

  Added files: 
/php-src/ext/simplexml/tests035.phpt 

  Modified files:  
/php-src/ext/simplexml  simplexml.c 
  Log:
  Fix #44484 (define SimpleXMLElement::__toString())
  
http://cvs.php.net/viewvc.cgi/php-src/ext/simplexml/simplexml.c?r1=1.253r2=1.254diff_format=u
Index: php-src/ext/simplexml/simplexml.c
diff -u php-src/ext/simplexml/simplexml.c:1.253 
php-src/ext/simplexml/simplexml.c:1.254
--- php-src/ext/simplexml/simplexml.c:1.253 Thu Mar 20 16:46:55 2008
+++ php-src/ext/simplexml/simplexml.c   Sat May  3 15:09:24 2008
@@ -18,7 +18,7 @@
   +--+
 */
 
-/* $Id: simplexml.c,v 1.253 2008/03/20 16:46:55 rrichards Exp $ */
+/* $Id: simplexml.c,v 1.254 2008/05/03 15:09:24 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -1851,6 +1851,23 @@
 }
 /* }}} */
 
+/* {{{ proto object SimpleXMLElement::__toString() U
+   Returns the string content */
+SXE_METHOD(__toString)
+{
+   zval   *result;
+
+   ALLOC_INIT_ZVAL(result);
+
+   if (sxe_object_cast(getThis(), result, IS_STRING, NULL TSRMLS_CC) == 
SUCCESS) {
+   RETURN_ZVAL(result, 1, 1);
+   } else {
+   zval_ptr_dtor(result);
+   RETURN_EMPTY_TEXT();
+   }
+}
+/* }}} */
+
 static int sxe_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */
 {
php_sxe_object  *sxe;
@@ -2494,6 +2511,7 @@
SXE_ME(getName,NULL, ZEND_ACC_PUBLIC)
SXE_ME(addChild,   NULL, ZEND_ACC_PUBLIC)
SXE_ME(addAttribute,   NULL, ZEND_ACC_PUBLIC)
+   SXE_ME(__toString, NULL, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
 };
 /* }}} */
@@ -2542,7 +2560,7 @@
 {
php_info_print_table_start();
php_info_print_table_header(2, Simplexml support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.253 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.254 $);
php_info_print_table_row(2, Schema support,
 #ifdef LIBXML_SCHEMAS_ENABLED
enabled);

http://cvs.php.net/viewvc.cgi/php-src/ext/simplexml/tests/035.phpt?view=markuprev=1.1
Index: php-src/ext/simplexml/tests/035.phpt
+++ php-src/ext/simplexml/tests/035.phpt
--TEST--
SimpleXML: __toString
--SKIPIF--
?php if (!extension_loaded(simplexml)) print skip; ?
--FILE--
?php
$string = '?xml version=1.0?
foobar
   pBlah 1/p
   pBlah 2/p
   pBlah 3/p
   ttBlah 4/tt
/bar/foo
';
$foo = simplexml_load_string($string);
$p = $foo-bar-p;
echo $p.\n;
echo $p-__toString().\n;
?
==Done==
--EXPECT--
Blah 1
Blah 1
==Done==



-- 
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/simplexml simplexml.c /ext/simplexml/tests 035.phpt

2008-05-03 Thread Etienne Kneuss
colder  Sat May  3 15:09:37 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/simplexml/tests035.phpt 

  Modified files:  
/php-src/ext/simplexml  simplexml.c 
  Log:
  MFH: Fix #44484 (define SimpleXMLElement::__toString())
  
http://cvs.php.net/viewvc.cgi/php-src/ext/simplexml/simplexml.c?r1=1.151.2.22.2.35.2.12r2=1.151.2.22.2.35.2.13diff_format=u
Index: php-src/ext/simplexml/simplexml.c
diff -u php-src/ext/simplexml/simplexml.c:1.151.2.22.2.35.2.12 
php-src/ext/simplexml/simplexml.c:1.151.2.22.2.35.2.13
--- php-src/ext/simplexml/simplexml.c:1.151.2.22.2.35.2.12  Thu Mar 20 
16:48:09 2008
+++ php-src/ext/simplexml/simplexml.c   Sat May  3 15:09:37 2008
@@ -18,7 +18,7 @@
   +--+
 */
 
-/* $Id: simplexml.c,v 1.151.2.22.2.35.2.12 2008/03/20 16:48:09 rrichards Exp $ 
*/
+/* $Id: simplexml.c,v 1.151.2.22.2.35.2.13 2008/05/03 15:09:37 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -1794,6 +1794,23 @@
 }
 /* }}} */
 
+/* {{{ proto object SimpleXMLElement::__toString() U
+   Returns the string content */
+SXE_METHOD(__toString)
+{
+   zval   *result;
+
+   ALLOC_INIT_ZVAL(result);
+
+   if (sxe_object_cast(getThis(), result, IS_STRING TSRMLS_CC) == SUCCESS) 
{
+   RETURN_ZVAL(result, 1, 1);
+   } else {
+   zval_ptr_dtor(result);
+   RETURN_EMPTY_STRING();
+   }
+}
+/* }}} */
+
 static int sxe_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */
 {
php_sxe_object  *sxe;
@@ -2412,6 +2429,7 @@
SXE_ME(getName,NULL, ZEND_ACC_PUBLIC)
SXE_ME(addChild,   NULL, ZEND_ACC_PUBLIC)
SXE_ME(addAttribute,   NULL, ZEND_ACC_PUBLIC)
+   SXE_ME(__toString, NULL, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
 };
 /* }}} */
@@ -2460,7 +2478,7 @@
 {
php_info_print_table_start();
php_info_print_table_header(2, Simplexml support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 
1.151.2.22.2.35.2.12 $);
+   php_info_print_table_row(2, Revision, $Revision: 
1.151.2.22.2.35.2.13 $);
php_info_print_table_row(2, Schema support,
 #ifdef LIBXML_SCHEMAS_ENABLED
enabled);

http://cvs.php.net/viewvc.cgi/php-src/ext/simplexml/tests/035.phpt?view=markuprev=1.1
Index: php-src/ext/simplexml/tests/035.phpt
+++ php-src/ext/simplexml/tests/035.phpt
--TEST--
SimpleXML: __toString
--SKIPIF--
?php if (!extension_loaded(simplexml)) print skip; ?
--FILE--
?php
$string = '?xml version=1.0?
foobar
   pBlah 1/p
   pBlah 2/p
   pBlah 3/p
   ttBlah 4/tt
/bar/foo
';
$foo = simplexml_load_string($string);
$p = $foo-bar-p;
echo $p.\n;
echo $p-__toString().\n;
?
==Done==
--EXPECT--
Blah 1
Blah 1
==Done==



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



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

2008-05-03 Thread Etienne Kneuss
colder  Sat May  3 16:00:40 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/splspl_directory.c 
  Log:
  MFB: Fix #44838 (static class reference restricting overwriting)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.45.2.27.2.26r2=1.45.2.27.2.27diff_format=u
Index: php-src/ext/spl/spl_directory.c
diff -u 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.27
--- php-src/ext/spl/spl_directory.c:1.45.2.27.2.26  Wed Feb 13 12:23:26 2008
+++ php-src/ext/spl/spl_directory.c Sat May  3 16:00:40 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_directory.c,v 1.45.2.27.2.26 2008/02/13 12:23:26 helly Exp $ */
+/* $Id: spl_directory.c,v 1.45.2.27.2.27 2008/05/03 16:00:40 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -1055,7 +1055,7 @@
INIT_PZVAL(zpath);
ZVAL_STRINGL(zpath, intern-file_name, intern-file_name_len, 0);
 
-   spl_instantiate_arg_ex1(spl_ce_RecursiveDirectoryIterator, 
return_value, 0, zpath TSRMLS_CC);
+   spl_instantiate_arg_ex1(Z_OBJCE_P(getThis()), return_value, 0, zpath 
TSRMLS_CC);

subdir = 
(spl_filesystem_object*)zend_object_store_get_object(return_value TSRMLS_CC);
if (subdir) {



-- 
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_directory.c

2008-05-03 Thread Etienne Kneuss
colder  Sat May  3 16:01:00 2008 UTC

  Modified files:  
/php-src/ext/splspl_directory.c 
  Log:
  MFB: Fix #44838 (static class reference restricting overwriting)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.151r2=1.152diff_format=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.151 
php-src/ext/spl/spl_directory.c:1.152
--- php-src/ext/spl/spl_directory.c:1.151   Wed Apr  9 19:00:48 2008
+++ php-src/ext/spl/spl_directory.c Sat May  3 16:01:00 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_directory.c,v 1.151 2008/04/09 19:00:48 colder Exp $ */
+/* $Id: spl_directory.c,v 1.152 2008/05/03 16:01:00 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -1276,7 +1276,7 @@
ZVAL_LONG(zflags, intern-flags);
ZVAL_ZSTRL(zpath, intern-file_name_type, intern-file_name, 
intern-file_name_len, 1);
 
-   spl_instantiate_arg_ex2(spl_ce_RecursiveDirectoryIterator, 
return_value, 0, zpath, zflags TSRMLS_CC);
+   spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), return_value, 0, zpath, 
zflags TSRMLS_CC);
 
zval_dtor(zpath);
 



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



[PHP-CVS] cvs: php-src /ext/gd gd.c /ext/ldap ldap.c /ext/openssl openssl.c /ext/standard file.c streamsfuncs.c uniqid.c

2008-05-04 Thread Etienne Kneuss
colder  Sun May  4 21:16:22 2008 UTC

  Modified files:  
/php-src/ext/gd gd.c 
/php-src/ext/ldap   ldap.c 
/php-src/ext/opensslopenssl.c 
/php-src/ext/standard   file.c streamsfuncs.c uniqid.c 
  Log:
  Fix protos
  
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.385r2=1.386diff_format=u
Index: php-src/ext/gd/gd.c
diff -u php-src/ext/gd/gd.c:1.385 php-src/ext/gd/gd.c:1.386
--- php-src/ext/gd/gd.c:1.385   Thu Feb 28 17:43:32 2008
+++ php-src/ext/gd/gd.c Sun May  4 21:16:22 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: gd.c,v 1.385 2008/02/28 17:43:32 felipe Exp $ */
+/* $Id: gd.c,v 1.386 2008/05/04 21:16:22 colder Exp $ */
 
 /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
Cold Spring Harbor Labs. */
@@ -3994,7 +3994,7 @@
 }
 /* }}} */
 
-/* {{{ proto array imagepstext(resource image, string text, resource font, int 
size, int foreground, int background, int xcoord, int ycoord [, int space, int 
tightness, float angle, int antialias])
+/* {{{ proto array imagepstext(resource image, string text, resource font, int 
size, int foreground, int background, int xcoord, int ycoord [, int space [, 
int tightness [, float angle [, int antialias)
Rasterize a string over an image */
 PHP_FUNCTION(imagepstext)
 {
http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.183r2=1.184diff_format=u
Index: php-src/ext/ldap/ldap.c
diff -u php-src/ext/ldap/ldap.c:1.183 php-src/ext/ldap/ldap.c:1.184
--- php-src/ext/ldap/ldap.c:1.183   Wed Apr 16 13:19:31 2008
+++ php-src/ext/ldap/ldap.c Sun May  4 21:16:22 2008
@@ -23,7 +23,7 @@
+--+
  */
  
-/* $Id: ldap.c,v 1.183 2008/04/16 13:19:31 tony2001 Exp $ */
+/* $Id: ldap.c,v 1.184 2008/05/04 21:16:22 colder Exp $ */
 #define IS_EXT_MODULE
 
 #ifdef HAVE_CONFIG_H
@@ -237,7 +237,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, LDAP Support, enabled);
-   php_info_print_table_row(2, RCS Version, $Id: ldap.c,v 1.183 
2008/04/16 13:19:31 tony2001 Exp $);
+   php_info_print_table_row(2, RCS Version, $Id: ldap.c,v 1.184 
2008/05/04 21:16:22 colder Exp $);
 
if (LDAPG(max_links) == -1) {
snprintf(tmp, 31, %ld/unlimited, LDAPG(num_links));
@@ -386,7 +386,7 @@
 }
 /* }}} */
 
-/* {{{ proto bool ldap_bind(resource link [, string dn, string password])
+/* {{{ proto bool ldap_bind(resource link [, string dn [, string password]])
Bind to LDAP directory */
 PHP_FUNCTION(ldap_bind)
 {
@@ -496,7 +496,7 @@
 }
 /* }}} */
 
-/* {{{ proto bool ldap_sasl_bind(resource link [, string binddn, string 
password, string sasl_mech, string sasl_realm, string sasl_authc_id, string 
sasl_authz_id, string props])
+/* {{{ proto bool ldap_sasl_bind(resource link [, string binddn [, string 
password [, string sasl_mech [, string sasl_realm [, string sasl_authc_id [, 
string sasl_authz_id [, string props]]])
Bind to LDAP directory using SASL */
 PHP_FUNCTION(ldap_sasl_bind)
 {
http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.157r2=1.158diff_format=u
Index: php-src/ext/openssl/openssl.c
diff -u php-src/ext/openssl/openssl.c:1.157 php-src/ext/openssl/openssl.c:1.158
--- php-src/ext/openssl/openssl.c:1.157 Wed Apr  2 14:35:16 2008
+++ php-src/ext/openssl/openssl.c   Sun May  4 21:16:22 2008
@@ -20,7 +20,7 @@
+--+
  */
 
-/* $Id: openssl.c,v 1.157 2008/04/02 14:35:16 tony2001 Exp $ */
+/* $Id: openssl.c,v 1.158 2008/05/04 21:16:22 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -2176,7 +2176,7 @@
 }
 /* }}} */
 
-/* {{{ proto bool openssl_csr_new(array dn, resource privkey [, array 
configargs, array extraattribs])
+/* {{{ proto bool openssl_csr_new(array dn, resource privkey [, array 
configargs [, array extraattribs]])
Generates a privkey and CSR */
 PHP_FUNCTION(openssl_csr_new)
 {
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.517r2=1.518diff_format=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.517 php-src/ext/standard/file.c:1.518
--- php-src/ext/standard/file.c:1.517   Mon Mar 31 22:44:38 2008
+++ php-src/ext/standard/file.c Sun May  4 21:16:22 2008
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: file.c,v 1.517 2008/03/31 22:44:38 iliaa Exp $ */
+/* $Id: file.c,v 1.518 2008/05/04 21:16:22 colder Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -1198,7 +1198,7 @@
 }
 /* }}} */
 
-/* {{{ proto string fgetss(resource fp [, int lengthish, string 
allowable_tags]) U
+/* {{{ proto string fgetss(resource fp [, int lengthish [, string 
allowable_tags]]) U
Get a line from file pointer and strip HTML tags */
 PHPAPI PHP_FUNCTION(fgetss)
 {

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/gd gd.c /ext/ldap ldap.c /ext/openssl openssl.c /ext/standard file.c streamsfuncs.c uniqid.c

2008-05-04 Thread Etienne Kneuss
colder  Sun May  4 21:17:33 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/gd gd.c 
/php-src/ext/ldap   ldap.c 
/php-src/ext/opensslopenssl.c 
/php-src/ext/standard   file.c streamsfuncs.c uniqid.c 
  Log:
  MFH: Fix protos
  http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.312.2.20.2.32.2.4r2=1.312.2.20.2.32.2.5diff_format=u
Index: php-src/ext/gd/gd.c
diff -u php-src/ext/gd/gd.c:1.312.2.20.2.32.2.4 
php-src/ext/gd/gd.c:1.312.2.20.2.32.2.5
--- php-src/ext/gd/gd.c:1.312.2.20.2.32.2.4 Fri Apr  4 17:42:18 2008
+++ php-src/ext/gd/gd.c Sun May  4 21:17:32 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: gd.c,v 1.312.2.20.2.32.2.4 2008/04/04 17:42:18 felipe Exp $ */
+/* $Id: gd.c,v 1.312.2.20.2.32.2.5 2008/05/04 21:17:32 colder Exp $ */
 
 /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
Cold Spring Harbor Labs. */
@@ -4547,7 +4547,7 @@
 }
 /* }}} */
 
-/* {{{ proto array imagepstext(resource image, string text, resource font, int 
size, int foreground, int background, int xcoord, int ycoord [, int space, int 
tightness, float angle, int antialias])
+/* {{{ proto array imagepstext(resource image, string text, resource font, int 
size, int foreground, int background, int xcoord, int ycoord [, int space [, 
int tightness [, float angle [, int antialias])
Rasterize a string over an image */
 PHP_FUNCTION(imagepstext)
 {
http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.161.2.3.2.11.2.7r2=1.161.2.3.2.11.2.8diff_format=u
Index: php-src/ext/ldap/ldap.c
diff -u php-src/ext/ldap/ldap.c:1.161.2.3.2.11.2.7 
php-src/ext/ldap/ldap.c:1.161.2.3.2.11.2.8
--- php-src/ext/ldap/ldap.c:1.161.2.3.2.11.2.7  Wed Apr 16 14:21:04 2008
+++ php-src/ext/ldap/ldap.c Sun May  4 21:17:32 2008
@@ -23,7 +23,7 @@
+--+
  */
  
-/* $Id: ldap.c,v 1.161.2.3.2.11.2.7 2008/04/16 14:21:04 tony2001 Exp $ */
+/* $Id: ldap.c,v 1.161.2.3.2.11.2.8 2008/05/04 21:17:32 colder Exp $ */
 #define IS_EXT_MODULE
 
 #ifdef HAVE_CONFIG_H
@@ -237,7 +237,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, LDAP Support, enabled);
-   php_info_print_table_row(2, RCS Version, $Id: ldap.c,v 
1.161.2.3.2.11.2.7 2008/04/16 14:21:04 tony2001 Exp $);
+   php_info_print_table_row(2, RCS Version, $Id: ldap.c,v 
1.161.2.3.2.11.2.8 2008/05/04 21:17:32 colder Exp $);
 
if (LDAPG(max_links) == -1) {
snprintf(tmp, 31, %ld/unlimited, LDAPG(num_links));
@@ -386,7 +386,7 @@
 }
 /* }}} */
 
-/* {{{ proto bool ldap_bind(resource link [, string dn, string password])
+/* {{{ proto bool ldap_bind(resource link [, string dn [, string password]])
Bind to LDAP directory */
 PHP_FUNCTION(ldap_bind)
 {
@@ -496,7 +496,7 @@
 }
 /* }}} */
 
-/* {{{ proto bool ldap_sasl_bind(resource link [, string binddn, string 
password, string sasl_mech, string sasl_realm, string sasl_authc_id, string 
sasl_authz_id, string props])
+/* {{{ proto bool ldap_sasl_bind(resource link [, string binddn [, string 
password [, string sasl_mech [, string sasl_realm [, string sasl_authc_id [, 
string sasl_authz_id [, string props]]])
Bind to LDAP directory using SASL */
 PHP_FUNCTION(ldap_sasl_bind)
 {
http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.98.2.5.2.41.2.8r2=1.98.2.5.2.41.2.9diff_format=u
Index: php-src/ext/openssl/openssl.c
diff -u php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.8 
php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.9
--- php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.8 Wed Apr  2 14:35:29 2008
+++ php-src/ext/openssl/openssl.c   Sun May  4 21:17:32 2008
@@ -20,7 +20,7 @@
+--+
  */
 
-/* $Id: openssl.c,v 1.98.2.5.2.41.2.8 2008/04/02 14:35:29 tony2001 Exp $ */
+/* $Id: openssl.c,v 1.98.2.5.2.41.2.9 2008/05/04 21:17:32 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -2138,7 +2138,7 @@
 }
 /* }}} */
 
-/* {{{ proto bool openssl_csr_new(array dn, resource privkey [, array 
configargs, array extraattribs])
+/* {{{ proto bool openssl_csr_new(array dn, resource privkey [, array 
configargs [, array extraattribs]])
Generates a privkey and CSR */
 PHP_FUNCTION(openssl_csr_new)
 {
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.12r2=1.409.2.6.2.28.2.13diff_format=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.12 
php-src/ext/standard/file.c:1.409.2.6.2.28.2.13
--- php-src/ext/standard/file.c:1.409.2.6.2.28.2.12 Tue Apr 15 15:48:20 2008
+++ php-src/ext/standard/file.c Sun May  4 21:17:32 2008
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: file.c,v 1.409.2.6.2.28.2.12 2008/04/15 15:48:20 iliaa Exp $ */
+/* $Id: file.c,v 1.409.2.6.2.28.2.13 

[PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd gd.c /ext/ldap ldap.c /ext/openssl openssl.c /ext/standard file.c streamsfuncs.c uniqid.c

2008-05-04 Thread Etienne Kneuss
colder  Sun May  4 21:19:18 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/gd gd.c 
/php-src/ext/ldap   ldap.c 
/php-src/ext/opensslopenssl.c 
/php-src/ext/standard   file.c streamsfuncs.c uniqid.c 
  Log:
  MFH: Fix protos
  http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.312.2.20.2.34r2=1.312.2.20.2.35diff_format=u
Index: php-src/ext/gd/gd.c
diff -u php-src/ext/gd/gd.c:1.312.2.20.2.34 php-src/ext/gd/gd.c:1.312.2.20.2.35
--- php-src/ext/gd/gd.c:1.312.2.20.2.34 Fri Apr  4 17:39:52 2008
+++ php-src/ext/gd/gd.c Sun May  4 21:19:17 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: gd.c,v 1.312.2.20.2.34 2008/04/04 17:39:52 felipe Exp $ */
+/* $Id: gd.c,v 1.312.2.20.2.35 2008/05/04 21:19:17 colder Exp $ */
 
 /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
Cold Spring Harbor Labs. */
@@ -4548,7 +4548,7 @@
 }
 /* }}} */
 
-/* {{{ proto array imagepstext(resource image, string text, resource font, int 
size, int foreground, int background, int xcoord, int ycoord [, int space, int 
tightness, float angle, int antialias])
+/* {{{ proto array imagepstext(resource image, string text, resource font, int 
size, int foreground, int background, int xcoord, int ycoord [, int space [, 
int tightness [, float angle [, int antialias)
Rasterize a string over an image */
 PHP_FUNCTION(imagepstext)
 {
http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.161.2.3.2.12r2=1.161.2.3.2.13diff_format=u
Index: php-src/ext/ldap/ldap.c
diff -u php-src/ext/ldap/ldap.c:1.161.2.3.2.12 
php-src/ext/ldap/ldap.c:1.161.2.3.2.13
--- php-src/ext/ldap/ldap.c:1.161.2.3.2.12  Mon Dec 31 07:20:07 2007
+++ php-src/ext/ldap/ldap.c Sun May  4 21:19:17 2008
@@ -23,7 +23,7 @@
+--+
  */
  
-/* $Id: ldap.c,v 1.161.2.3.2.12 2007/12/31 07:20:07 sebastian Exp $ */
+/* $Id: ldap.c,v 1.161.2.3.2.13 2008/05/04 21:19:17 colder Exp $ */
 #define IS_EXT_MODULE
 
 #ifdef HAVE_CONFIG_H
@@ -322,7 +322,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, LDAP Support, enabled);
-   php_info_print_table_row(2, RCS Version, $Id: ldap.c,v 
1.161.2.3.2.12 2007/12/31 07:20:07 sebastian Exp $);
+   php_info_print_table_row(2, RCS Version, $Id: ldap.c,v 
1.161.2.3.2.13 2008/05/04 21:19:17 colder Exp $);
 
if (LDAPG(max_links) == -1) {
snprintf(tmp, 31, %ld/unlimited, LDAPG(num_links));
@@ -471,7 +471,7 @@
 }
 /* }}} */
 
-/* {{{ proto bool ldap_bind(resource link [, string dn, string password])
+/* {{{ proto bool ldap_bind(resource link [, string dn [, string password]])
Bind to LDAP directory */
 PHP_FUNCTION(ldap_bind)
 {
@@ -581,7 +581,7 @@
 }
 /* }}} */
 
-/* {{{ proto bool ldap_sasl_bind(resource link [, string binddn, string 
password, string sasl_mech, string sasl_realm, string sasl_authc_id, string 
sasl_authz_id, string props])
+/* {{{ proto bool ldap_sasl_bind(resource link [, string binddn [, string 
password [, string sasl_mech [, string sasl_realm [, string sasl_authc_id [, 
string sasl_authz_id [, string props]]])
Bind to LDAP directory using SASL */
 PHP_FUNCTION(ldap_sasl_bind)
 {
http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.98.2.5.2.45r2=1.98.2.5.2.46diff_format=u
Index: php-src/ext/openssl/openssl.c
diff -u php-src/ext/openssl/openssl.c:1.98.2.5.2.45 
php-src/ext/openssl/openssl.c:1.98.2.5.2.46
--- php-src/ext/openssl/openssl.c:1.98.2.5.2.45 Mon Apr  7 10:44:03 2008
+++ php-src/ext/openssl/openssl.c   Sun May  4 21:19:17 2008
@@ -20,7 +20,7 @@
+--+
  */
 
-/* $Id: openssl.c,v 1.98.2.5.2.45 2008/04/07 10:44:03 tony2001 Exp $ */
+/* $Id: openssl.c,v 1.98.2.5.2.46 2008/05/04 21:19:17 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -2086,7 +2086,7 @@
 }
 /* }}} */
 
-/* {{{ proto bool openssl_csr_new(array dn, resource privkey [, array 
configargs, array extraattribs])
+/* {{{ proto bool openssl_csr_new(array dn, resource privkey [, array 
configargs [, array extraattribs]])
Generates a privkey and CSR */
 PHP_FUNCTION(openssl_csr_new)
 {
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.31r2=1.409.2.6.2.32diff_format=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.409.2.6.2.31 
php-src/ext/standard/file.c:1.409.2.6.2.32
--- php-src/ext/standard/file.c:1.409.2.6.2.31  Mon Dec 31 07:20:12 2007
+++ php-src/ext/standard/file.c Sun May  4 21:19:17 2008
@@ -21,7 +21,7 @@
+--+
  */
 
-/* $Id: file.c,v 1.409.2.6.2.31 2007/12/31 07:20:12 sebastian Exp $ */
+/* $Id: file.c,v 1.409.2.6.2.32 2008/05/04 21:19:17 colder Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -1129,7 +1129,7 @@
 }
 /* }}} 

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

2008-05-06 Thread Etienne Kneuss
colder  Tue May  6 22:59:59 2008 UTC

  Modified files:  
/php-src/ext/splspl_array.c 
  Log:
  Add a flag that defines whether the objects should get iterated through or not
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.137r2=1.138diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.137 php-src/ext/spl/spl_array.c:1.138
--- php-src/ext/spl/spl_array.c:1.137   Mon Feb  4 16:47:06 2008
+++ php-src/ext/spl/spl_array.c Tue May  6 22:59:59 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.137 2008/02/04 16:47:06 helly Exp $ */
+/* $Id: spl_array.c,v 1.138 2008/05/06 22:59:59 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -47,6 +47,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
@@ -122,7 +123,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;
@@ -1391,7 +1392,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));
 }
 /* }}} */
 
@@ -1417,12 +1418,18 @@
return;
}
 
-   if (Z_TYPE_PP(entry) == IS_OBJECT  
instanceof_function(Z_OBJCE_PP(entry), intern-std.ce TSRMLS_CC)) {
-   RETURN_ZVAL(*entry, 0, 0);
+   if (Z_TYPE_PP(entry) == IS_OBJECT) {
+   if ((intern-ar_flags  SPL_ARRAY_CHILD_ARRAYS_ONLY) != 0) {
+   return;
+   }
+   if (instanceof_function(Z_OBJCE_PP(entry), Z_OBJCE_P(getThis()) 
TSRMLS_CC)) {
+   RETURN_ZVAL(*entry, 0, 0);
+   }
}
 
-  MAKE_STD_ZVAL(flags);
-  ZVAL_LONG(flags, SPL_ARRAY_USE_OTHER);
+   MAKE_STD_ZVAL(flags);
+   ZVAL_LONG(flags, SPL_ARRAY_USE_OTHER | intern-ar_flags);
+
spl_instantiate_arg_ex2(intern-std.ce, return_value, 0, *entry, flags 
TSRMLS_CC);
zval_ptr_dtor(flags);
 }
@@ -1730,6 +1737,9 @@
 
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(RecursiveArrayIterator, 
CHILD_ARRAYS_ONLY, SPL_ARRAY_CHILD_ARRAYS_ONLY);
+
return SUCCESS;
 }
 /* }}} */



-- 
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 /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 /ext/spl/tests bug38618.phpt

2008-05-08 Thread Etienne Kneuss
colder  Thu May  8 12:03:18 2008 UTC

  Modified files:  
/php-src/ext/spl/tests  bug38618.phpt 
  Log:
  Sync spl tests with 5.3
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug38618.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/spl/tests/bug38618.phpt
diff -u /dev/null php-src/ext/spl/tests/bug38618.phpt:1.2
--- /dev/null   Thu May  8 12:03:18 2008
+++ php-src/ext/spl/tests/bug38618.phpt Thu May  8 12:03:18 2008
@@ -0,0 +1,105 @@
+--TEST--
+Bug #38618 (RecursiveArrayIterator::hasChildren() follows objects)
+--FILE--
+?php # vim:ft=php
+
+class FruitPublic
+{
+  public $title;
+
+  public function __construct($title)
+  {
+$this-title = $title;
+  }
+
+  public function __toString()
+  {
+return $this-title;
+  }
+}
+
+class FruitProtected
+{
+  protected $title;
+
+  public function __construct($title)
+  {
+$this-title = $title;
+  }
+
+  public function __toString()
+  {
+return $this-title;
+  }
+}
+
+function test_array($array, $which, $flags = 0)
+{
+  echo ===$which===\n;
+  $it = new RecursiveArrayIterator($array, $flags);
+  foreach (new RecursiveIteratorIterator($it) as $k = $fruit) {
+echo $k , ' = ', $fruit, \n;
+  }
+}
+
+$array = array(
+  1 = array(
+1 = array(
+  1 = 'apple',
+),
+2 = array(
+  1 = 'grape',
+),
+  ),
+);
+
+test_array($array, 'Default with array');
+
+$array = array(
+  1 = array(
+1 = array(
+  1 = new FruitPublic('apple'),
+),
+2 = array(
+  1 = new FruitPublic('grape'),
+),
+  ),
+);
+
+test_array($array, 'Public Property');
+
+$array = array(
+  1 = array(
+1 = array(
+  1 = new FruitProtected('apple'),
+),
+2 = array(
+  1 = new FruitProtected('grape'),
+),
+  ),
+);
+
+test_array($array, 'Protected Property');
+
+test_array($array, 'Public Property New', 
RecursiveArrayIterator::CHILD_ARRAYS_ONLY);
+test_array($array, 'Protected Property New', 
RecursiveArrayIterator::CHILD_ARRAYS_ONLY);
+?
+===DONE===
+?php exit(0); ?
+?
+===DONE===
+--EXPECTF--
+===Default with array===
+1 = apple
+1 = grape
+===Public Property===
+title = apple
+title = grape
+===Protected Property===
+===Public Property New===
+1 = apple
+1 = grape
+===Protected Property New===
+1 = apple
+1 = grape
+===DONE===



-- 
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/tests array_023.phpt

2008-05-08 Thread Etienne Kneuss
colder  Thu May  8 12:02:17 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/spl/tests  array_023.phpt 
  Log:
  Sync spl tests with HEAD
  

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/array_023.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/array_023.phpt
+++ php-src/ext/spl/tests/array_023.phpt
--TEST--
Testing class extending to ArrayObject and serialize
--FILE--
?php

class Name extends ArrayObject
{
public $var = 'a';
protected $bar = 'b';
private $foo = 'c';
}

$a = new Name();
var_dump($a);
var_dump($a-var);

$a = unserialize(serialize($a));

var_dump($a);
var_dump($a-var);

?
--EXPECT--
object(Name)#1 (4) {
  [var]=
  string(1) a
  [bar:protected]=
  string(1) b
  [foo:Name:private]=
  string(1) c
  [storage:ArrayObject:private]=
  array(0) {
  }
}
string(1) a
object(Name)#2 (4) {
  [var]=
  string(1) a
  [bar:protected]=
  string(1) b
  [foo:Name:private]=
  string(1) c
  [storage:ArrayObject:private]=
  array(0) {
  }
}
string(1) a



-- 
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_heap.c /ext/spl/tests pqueue_001.phpt

2008-05-15 Thread Etienne Kneuss
colder  Thu May 15 17:05:20 2008 UTC

  Modified files:  
/php-src/ext/splspl_heap.c 
/php-src/ext/spl/tests  pqueue_001.phpt 
  Log:
  Implement SplPriorityQueue::getExtractFlags()
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_heap.c?r1=1.3r2=1.4diff_format=u
Index: php-src/ext/spl/spl_heap.c
diff -u php-src/ext/spl/spl_heap.c:1.3 php-src/ext/spl/spl_heap.c:1.4
--- php-src/ext/spl/spl_heap.c:1.3  Fri Feb 29 09:25:30 2008
+++ php-src/ext/spl/spl_heap.c  Thu May 15 17:05:20 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_heap.c,v 1.3 2008/02/29 09:25:30 colder Exp $ */
+/* $Id: spl_heap.c,v 1.4 2008/05/15 17:05:20 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -737,7 +737,7 @@
 }
 /* }}} */
 
-/* {{{ proto int SplPriorityQueue::setIteratorMode($flags) U
+/* {{{ proto int SplPriorityQueue::setExtractFlags($flags) U
  Set the flags of extraction*/
 SPL_METHOD(SplPriorityQueue, setExtractFlags)
 {
@@ -755,6 +755,22 @@
RETURN_LONG(intern-flags);
 }
 /* }}} */
+/* {{{ proto int SplPriorityQueue::getExtractFlags($flags) U
+ Set the flags of extraction*/
+SPL_METHOD(SplPriorityQueue, getExtractFlags)
+{
+   long value;
+   spl_heap_object *intern;
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ) == FAILURE) {
+   return;
+   }
+
+   intern = (spl_heap_object*)zend_object_store_get_object(getThis() 
TSRMLS_CC);
+
+   RETURN_LONG(intern-flags  SPL_PQUEUE_EXTR_MASK;);
+}
+/* }}} */
 
 /* {{{ proto int SplHeap::recoverFromCorruption() U
  Recover from a corrupted state*/
@@ -1119,6 +1135,7 @@
SPL_ME(SplPriorityQueue, compare,   arginfo_heap_compare,   
 ZEND_ACC_PUBLIC)
SPL_ME(SplPriorityQueue, insert,arginfo_pqueue_insert,  
 ZEND_ACC_PUBLIC)
SPL_ME(SplPriorityQueue, setExtractFlags,   
arginfo_pqueue_setflags, ZEND_ACC_PUBLIC)
+   SPL_ME(SplPriorityQueue, getExtractFlags,   NULL,   
 ZEND_ACC_PUBLIC)
SPL_ME(SplPriorityQueue, top,   NULL,   
 ZEND_ACC_PUBLIC)
SPL_ME(SplPriorityQueue, extract,   NULL,   
 ZEND_ACC_PUBLIC)
SPL_ME(SplHeap,  count, NULL,   
 ZEND_ACC_PUBLIC)
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/pqueue_001.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/spl/tests/pqueue_001.phpt
diff -u php-src/ext/spl/tests/pqueue_001.phpt:1.1 
php-src/ext/spl/tests/pqueue_001.phpt:1.2
--- php-src/ext/spl/tests/pqueue_001.phpt:1.1   Mon Feb 25 23:36:36 2008
+++ php-src/ext/spl/tests/pqueue_001.phpt   Thu May 15 17:05:20 2008
@@ -5,6 +5,7 @@
 --FILE--
 ?php
 $pq = new SplPriorityQueue();
+echo $pq-getExtractFlags().\n;
 
 // errors
 try {
@@ -25,6 +26,7 @@
 
 $pq1 = new SplPriorityQueue();
 $pq1-setExtractFlags(SplPriorityQueue::EXTR_BOTH);
+echo $pq1-getExtractFlags().\n;
 
 $pq1-insert(a, 1);
 $pq1-insert(b, 2);
@@ -38,6 +40,7 @@
 
 $pq2 = new SplPriorityQueue();
 $pq2-setExtractFlags(SplPriorityQueue::EXTR_DATA);
+echo $pq2-getExtractFlags().\n;
 
 $pq2-insert(a, 1);
 $pq2-insert(b, 2);
@@ -51,6 +54,7 @@
 
 $pq3 = new SplPriorityQueue();
 $pq3-setExtractFlags(SplPriorityQueue::EXTR_PRIORITY);
+echo $pq3-getExtractFlags().\n;
 
 $pq3-insert(a, 1);
 $pq3-insert(b, 2);
@@ -64,11 +68,13 @@
 ===DONE===
 ?php exit(0); ?
 --EXPECTF--
+1
 Exception: Can't extract from an empty heap
 3=b
 2=a
 1=c
 EXTR_BOTH
+3
 3=Array
 (
 [data] = b
@@ -88,10 +94,12 @@
 )
 
 EXTR_DATA
+1
 3=b
 2=a
 1=c
 EXTR_PRIORITY
+2
 3=2
 2=1
 1=0



-- 
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_directory.c

2008-05-15 Thread Etienne Kneuss
colder  Thu May 15 17:22:03 2008 UTC

  Modified files:  
/php-src/ext/splspl_directory.c 
  Log:
  Replace the iterator correctly after being cloned (related to #44964)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.152r2=1.153diff_format=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.152 
php-src/ext/spl/spl_directory.c:1.153
--- php-src/ext/spl/spl_directory.c:1.152   Sat May  3 16:01:00 2008
+++ php-src/ext/spl/spl_directory.c Thu May 15 17:22:03 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_directory.c,v 1.152 2008/05/03 16:01:00 colder Exp $ */
+/* $Id: spl_directory.c,v 1.153 2008/05/15 17:22:03 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -298,6 +298,7 @@
zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
spl_filesystem_object *intern;
spl_filesystem_object *source;
+   int index;
 
old_object = zend_objects_get_address(zobject TSRMLS_CC);
source = (spl_filesystem_object*)old_object;
@@ -316,6 +317,11 @@
break;
case SPL_FS_DIR:
spl_filesystem_dir_open(intern, source-_path_type, 
source-_path, source-_path_len TSRMLS_CC);
+   /* read until we hit the position in which we were before */
+   for(index = 0; index  source-u.dir.index; ++index) {
+   spl_filesystem_dir_read(intern TSRMLS_CC);
+   }
+   intern-u.dir.index = index;
break;
case SPL_FS_FILE:
php_error_docref(NULL TSRMLS_CC, E_ERROR, An object of class 
%v cannot be cloned, old_object-ce-name);



-- 
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_directory.c spl_directory.h /ext/spl/tests dit_004.phpt dit_005.phpt

2008-05-16 Thread Etienne Kneuss
colder  Fri May 16 13:22:02 2008 UTC

  Added files: 
/php-src/ext/spl/tests  dit_004.phpt dit_005.phpt 

  Modified files:  
/php-src/ext/splspl_directory.c spl_directory.h 
  Log:
  Fix FilesystemIterator with ./..
  http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.153r2=1.154diff_format=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.153 
php-src/ext/spl/spl_directory.c:1.154
--- php-src/ext/spl/spl_directory.c:1.153   Thu May 15 17:22:03 2008
+++ php-src/ext/spl/spl_directory.c Fri May 16 13:22:02 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_directory.c,v 1.153 2008/05/15 17:22:03 colder Exp $ */
+/* $Id: spl_directory.c,v 1.154 2008/05/16 13:22:02 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -212,11 +212,18 @@
 
 #define IS_SLASH_AT(type, zs, pos) (type == IS_UNICODE ? IS_U_SLASH(zs.u[pos]) 
: IS_SLASH(zs.s[pos]))
 
+static inline int spl_filesystem_is_dot(const char * d_name) /* {{{ */
+{
+   return !strcmp(d_name, .) || !strcmp(d_name, ..);
+}
+/* }}} */
+
 /* {{{ spl_filesystem_dir_open */
 /* open a directory resource */
 static void spl_filesystem_dir_open(spl_filesystem_object* intern, zend_uchar 
type, zstr path, int path_len TSRMLS_DC)
 {
int options = REPORT_ERRORS;
+   int skip_dots = intern-flags  SPL_FILE_DIR_SKIPDOTS;
 
 #if HELLY_0
if (php_stream_is(intern-u.dir.dirp, php_glob_stream_ops)) {
@@ -240,7 +247,9 @@
/* throw exception: should've been already happened */
intern-u.dir.entry.d_name[0] = '\0';
} else {
-   spl_filesystem_dir_read(intern TSRMLS_CC);
+   do {
+   spl_filesystem_dir_read(intern TSRMLS_CC);
+   } while (skip_dots  
spl_filesystem_is_dot(intern-u.dir.entry.d_name));
}
 }
 /* }}} */
@@ -299,13 +308,18 @@
spl_filesystem_object *intern;
spl_filesystem_object *source;
int index;
+   int skip_dots;
 
old_object = zend_objects_get_address(zobject TSRMLS_CC);
source = (spl_filesystem_object*)old_object;
 
+   skip_dots = source-flags  SPL_FILE_DIR_SKIPDOTS;
+
new_obj_val = spl_filesystem_object_new_ex(old_object-ce, intern 
TSRMLS_CC);
new_object = intern-std;
 
+   intern-flags = source-flags;
+
switch (source-type) {
case SPL_FS_INFO:
intern-_path_type = source-_path_type;
@@ -319,7 +333,9 @@
spl_filesystem_dir_open(intern, source-_path_type, 
source-_path, source-_path_len TSRMLS_CC);
/* read until we hit the position in which we were before */
for(index = 0; index  source-u.dir.index; ++index) {
-   spl_filesystem_dir_read(intern TSRMLS_CC);
+   do {
+   spl_filesystem_dir_read(intern TSRMLS_CC);
+   } while (skip_dots  
spl_filesystem_is_dot(intern-u.dir.entry.d_name));
}
intern-u.dir.index = index;
break;
@@ -330,7 +346,6 @@

intern-file_class = source-file_class;
intern-info_class = source-info_class;
-   intern-flags = source-flags;
intern-oth = source-oth;
intern-oth_handler = source-oth_handler;
 
@@ -514,12 +529,6 @@
return NULL;
 } /* }}} */
 
-static inline int spl_filesystem_is_dot(const char * d_name) /* {{{ */
-{
-   return !strcmp(d_name, .) || !strcmp(d_name, ..);
-}
-/* }}} */
-
 static int spl_filesystem_is_invalid_or_dot(const char * d_name) /* {{{ */
 {
return d_name[0] == '\0' || spl_filesystem_is_dot(d_name);
@@ -614,6 +623,11 @@
flags = 
SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_SELF;
parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, t, 
path, len, path_type);
}
+
+   if (ctor_flags  SPL_FILE_DIR_SKIPDOTS) {
+   flags |= SPL_FILE_DIR_SKIPDOTS;
+   }
+
if (parsed == FAILURE) {
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
return;
@@ -625,6 +639,8 @@
}
 
intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() 
TSRMLS_CC);
+   intern-flags = flags;
+
if ((ctor_flags  DIT_CTOR_GLOB)  (
(path_type == IS_STRING  strstr(path.s, glob://) != path.s) 
||
(path_type == IS_UNICODE  u_strstr(path.u, u_glob) != path.u)
@@ -637,7 +653,6 @@
}
 
intern-u.dir.is_recursive = instanceof_function(intern-std.ce, 
spl_ce_RecursiveDirectoryIterator TSRMLS_CC) ? 1 : 0;
-   intern-flags = flags;
 
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
 }
@@ -692,9 +707,12 @@
 SPL_METHOD(DirectoryIterator, next)
 {
spl_filesystem_object *intern = 

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

2008-05-18 Thread Etienne Kneuss
colder  Sun May 18 12:17:43 2008 UTC

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

  Modified files:  
/php-src/ext/splspl_directory.c spl_directory.h 
  Log:
  MFH: Fix filesystemiterator with ./.. + add cloning tests
  http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.45.2.27.2.23.2.19r2=1.45.2.27.2.23.2.20diff_format=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.19 
php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.20
--- php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.19 Wed Apr  9 19:01:12 2008
+++ php-src/ext/spl/spl_directory.c Sun May 18 12:17:43 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_directory.c,v 1.45.2.27.2.23.2.19 2008/04/09 19:01:12 colder Exp $ 
*/
+/* $Id: spl_directory.c,v 1.45.2.27.2.23.2.20 2008/05/18 12:17:43 colder Exp $ 
*/
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -200,10 +200,18 @@
 
 #define IS_SLASH_AT(zs, pos) (IS_SLASH(zs[pos]))
 
+static inline int spl_filesystem_is_dot(const char * d_name) /* {{{ */
+{
+   return !strcmp(d_name, .) || !strcmp(d_name, ..);
+}
+/* }}} */
+
 /* {{{ spl_filesystem_dir_open */
 /* open a directory resource */
 static void spl_filesystem_dir_open(spl_filesystem_object* intern, char *path 
TSRMLS_DC)
 {
+   int skip_dots = intern-flags  SPL_FILE_DIR_SKIPDOTS;
+
intern-type = SPL_FS_DIR;
intern-_path_len = strlen(path);
intern-u.dir.dirp = php_stream_opendir(path, 
ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL);
@@ -219,7 +227,9 @@
/* throw exception: should've been already happened */
intern-u.dir.entry.d_name[0] = '\0';
} else {
-   spl_filesystem_dir_read(intern TSRMLS_CC);
+   do {
+   spl_filesystem_dir_read(intern TSRMLS_CC);
+   } while (skip_dots  
spl_filesystem_is_dot(intern-u.dir.entry.d_name));
}
 }
 /* }}} */
@@ -277,6 +287,7 @@
zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
spl_filesystem_object *intern;
spl_filesystem_object *source;
+   int index, skip_dots;
 
old_object = zend_objects_get_address(zobject TSRMLS_CC);
source = (spl_filesystem_object*)old_object;
@@ -284,6 +295,8 @@
new_obj_val = spl_filesystem_object_new_ex(old_object-ce, intern 
TSRMLS_CC);
new_object = intern-std;
 
+   intern-flags = source-flags;
+
switch (source-type) {
case SPL_FS_INFO:
intern-_path_len = source-_path_len;
@@ -293,6 +306,14 @@
break;
case SPL_FS_DIR:
spl_filesystem_dir_open(intern, source-_path TSRMLS_CC);
+   /* read until we hit the position in which we were before */
+   skip_dots = source-flags  SPL_FILE_DIR_SKIPDOTS;
+   for(index = 0; index  source-u.dir.index; ++index) {
+   do {
+   spl_filesystem_dir_read(intern TSRMLS_CC);
+   } while (skip_dots  
spl_filesystem_is_dot(intern-u.dir.entry.d_name));
+   }
+   intern-u.dir.index = index;
break;
case SPL_FS_FILE:
php_error_docref(NULL TSRMLS_CC, E_ERROR, An object of class 
%s cannot be cloned, old_object-ce-name);
@@ -301,7 +322,6 @@

intern-file_class = source-file_class;
intern-info_class = source-info_class;
-   intern-flags = source-flags;
intern-oth = source-oth;
intern-oth_handler = source-oth_handler;
 
@@ -468,12 +488,6 @@
return NULL;
 } /* }}} */
 
-static inline int spl_filesystem_is_dot(const char * d_name) /* {{{ */
-{
-   return !strcmp(d_name, .) || !strcmp(d_name, ..);
-}
-/* }}} */
-
 static int spl_filesystem_is_invalid_or_dot(const char * d_name) /* {{{ */
 {
return d_name[0] == '\0' || spl_filesystem_is_dot(d_name);
@@ -562,6 +576,9 @@
flags = 
SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_SELF;
parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, 
path, len);
}
+   if (ctor_flags  SPL_FILE_DIR_SKIPDOTS) {
+   flags |= SPL_FILE_DIR_SKIPDOTS;
+   }
if (parsed == FAILURE) {
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
return;
@@ -573,6 +590,7 @@
}
 
intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() 
TSRMLS_CC);
+   intern-flags = flags;
if ((ctor_flags  DIT_CTOR_GLOB)  strstr(path, glob://) != path) {
spprintf(path, 0, glob://%s, path);
spl_filesystem_dir_open(intern, path TSRMLS_CC);
@@ -582,7 +600,6 @@
}
 
intern-u.dir.is_recursive = instanceof_function(intern-std.ce, 
spl_ce_RecursiveDirectoryIterator TSRMLS_CC) ? 1 

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

2008-05-20 Thread Etienne Kneuss
colder  Tue May 20 21:46:51 2008 UTC

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

  Modified files:  
/php-src/ext/splspl_directory.c spl_directory.h 
  Log:
  MFH: Fix path lookup when include_path is used
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.45.2.27.2.23.2.20r2=1.45.2.27.2.23.2.21diff_format=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.20 
php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.21
--- php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.20 Sun May 18 12:17:43 2008
+++ php-src/ext/spl/spl_directory.c Tue May 20 21:46:50 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_directory.c,v 1.45.2.27.2.23.2.20 2008/05/18 12:17:43 colder Exp $ 
*/
+/* $Id: spl_directory.c,v 1.45.2.27.2.23.2.21 2008/05/20 21:46:50 colder Exp $ 
*/
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -109,6 +109,9 @@
if (intern-u.file.open_mode) {
efree(intern-u.file.open_mode);
}
+   if (intern-orig_path) {
+   efree(intern-orig_path);
+   }
}
spl_filesystem_file_free_line(intern TSRMLS_CC);
break;
@@ -257,6 +260,8 @@
intern-file_name_len--;
}
 
+   intern-orig_path = estrndup(intern-u.file.stream-orig_path, 
strlen(intern-u.file.stream-orig_path));
+
intern-file_name = estrndup(intern-file_name, intern-file_name_len);
intern-u.file.open_mode = estrndup(intern-u.file.open_mode, 
intern-u.file.open_mode_len);
 
@@ -985,14 +990,22 @@
 {
spl_filesystem_object *intern = 
(spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
char buff[MAXPATHLEN];
+   char *filename;
 
php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC);
 
if (intern-type == SPL_FS_DIR  !intern-file_name  
intern-u.dir.entry.d_name[0]) {
spl_filesystem_object_get_file_name(intern TSRMLS_CC);
}
+   
+   if (intern-orig_path) {
+   filename = intern-orig_path;
+   } else { 
+   filename = intern-file_name;
+   }
+
 
-   if (intern-file_name  VCWD_REALPATH(intern-file_name, buff)) {
+   if (filename  VCWD_REALPATH(filename, buff)) {
 #ifdef ZTS
if (VCWD_ACCESS(buff, F_OK)) {
RETVAL_FALSE;
@@ -1866,6 +1879,8 @@
spl_filesystem_object *intern = 
(spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
zend_bool use_include_path = 0;
char *p1, *p2;
+   char *tmp_path;
+   int   tmp_path_len;
 
php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC);
 
@@ -1881,18 +1896,29 @@
}

if (spl_filesystem_file_open(intern, use_include_path, 0 TSRMLS_CC) == 
SUCCESS) {
-   p1 = strrchr(intern-file_name, '/');
+   tmp_path_len = strlen(intern-u.file.stream-orig_path);
+
+   if (tmp_path_len  
IS_SLASH_AT(intern-u.file.stream-orig_path, tmp_path_len-1)) {
+   tmp_path_len--;
+   }
+
+   tmp_path = estrndup(intern-u.file.stream-orig_path, 
tmp_path_len);
+
+   p1 = strrchr(tmp_path, '/');
 #if defined(PHP_WIN32) || defined(NETWARE)
-   p2 = strrchr(intern-file_name, '\\');
+   p2 = strrchr(tmp_path, '\\');
 #else
p2 = 0;
 #endif
if (p1 || p2) {
-   intern-_path_len = (p1  p2 ? p1 : p2) - 
intern-file_name;
+   intern-_path_len = (p1  p2 ? p1 : p2) - tmp_path;
} else {
intern-_path_len = 0;
}
-   intern-_path = estrndup(intern-file_name, intern-_path_len);
+
+   efree(tmp_path);
+
+   intern-_path = estrndup(intern-u.file.stream-orig_path, 
intern-_path_len);
}
 
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.h?r1=1.12.2.5.2.4.2.9r2=1.12.2.5.2.4.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.4.2.9 
php-src/ext/spl/spl_directory.h:1.12.2.5.2.4.2.10
--- php-src/ext/spl/spl_directory.h:1.12.2.5.2.4.2.9Sun May 18 12:17:43 2008
+++ php-src/ext/spl/spl_directory.h Tue May 20 21:46:50 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_directory.h,v 1.12.2.5.2.4.2.9 2008/05/18 12:17:43 colder Exp $ */
+/* $Id: spl_directory.h,v 1.12.2.5.2.4.2.10 2008/05/20 21:46:50 colder Exp $ */
 
 #ifndef SPL_DIRECTORY_H
 #define SPL_DIRECTORY_H
@@ -65,6 +65,7 @@

[PHP-CVS] cvs: php-src /ext/spl spl_directory.c spl_directory.h /ext/spl/tests fileobject_004.phpt

2008-05-20 Thread Etienne Kneuss
colder  Tue May 20 21:46:14 2008 UTC

  Added files: 
/php-src/ext/spl/tests  fileobject_004.phpt 

  Modified files:  
/php-src/ext/splspl_directory.c spl_directory.h 
  Log:
  Fix path lookup when include_path is used
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.154r2=1.155diff_format=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.154 
php-src/ext/spl/spl_directory.c:1.155
--- php-src/ext/spl/spl_directory.c:1.154   Fri May 16 13:22:02 2008
+++ php-src/ext/spl/spl_directory.c Tue May 20 21:46:13 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_directory.c,v 1.154 2008/05/16 13:22:02 colder Exp $ */
+/* $Id: spl_directory.c,v 1.155 2008/05/20 21:46:13 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -109,6 +109,9 @@
if (intern-u.file.open_mode) {
efree(intern-u.file.open_mode);
}
+   if (intern-orig_path) {
+   efree(intern-orig_path);
+   }
}
spl_filesystem_file_free_line(intern TSRMLS_CC);
break;
@@ -277,6 +280,10 @@
intern-file_name_len--;
}
 
+   /* NOTE: Works as long as stream-orig_path is not unicode aware, might
+* break later. */
+   intern-orig_path = estrndup(intern-u.file.stream-orig_path, 
strlen(intern-u.file.stream-orig_path));
+
intern-file_name = ezstrndup(intern-file_name_type, 
intern-file_name, intern-file_name_len);
intern-u.file.open_mode = estrndup(intern-u.file.open_mode, 
intern-u.file.open_mode_len);
 
@@ -1082,10 +1089,14 @@
spl_filesystem_object_get_file_name(intern TSRMLS_CC);
}
 
-   if (intern-file_name_type == IS_UNICODE) {
-   php_stream_path_encode(NULL, filename, filename_len, 
intern-file_name.u, intern-file_name_len, REPORT_ERRORS, FG(default_context));
+   if (intern-orig_path) {
+   filename = intern-orig_path;
} else {
-   filename = intern-file_name.s;
+   if (intern-file_name_type == IS_UNICODE) {
+   php_stream_path_encode(NULL, filename, filename_len, 
intern-file_name.u, intern-file_name_len, REPORT_ERRORS, FG(default_context));
+   } else {
+   filename = intern-file_name.s;
+   }
}
 
if (filename  VCWD_REALPATH(filename, buff)) {
@@ -1994,6 +2005,8 @@
spl_filesystem_object *intern = 
(spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
zend_bool use_include_path = 0;
zstr p1, p2;
+   char *tmp_path;
+   int   tmp_path_len;
 
php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC);
 
@@ -2009,31 +2022,31 @@
}

if (spl_filesystem_file_open(intern, use_include_path, 0 TSRMLS_CC) == 
SUCCESS) {
-   if (intern-file_name_type == IS_UNICODE) {
-   p1.u = u_strrchr(intern-file_name.u, '/');
-   } else {
-   p1.s = strrchr(intern-file_name.s, '/');
+   tmp_path_len  = strlen(intern-u.file.stream-orig_path);
+
+   if (tmp_path_len  IS_SLASH_AT(IS_STRING, 
ZSTR(intern-u.file.stream-orig_path), tmp_path_len-1)) {
+   tmp_path_len--;
}
+
+   tmp_path = estrndup(intern-u.file.stream-orig_path, 
tmp_path_len);
+
+   p1.s = strrchr(tmp_path, '/');
 #if defined(PHP_WIN32) || defined(NETWARE)
-   if (intern-file_name_type == IS_UNICODE) {
-   p2.u = u_strrchr(intern-file_name.u, '\\');
-   } else {
-   p2.s = strrchr(intern-file_name.s, '\\');
-   }
+   p2.s = strrchr(tmp_path, '\\');
 #else
p2.v = 0;
 #endif
+
if (p1.v || p2.v) {
-   if (intern-file_name_type == IS_UNICODE) {
-   intern-_path_len = (p1.u  p2.u ? p1.u : p2.u) 
- intern-file_name.u;
-   } else {
-   intern-_path_len = (p1.s  p2.s ? p1.s : p2.s) 
- intern-file_name.s;
-   }
+   intern-_path_len = (p1.s  p2.s ? p1.s : p2.s) - 
tmp_path;
} else {
intern-_path_len = 0;
}
-   intern-_path_type = intern-file_name_type;
-   intern-_path = ezstrndup(intern-file_name_type, 
intern-file_name, intern-_path_len);
+
+   efree(tmp_path);
+
+   intern-_path  = 
ZSTR(estrndup(intern-u.file.stream-orig_path, intern-_path_len));
+   intern-_path_type = IS_STRING;
}
 

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl/tests regexIterator_flags_basic.phpt regexIterator_mode_basic.phpt regexIterator_setMode_error.phpt

2008-05-24 Thread Etienne Kneuss
colder  Sat May 24 13:25:24 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/spl/tests  regexIterator_flags_basic.phpt 
regexIterator_mode_basic.phpt 
regexIterator_setMode_error.phpt 
  Log:
  Add tests from testfest
  

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

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

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



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



[PHP-CVS] cvs: php-src /ext/spl/tests regexIterator_flags_basic.phpt regexIterator_mode_basic.phpt regexIterator_setMode_error.phpt

2008-05-24 Thread Etienne Kneuss
colder  Sat May 24 13:40:33 2008 UTC

  Modified files:  
/php-src/ext/spl/tests  regexIterator_flags_basic.phpt 
regexIterator_mode_basic.phpt 
regexIterator_setMode_error.phpt 
  Log:
  Add tests from testfest
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/regexIterator_flags_basic.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/spl/tests/regexIterator_flags_basic.phpt
diff -u /dev/null php-src/ext/spl/tests/regexIterator_flags_basic.phpt:1.2
--- /dev/null   Sat May 24 13:40:33 2008
+++ php-src/ext/spl/tests/regexIterator_flags_basic.phptSat May 24 
13:40:33 2008
@@ -0,0 +1,26 @@
+--TEST--
+SPL: RegexIterator::getFlags() and setFlags() basic tests
+--SKIPIF--
+?php extension_loaded('spl') or die('skip'); ?
+--CREDITS--
+Felix De Vliegher [EMAIL PROTECTED]
+--FILE--
+?php
+
+$array = array('foo', 'bar', 'baz');
+$iterator = new ArrayIterator($array);
+$regexIterator = new RegexIterator($iterator, /f/, null, 
RegexIterator::USE_KEY);
+
+var_dump($regexIterator-getFlags() === RegexIterator::USE_KEY);
+
+// Test a change in flags, there's only one class constant so it has to be 
another int value
+$regexIterator-setFlags(3);
+var_dump($regexIterator-getFlags() === RegexIterator::USE_KEY);
+$regexIterator-setFlags(RegexIterator::USE_KEY);
+var_dump($regexIterator-getFlags() === RegexIterator::USE_KEY);
+
+?
+--EXPECT--
+bool(true)
+bool(false)
+bool(true)
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/regexIterator_mode_basic.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/spl/tests/regexIterator_mode_basic.phpt
diff -u /dev/null php-src/ext/spl/tests/regexIterator_mode_basic.phpt:1.2
--- /dev/null   Sat May 24 13:40:33 2008
+++ php-src/ext/spl/tests/regexIterator_mode_basic.phpt Sat May 24 13:40:33 2008
@@ -0,0 +1,34 @@
+--TEST--
+SPL: RegexIterator::getMode() and setMode() basic tests
+--SKIPIF--
+?php extension_loaded('spl') or die('skip'); ?
+--CREDITS--
+Felix De Vliegher [EMAIL PROTECTED]
+--FILE--
+?php
+
+$array = array('foo', 'bar', 'baz');
+$iterator = new ArrayIterator($array);
+$regexIterator = new RegexIterator($iterator, /f/);
+
+var_dump($regexIterator-getMode() === RegexIterator::MATCH);
+
+$regexIterator-setMode(RegexIterator::MATCH);
+var_dump($regexIterator-getMode() === RegexIterator::MATCH);
+
+$regexIterator-setMode(RegexIterator::GET_MATCH);
+var_dump($regexIterator-getMode() === RegexIterator::GET_MATCH);
+
+$regexIterator-setMode(RegexIterator::ALL_MATCHES);
+var_dump($regexIterator-getMode() === RegexIterator::ALL_MATCHES);
+
+$regexIterator-setMode(RegexIterator::SPLIT);
+var_dump($regexIterator-getMode() === RegexIterator::SPLIT);
+
+?
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/regexIterator_setMode_error.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/spl/tests/regexIterator_setMode_error.phpt
diff -u /dev/null php-src/ext/spl/tests/regexIterator_setMode_error.phpt:1.2
--- /dev/null   Sat May 24 13:40:33 2008
+++ php-src/ext/spl/tests/regexIterator_setMode_error.phpt  Sat May 24 
13:40:33 2008
@@ -0,0 +1,30 @@
+--TEST--
+SPL: RegexIterator::setMode() error tests
+--SKIPIF--
+?php extension_loaded('spl') or die('skip'); ?
+--CREDITS--
+Felix De Vliegher [EMAIL PROTECTED]
+--FILE--
+?php
+
+$array = array('foo', 'bar', 'baz');
+$regexIterator = new RegexIterator(new ArrayIterator($array), /f/);
+
+var_dump($regexIterator-getMode());
+
+try {
+   $regexIterator-setMode(7);
+} catch (InvalidArgumentException $e) {
+   var_dump($e-getMessage());
+   var_dump($e-getCode());
+}
+
+$regexIterator-setMode('foo');
+
+?
+--EXPECTF--
+int(0)
+string(14) Illegal mode 7
+int(0)
+
+Warning: RegexIterator::setMode() expects parameter 1 to be long, string given 
in %s on line %d



-- 
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_heap.c

2008-05-24 Thread Etienne Kneuss
colder  Sat May 24 14:37:53 2008 UTC

  Modified files:  
/php-src/ext/splspl_heap.c 
  Log:
  Also register the get_iterator handler for Max/Min Heap
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_heap.c?r1=1.5r2=1.6diff_format=u
Index: php-src/ext/spl/spl_heap.c
diff -u php-src/ext/spl/spl_heap.c:1.5 php-src/ext/spl/spl_heap.c:1.6
--- php-src/ext/spl/spl_heap.c:1.5  Tue May 20 12:04:37 2008
+++ php-src/ext/spl/spl_heap.c  Sat May 24 14:37:53 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_heap.c,v 1.5 2008/05/20 12:04:37 tony2001 Exp $ */
+/* $Id: spl_heap.c,v 1.6 2008/05/24 14:37:53 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -1183,6 +1183,9 @@
REGISTER_SPL_SUB_CLASS_EX(SplMinHeap,   SplHeap,
spl_heap_object_new, spl_funcs_SplMinHeap);
REGISTER_SPL_SUB_CLASS_EX(SplMaxHeap,   SplHeap,
spl_heap_object_new, spl_funcs_SplMaxHeap);
 
+   spl_ce_SplMaxHeap-get_iterator = spl_heap_get_iterator;
+   spl_ce_SplMinHeap-get_iterator = spl_heap_get_iterator;
+
REGISTER_SPL_STD_CLASS_EX(SplPriorityQueue, spl_heap_object_new, 
spl_funcs_SplPriorityQueue);
memcpy(spl_handler_SplPriorityQueue, zend_get_std_object_handlers(), 
sizeof(zend_object_handlers));
 



-- 
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_heap.c

2008-05-24 Thread Etienne Kneuss
colder  Sat May 24 14:38:04 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/splspl_heap.c 
  Log:
  MFH: Also register the get_iterator handler for Max/Min Heap
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_heap.c?r1=1.1.2.4r2=1.1.2.5diff_format=u
Index: php-src/ext/spl/spl_heap.c
diff -u php-src/ext/spl/spl_heap.c:1.1.2.4 php-src/ext/spl/spl_heap.c:1.1.2.5
--- php-src/ext/spl/spl_heap.c:1.1.2.4  Fri Feb 29 09:26:01 2008
+++ php-src/ext/spl/spl_heap.c  Sat May 24 14:38:04 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_heap.c,v 1.1.2.4 2008/02/29 09:26:01 colder Exp $ */
+/* $Id: spl_heap.c,v 1.1.2.5 2008/05/24 14:38:04 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -1166,6 +1166,9 @@
REGISTER_SPL_SUB_CLASS_EX(SplMinHeap,   SplHeap,
spl_heap_object_new, spl_funcs_SplMinHeap);
REGISTER_SPL_SUB_CLASS_EX(SplMaxHeap,   SplHeap,
spl_heap_object_new, spl_funcs_SplMaxHeap);
 
+   spl_ce_SplMaxHeap-get_iterator = spl_heap_get_iterator;
+   spl_ce_SplMinHeap-get_iterator = spl_heap_get_iterator;
+
REGISTER_SPL_STD_CLASS_EX(SplPriorityQueue, spl_heap_object_new, 
spl_funcs_SplPriorityQueue);
memcpy(spl_handler_SplPriorityQueue, zend_get_std_object_handlers(), 
sizeof(zend_object_handlers));
 



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



[PHP-CVS] cvs: php-src /ext/spl/tests fileobject_005.phpt heap_009.phpt

2008-05-24 Thread Etienne Kneuss
colder  Sat May 24 16:48:15 2008 UTC

  Added files: 
/php-src/ext/spl/tests  heap_009.phpt fileobject_005.phpt 
  Log:
  New tests from testfest
  

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/heap_009.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/heap_009.phpt
+++ php-src/ext/spl/tests/heap_009.phpt
--TEST--
SPL: SplHeap and friends, throw: An iterator cannot be used with foreach by 
reference
--CREDITS--
Thomas Koch [EMAIL PROTECTED]
#Hackday Webtuesday 2008-05-24
--SKIPIF--
?php if (!extension_loaded(spl)) print skip; ?
--FILE--
?php
function testForException( $heap )
{
try
{
foreach( $heap as $item );
}
catch( RuntimeException $e )
{
echo $e-getMessage(),\n;
}
}

// 1. SplMinHeap emtpy
$heap = new SplMinHeap;
testForException( $heap );

// 2. SplMinHeap non-emtpy
$heap = new SplMinHeap;
$heap-insert( 1 );
testForException( $heap );

// 3. SplMaxHeap emtpy
$heap = new SplMaxHeap;
testForException( $heap );

// 4. SplMaxHeap non-emtpy
$heap = new SplMaxHeap;
$heap-insert( 1 );
testForException( $heap );

// 5. SplPriorityQueue empty
$heap = new SplPriorityQueue;
testForException( $heap );

// 6. SplPriorityQueue non-empty
$heap = new SplPriorityQueue;
$heap-insert( 1, 2 );
testForException( $heap );

?
==DONE==
--EXPECT--
An iterator cannot be used with foreach by reference
An iterator cannot be used with foreach by reference
An iterator cannot be used with foreach by reference
An iterator cannot be used with foreach by reference
An iterator cannot be used with foreach by reference
An iterator cannot be used with foreach by reference
==DONE==

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fileobject_005.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/fileobject_005.phpt
+++ php-src/ext/spl/tests/fileobject_005.phpt
--TEST--
SPL: SplFileObject truncate tests
--SKIPIF--
?php if (!extension_loaded(spl)) print skip; ?
--CREDITS--
Mark Ammann
#Hackday Webtuesday 2008-05-24
--FILE--
?php

set_include_path(dirname(dirname(__FILE__)));

$path = dirname(__FILE__).DIRECTORY_SEPARATOR.'fileobject_005.txt';
touch($path);

$fo = new SplFileObject('tests'.DIRECTORY_SEPARATOR.'fileobject_005.txt', 'w+', 
true);
$fo-fwrite(blahlubba);
var_dump($fo-ftruncate(4));

$fo-rewind();
var_dump($fo-fgets(8));

$fo-rewind();
$fo-fwrite(blahlubba);

// This should throw a warning and return NULL since an argument is missing 
var_dump($fo-ftruncate());

?
==DONE==
--CLEAN--
?php
$path = dirname(__FILE__).DIRECTORY_SEPARATOR.'fileobject_005.txt';
unlink($path);
?
--EXPECTF--
bool(true)
string(4) blah

Warning: SplFileObject::ftruncate() expects exactly 1 parameter, 0 given in %s 
on line %d
NULL
==DONE==



-- 
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/tests fileobject_005.phpt heap_009.phpt

2008-05-24 Thread Etienne Kneuss
colder  Sat May 24 16:49:04 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/spl/tests  heap_009.phpt fileobject_005.phpt 
  Log:
  New tests from testfest
  

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/heap_009.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/heap_009.phpt
+++ php-src/ext/spl/tests/heap_009.phpt
--TEST--
SPL: SplHeap and friends, throw: An iterator cannot be used with foreach by 
reference
--CREDITS--
Thomas Koch [EMAIL PROTECTED]
#Hackday Webtuesday 2008-05-24
--SKIPIF--
?php if (!extension_loaded(spl)) print skip; ?
--FILE--
?php
function testForException( $heap )
{
try
{
foreach( $heap as $item );
}
catch( RuntimeException $e )
{
echo $e-getMessage(),\n;
}
}

// 1. SplMinHeap emtpy
$heap = new SplMinHeap;
testForException( $heap );

// 2. SplMinHeap non-emtpy
$heap = new SplMinHeap;
$heap-insert( 1 );
testForException( $heap );

// 3. SplMaxHeap emtpy
$heap = new SplMaxHeap;
testForException( $heap );

// 4. SplMaxHeap non-emtpy
$heap = new SplMaxHeap;
$heap-insert( 1 );
testForException( $heap );

// 5. SplPriorityQueue empty
$heap = new SplPriorityQueue;
testForException( $heap );

// 6. SplPriorityQueue non-empty
$heap = new SplPriorityQueue;
$heap-insert( 1, 2 );
testForException( $heap );

?
==DONE==
--EXPECT--
An iterator cannot be used with foreach by reference
An iterator cannot be used with foreach by reference
An iterator cannot be used with foreach by reference
An iterator cannot be used with foreach by reference
An iterator cannot be used with foreach by reference
An iterator cannot be used with foreach by reference
==DONE==

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fileobject_005.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/fileobject_005.phpt
+++ php-src/ext/spl/tests/fileobject_005.phpt
--TEST--
SPL: SplFileObject truncate tests
--SKIPIF--
?php if (!extension_loaded(spl)) print skip; ?
--CREDITS--
Mark Ammann
#Hackday Webtuesday 2008-05-24
--FILE--
?php

set_include_path(dirname(dirname(__FILE__)));

$path = dirname(__FILE__).DIRECTORY_SEPARATOR.'fileobject_005.txt';
touch($path);

$fo = new SplFileObject('tests'.DIRECTORY_SEPARATOR.'fileobject_005.txt', 'w+', 
true);
$fo-fwrite(blahlubba);
var_dump($fo-ftruncate(4));

$fo-rewind();
var_dump($fo-fgets(8));

$fo-rewind();
$fo-fwrite(blahlubba);

// This should throw a warning and return NULL since an argument is missing 
var_dump($fo-ftruncate());

?
==DONE==
--CLEAN--
?php
$path = dirname(__FILE__).DIRECTORY_SEPARATOR.'fileobject_005.txt';
unlink($path);
?
--EXPECTF--
bool(true)
string(4) blah

Warning: SplFileObject::ftruncate() expects exactly 1 parameter, 0 given in %s 
on line %d
NULL
==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/tests heap_009.phpt

2008-05-25 Thread Etienne Kneuss
colder  Sun May 25 12:10:15 2008 UTC

  Modified files:  
/php-src/ext/spl/tests  heap_009.phpt 
  Log:
  remove the skipif
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/heap_009.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/spl/tests/heap_009.phpt
diff -u php-src/ext/spl/tests/heap_009.phpt:1.1 
php-src/ext/spl/tests/heap_009.phpt:1.2
--- php-src/ext/spl/tests/heap_009.phpt:1.1 Sat May 24 16:48:15 2008
+++ php-src/ext/spl/tests/heap_009.phpt Sun May 25 12:10:14 2008
@@ -3,8 +3,6 @@
 --CREDITS--
 Thomas Koch [EMAIL PROTECTED]
 #Hackday Webtuesday 2008-05-24
---SKIPIF--
-?php if (!extension_loaded(spl)) print skip; ?
 --FILE--
 ?php
 function testForException( $heap )



-- 
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/tests heap_009.phpt

2008-05-25 Thread Etienne Kneuss
colder  Sun May 25 12:13:41 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/spl/tests  heap_009.phpt 
  Log:
  remove the skipif
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/heap_009.phpt?r1=1.1.2.2r2=1.1.2.3diff_format=u
Index: php-src/ext/spl/tests/heap_009.phpt
diff -u php-src/ext/spl/tests/heap_009.phpt:1.1.2.2 
php-src/ext/spl/tests/heap_009.phpt:1.1.2.3
--- php-src/ext/spl/tests/heap_009.phpt:1.1.2.2 Sat May 24 16:49:04 2008
+++ php-src/ext/spl/tests/heap_009.phpt Sun May 25 12:13:41 2008
@@ -3,8 +3,6 @@
 --CREDITS--
 Thomas Koch [EMAIL PROTECTED]
 #Hackday Webtuesday 2008-05-24
---SKIPIF--
-?php if (!extension_loaded(spl)) print skip; ?
 --FILE--
 ?php
 function testForException( $heap )



-- 
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 php_spl.c /ext/spl/tests spl_autoload_010.phpt spl_autoload_011.phpt

2008-05-25 Thread Etienne Kneuss
colder  Sun May 25 12:22:38 2008 UTC

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

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  MFH: Add a prepend param to spl_autoload_register
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.52.2.28.2.17.2.16r2=1.52.2.28.2.17.2.17diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.52.2.28.2.17.2.16 
php-src/ext/spl/php_spl.c:1.52.2.28.2.17.2.17
--- php-src/ext/spl/php_spl.c:1.52.2.28.2.17.2.16   Tue Apr 29 09:18:26 2008
+++ php-src/ext/spl/php_spl.c   Sun May 25 12:22:37 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.52.2.28.2.17.2.16 2008/04/29 09:18:26 dmitry Exp $ */
+/* $Id: php_spl.c,v 1.52.2.28.2.17.2.17 2008/05/25 12:22:37 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -401,7 +401,14 @@
}
 } /* }}} */
 
-/* {{{ proto bool spl_autoload_register([mixed autoload_function = 
spl_autoload [, throw = true]])
+#define HT_MOVE_TAIL_TO_HEAD(ht)   
\
+   (ht)-pListTail-pListNext = (ht)-pListHead;   \
+   (ht)-pListHead = (ht)-pListTail;  
\
+   (ht)-pListTail = (ht)-pListHead-pListLast;   \
+   (ht)-pListTail-pListNext = NULL;  
\
+   (ht)-pListHead-pListLast = NULL;
+
+/* {{{ proto bool spl_autoload_register([mixed autoload_function = 
spl_autoload [, throw = true [, prepend]]])
  Register given function as __autoload() implementation */
 PHP_FUNCTION(spl_autoload_register)
 {
@@ -410,11 +417,12 @@
char *lc_name = NULL;
zval *zcallable = NULL;
zend_bool do_throw = 1;
+   zend_bool prepend  = 0;
zend_function *spl_func_ptr;
autoload_func_info alfi;
zval **obj_ptr;
 
-   if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() 
TSRMLS_CC, |zb, zcallable, do_throw) == FAILURE) {
+   if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() 
TSRMLS_CC, |zbb, zcallable, do_throw, prepend) == FAILURE) {
return;
}
 
@@ -507,9 +515,17 @@
spl_alfi.obj = NULL;
spl_alfi.ce = NULL;
zend_hash_add(SPL_G(autoload_functions), 
spl_autoload, sizeof(spl_autoload), spl_alfi, sizeof(autoload_func_info), 
NULL);
+   if (prepend  
SPL_G(autoload_functions)-nNumOfElements  1) {
+   /* Move the newly created element to the head 
of the hashtable */
+   HT_MOVE_TAIL_TO_HEAD(SPL_G(autoload_functions));
+   }
}
 
zend_hash_add(SPL_G(autoload_functions), lc_name, 
func_name_len+1, alfi.func_ptr, sizeof(autoload_func_info), NULL);
+   if (prepend  SPL_G(autoload_functions)-nNumOfElements  1) {
+   /* Move the newly created element to the head of the 
hashtable */
+   HT_MOVE_TAIL_TO_HEAD(SPL_G(autoload_functions));
+   }
 skip:
efree(lc_name);
}

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/spl_autoload_010.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/spl_autoload_010.phpt
+++ php-src/ext/spl/tests/spl_autoload_010.phpt
--TEST--
SPL: spl_autoload() and prepend
--INI--
include_path=.
--FILE--
?php
function autoloadA($name) {
echo A - $name\n;
}
function autoloadB($name) {
echo B - $name\n;
}
function autoloadC($name) {
echo C - $name\n;
class C{}
}

spl_autoload_register('autoloadA');
spl_autoload_register('autoloadB', true, true);
spl_autoload_register('autoloadC');

new C;
?
===DONE===
?php exit(0); ?
--EXPECTF--
B - C
A - C
C - C
===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/spl_autoload_011.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/spl_autoload_011.phpt
+++ php-src/ext/spl/tests/spl_autoload_011.phpt
--TEST--
SPL: spl_autoload() and object freed
--INI--
include_path=.
--FILE--
?php
class A {
public $var = 1;
public function autoload() {
echo var:.$this-var.\n;
}
public function __destruct() {
echo __destruct__\n;
}
}

$a = new A;
$a-var = 2;

spl_autoload_register(array($a, 'autoload'));
unset($a);

var_dump(class_exists(C, true));
?
===DONE===
?php exit(0); ?
--EXPECTF--
var:2
bool(false)
===DONE===
__destruct__



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



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

2008-05-25 Thread Etienne Kneuss
colder  Sun May 25 12:23:22 2008 UTC

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  ws
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.130r2=1.131diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.130 php-src/ext/spl/php_spl.c:1.131
--- php-src/ext/spl/php_spl.c:1.130 Sun May 25 12:17:27 2008
+++ php-src/ext/spl/php_spl.c   Sun May 25 12:23:22 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.130 2008/05/25 12:17:27 colder Exp $ */
+/* $Id: php_spl.c,v 1.131 2008/05/25 12:23:22 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -393,11 +393,11 @@
zval_ptr_dtor(zclass_name);
 } /* }}} */
 
-#define HT_MOVE_TAIL_TO_HEAD(ht)   
\
+#define HT_MOVE_TAIL_TO_HEAD(ht)   
\
(ht)-pListTail-pListNext = (ht)-pListHead;   \
(ht)-pListHead = (ht)-pListTail;  
\
(ht)-pListTail = (ht)-pListHead-pListLast;   \
-   (ht)-pListTail-pListNext = NULL;  
\
+   (ht)-pListTail-pListNext = NULL;  
\
(ht)-pListHead-pListLast = NULL;
 
 /* {{{ proto bool spl_autoload_register([mixed autoload_function = 
spl_autoload [, throw = true [, prepend = false]]]) U



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



[PHP-CVS] cvs: php-src /ext/spl php_spl.c /ext/spl/tests spl_autoload_010.phpt spl_autoload_011.phpt

2008-05-25 Thread Etienne Kneuss
colder  Sun May 25 12:17:27 2008 UTC

  Added files: 
/php-src/ext/spl/tests  spl_autoload_010.phpt spl_autoload_011.phpt 

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  Add a prepend param to spl_autoload_register
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.129r2=1.130diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.129 php-src/ext/spl/php_spl.c:1.130
--- php-src/ext/spl/php_spl.c:1.129 Tue Apr 29 09:18:54 2008
+++ php-src/ext/spl/php_spl.c   Sun May 25 12:17:27 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.129 2008/04/29 09:18:54 dmitry Exp $ */
+/* $Id: php_spl.c,v 1.130 2008/05/25 12:17:27 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -393,7 +393,14 @@
zval_ptr_dtor(zclass_name);
 } /* }}} */
 
-/* {{{ proto bool spl_autoload_register([mixed autoload_function = 
spl_autoload [, throw = true]]) U
+#define HT_MOVE_TAIL_TO_HEAD(ht)   
\
+   (ht)-pListTail-pListNext = (ht)-pListHead;   \
+   (ht)-pListHead = (ht)-pListTail;  
\
+   (ht)-pListTail = (ht)-pListHead-pListLast;   \
+   (ht)-pListTail-pListNext = NULL;  
\
+   (ht)-pListHead-pListLast = NULL;
+
+/* {{{ proto bool spl_autoload_register([mixed autoload_function = 
spl_autoload [, throw = true [, prepend = false]]]) U
  Register given function as __autoload() implementation */
 PHP_FUNCTION(spl_autoload_register)
 {
@@ -401,11 +408,12 @@
zval zfunc_name, ztmp;
zval *zcallable = NULL;
zend_bool do_throw = 1;
+   zend_bool prepend = 0;
zend_function *spl_func_ptr;
autoload_func_info alfi;
zval **obj_ptr;
 
-   if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() 
TSRMLS_CC, |zb, zcallable, do_throw) == FAILURE) {
+   if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() 
TSRMLS_CC, |zbb, zcallable, do_throw, prepend) == FAILURE) {
return;
}
 
@@ -517,9 +525,17 @@
spl_alfi.obj = NULL;
spl_alfi.ce = NULL;
zend_hash_add(SPL_G(autoload_functions), 
spl_autoload, sizeof(spl_autoload), spl_alfi, sizeof(autoload_func_info), 
NULL);
+   if (prepend  
SPL_G(autoload_functions)-nNumOfElements  1) {
+   /* Move the newly created element to the head 
of the hashtable */
+   HT_MOVE_TAIL_TO_HEAD(SPL_G(autoload_functions));
+   }
}
 
zend_u_hash_add(SPL_G(autoload_functions), Z_TYPE(zfunc_name), 
Z_UNIVAL(zfunc_name), Z_UNILEN(zfunc_name)+1, alfi, 
sizeof(autoload_func_info), NULL);
+   if (prepend  SPL_G(autoload_functions)-nNumOfElements  1) {
+   /* Move the newly created element to the head of the 
hashtable */
+   HT_MOVE_TAIL_TO_HEAD(SPL_G(autoload_functions));
+   }
 skip:
zval_dtor(zfunc_name);
}

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/spl_autoload_010.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/spl_autoload_010.phpt
+++ php-src/ext/spl/tests/spl_autoload_010.phpt
--TEST--
SPL: spl_autoload() and prepend
--INI--
include_path=.
--FILE--
?php
function autoloadA($name) {
echo A - $name\n;
}
function autoloadB($name) {
echo B - $name\n;
}
function autoloadC($name) {
echo C - $name\n;
class C{}
}

spl_autoload_register('autoloadA');
spl_autoload_register('autoloadB', true, true);
spl_autoload_register('autoloadC');

new C;
?
===DONE===
?php exit(0); ?
--EXPECTF--
B - C
A - C
C - C
===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/spl_autoload_011.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/spl_autoload_011.phpt
+++ php-src/ext/spl/tests/spl_autoload_011.phpt
--TEST--
SPL: spl_autoload() and object freed
--INI--
include_path=.
--FILE--
?php
class A {
public $var = 1;
public function autoload() {
echo var:.$this-var.\n;
}
public function __destruct() {
echo __destruct__\n;
}
}

$a = new A;
$a-var = 2;

spl_autoload_register(array($a, 'autoload'));
unset($a);

var_dump(class_exists(C, true));
?
===DONE===
?php exit(0); ?
--EXPECTF--
var:2
bool(false)
===DONE===
__destruct__



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



[PHP-CVS] cvs: php-src /ext/spl config.m4 config.w32 php_spl.c spl_dllist.c spl_engine.c spl_engine.h spl_fastarray.c spl_fastarray.h /ext/spl/tests fastarray_001.phpt fastarray_002.phpt fastarray_00

2008-06-06 Thread Etienne Kneuss
 = spl_dllist_get_iterator;
+   spl_ce_SplStack-get_iterator = spl_dllist_get_iterator;
+
return SUCCESS;
 }
 /* }}} */

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_fastarray.c?view=markuprev=1.1
Index: php-src/ext/spl/spl_fastarray.c
+++ php-src/ext/spl/spl_fastarray.c
/*
  +--+
  | PHP Version 5|
  +--+
  | 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|
  | available through the world-wide-web at the following url:   |
  | http://www.php.net/license/3_01.txt  |
  | If you did not receive a copy of the PHP license and are unable to   |
  | obtain it through the world-wide-web, please send a note to  |
  | [EMAIL PROTECTED] so we can mail you a copy immediately.   |
  +--+
  | Author: Antony Dovgal [EMAIL PROTECTED]  |
  | Etienne Kneuss [EMAIL PROTECTED]  |
  +--+
*/

/* $Id: spl_fastarray.c,v 1.1 2008/06/06 23:53:10 colder Exp $ */

#ifdef HAVE_CONFIG_H
#include config.h
#endif

#include php.h
#include php_ini.h
#include ext/standard/info.h
#include zend_exceptions.h

#include php_spl.h
#include spl_functions.h
#include spl_engine.h
#include spl_fastarray.h
#include spl_exceptions.h
#include spl_iterators.h

zend_object_handlers spl_handler_SplFastArray;
PHPAPI zend_class_entry *spl_ce_SplFastArray;

#ifdef COMPILE_DL_SPL_FASTARRAY
ZEND_GET_MODULE(spl_fastarray)
#endif

typedef struct _spl_fastarray { /* {{{ */
long size;
zval **elements;
} spl_fastarray;
/* }}} */

typedef struct _spl_fastarray_object { /* {{{ */
zend_objectstd;
spl_fastarray *array;
zval  *retval;
zend_function *fptr_offset_get;
zend_function *fptr_offset_set;
zend_function *fptr_offset_has;
zend_function *fptr_offset_del;
zend_function *fptr_it_next;
zend_function *fptr_it_rewind;
zend_function *fptr_it_current;
zend_function *fptr_it_key;
zend_function *fptr_it_valid;
intcurrent;
zend_class_entry  *ce_get_iterator;
} spl_fastarray_object;
/* }}} */

typedef struct _spl_fastarray_it { /* {{{ */
zend_user_iterator intern;
spl_fastarray_object  *object;
} spl_fastarray_it;
/* }}} */

static void spl_fastarray_init(spl_fastarray *array, long size TSRMLS_DC) /* 
{{{ */
{
if (size  0) {
array-elements = ecalloc(size, sizeof(zval *));
array-size = size;
} else {
array-elements = NULL;
array-size = 0;
}
}
/* }}} */

static void spl_fastarray_resize(spl_fastarray *array, long size TSRMLS_DC) /* 
{{{ */
{
if (size == array-size) {
/* nothing to do */
return;
}

/* first initialization */
if (array-size == 0) {
spl_fastarray_init(array, size TSRMLS_CC);
return;
}

/* clearing the array */
if (size == 0) {
long i;

for (i = 0; i  array-size; i++) {
if (array-elements[i]) {
zval_ptr_dtor((array-elements[i]));
}
}

if (array-elements) {
efree(array-elements);
}
} else if (size  array-size) {
array-elements = erealloc(array-elements, sizeof(zval *) * 
size);
memset(array-elements + array-size, '\0', sizeof(zval *) * 
(size - array-size));
} else { /* size  array-size */
long i;

for (i = size; i  array-size; i++) {
if (array-elements[i]) {
zval_ptr_dtor((array-elements[i]));
}
}
array-elements = erealloc(array-elements, sizeof(zval *) * 
size);
}

array-size = size;
}
/* }}} */

static void spl_fastarray_copy(spl_fastarray *to, spl_fastarray *from 
TSRMLS_DC) /* {{{ */
{
int i;
for (i = 0; i  from-size; i++) {
if (from-elements[i]) {
Z_ADDREF_P(from-elements[i]);
to-elements[i] = from-elements[i

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl config.m4 config.w32 php_spl.c spl_dllist.c spl_engine.c spl_engine.h spl_fastarray.c spl_fastarray.h /ext/spl/tests fastarray_001.phpt fastarray_002.phpt fas

2008-06-06 Thread Etienne Kneuss
 or out of range, 0 TSRMLS_CC);
@@ -859,7 +841,7 @@
}
 
intern = (spl_dllist_object*)zend_object_store_get_object(getThis() 
TSRMLS_CC);
-   index  = (int)spl_dllist_offset_convert(zindex TSRMLS_CC);
+   index  = (int)spl_offset_convert_to_long(zindex TSRMLS_CC);
 llist  = intern-llist;
 
 if (index  0 || index = intern-llist-count) {
@@ -1192,6 +1174,9 @@
REGISTER_SPL_SUB_CLASS_EX(SplQueue,   SplDoublyLinkedList,  
  spl_dllist_object_new, spl_funcs_SplQueue);
REGISTER_SPL_SUB_CLASS_EX(SplStack,   SplDoublyLinkedList,  
  spl_dllist_object_new, NULL);
 
+   spl_ce_SplQueue-get_iterator = spl_dllist_get_iterator;
+   spl_ce_SplStack-get_iterator = spl_dllist_get_iterator;
+
return SUCCESS;
 }
 /* }}} */

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_fastarray.c?view=markuprev=1.1
Index: php-src/ext/spl/spl_fastarray.c
+++ php-src/ext/spl/spl_fastarray.c
/*
  +--+
  | PHP Version 5|
  +--+
  | 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|
  | available through the world-wide-web at the following url:   |
  | http://www.php.net/license/3_01.txt  |
  | If you did not receive a copy of the PHP license and are unable to   |
  | obtain it through the world-wide-web, please send a note to  |
  | [EMAIL PROTECTED] so we can mail you a copy immediately.   |
  +--+
  | Author: Antony Dovgal [EMAIL PROTECTED]  |
  | Etienne Kneuss [EMAIL PROTECTED]  |
  +--+
*/

/* $Id: spl_fastarray.c,v 1.1 2008/06/06 23:53:10 colder Exp $ */

#ifdef HAVE_CONFIG_H
#include config.h
#endif

#include php.h
#include php_ini.h
#include ext/standard/info.h
#include zend_exceptions.h

#include php_spl.h
#include spl_functions.h
#include spl_engine.h
#include spl_fastarray.h
#include spl_exceptions.h
#include spl_iterators.h

zend_object_handlers spl_handler_SplFastArray;
PHPAPI zend_class_entry *spl_ce_SplFastArray;

#ifdef COMPILE_DL_SPL_FASTARRAY
ZEND_GET_MODULE(spl_fastarray)
#endif

typedef struct _spl_fastarray { /* {{{ */
long size;
zval **elements;
} spl_fastarray;
/* }}} */

typedef struct _spl_fastarray_object { /* {{{ */
zend_objectstd;
spl_fastarray *array;
zval  *retval;
zend_function *fptr_offset_get;
zend_function *fptr_offset_set;
zend_function *fptr_offset_has;
zend_function *fptr_offset_del;
zend_function *fptr_it_next;
zend_function *fptr_it_rewind;
zend_function *fptr_it_current;
zend_function *fptr_it_key;
zend_function *fptr_it_valid;
intcurrent;
zend_class_entry  *ce_get_iterator;
} spl_fastarray_object;
/* }}} */

typedef struct _spl_fastarray_it { /* {{{ */
zend_user_iterator intern;
spl_fastarray_object  *object;
} spl_fastarray_it;
/* }}} */

static void spl_fastarray_init(spl_fastarray *array, long size TSRMLS_DC) /* 
{{{ */
{
if (size  0) {
array-elements = ecalloc(size, sizeof(zval *));
array-size = size;
} else {
array-elements = NULL;
array-size = 0;
}
}
/* }}} */

static void spl_fastarray_resize(spl_fastarray *array, long size TSRMLS_DC) /* 
{{{ */
{
if (size == array-size) {
/* nothing to do */
return;
}

/* first initialization */
if (array-size == 0) {
spl_fastarray_init(array, size TSRMLS_CC);
return;
}

/* clearing the array */
if (size == 0) {
long i;

for (i = 0; i  array-size; i++) {
if (array-elements[i]) {
zval_ptr_dtor((array-elements[i]));
}
}

if (array-elements) {
efree(array-elements);
}
} else if (size  array-size) {
array-elements = erealloc(array-elements, sizeof(zval *) * 
size);
memset(array-elements + array-size, '\0', sizeof(zval *) * 
(size - array-size));
} else { /* size  array-size

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

2008-06-06 Thread Etienne Kneuss
colder  Sat Jun  7 01:46:27 2008 UTC

  Modified files:  
/php-src/ext/splspl_fastarray.c 
  Log:
  Fix segfault caused by get_current_data on an uninitialized element
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_fastarray.c?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/spl/spl_fastarray.c
diff -u php-src/ext/spl/spl_fastarray.c:1.1 php-src/ext/spl/spl_fastarray.c:1.2
--- php-src/ext/spl/spl_fastarray.c:1.1 Fri Jun  6 23:53:10 2008
+++ php-src/ext/spl/spl_fastarray.c Sat Jun  7 01:46:27 2008
@@ -17,7 +17,7 @@
   +--+
 */
 
-/* $Id: spl_fastarray.c,v 1.1 2008/06/06 23:53:10 colder Exp $ */
+/* $Id: spl_fastarray.c,v 1.2 2008/06/07 01:46:27 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -279,24 +279,22 @@
 static inline zval 
**spl_fastarray_object_read_dimension_helper(spl_fastarray_object *intern, zval 
*offset TSRMLS_DC) /* {{{ */
 {
long index;
-   zval **retval;
 
index = spl_offset_convert_to_long(offset TSRMLS_CC);

if (index  0 || index = intern-array-size) {
zend_throw_exception(spl_ce_RuntimeException, Index invalid or 
out of range, 0 TSRMLS_CC);
-   return NULL;
+   return EG(uninitialized_zval_ptr);
+   } else if(!intern-array-elements[index]) {
+   return EG(uninitialized_zval_ptr);
} else {
-   retval = intern-array-elements[index];
+   return intern-array-elements[index];
}
-
-   return retval;
 }
 /* }}} */
 
 static zval *spl_fastarray_object_read_dimension(zval *object, zval *offset, 
int type TSRMLS_DC) /* {{{ */
 {
-   zval **value_pp;
spl_fastarray_object *intern;
 
intern = (spl_fastarray_object *)zend_object_store_get_object(object 
TSRMLS_CC);
@@ -315,12 +313,7 @@
return EG(uninitialized_zval_ptr);
}
 
-   value_pp = spl_fastarray_object_read_dimension_helper(intern, offset 
TSRMLS_CC);
-   if (value_pp) {
-   return *value_pp;
-   } else {
-   return EG(uninitialized_zval_ptr);
-   }
+   return *spl_fastarray_object_read_dimension_helper(intern, offset 
TSRMLS_CC);
 }
 /* }}} */
 
@@ -574,9 +567,7 @@
intern= (spl_fastarray_object 
*)zend_object_store_get_object(getThis() TSRMLS_CC);
value_pp  = spl_fastarray_object_read_dimension_helper(intern, zindex 
TSRMLS_CC);
 
-   if (value_pp) {
-   RETURN_ZVAL(*value_pp, 1, 0);
-   }
+   RETURN_ZVAL(*value_pp, 1, 0);
 } /* }}} */
 
 /* {{{ proto void SplFastArray::offsetSet(mixed $index, mixed $newval) U
@@ -676,14 +667,16 @@
MAKE_STD_ZVAL(intern-retval);
ZVAL_ZVAL(intern-retval, rv, 1, 1);
*data = intern-retval;
+   return;
}
+   *data = NULL;
return;
}
 
ALLOC_INIT_ZVAL(zindex);
ZVAL_LONG(zindex, iterator-object-current);
 
-   *data  = spl_fastarray_object_read_dimension_helper(iterator-object, 
zindex TSRMLS_CC);
+   *data = spl_fastarray_object_read_dimension_helper(intern, zindex 
TSRMLS_CC);
 
zval_ptr_dtor(zindex);
 }
@@ -785,9 +778,7 @@
 
zval_ptr_dtor(zindex);
 
-   if (value_pp) {
-   RETURN_ZVAL(*value_pp, 1, 0);
-   }
+   RETURN_ZVAL(*value_pp, 1, 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_fastarray.c

2008-06-06 Thread Etienne Kneuss
colder  Sat Jun  7 01:46:44 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/splspl_fastarray.c 
  Log:
  MFH: Fix segfault caused by get_current_data on an uninitialized element
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_fastarray.c?r1=1.1.2.2r2=1.1.2.3diff_format=u
Index: php-src/ext/spl/spl_fastarray.c
diff -u php-src/ext/spl/spl_fastarray.c:1.1.2.2 
php-src/ext/spl/spl_fastarray.c:1.1.2.3
--- php-src/ext/spl/spl_fastarray.c:1.1.2.2 Fri Jun  6 23:53:43 2008
+++ php-src/ext/spl/spl_fastarray.c Sat Jun  7 01:46:44 2008
@@ -17,7 +17,7 @@
   +--+
 */
 
-/* $Id: spl_fastarray.c,v 1.1.2.2 2008/06/06 23:53:43 colder Exp $ */
+/* $Id: spl_fastarray.c,v 1.1.2.3 2008/06/07 01:46:44 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -279,24 +279,22 @@
 static inline zval 
**spl_fastarray_object_read_dimension_helper(spl_fastarray_object *intern, zval 
*offset TSRMLS_DC) /* {{{ */
 {
long index;
-   zval **retval;
 
index = spl_offset_convert_to_long(offset TSRMLS_CC);

if (index  0 || index = intern-array-size) {
zend_throw_exception(spl_ce_RuntimeException, Index invalid or 
out of range, 0 TSRMLS_CC);
-   return NULL;
+   return EG(uninitialized_zval_ptr);
+   } else if(!intern-array-elements[index]) {
+   return EG(uninitialized_zval_ptr);
} else {
-   retval = intern-array-elements[index];
+   return intern-array-elements[index];
}
-
-   return retval;
 }
 /* }}} */
 
 static zval *spl_fastarray_object_read_dimension(zval *object, zval *offset, 
int type TSRMLS_DC) /* {{{ */
 {
-   zval **value_pp;
spl_fastarray_object *intern;
 
intern = (spl_fastarray_object *)zend_object_store_get_object(object 
TSRMLS_CC);
@@ -315,12 +313,7 @@
return EG(uninitialized_zval_ptr);
}
 
-   value_pp = spl_fastarray_object_read_dimension_helper(intern, offset 
TSRMLS_CC);
-   if (value_pp) {
-   return *value_pp;
-   } else {
-   return EG(uninitialized_zval_ptr);
-   }
+   return *spl_fastarray_object_read_dimension_helper(intern, offset 
TSRMLS_CC);
 }
 /* }}} */
 
@@ -574,9 +567,7 @@
intern= (spl_fastarray_object 
*)zend_object_store_get_object(getThis() TSRMLS_CC);
value_pp  = spl_fastarray_object_read_dimension_helper(intern, zindex 
TSRMLS_CC);
 
-   if (value_pp) {
-   RETURN_ZVAL(*value_pp, 1, 0);
-   }
+   RETURN_ZVAL(*value_pp, 1, 0);
 } /* }}} */
 
 /* {{{ proto void SplFastArray::offsetSet(mixed $index, mixed $newval) U
@@ -676,14 +667,16 @@
MAKE_STD_ZVAL(intern-retval);
ZVAL_ZVAL(intern-retval, rv, 1, 1);
*data = intern-retval;
+   return;
}
+   *data = NULL;
return;
}
 
ALLOC_INIT_ZVAL(zindex);
ZVAL_LONG(zindex, iterator-object-current);
 
-   *data  = spl_fastarray_object_read_dimension_helper(iterator-object, 
zindex TSRMLS_CC);
+   *data = spl_fastarray_object_read_dimension_helper(intern, zindex 
TSRMLS_CC);
 
zval_ptr_dtor(zindex);
 }
@@ -785,9 +778,7 @@
 
zval_ptr_dtor(zindex);
 
-   if (value_pp) {
-   RETURN_ZVAL(*value_pp, 1, 0);
-   }
+   RETURN_ZVAL(*value_pp, 1, 0);
 }
 /* }}} */
 



-- 
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_fastarray.c

2008-06-09 Thread Etienne Kneuss
colder  Mon Jun  9 17:29:09 2008 UTC

  Modified files:  
/php-src/ext/splspl_fastarray.c 
  Log:
  add get_Debug_info + fix proto
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_fastarray.c?r1=1.5r2=1.6diff_format=u
Index: php-src/ext/spl/spl_fastarray.c
diff -u php-src/ext/spl/spl_fastarray.c:1.5 php-src/ext/spl/spl_fastarray.c:1.6
--- php-src/ext/spl/spl_fastarray.c:1.5 Sat Jun  7 21:35:53 2008
+++ php-src/ext/spl/spl_fastarray.c Mon Jun  9 17:29:09 2008
@@ -17,7 +17,7 @@
   +--+
 */
 
-/* $Id: spl_fastarray.c,v 1.5 2008/06/07 21:35:53 tony2001 Exp $ */
+/* $Id: spl_fastarray.c,v 1.6 2008/06/09 17:29:09 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -143,6 +143,49 @@
 }
 /* }}} */
 
+static HashTable* spl_fastarray_object_get_debug_info(zval *obj, int *is_temp 
TSRMLS_DC) /*  */
+{
+   spl_fastarray_object *intern  = 
(spl_fastarray_object*)zend_object_store_get_object(obj TSRMLS_CC);
+   HashTable *rv;
+   zval *tmp, zrv, *fastarray_array;
+   zstr pnstr;
+   int  pnlen;
+   int  i = 0;
+
+   *is_temp = 1;
+
+   ALLOC_HASHTABLE(rv);
+   ZEND_INIT_SYMTABLE_EX(rv, 
zend_hash_num_elements(intern-std.properties) + 1, 0);
+
+   INIT_PZVAL(zrv);
+   Z_ARRVAL(zrv) = rv;
+
+   zend_hash_copy(rv, intern-std.properties, (copy_ctor_func_t) 
zval_add_ref, (void *) tmp, sizeof(zval *));
+
+   ALLOC_INIT_ZVAL(fastarray_array);
+   array_init(fastarray_array);
+
+
+   if (intern-array) {
+   for (i = 0; i  intern-array-size; i++) {
+   if (intern-array-elements[i]) {
+   add_index_zval(fastarray_array, i, (zval 
*)intern-array-elements[i]);
+   Z_ADDREF_P(intern-array-elements[i]);
+   } else {
+   add_index_zval(fastarray_array, i, (zval 
*)EG(uninitialized_zval_ptr));
+   Z_ADDREF_P(EG(uninitialized_zval_ptr));
+   }
+   }
+   }
+
+   pnstr = spl_gen_private_prop_name(spl_ce_SplFastArray, array, 
sizeof(array)-1, pnlen TSRMLS_CC);
+   add_u_assoc_zval_ex(zrv, ZEND_STR_TYPE, pnstr, pnlen+1, 
fastarray_array);
+   efree(pnstr.v);
+
+   return rv;
+}
+/*  */
+
 static void spl_fastarray_object_free_storage(void *object TSRMLS_DC) /* {{{ */
 {
spl_fastarray_object *intern = (spl_fastarray_object *)object;
@@ -724,7 +767,7 @@
 }
 /* }}} */
 
-static int spl_fastarray_it_get_current_key(zend_object_iterator *iter, char 
**str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) /* {{{ */
+static int spl_fastarray_it_get_current_key(zend_object_iterator *iter, zstr 
*str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) /* {{{ */
 {
spl_fastarray_it *iterator = (spl_fastarray_it *)iter;
spl_fastarray_object *intern   = iterator-object;
@@ -907,6 +950,7 @@
spl_handler_SplFastArray.unset_dimension = 
spl_fastarray_object_unset_dimension;
spl_handler_SplFastArray.has_dimension   = 
spl_fastarray_object_has_dimension;
spl_handler_SplFastArray.count_elements  = 
spl_fastarray_object_count_elements;
+   spl_handler_SplFastArray.get_debug_info  = 
spl_fastarray_object_get_debug_info;
 
REGISTER_SPL_IMPLEMENTS(SplFastArray, Iterator);
REGISTER_SPL_IMPLEMENTS(SplFastArray, ArrayAccess);



-- 
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_fastarray.c

2008-06-09 Thread Etienne Kneuss
colder  Mon Jun  9 17:29:23 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/splspl_fastarray.c 
  Log:
  add get_debug_info
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_fastarray.c?r1=1.1.2.6r2=1.1.2.7diff_format=u
Index: php-src/ext/spl/spl_fastarray.c
diff -u php-src/ext/spl/spl_fastarray.c:1.1.2.6 
php-src/ext/spl/spl_fastarray.c:1.1.2.7
--- php-src/ext/spl/spl_fastarray.c:1.1.2.6 Sat Jun  7 21:36:13 2008
+++ php-src/ext/spl/spl_fastarray.c Mon Jun  9 17:29:23 2008
@@ -17,7 +17,7 @@
   +--+
 */
 
-/* $Id: spl_fastarray.c,v 1.1.2.6 2008/06/07 21:36:13 tony2001 Exp $ */
+/* $Id: spl_fastarray.c,v 1.1.2.7 2008/06/09 17:29:23 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -143,6 +143,49 @@
 }
 /* }}} */
 
+static HashTable* spl_fastarray_object_get_debug_info(zval *obj, int *is_temp 
TSRMLS_DC) /*  */
+{
+   spl_fastarray_object *intern  = 
(spl_fastarray_object*)zend_object_store_get_object(obj TSRMLS_CC);
+   HashTable *rv;
+   zval *tmp, zrv, *fastarray_array;
+   char *pnstr;
+   int  pnlen;
+   int  i = 0;;
+
+   *is_temp = 1;
+
+   ALLOC_HASHTABLE(rv);
+   ZEND_INIT_SYMTABLE_EX(rv, 
zend_hash_num_elements(intern-std.properties) + 1, 0);
+
+   INIT_PZVAL(zrv);
+   Z_ARRVAL(zrv) = rv;
+
+   zend_hash_copy(rv, intern-std.properties, (copy_ctor_func_t) 
zval_add_ref, (void *) tmp, sizeof(zval *));
+
+   ALLOC_INIT_ZVAL(fastarray_array);
+   array_init(fastarray_array);
+
+
+   if (intern-array) {
+   for (i = 0; i  intern-array-size; i++) {
+   if (intern-array-elements[i]) {
+   add_index_zval(fastarray_array, i, (zval 
*)intern-array-elements[i]);
+   Z_ADDREF_P(intern-array-elements[i]);
+   } else {
+   add_index_zval(fastarray_array, i, (zval 
*)EG(uninitialized_zval_ptr));
+   Z_ADDREF_P(EG(uninitialized_zval_ptr));
+   }
+   }
+   }
+
+   pnstr = spl_gen_private_prop_name(spl_ce_SplFastArray, array, 
sizeof(array)-1, pnlen TSRMLS_CC);
+   add_assoc_zval_ex(zrv, pnstr, pnlen+1, fastarray_array);
+   efree(pnstr);
+
+   return rv;
+}
+/*  */
+
 static void spl_fastarray_object_free_storage(void *object TSRMLS_DC) /* {{{ */
 {
spl_fastarray_object *intern = (spl_fastarray_object *)object;
@@ -907,6 +950,7 @@
spl_handler_SplFastArray.unset_dimension = 
spl_fastarray_object_unset_dimension;
spl_handler_SplFastArray.has_dimension   = 
spl_fastarray_object_has_dimension;
spl_handler_SplFastArray.count_elements  = 
spl_fastarray_object_count_elements;
+   spl_handler_SplFastArray.get_debug_info  = 
spl_fastarray_object_get_debug_info;
 
REGISTER_SPL_IMPLEMENTS(SplFastArray, Iterator);
REGISTER_SPL_IMPLEMENTS(SplFastArray, ArrayAccess);



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



[PHP-CVS] cvs: php-src /ext/spl/tests fileobject_checktype_basic.phpt fileobject_getbasename_basic.phpt fileobject_getcurrentline_basic.phpt fileobject_getfileinfo_basic.phpt fileobject_getmaxlinelen_

2008-06-12 Thread Etienne Kneuss
colder  Thu Jun 12 20:46:00 2008 UTC

  Added files: 
/php-src/ext/spl/tests  fileobject_checktype_basic.phpt 
fileobject_getbasename_basic.phpt 
fileobject_getcurrentline_basic.phpt 
fileobject_getfileinfo_basic.phpt 
fileobject_getmaxlinelen_basic.phpt 
fileobject_getsize_basic.phpt 
fileobject_setmaxlinelen_basic.phpt 
  Log:
  Add tests from testfest
  

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fileobject_checktype_basic.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/fileobject_checktype_basic.phpt
+++ php-src/ext/spl/tests/fileobject_checktype_basic.phpt
--TEST--
SPL: SplFileObject::isFile/isDir/isLink
--CREDITS--
H�vard Eide nucleuz at gmail.com
#Testfest php.no
--FILE--
?php
$s = new SplFileObject(__FILE__);
var_dump($s-isFile());
var_dump($s-isDir());
var_dump($s-isLink());
?
--EXPECT--
bool(true)
bool(false)
bool(false)

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fileobject_getbasename_basic.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/fileobject_getbasename_basic.phpt
+++ php-src/ext/spl/tests/fileobject_getbasename_basic.phpt
--TEST--
SPL: SplFileObject::getBasename 
--CREDITS--
H�vard Eide nucleuz at gmail.com
#Testfest php.no
--FILE--
?php
$file = __FILE__;
$s = new SplFileObject( __FILE__ );
echo $s-getBasename();
?
--EXPECT--
fileobject_getbasename_basic.php

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fileobject_getcurrentline_basic.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/fileobject_getcurrentline_basic.phpt
+++ php-src/ext/spl/tests/fileobject_getcurrentline_basic.phpt
--TEST--
SPL: SplFileObject::getCurrentLine
--CREDITS--
H�vard Eide nucleuz at gmail.com
#Testfest php.no
--FILE--
?php
//line 2
//line 3
//line 4
//line 5
$s = new SplFileObject(__FILE__);
$s-seek(1);
echo $s-getCurrentLine();
echo $s-getCurrentLine();
?
--EXPECT--
//line 3
//line 4

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fileobject_getfileinfo_basic.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/fileobject_getfileinfo_basic.phpt
+++ php-src/ext/spl/tests/fileobject_getfileinfo_basic.phpt
--TEST--
SPL: SplFileObject::getFileInfo
--CREDITS--
H�vard Eide nucleuz at gmail.com
#Testfest php.no
--INI--
include_path=.
--FILE--
?php
$file = __FILE__;
$s = new SplFileObject( $file );
var_dump($fi = $s-getFileInfo(), (string)$fi);

$d = new SplFileInfo( __DIR__ );
echo \n;
var_dump($fi = $d-getFileInfo(), (string)$fi);
?
--EXPECTF--
object(SplFileInfo)#2 (2) {
  [upathName:uSplFileInfo:private]=
  %s(%d) %sext%espl%etests
  [ufileName:uSplFileInfo:private]=
  %s(%d) %sext%espl%etests%efileobject_getfileinfo_basic.php
}
%s(%d) %sext%espl%etests%efileobject_getfileinfo_basic.php

object(SplFileInfo)#4 (2) {
  [upathName:uSplFileInfo:private]=
  %s(%d) %sext%espl
  [ufileName:uSplFileInfo:private]=
  %s(%d) %sext%espl%etests
}
%s(%d) %sext%espl%etests

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fileobject_getmaxlinelen_basic.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/fileobject_getmaxlinelen_basic.phpt
+++ php-src/ext/spl/tests/fileobject_getmaxlinelen_basic.phpt
--TEST--
SPL: SplFileObject::getMaxLineLen()
--CREDITS--
H�vard Eide nucleuz at gmail.com
#Testfest php.no
--INI--
include_path=.
--FILE--
?php
$s = new SplFileObject( __FILE__ ); 
$s-setMaxLineLen( 7 );  
echo $s-getMaxLineLen();
?
--EXPECT--
7

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fileobject_getsize_basic.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/fileobject_getsize_basic.phpt
+++ php-src/ext/spl/tests/fileobject_getsize_basic.phpt
--TEST--
SPL: SplFileObject::getSize
--CREDITS--
H�vard Eide nucleuz at gmail.com
#Testfest php.no
--INI--
include_path=.
--FILE--
?php
$file = __DIR__ ./data.txt;
file_put_contents($file, foobar);

$s = new SplFileObject( $file );
echo $s-getSize();
?
--CLEAN--
$file = __DIR__ ./data.txt;
unlink($file);
--EXPECT--
6

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fileobject_setmaxlinelen_basic.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/fileobject_setmaxlinelen_basic.phpt
+++ php-src/ext/spl/tests/fileobject_setmaxlinelen_basic.phpt
--TEST--
SPL: SplFileObject::setMaxLineLen
--CREDITS--
H�vard Eide nucleuz at gmail.com
#Testfest php.no
--INI--
include_path=.
--FILE--
?php
$s = new SplFileObject( __FILE__ ); 
$s-setMaxLineLen( 3);  
echo $s-getCurrentLine();
?
--EXPECT--
?



-- 
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/tests fileobject_checktype_basic.phpt fileobject_getbasename_basic.phpt fileobject_getcurrentline_basic.phpt fileobject_getfileinfo_basic.phpt fileobject_getma

2008-06-12 Thread Etienne Kneuss
colder  Thu Jun 12 20:46:12 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/spl/tests  fileobject_checktype_basic.phpt 
fileobject_getbasename_basic.phpt 
fileobject_getcurrentline_basic.phpt 
fileobject_getfileinfo_basic.phpt 
fileobject_getmaxlinelen_basic.phpt 
fileobject_getsize_basic.phpt 
fileobject_setmaxlinelen_basic.phpt 
  Log:
  Add tests from testfest
  

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fileobject_checktype_basic.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/fileobject_checktype_basic.phpt
+++ php-src/ext/spl/tests/fileobject_checktype_basic.phpt
--TEST--
SPL: SplFileObject::isFile/isDir/isLink
--CREDITS--
H�vard Eide nucleuz at gmail.com
#Testfest php.no
--FILE--
?php
$s = new SplFileObject(__FILE__);
var_dump($s-isFile());
var_dump($s-isDir());
var_dump($s-isLink());
?
--EXPECT--
bool(true)
bool(false)
bool(false)

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fileobject_getbasename_basic.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/fileobject_getbasename_basic.phpt
+++ php-src/ext/spl/tests/fileobject_getbasename_basic.phpt
--TEST--
SPL: SplFileObject::getBasename 
--CREDITS--
H�vard Eide nucleuz at gmail.com
#Testfest php.no
--FILE--
?php
$file = __FILE__;
$s = new SplFileObject( __FILE__ );
echo $s-getBasename();
?
--EXPECT--
fileobject_getbasename_basic.php

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fileobject_getcurrentline_basic.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/fileobject_getcurrentline_basic.phpt
+++ php-src/ext/spl/tests/fileobject_getcurrentline_basic.phpt
--TEST--
SPL: SplFileObject::getCurrentLine
--CREDITS--
H�vard Eide nucleuz at gmail.com
#Testfest php.no
--FILE--
?php
//line 2
//line 3
//line 4
//line 5
$s = new SplFileObject(__FILE__);
$s-seek(1);
echo $s-getCurrentLine();
echo $s-getCurrentLine();
?
--EXPECT--
//line 3
//line 4

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fileobject_getfileinfo_basic.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/fileobject_getfileinfo_basic.phpt
+++ php-src/ext/spl/tests/fileobject_getfileinfo_basic.phpt
--TEST--
SPL: SplFileObject::getFileInfo
--CREDITS--
H�vard Eide nucleuz at gmail.com
#Testfest php.no
--INI--
include_path=.
--FILE--
?php
$file = __FILE__;
$s = new SplFileObject( $file );
var_dump($fi = $s-getFileInfo(), (string)$fi);

$d = new SplFileInfo( __DIR__ );
echo \n;
var_dump($fi = $d-getFileInfo(), (string)$fi);
?
--EXPECTF--
object(SplFileInfo)#2 (2) {
  [upathName:uSplFileInfo:private]=
  %s(%d) %sext%espl%etests
  [ufileName:uSplFileInfo:private]=
  %s(%d) %sext%espl%etests%efileobject_getfileinfo_basic.php
}
%s(%d) %sext%espl%etests%efileobject_getfileinfo_basic.php

object(SplFileInfo)#4 (2) {
  [upathName:uSplFileInfo:private]=
  %s(%d) %sext%espl
  [ufileName:uSplFileInfo:private]=
  %s(%d) %sext%espl%etests
}
%s(%d) %sext%espl%etests

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fileobject_getmaxlinelen_basic.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/fileobject_getmaxlinelen_basic.phpt
+++ php-src/ext/spl/tests/fileobject_getmaxlinelen_basic.phpt
--TEST--
SPL: SplFileObject::getMaxLineLen()
--CREDITS--
H�vard Eide nucleuz at gmail.com
#Testfest php.no
--INI--
include_path=.
--FILE--
?php
$s = new SplFileObject( __FILE__ ); 
$s-setMaxLineLen( 7 );  
echo $s-getMaxLineLen();
?
--EXPECT--
7

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fileobject_getsize_basic.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/fileobject_getsize_basic.phpt
+++ php-src/ext/spl/tests/fileobject_getsize_basic.phpt
--TEST--
SPL: SplFileObject::getSize
--CREDITS--
H�vard Eide nucleuz at gmail.com
#Testfest php.no
--INI--
include_path=.
--FILE--
?php
$file = __DIR__ ./data.txt;
file_put_contents($file, foobar);

$s = new SplFileObject( $file );
echo $s-getSize();
?
--CLEAN--
$file = __DIR__ ./data.txt;
unlink($file);
--EXPECT--
6

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fileobject_setmaxlinelen_basic.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/fileobject_setmaxlinelen_basic.phpt
+++ php-src/ext/spl/tests/fileobject_setmaxlinelen_basic.phpt
--TEST--
SPL: SplFileObject::setMaxLineLen
--CREDITS--
H�vard Eide nucleuz at gmail.com
#Testfest php.no
--INI--
include_path=.
--FILE--
?php
$s = new SplFileObject( __FILE__ ); 
$s-setMaxLineLen( 3);  
echo $s-getCurrentLine();
?
--EXPECT--
?



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



[PHP-CVS] cvs: php-src /ext/spl/tests bug44615.phpt

2008-06-12 Thread Etienne Kneuss
colder  Thu Jun 12 20:51:25 2008 UTC

  Added files: 
/php-src/ext/spl/tests  bug44615.phpt 
  Log:
  Add tests from testfest
  

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug44615.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/bug44615.phpt
+++ php-src/ext/spl/tests/bug44615.phpt
--TEST--
SPL: RecursiveArrayIterator bug 44615
--CREDITS--
Julien Pauli [EMAIL PROTECTED]
#testfest phpcampparis 2008-06-07
--FILE--
?php
$a = new stdClass();

$array = array(array('z',$a),array('q','s'));

$rai = new 
RecursiveArrayIterator($array,RecursiveArrayIterator::CHILD_ARRAYS_ONLY);

foreach (new RecursiveIteratorIterator($rai) as $t) {
var_dump($t);
}
echo Second:\n;
$rai = new RecursiveArrayIterator($array);
foreach (new RecursiveIteratorIterator($rai) as $t) {
var_dump($t);
}
?
--EXPECTF--
string(1) z
object(stdClass)#1 (0) {
}
string(1) q
string(1) s
Second:
string(1) z
string(1) q
string(1) s



-- 
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/tests bug44615.phpt

2008-06-12 Thread Etienne Kneuss
colder  Thu Jun 12 20:52:34 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/spl/tests  bug44615.phpt 
  Log:
  Add tests from testfest
  

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug44615.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/bug44615.phpt
+++ php-src/ext/spl/tests/bug44615.phpt
--TEST--
SPL: RecursiveArrayIterator bug 44615
--CREDITS--
Julien Pauli [EMAIL PROTECTED]
#testfest phpcampparis 2008-06-07
--FILE--
?php
$a = new stdClass();

$array = array(array('z',$a),array('q','s'));

$rai = new 
RecursiveArrayIterator($array,RecursiveArrayIterator::CHILD_ARRAYS_ONLY);

foreach (new RecursiveIteratorIterator($rai) as $t) {
var_dump($t);
}
echo Second:\n;
$rai = new RecursiveArrayIterator($array);
foreach (new RecursiveIteratorIterator($rai) as $t) {
var_dump($t);
}
?
--EXPECTF--
string(1) z
object(stdClass)#1 (0) {
}
string(1) q
string(1) s
Second:
string(1) z
string(1) q
string(1) s



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



[PHP-CVS] cvs: php-src /ext/spl/tests iterator_056.phpt iterator_057.phpt iterator_058.phpt iterator_059.phpt iterator_060.phpt iterator_061.phpt iterator_062.phpt iterator_063.phpt iterator_064.phpt

2008-06-15 Thread Etienne Kneuss
colder  Sun Jun 15 11:45:48 2008 UTC

  Added files: 
/php-src/ext/spl/tests  iterator_056.phpt iterator_057.phpt 
iterator_058.phpt iterator_059.phpt 
iterator_060.phpt iterator_061.phpt 
iterator_062.phpt iterator_063.phpt 
iterator_064.phpt iterator_065.phpt 
iterator_066.phpt iterator_067.phpt 
  Log:
  Add tests for iterators when instanciated without argument (by Sebastian 
Schürmann)
  

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/iterator_056.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/iterator_056.phpt
+++ php-src/ext/spl/tests/iterator_056.phpt
--TEST--
SPL: FilterIterator::__construct(void)
--CREDITS--
Sebastian Schürmann
--FILE--
?php
class myFilterIterator extends FilterIterator {
function accept() {

}
}
try {
$it = new myFilterIterator();   
} catch (InvalidArgumentException $e) {
echo 'InvalidArgumentException thrown';
}
?
--EXPECT--
InvalidArgumentException thrown

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/iterator_057.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/iterator_057.phpt
+++ php-src/ext/spl/tests/iterator_057.phpt
--TEST--
SPL: ArrayIterator::__construct(void)
--CREDITS--
Sebastian Schürmann
--FILE--
?php
/**
 * From Docs: Construct a new array iterator from anything that has a hash 
table. 
 * NULL, NOTHING is not a hash table ;) 
 */
class myArrayIterator extends ArrayIterator {
}
try {
$it = new myArrayIterator();
} catch (InvalidArgumentException $e) {
echo 'InvalidArgumentException thrown';
}
echo 'no Exception thrown'
?
--EXPECT--
no Exception thrown

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/iterator_058.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/iterator_058.phpt
+++ php-src/ext/spl/tests/iterator_058.phpt
--TEST--
SPL: Iterator::__construct(void)
--CREDITS--
Sebastian Schürmann
--FILE--
?php
class myIterator implements Iterator {

function current() {}
function next() {}
function key() {}   
function valid() {}
function rewind() {}

}
try {
$it = new myIterator(); 
} catch (InvalidArgumentException $e) {
echo 'InvalidArgumentException thrown';
}
echo 'no Exception thrown';
?
--EXPECT--
no Exception thrown

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/iterator_059.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/iterator_059.phpt
+++ php-src/ext/spl/tests/iterator_059.phpt
--TEST--
SPL: CachingIterator::__construct(void)
--CREDITS--
Sebastian Schürmann
--FILE--
?php
class myCachingIterator extends CachingIterator {

}
try {
$it = new myCachingIterator();  
} catch (InvalidArgumentException $e) {
echo 'InvalidArgumentException thrown';
}
?
--EXPECT--
InvalidArgumentException thrown

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/iterator_060.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/iterator_060.phpt
+++ php-src/ext/spl/tests/iterator_060.phpt
--TEST--
SPL: RecursiveCachingIterator::__construct(void)
--CREDITS--
Sebastian Schürmann
--FILE--
?php
class myRecursiveCachingIterator extends RecursiveCachingIterator {

}
try {
$it = new myRecursiveCachingIterator(); 
} catch (InvalidArgumentException $e) {
echo 'InvalidArgumentException thrown';
}
?
--EXPECT--
InvalidArgumentException thrown

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/iterator_061.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/iterator_061.phpt
+++ php-src/ext/spl/tests/iterator_061.phpt
--TEST--
SPL: ParentIterator::__construct(void)
--CREDITS--
Sebastian Schürmann
--FILE--
?php
class myParentIterator extends ParentIterator {

}
try {
$it = new myParentIterator();   
} catch (InvalidArgumentException $e) {
echo 'InvalidArgumentException thrown';
}
?
--EXPECT--
InvalidArgumentException thrown

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/iterator_062.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/iterator_062.phpt
+++ php-src/ext/spl/tests/iterator_062.phpt
--TEST--
SPL: RecursiveIteratorIterator::__construct(void)
--CREDITS--
Sebastian Schürmann
--FILE--
?php
class myRecursiveIteratorIterator extends RecursiveIteratorIterator {

}

try {
$it = new myRecursiveIteratorIterator();
} catch (InvalidArgumentException $e) {
echo 'InvalidArgumentException thrown';
}
?
--EXPECT--
InvalidArgumentException thrown

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/iterator_063.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/iterator_063.phpt
+++ php-src/ext/spl/tests/iterator_063.phpt
--TEST--
SPL: LimitIterator::__construct(void)
--CREDITS--
Sebastian Schürmann
--FILE--
?php
class myLimitIterator extends LimitIterator {

}
try {
$it = new myLimitIterator();
} 

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl/tests iterator_056.phpt iterator_057.phpt iterator_058.phpt iterator_059.phpt iterator_060.phpt iterator_061.phpt iterator_062.phpt iterator_063.phpt iterator_

2008-06-15 Thread Etienne Kneuss
colder  Sun Jun 15 11:47:34 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/spl/tests  iterator_056.phpt iterator_057.phpt 
iterator_058.phpt iterator_059.phpt 
iterator_060.phpt iterator_061.phpt 
iterator_062.phpt iterator_063.phpt 
iterator_064.phpt iterator_065.phpt 
iterator_066.phpt iterator_067.phpt 
  Log:
  MFH: Add tests for iterators when instanciated without argument (by Sebastian 
Schürmann)
  

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/iterator_056.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/iterator_056.phpt
+++ php-src/ext/spl/tests/iterator_056.phpt
--TEST--
SPL: FilterIterator::__construct(void)
--CREDITS--
Sebastian Schürmann
--FILE--
?php
class myFilterIterator extends FilterIterator {
function accept() {

}
}
try {
$it = new myFilterIterator();   
} catch (InvalidArgumentException $e) {
echo 'InvalidArgumentException thrown';
}
?
--EXPECT--
InvalidArgumentException thrown

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/iterator_057.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/iterator_057.phpt
+++ php-src/ext/spl/tests/iterator_057.phpt
--TEST--
SPL: ArrayIterator::__construct(void)
--CREDITS--
Sebastian Schürmann
--FILE--
?php
/**
 * From Docs: Construct a new array iterator from anything that has a hash 
table. 
 * NULL, NOTHING is not a hash table ;) 
 */
class myArrayIterator extends ArrayIterator {
}
try {
$it = new myArrayIterator();
} catch (InvalidArgumentException $e) {
echo 'InvalidArgumentException thrown';
}
echo 'no Exception thrown'
?
--EXPECT--
no Exception thrown

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/iterator_058.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/iterator_058.phpt
+++ php-src/ext/spl/tests/iterator_058.phpt
--TEST--
SPL: Iterator::__construct(void)
--CREDITS--
Sebastian Schürmann
--FILE--
?php
class myIterator implements Iterator {

function current() {}
function next() {}
function key() {}   
function valid() {}
function rewind() {}

}
try {
$it = new myIterator(); 
} catch (InvalidArgumentException $e) {
echo 'InvalidArgumentException thrown';
}
echo 'no Exception thrown';
?
--EXPECT--
no Exception thrown

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/iterator_059.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/iterator_059.phpt
+++ php-src/ext/spl/tests/iterator_059.phpt
--TEST--
SPL: CachingIterator::__construct(void)
--CREDITS--
Sebastian Schürmann
--FILE--
?php
class myCachingIterator extends CachingIterator {

}
try {
$it = new myCachingIterator();  
} catch (InvalidArgumentException $e) {
echo 'InvalidArgumentException thrown';
}
?
--EXPECT--
InvalidArgumentException thrown

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/iterator_060.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/iterator_060.phpt
+++ php-src/ext/spl/tests/iterator_060.phpt
--TEST--
SPL: RecursiveCachingIterator::__construct(void)
--CREDITS--
Sebastian Schürmann
--FILE--
?php
class myRecursiveCachingIterator extends RecursiveCachingIterator {

}
try {
$it = new myRecursiveCachingIterator(); 
} catch (InvalidArgumentException $e) {
echo 'InvalidArgumentException thrown';
}
?
--EXPECT--
InvalidArgumentException thrown

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/iterator_061.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/iterator_061.phpt
+++ php-src/ext/spl/tests/iterator_061.phpt
--TEST--
SPL: ParentIterator::__construct(void)
--CREDITS--
Sebastian Schürmann
--FILE--
?php
class myParentIterator extends ParentIterator {

}
try {
$it = new myParentIterator();   
} catch (InvalidArgumentException $e) {
echo 'InvalidArgumentException thrown';
}
?
--EXPECT--
InvalidArgumentException thrown

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/iterator_062.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/iterator_062.phpt
+++ php-src/ext/spl/tests/iterator_062.phpt
--TEST--
SPL: RecursiveIteratorIterator::__construct(void)
--CREDITS--
Sebastian Schürmann
--FILE--
?php
class myRecursiveIteratorIterator extends RecursiveIteratorIterator {

}

try {
$it = new myRecursiveIteratorIterator();
} catch (InvalidArgumentException $e) {
echo 'InvalidArgumentException thrown';
}
?
--EXPECT--
InvalidArgumentException thrown

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/iterator_063.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/iterator_063.phpt
+++ php-src/ext/spl/tests/iterator_063.phpt
--TEST--
SPL: LimitIterator::__construct(void)
--CREDITS--
Sebastian Schürmann
--FILE--
?php
class myLimitIterator extends LimitIterator {

}
try {
$it = new 

[PHP-CVS] cvs: php-src /ext/spl spl_directory.c /ext/spl/tests bug45216.phpt

2008-06-18 Thread Etienne Kneuss
colder  Wed Jun 18 10:05:15 2008 UTC

  Added files: 
/php-src/ext/spl/tests  bug45216.phpt 

  Modified files:  
/php-src/ext/splspl_directory.c 
  Log:
  Fix #45216 (Add a default size for fgetss)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.155r2=1.156diff_format=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.155 
php-src/ext/spl/spl_directory.c:1.156
--- php-src/ext/spl/spl_directory.c:1.155   Tue May 20 21:46:13 2008
+++ php-src/ext/spl/spl_directory.c Wed Jun 18 10:05:14 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_directory.c,v 1.155 2008/05/20 21:46:13 colder Exp $ */
+/* $Id: spl_directory.c,v 1.156 2008/06/18 10:05:14 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -2427,7 +2427,12 @@
spl_filesystem_object *intern = 
(spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
zval *arg2 = NULL;
MAKE_STD_ZVAL(arg2);
-   ZVAL_LONG(arg2, intern-u.file.max_line_len);
+
+   if (intern-u.file.max_line_len  0) {
+   ZVAL_LONG(arg2, intern-u.file.max_line_len);
+   } else {
+   ZVAL_LONG(arg2, 1024);
+   }
 
spl_filesystem_file_free_line(intern TSRMLS_CC);
intern-u.file.current_line_num++;

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug45216.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/bug45216.phpt
+++ php-src/ext/spl/tests/bug45216.phpt
--TEST--
SPL: SplFileObject::fgetss (bug 45216)
--CREDITS--
Perrick Penet [EMAIL PROTECTED]
#testfest phpcampparis 2008-06-07
--FILE--
?php 
$file = dirname(__FILE__) . '/foo.html';
file_put_contents($file, 'text 0div class=testedtext 1/div');
$handle = fopen($file, 'r');

$object = new SplFileObject($file);
var_dump($object-fgetss());
var_dump(fgetss($handle));
?
--CLEAN--
?php
unlink(dirname(__FILE__) . '/foo.html');
?
--EXPECTF--
string(12) text 0text 1
string(12) text 0text 1



-- 
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_directory.c /ext/spl/tests bug45216.phpt

2008-06-18 Thread Etienne Kneuss
colder  Wed Jun 18 10:05:29 2008 UTC

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

  Modified files:  
/php-src/ext/splspl_directory.c 
  Log:
  MFH: Fix #45216 (Add a default size for fgetss)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.45.2.27.2.23.2.21r2=1.45.2.27.2.23.2.22diff_format=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.21 
php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.22
--- php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.21 Tue May 20 21:46:50 2008
+++ php-src/ext/spl/spl_directory.c Wed Jun 18 10:05:29 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_directory.c,v 1.45.2.27.2.23.2.21 2008/05/20 21:46:50 colder Exp $ 
*/
+/* $Id: spl_directory.c,v 1.45.2.27.2.23.2.22 2008/06/18 10:05:29 colder Exp $ 
*/
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -2295,7 +2295,12 @@
spl_filesystem_object *intern = 
(spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
zval *arg2 = NULL;
MAKE_STD_ZVAL(arg2);
-   ZVAL_LONG(arg2, intern-u.file.max_line_len);
+
+   if (intern-u.file.max_line_len  0) {
+   ZVAL_LONG(arg2, intern-u.file.max_line_len);
+   } else {
+   ZVAL_LONG(arg2, 1024);
+   }
 
spl_filesystem_file_free_line(intern TSRMLS_CC);
intern-u.file.current_line_num++;

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug45216.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/bug45216.phpt
+++ php-src/ext/spl/tests/bug45216.phpt
--TEST--
SPL: SplFileObject::fgetss (bug 45216)
--CREDITS--
Perrick Penet [EMAIL PROTECTED]
#testfest phpcampparis 2008-06-07
--FILE--
?php 
$file = dirname(__FILE__) . '/foo.html';
file_put_contents($file, 'text 0div class=testedtext 1/div');
$handle = fopen($file, 'r');

$object = new SplFileObject($file);
var_dump($object-fgetss());
var_dump(fgetss($handle));
?
--CLEAN--
?php
unlink(dirname(__FILE__) . '/foo.html');
?
--EXPECTF--
string(12) text 0text 1
string(12) text 0text 1



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



[PHP-CVS] cvs: php-src /ext/spl config.m4 config.w32 php_spl.c spl_fastarray.c spl_fastarray.h spl_fixedarray.c spl_fixedarray.h /ext/spl/tests fastarray_001.phpt fastarray_002.phpt fastarray_003.php

2008-06-18 Thread Etienne Kneuss
, ce_flags); \
SPL_ADD_CLASS(SplPriorityQueue, z_list, sub, allow, ce_flags); \
-   SPL_ADD_CLASS(SplFastArray, z_list, sub, allow, ce_flags); \
+   SPL_ADD_CLASS(SplFixedArray, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(BadFunctionCallException, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(BadMethodCallException, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(CachingIterator, z_list, sub, allow, ce_flags); \
@@ -802,7 +802,7 @@
PHP_MINIT(spl_sxe)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(spl_dllist)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(spl_heap)(INIT_FUNC_ARGS_PASSTHRU);
-   PHP_MINIT(spl_fastarray)(INIT_FUNC_ARGS_PASSTHRU);
+   PHP_MINIT(spl_fixedarray)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(spl_observer)(INIT_FUNC_ARGS_PASSTHRU);
 
return SUCCESS;

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_fixedarray.c?view=markuprev=1.1
Index: php-src/ext/spl/spl_fixedarray.c
+++ php-src/ext/spl/spl_fixedarray.c
/*
  +--+
  | PHP Version 5|
  +--+
  | 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|
  | available through the world-wide-web at the following url:   |
  | http://www.php.net/license/3_01.txt  |
  | If you did not receive a copy of the PHP license and are unable to   |
  | obtain it through the world-wide-web, please send a note to  |
  | [EMAIL PROTECTED] so we can mail you a copy immediately.   |
  +--+
  | Author: Antony Dovgal [EMAIL PROTECTED]  |
  | Etienne Kneuss [EMAIL PROTECTED]  |
  +--+
*/

/* $Id: spl_fixedarray.c,v 1.1 2008/06/18 14:54:27 colder Exp $ */

#ifdef HAVE_CONFIG_H
#include config.h
#endif

#include php.h
#include php_ini.h
#include ext/standard/info.h
#include zend_exceptions.h

#include php_spl.h
#include spl_functions.h
#include spl_engine.h
#include spl_fixedarray.h
#include spl_exceptions.h
#include spl_iterators.h

zend_object_handlers spl_handler_SplFixedArray;
PHPAPI zend_class_entry *spl_ce_SplFixedArray;

#ifdef COMPILE_DL_SPL_FIXEDARRAY
ZEND_GET_MODULE(spl_fixedarray)
#endif

typedef struct _spl_fixedarray { /* {{{ */
long size;
zval **elements;
} spl_fixedarray;
/* }}} */

typedef struct _spl_fixedarray_object { /* {{{ */
zend_objectstd;
spl_fixedarray *array;
zval  *retval;
zend_function *fptr_offset_get;
zend_function *fptr_offset_set;
zend_function *fptr_offset_has;
zend_function *fptr_offset_del;
zend_function *fptr_it_next;
zend_function *fptr_it_rewind;
zend_function *fptr_it_current;
zend_function *fptr_it_key;
zend_function *fptr_it_valid;
intcurrent;
zend_class_entry  *ce_get_iterator;
} spl_fixedarray_object;
/* }}} */

typedef struct _spl_fixedarray_it { /* {{{ */
zend_user_iterator intern;
spl_fixedarray_object  *object;
} spl_fixedarray_it;
/* }}} */

static void spl_fixedarray_init(spl_fixedarray *array, long size TSRMLS_DC) /* 
{{{ */
{
if (size  0) {
array-size = 0; /* reset size in case ecalloc() fails */
array-elements = ecalloc(size, sizeof(zval *));
array-size = size;
} else {
array-elements = NULL;
array-size = 0;
}
}
/* }}} */

static void spl_fixedarray_resize(spl_fixedarray *array, long size TSRMLS_DC) 
/* {{{ */
{
if (size == array-size) {
/* nothing to do */
return;
}

/* first initialization */
if (array-size == 0) {
spl_fixedarray_init(array, size TSRMLS_CC);
return;
}

/* clearing the array */
if (size == 0) {
long i;

for (i = 0; i  array-size; i++) {
if (array-elements[i]) {
zval_ptr_dtor((array-elements[i]));
}
}

if (array-elements) {
efree(array-elements);
array-elements = NULL;
}
} else if (size  array-size) {
array-elements = erealloc(array-elements

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl config.m4 config.w32 php_spl.c spl_fastarray.c spl_fastarray.h spl_fixedarray.c spl_fixedarray.h /ext/spl/tests fastarray_001.phpt fastarray_002.phpt fastarra

2008-06-18 Thread Etienne Kneuss
 spl_fixedarray.h
 #include spl_heap.h
 #include zend_exceptions.h
 #include zend_interfaces.h
@@ -163,7 +163,7 @@
SPL_ADD_CLASS(SplMinHeap, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(SplMaxHeap, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(SplPriorityQueue, z_list, sub, allow, ce_flags); \
-   SPL_ADD_CLASS(SplFastArray, z_list, sub, allow, ce_flags); \
+   SPL_ADD_CLASS(SplFixedArray, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(BadFunctionCallException, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(BadMethodCallException, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(CachingIterator, z_list, sub, allow, ce_flags); \
@@ -782,7 +782,7 @@
PHP_MINIT(spl_sxe)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(spl_dllist)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(spl_heap)(INIT_FUNC_ARGS_PASSTHRU);
-   PHP_MINIT(spl_fastarray)(INIT_FUNC_ARGS_PASSTHRU);
+   PHP_MINIT(spl_fixedarray)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(spl_observer)(INIT_FUNC_ARGS_PASSTHRU);
 
return SUCCESS;

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_fixedarray.c?view=markuprev=1.1
Index: php-src/ext/spl/spl_fixedarray.c
+++ php-src/ext/spl/spl_fixedarray.c
/*
  +--+
  | PHP Version 5|
  +--+
  | 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|
  | available through the world-wide-web at the following url:   |
  | http://www.php.net/license/3_01.txt  |
  | If you did not receive a copy of the PHP license and are unable to   |
  | obtain it through the world-wide-web, please send a note to  |
  | [EMAIL PROTECTED] so we can mail you a copy immediately.   |
  +--+
  | Author: Antony Dovgal [EMAIL PROTECTED]  |
  | Etienne Kneuss [EMAIL PROTECTED]  |
  +--+
*/

/* $Id: spl_fixedarray.c,v 1.1 2008/06/18 14:54:27 colder Exp $ */

#ifdef HAVE_CONFIG_H
#include config.h
#endif

#include php.h
#include php_ini.h
#include ext/standard/info.h
#include zend_exceptions.h

#include php_spl.h
#include spl_functions.h
#include spl_engine.h
#include spl_fixedarray.h
#include spl_exceptions.h
#include spl_iterators.h

zend_object_handlers spl_handler_SplFixedArray;
PHPAPI zend_class_entry *spl_ce_SplFixedArray;

#ifdef COMPILE_DL_SPL_FIXEDARRAY
ZEND_GET_MODULE(spl_fixedarray)
#endif

typedef struct _spl_fixedarray { /* {{{ */
long size;
zval **elements;
} spl_fixedarray;
/* }}} */

typedef struct _spl_fixedarray_object { /* {{{ */
zend_objectstd;
spl_fixedarray *array;
zval  *retval;
zend_function *fptr_offset_get;
zend_function *fptr_offset_set;
zend_function *fptr_offset_has;
zend_function *fptr_offset_del;
zend_function *fptr_it_next;
zend_function *fptr_it_rewind;
zend_function *fptr_it_current;
zend_function *fptr_it_key;
zend_function *fptr_it_valid;
intcurrent;
zend_class_entry  *ce_get_iterator;
} spl_fixedarray_object;
/* }}} */

typedef struct _spl_fixedarray_it { /* {{{ */
zend_user_iterator intern;
spl_fixedarray_object  *object;
} spl_fixedarray_it;
/* }}} */

static void spl_fixedarray_init(spl_fixedarray *array, long size TSRMLS_DC) /* 
{{{ */
{
if (size  0) {
array-size = 0; /* reset size in case ecalloc() fails */
array-elements = ecalloc(size, sizeof(zval *));
array-size = size;
} else {
array-elements = NULL;
array-size = 0;
}
}
/* }}} */

static void spl_fixedarray_resize(spl_fixedarray *array, long size TSRMLS_DC) 
/* {{{ */
{
if (size == array-size) {
/* nothing to do */
return;
}

/* first initialization */
if (array-size == 0) {
spl_fixedarray_init(array, size TSRMLS_CC);
return;
}

/* clearing the array */
if (size == 0) {
long i;

for (i = 0; i  array-size; i++) {
if (array-elements[i]) {
zval_ptr_dtor((array-elements[i

[PHP-CVS] cvs: php-src /ext/spl/tests fixedarray_010.phpt fixedarray_017.phpt

2008-06-22 Thread Etienne Kneuss
colder  Sun Jun 22 16:23:33 2008 UTC

  Added files: 
/php-src/ext/spl/tests  fixedarray_017.phpt 

  Modified files:  
/php-src/ext/spl/tests  fixedarray_010.phpt 
  Log:
  Add some tests to increase code coverage
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fixedarray_010.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/spl/tests/fixedarray_010.phpt
diff -u php-src/ext/spl/tests/fixedarray_010.phpt:1.1 
php-src/ext/spl/tests/fixedarray_010.phpt:1.2
--- php-src/ext/spl/tests/fixedarray_010.phpt:1.1   Wed Jun 18 14:54:28 2008
+++ php-src/ext/spl/tests/fixedarray_010.phpt   Sun Jun 22 16:23:33 2008
@@ -1,12 +1,15 @@
 --TEST--
-SPL: FixedArray: Setting size to 0
+SPL: FixedArray: Setting size
 --FILE--
 ?php
 
-$a = new SplFixedArray(1);
+$a = new SplFixedArray(0);
+$a = new SplFixedArray(3);
 
 $a[0] = 1;
 
+$a-setSize(2);
+$a-setSize(3);
 $a-setSize(0);
 
 print ok\n;

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fixedarray_017.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/fixedarray_017.phpt
+++ php-src/ext/spl/tests/fixedarray_017.phpt
--TEST--
SPL: FixedArray: var_dump
--FILE--
?php
$a = new SplFixedArray(2);
$a[0] = foo;
var_dump(empty($a[0]), empty($a[1]), $a);
?
--EXPECTF--
bool(false)
bool(true)
object(SplFixedArray)#1 (1) {
  [uarray:uSplFixedArray:private]=
  array(2) {
[0]=
unicode(3) foo
[1]=
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/tests fixedarray_010.phpt fixedarray_017.phpt

2008-06-22 Thread Etienne Kneuss
colder  Sun Jun 22 16:25:02 2008 UTC

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

  Modified files:  
/php-src/ext/spl/tests  fixedarray_010.phpt 
  Log:
  MFH: Add some tests to increase code coverage
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fixedarray_010.phpt?r1=1.1.2.2r2=1.1.2.3diff_format=u
Index: php-src/ext/spl/tests/fixedarray_010.phpt
diff -u php-src/ext/spl/tests/fixedarray_010.phpt:1.1.2.2 
php-src/ext/spl/tests/fixedarray_010.phpt:1.1.2.3
--- php-src/ext/spl/tests/fixedarray_010.phpt:1.1.2.2   Wed Jun 18 14:54:39 2008
+++ php-src/ext/spl/tests/fixedarray_010.phpt   Sun Jun 22 16:25:02 2008
@@ -1,12 +1,15 @@
 --TEST--
-SPL: FixedArray: Setting size to 0
+SPL: FixedArray: Setting size
 --FILE--
 ?php
 
-$a = new SplFixedArray(1);
+$a = new SplFixedArray(0);
+$a = new SplFixedArray(3);
 
 $a[0] = 1;
 
+$a-setSize(2);
+$a-setSize(3);
 $a-setSize(0);
 
 print ok\n;

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fixedarray_017.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/fixedarray_017.phpt
+++ php-src/ext/spl/tests/fixedarray_017.phpt
--TEST--
SPL: FixedArray: var_dump
--FILE--
?php
$a = new SplFixedArray(2);
$a[0] = foo;
var_dump(empty($a[0]), empty($a[1]), $a);
?
--EXPECTF--
bool(false)
bool(true)
object(SplFixedArray)#1 (1) {
  [uarray:uSplFixedArray:private]=
  array(2) {
[0]=
unicode(3) foo
[1]=
NULL
  }
}



-- 
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 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:38 2008 UTC

  Added files: 
/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:
  First part of count/handlers related fixes
  http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.139r2=1.140diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.139 php-src/ext/spl/spl_array.c:1.140
--- php-src/ext/spl/spl_array.c:1.139   Tue May 20 12:04:37 2008
+++ php-src/ext/spl/spl_array.c Sun Jul  6 23:45:38 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.139 2008/05/20 12:04:37 tony2001 Exp $ */
+/* $Id: spl_array.c,v 1.140 2008/07/06 23:45:38 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -66,10 +66,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;
 
@@ -202,6 +203,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 */
@@ -1164,9 +1169,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;
 
@@ -1193,14 +1197,36 @@
}
 } /* }}} */
 
+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() U
proto int ArrayIterator::count() U
  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(getThis(), count TSRMLS_CC);
+   spl_array_object_count_elements_helper(intern, count TSRMLS_CC);
RETURN_LONG(count);
 } /* }}} */
 
@@ -1220,9 +1246,11 @@
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);
+   zval_ptr_dtor(return_value_ptr);
+   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);
+   zval_ptr_dtor(return_value_ptr);
+   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 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 /ext/spl/tests fixedarray_016.phpt

2008-07-06 Thread Etienne Kneuss
colder  Sun Jul  6 23:52:44 2008 UTC

  Added files: 
/php-src/ext/spl/tests  fixedarray_016.phpt 
  Log:
  Add missing test
  

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fixedarray_016.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/fixedarray_016.phpt
+++ php-src/ext/spl/tests/fixedarray_016.phpt
--TEST--
SPL: FixedArray: var_dump
--FILE--
?php
$a = new SplFixedArray(2);
$a[0] = foo;
var_dump(empty($a[0]), empty($a[1]), $a);
?
--EXPECTF--
bool(false)
bool(true)
object(SplFixedArray)#1 (1) {
  [uarray:uSplFixedArray:private]=
  array(2) {
[0]=
unicode(3) foo
[1]=
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/tests fixedarray_016.phpt

2008-07-06 Thread Etienne Kneuss
colder  Sun Jul  6 23:54:36 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/spl/tests  fixedarray_016.phpt 
  Log:
  MFH: Add missing test
  

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fixedarray_016.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/fixedarray_016.phpt
+++ php-src/ext/spl/tests/fixedarray_016.phpt
--TEST--
SPL: FixedArray: var_dump
--FILE--
?php
$a = new SplFixedArray(2);
$a[0] = foo;
var_dump(empty($a[0]), empty($a[1]), $a);
?
--EXPECTF--
bool(false)
bool(true)
object(SplFixedArray)#1 (1) {
  [uarray:uSplFixedArray:private]=
  array(2) {
[0]=
unicode(3) foo
[1]=
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_2) /ext/spl spl_array.c

2008-07-06 Thread Etienne Kneuss
colder  Mon Jul  7 00:02:22 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/splspl_array.c 
  Log:
  Avoid a leak on return_value
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.15r2=1.71.2.17.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.15 
php-src/ext/spl/spl_array.c:1.71.2.17.2.16
--- php-src/ext/spl/spl_array.c:1.71.2.17.2.15  Mon Dec 31 07:20:11 2007
+++ php-src/ext/spl/spl_array.c Mon Jul  7 00:02:22 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.71.2.17.2.15 2007/12/31 07:20:11 sebastian Exp $ */
+/* $Id: spl_array.c,v 1.71.2.17.2.16 2008/07/07 00:02:22 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -1190,9 +1190,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 Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/spl spl_directory.c /ext/spl/tests dit_001.phpt fileobject_003.phpt fileobject_004.phpt fileobject_getfileinfo_basic.phpt

2008-07-08 Thread Etienne Kneuss
colder  Tue Jul  8 22:40:30 2008 UTC

  Modified files:  
/php-src/ext/splspl_directory.c 
/php-src/ext/spl/tests  dit_001.phpt fileobject_003.phpt 
fileobject_004.phpt 
fileobject_getfileinfo_basic.phpt 
  Log:
  - Fix filename in debug_info
  - Fix #45345 (getPathInfo on the file instead of the dir)
  - Remove trailing / on input
  http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.157r2=1.158diff_format=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.157 
php-src/ext/spl/spl_directory.c:1.158
--- php-src/ext/spl/spl_directory.c:1.157   Wed Jul  2 10:46:52 2008
+++ php-src/ext/spl/spl_directory.c Tue Jul  8 22:40:29 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_directory.c,v 1.157 2008/07/02 10:46:52 tony2001 Exp $ */
+/* $Id: spl_directory.c,v 1.158 2008/07/08 22:40:29 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -374,29 +374,47 @@
intern-file_name = use_copy ? ezstrndup(type, path, len) : path;
intern-file_name_len = len;
 
-   if (type == IS_UNICODE) {
-   p1.u = u_strrchr(path.u, '/');
-   } else {
-   p1.s = strrchr(path.s, '/');
-   }
+   while (1) {
+   if (type == IS_UNICODE) {
+   p1.u = u_strrchr(intern-file_name.u, '/');
+   } else {
+   p1.s = strrchr(intern-file_name.s, '/');
+   }
 #if defined(PHP_WIN32) || defined(NETWARE)
-   if (type == IS_UNICODE) {
-   p2.u = u_strrchr(path.u, '\\');
-   } else {
-   p2.s = strrchr(path.s, '\\');
-   }
+   if (type == IS_UNICODE) {
+   p2.u = u_strrchr(intern-file_name.u, '\\');
+   } else {
+   p2.s = strrchr(intern-file_name.s, '\\');
+   }
 #else
-   p2.v = 0;
+   p2.v = 0;
 #endif
-   if (p1.v || p2.v) {
-   if (type == IS_UNICODE) {
-   intern-_path_len = (p1.u  p2.u ? p1.u : p2.u) - 
path.u;
+   if (p1.v || p2.v) {
+   zstr slash_pos;
+   
+   if (type == IS_UNICODE) {
+   slash_pos.u = (p1.u  p2.u ? p1.u : p2.u);
+   if (IS_SLASH_AT(type, intern-file_name, 
intern-file_name_len)) {
+   intern-file_name_len = slash_pos.u - 
intern-file_name.u;
+   
intern-file_name.u[intern-file_name_len] = 0;
+   continue;
+   }
+   intern-_path_len = slash_pos.u - 
intern-file_name.u;
+   } else {
+   slash_pos.s = (p1.s  p2.s ? p1.s : p2.s);
+   if (IS_SLASH_AT(type, intern-file_name, 
intern-file_name_len)) {
+   intern-file_name_len = slash_pos.s - 
intern-file_name.s;
+   
intern-file_name.s[intern-file_name_len] = 0;
+   continue;
+   }
+   intern-_path_len = slash_pos.s - 
intern-file_name.s;
+   }
} else {
-   intern-_path_len = (p1.s  p2.s ? p1.s : p2.s) - 
path.s;
+   intern-_path_len = 0;
}
-   } else {
-   intern-_path_len = 0;
+   break;
}
+
intern-_path_type = type;
intern-_path = ezstrndup(type, path, intern-_path_len);
 } /* }}} */
@@ -542,6 +560,27 @@
 }
 /* }}} */
 
+static zstr spl_filesystem_object_get_pathname(spl_filesystem_object *intern, 
int *len, zend_uchar *type  TSRMLS_DC) { /* {{{ */
+   switch (intern-type) {
+   case SPL_FS_INFO:
+   case SPL_FS_FILE:
+   *len = intern-file_name_len;
+   *type = intern-file_name_type;
+   return intern-file_name;
+   case SPL_FS_DIR:
+   if (intern-u.dir.entry.d_name[0]) {
+   spl_filesystem_object_get_file_name(intern TSRMLS_CC);
+   *len = intern-file_name_len;
+   *type = intern-file_name_type;
+   return intern-file_name;
+   }
+   }
+   *len  = 0;
+   *type = IS_STRING;
+   return intern-file_name; /* dummy */
+}
+/* }}} */
+
 static HashTable* spl_filesystem_object_get_debug_info(zval *obj, int *is_temp 
TSRMLS_DC) /*  */
 {
spl_filesystem_object *intern = 
(spl_filesystem_object*)zend_object_store_get_object(obj TSRMLS_CC);
@@ -564,13 +603,23 @@
 
zend_hash_copy(rv, intern-std.properties, 

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl spl_directory.c /ext/spl/tests dit_001.phpt fileobject_003.phpt fileobject_getfileinfo_basic.phpt

2008-07-08 Thread Etienne Kneuss
colder  Tue Jul  8 22:40:49 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/splspl_directory.c 
/php-src/ext/spl/tests  dit_001.phpt fileobject_003.phpt 
fileobject_getfileinfo_basic.phpt 
  Log:
  MFH: - Fix filename in debug_info
  - Fix #45345 (getPathInfo on the file instead of the dir)
  - Remove trailing / on input
  http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.45.2.27.2.23.2.23r2=1.45.2.27.2.23.2.24diff_format=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.23 
php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.24
--- php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.23 Wed Jul  2 10:47:11 2008
+++ php-src/ext/spl/spl_directory.c Tue Jul  8 22:40:48 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_directory.c,v 1.45.2.27.2.23.2.23 2008/07/02 10:47:11 tony2001 Exp 
$ */
+/* $Id: spl_directory.c,v 1.45.2.27.2.23.2.24 2008/07/08 22:40:48 colder Exp $ 
*/
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -347,17 +347,23 @@
intern-file_name = use_copy ? estrndup(path, len) : path;
intern-file_name_len = len;
 
-   p1 = strrchr(path, '/');
+   while(IS_SLASH_AT(intern-file_name, intern-file_name_len-1)) {
+   intern-file_name[intern-file_name_len-1] = 0;
+   intern-file_name_len--;
+   }
+
+   p1 = strrchr(intern-file_name, '/');
 #if defined(PHP_WIN32) || defined(NETWARE)
-   p2 = strrchr(path, '\\');
+   p2 = strrchr(intern-file_name, '\\');
 #else
p2 = 0;
 #endif
if (p1 || p2) {
-   intern-_path_len = (p1  p2 ? p1 : p2) - path;
+   intern-_path_len = (p1  p2 ? p1 : p2) - intern-file_name;
} else {
intern-_path_len = 0;
}
+
intern-_path = estrndup(path, intern-_path_len);
 } /* }}} */
 
@@ -499,7 +505,25 @@
 }
 /* }}} */
 
-static HashTable* spl_filesystem_object_get_debug_info(zval *obj, int *is_temp 
TSRMLS_DC) /*  */
+static char *spl_filesystem_object_get_pathname(spl_filesystem_object *intern, 
int *len TSRMLS_DC) { /* {{{ */
+   switch (intern-type) {
+   case SPL_FS_INFO:
+   case SPL_FS_FILE:
+   *len = intern-file_name_len;
+   return intern-file_name;
+   case SPL_FS_DIR:
+   if (intern-u.dir.entry.d_name[0]) {
+   spl_filesystem_object_get_file_name(intern TSRMLS_CC);
+   *len = intern-file_name_len;
+   return intern-file_name;
+   }
+   }
+   *len = 0;
+   return NULL;
+}
+/* }}} */
+
+static HashTable* spl_filesystem_object_get_debug_info(zval *obj, int *is_temp 
TSRMLS_DC) /* {{{ */
 {
spl_filesystem_object *intern = 
(spl_filesystem_object*)zend_object_store_get_object(obj TSRMLS_CC);
HashTable *rv;
@@ -518,13 +542,20 @@
 
zend_hash_copy(rv, intern-std.properties, (copy_ctor_func_t) 
zval_add_ref, (void *) tmp, sizeof(zval *));
 
-   path = spl_filesystem_object_get_path(intern, path_len TSRMLS_CC);
pnstr = spl_gen_private_prop_name(spl_ce_SplFileInfo, pathName, 
sizeof(pathName)-1, pnlen TSRMLS_CC);
+   path = spl_filesystem_object_get_pathname(intern, path_len TSRMLS_CC);
add_assoc_stringl_ex(zrv, pnstr, pnlen+1, path, path_len, 1);
efree(pnstr);
+
if (intern-file_name) {
pnstr = spl_gen_private_prop_name(spl_ce_SplFileInfo, 
fileName, sizeof(fileName)-1, pnlen TSRMLS_CC);
-   add_assoc_stringl_ex(zrv, pnstr, pnlen+1, intern-file_name, 
intern-file_name_len, 1);
+   spl_filesystem_object_get_path(intern, path_len TSRMLS_CC);
+   
+   if (path_len  path_len  intern-file_name_len) {
+   add_assoc_stringl_ex(zrv, pnstr, pnlen+1, 
intern-file_name + path_len + 1, intern-file_name_len - (path_len + 1), 1);
+   } else {
+   add_assoc_stringl_ex(zrv, pnstr, pnlen+1, 
intern-file_name, intern-file_name_len, 1);
+   }
efree(pnstr);
}
if (intern-type == SPL_FS_DIR) {
@@ -560,7 +591,7 @@
 
return rv;
 }
-/*  */
+/* }}} */
 
 #define DIT_CTOR_FLAGS  0x0001
 #define DIT_CTOR_GLOB   0x0002
@@ -775,18 +806,14 @@
 SPL_METHOD(SplFileInfo, getPathname)
 {
spl_filesystem_object *intern = 
(spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
-   switch (intern-type) {
-   case SPL_FS_INFO:
-   case SPL_FS_FILE:
-   RETURN_STRINGL(intern-file_name, intern-file_name_len, 1);
-   case SPL_FS_DIR:
-   if (intern-u.dir.entry.d_name[0]) {
-   spl_filesystem_object_get_file_name(intern TSRMLS_CC);
-   RETURN_STRINGL(intern-file_name, 
intern-file_name_len, 1);
-  

[PHP-CVS] cvs: php-src /ext/spl spl_directory.c /ext/spl/tests fileobject_003.phpt

2008-07-08 Thread Etienne Kneuss
colder  Tue Jul  8 22:49:35 2008 UTC

  Modified files:  
/php-src/ext/splspl_directory.c 
/php-src/ext/spl/tests  fileobject_003.phpt 
  Log:
  Woopsy
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.158r2=1.159diff_format=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.158 
php-src/ext/spl/spl_directory.c:1.159
--- php-src/ext/spl/spl_directory.c:1.158   Tue Jul  8 22:40:29 2008
+++ php-src/ext/spl/spl_directory.c Tue Jul  8 22:49:35 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_directory.c,v 1.158 2008/07/08 22:40:29 colder Exp $ */
+/* $Id: spl_directory.c,v 1.159 2008/07/08 22:49:35 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -394,7 +394,7 @@

if (type == IS_UNICODE) {
slash_pos.u = (p1.u  p2.u ? p1.u : p2.u);
-   if (IS_SLASH_AT(type, intern-file_name, 
intern-file_name_len)) {
+   if (IS_SLASH_AT(type, intern-file_name, 
intern-file_name_len-1)) {
intern-file_name_len = slash_pos.u - 
intern-file_name.u;

intern-file_name.u[intern-file_name_len] = 0;
continue;
@@ -402,7 +402,7 @@
intern-_path_len = slash_pos.u - 
intern-file_name.u;
} else {
slash_pos.s = (p1.s  p2.s ? p1.s : p2.s);
-   if (IS_SLASH_AT(type, intern-file_name, 
intern-file_name_len)) {
+   if (IS_SLASH_AT(type, intern-file_name, 
intern-file_name_len-1)) {
intern-file_name_len = slash_pos.s - 
intern-file_name.s;

intern-file_name.s[intern-file_name_len] = 0;
continue;
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fileobject_003.phpt?r1=1.9r2=1.10diff_format=u
Index: php-src/ext/spl/tests/fileobject_003.phpt
diff -u php-src/ext/spl/tests/fileobject_003.phpt:1.9 
php-src/ext/spl/tests/fileobject_003.phpt:1.10
--- php-src/ext/spl/tests/fileobject_003.phpt:1.9   Tue Jul  8 22:40:30 2008
+++ php-src/ext/spl/tests/fileobject_003.phpt   Tue Jul  8 22:49:35 2008
@@ -71,15 +71,15 @@
 ===1===
 object(SplFileInfo)#%d (2) {
   [upathName:uSplFileInfo:private]=
-  unicode(%d) %s
+  unicode(%d) %s%etests
   [ufileName:uSplFileInfo:private]=
-  unicode(%d) 
+  unicode(%d) tests
 }
 object(SplFileInfo)#%d (2) {
   [upathName:uSplFileInfo:private]=
   unicode(%d) %s
   [ufileName:uSplFileInfo:private]=
-  unicode(%d) 
+  unicode(%d) tests
 }
 bool(false)
 bool(true)
@@ -92,8 +92,8 @@
 string(%d) %sspl
 bool(true)
 unicode(%d) %stests
-unicode(%d) %stests
-unicode(%d) %stests
+unicode(%d) tests
+unicode(%d) %s%espl
 ===2===
 object(SplFileInfo)#%d (2) {
   [upathName:uSplFileInfo:private]=
@@ -103,7 +103,7 @@
 }
 object(SplFileInfo)#%d (2) {
   [upathName:uSplFileInfo:private]=
-  unicode(%d) %s
+  unicode(%d) %s%etests
   [ufileName:uSplFileInfo:private]=
   unicode(%d) %s
 }



-- 
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) / NEWS

2008-07-09 Thread Etienne Kneuss
colder  Wed Jul  9 10:07:46 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-srcNEWS 
  Log:
  add SplFileInfo::getPathInfo fix to NEWS
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.197r2=1.2027.2.547.2.965.2.198diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.197 
php-src/NEWS:1.2027.2.547.2.965.2.198
--- php-src/NEWS:1.2027.2.547.2.965.2.197   Tue Jul  8 17:41:51 2008
+++ php-src/NEWSWed Jul  9 10:07:46 2008
@@ -199,6 +199,8 @@
 
 - Fixed PECL bug #12431 (OCI8 ping functionality is broken). (Oracle Corp.)
 
+- Fixed bug #45345 (SPLFileInfo::getPathInfo() returning dir info instead of
+  file info). (Etienne)
 - Fixed bug #45038 (Crash when using DateTimeZone object returned by
   Date::getTimezone). (Joe Orton, Derick)
 - Fixed bug #44769 (declaring private magic methods should throw error). 
(Felipe)



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



[PHP-CVS] cvs: php-src /ext/spl/tests fixedarray_019.phpt

2008-07-09 Thread Etienne Kneuss
colder  Wed Jul  9 20:34:37 2008 UTC

  Added files: 
/php-src/ext/spl/tests  fixedarray_019.phpt 
  Log:
  Test extended iterators methods
  

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fixedarray_019.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/fixedarray_019.phpt
+++ php-src/ext/spl/tests/fixedarray_019.phpt
--TEST--
SPL: SplFixedArray with overriden iterator methods
--FILE--
?php
class SplFixedArray2 extends SplFixedArray {
public function rewind() {
echo rewind\n;
return parent::rewind();
}
public function valid() {
echo valid\n;
return parent::valid();
}
public function next() {
echo next\n;
return parent::next();
}
public function current() {
echo current\n;
return parent::current();
}
public function key() {
echo key\n;
return parent::key();
}
}

$fa = new SplFixedArray2(3);
foreach($fa as $k=$v) {
echo $k=;
var_dump($v);
}
?
--EXPECT--
rewind
valid
current
key
0=NULL
next
valid
current
key
1=NULL
next
valid
current
key
2=NULL
next
valid



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



  1   2   3   >