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

2008-11-29 Thread Hannes Magnusson
bjori   Sun Nov 30 00:12:45 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/splphp_spl.c 
  Log:
  MFH: Fix proto
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.52.2.28.2.18r2=1.52.2.28.2.19diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.52.2.28.2.18 
php-src/ext/spl/php_spl.c:1.52.2.28.2.19
--- php-src/ext/spl/php_spl.c:1.52.2.28.2.18Mon Dec 31 07:20:11 2007
+++ php-src/ext/spl/php_spl.c   Sun Nov 30 00:12:45 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.52.2.28.2.18 2007/12/31 07:20:11 sebastian Exp $ */
+/* $Id: php_spl.c,v 1.52.2.28.2.19 2008/11/30 00:12:45 bjori Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -89,7 +89,7 @@
return *ce;
 }
 
-/* {{{ proto array class_parents(object instance)
+/* {{{ proto array class_parents(object instance [, boolean autoload = true])
  Return an array containing the names of all parent classes */
 PHP_FUNCTION(class_parents)
 {



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

2007-05-19 Thread Ilia Alshanetsky
iliaa   Sat May 19 18:32:35 2007 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/splphp_spl.c 
  Log:
  Eliminate memory allocation in RINIT for spl
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.52.2.28.2.15r2=1.52.2.28.2.16diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.52.2.28.2.15 
php-src/ext/spl/php_spl.c:1.52.2.28.2.16
--- php-src/ext/spl/php_spl.c:1.52.2.28.2.15Fri Apr  6 16:00:08 2007
+++ php-src/ext/spl/php_spl.c   Sat May 19 18:32:35 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.52.2.28.2.15 2007/04/06 16:00:08 helly Exp $ */
+/* $Id: php_spl.c,v 1.52.2.28.2.16 2007/05/19 18:32:35 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -45,6 +45,8 @@
 
 ZEND_DECLARE_MODULE_GLOBALS(spl)
 
+#define SPL_DEFAULT_FILE_EXTRNSIONS .inc,.php
+
 /* {{{ spl_functions_none
  */
 zend_function_entry spl_functions_none[] = {
@@ -271,7 +273,11 @@
RETURN_FALSE;
}
 
-   copy = pos1 = estrndup(file_exts, file_exts_len);
+   if (file_exts == NULL) { /* autoload_extensions is not intialzed, set 
to defaults */
+   copy = pos1 = estrndup(SPL_DEFAULT_FILE_EXTRNSIONS, 
sizeof(SPL_DEFAULT_FILE_EXTRNSIONS)-1);
+   } else {
+   copy = pos1 = estrndup(file_exts, file_exts_len);
+   }
lc_name = zend_str_tolower_dup(class_name, class_name_len);
while(pos1  *pos1  !EG(exception)) {
EG(return_value_ptr_ptr) = original_return_value;
@@ -328,7 +334,11 @@
SPL_G(autoload_extensions_len) = file_exts_len;
}
 
-   RETURN_STRINGL(SPL_G(autoload_extensions), 
SPL_G(autoload_extensions_len), 1);
+   if (SPL_G(autoload_extensions) == NULL) {
+   RETURN_STRINGL(SPL_DEFAULT_FILE_EXTRNSIONS, 
sizeof(SPL_DEFAULT_FILE_EXTRNSIONS) - 1, 1);
+   } else {
+   RETURN_STRINGL(SPL_G(autoload_extensions), 
SPL_G(autoload_extensions_len), 1);
+   }
 } /* }}} */
 
 typedef struct {
@@ -717,8 +727,8 @@
 
 PHP_RINIT_FUNCTION(spl) /* {{{ */
 {
-   SPL_G(autoload_extensions) = estrndup(.inc,.php, 
sizeof(.inc,.php)-1);
-   SPL_G(autoload_extensions_len) = sizeof(.inc,.php)-1;
+   SPL_G(autoload_extensions) = NULL;
+   SPL_G(autoload_extensions_len) = 0;
SPL_G(autoload_functions) = NULL;
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_2) /ext/spl php_spl.c

2007-05-19 Thread Ilia Alshanetsky
iliaa   Sat May 19 18:40:27 2007 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/splphp_spl.c 
  Log:
  
  Fixed typo in constant name
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.52.2.28.2.16r2=1.52.2.28.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.16 
php-src/ext/spl/php_spl.c:1.52.2.28.2.17
--- php-src/ext/spl/php_spl.c:1.52.2.28.2.16Sat May 19 18:32:35 2007
+++ php-src/ext/spl/php_spl.c   Sat May 19 18:40:27 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.52.2.28.2.16 2007/05/19 18:32:35 iliaa Exp $ */
+/* $Id: php_spl.c,v 1.52.2.28.2.17 2007/05/19 18:40:27 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -45,7 +45,7 @@
 
 ZEND_DECLARE_MODULE_GLOBALS(spl)
 
-#define SPL_DEFAULT_FILE_EXTRNSIONS .inc,.php
+#define SPL_DEFAULT_FILE_EXTENSIONS .inc,.php
 
 /* {{{ spl_functions_none
  */
@@ -274,7 +274,7 @@
}
 
if (file_exts == NULL) { /* autoload_extensions is not intialzed, set 
to defaults */
-   copy = pos1 = estrndup(SPL_DEFAULT_FILE_EXTRNSIONS, 
sizeof(SPL_DEFAULT_FILE_EXTRNSIONS)-1);
+   copy = pos1 = estrndup(SPL_DEFAULT_FILE_EXTENSIONS, 
sizeof(SPL_DEFAULT_FILE_EXTENSIONS)-1);
} else {
copy = pos1 = estrndup(file_exts, file_exts_len);
}
@@ -335,7 +335,7 @@
}
 
if (SPL_G(autoload_extensions) == NULL) {
-   RETURN_STRINGL(SPL_DEFAULT_FILE_EXTRNSIONS, 
sizeof(SPL_DEFAULT_FILE_EXTRNSIONS) - 1, 1);
+   RETURN_STRINGL(SPL_DEFAULT_FILE_EXTENSIONS, 
sizeof(SPL_DEFAULT_FILE_EXTENSIONS) - 1, 1);
} else {
RETURN_STRINGL(SPL_G(autoload_extensions), 
SPL_G(autoload_extensions_len), 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_2) /ext/spl php_spl.c /main main.c php_main.h

2007-01-07 Thread Ilia Alshanetsky
iliaa   Mon Jan  8 03:39:09 2007 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/main   main.c php_main.h 
/php-src/ext/splphp_spl.c 
  Log:
  
  Provide means for opening file for zend with error supression. Allows us to
  avoid INI hackery such as the one used in SPL.
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/main.c?r1=1.640.2.23.2.28r2=1.640.2.23.2.29diff_format=u
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.640.2.23.2.28 php-src/main/main.c:1.640.2.23.2.29
--- php-src/main/main.c:1.640.2.23.2.28 Mon Jan  1 09:36:11 2007
+++ php-src/main/main.c Mon Jan  8 03:39:09 2007
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: main.c,v 1.640.2.23.2.28 2007/01/01 09:36:11 sebastian Exp $ */
+/* $Id: main.c,v 1.640.2.23.2.29 2007/01/08 03:39:09 iliaa Exp $ */
 
 /* {{{ includes
  */
@@ -904,9 +904,14 @@
 
 static int php_stream_open_for_zend(const char *filename, zend_file_handle 
*handle TSRMLS_DC)
 {
+   return php_stream_open_for_zend_ex(filename, handle, 
ENFORCE_SAFE_MODE|USE_PATH|REPORT_ERRORS|STREAM_OPEN_FOR_INCLUDE TSRMLS_CC);
+}
+
+PHPAPI int php_stream_open_for_zend_ex(const char *filename, zend_file_handle 
*handle, int mode TSRMLS_DC)
+{
php_stream *stream;
 
-   stream = php_stream_open_wrapper((char *)filename, rb, 
ENFORCE_SAFE_MODE|USE_PATH|REPORT_ERRORS|STREAM_OPEN_FOR_INCLUDE, 
handle-opened_path);
+   stream = php_stream_open_wrapper((char *)filename, rb, mode, 
handle-opened_path);
 
if (stream) {
handle-type = ZEND_HANDLE_STREAM;
@@ -925,7 +930,6 @@
return FAILURE;
 }
 
-
 /* {{{ php_get_configuration_directive_for_zend
  */
 static int php_get_configuration_directive_for_zend(char *name, uint 
name_length, zval *contents)
http://cvs.php.net/viewvc.cgi/php-src/main/php_main.h?r1=1.34.2.1.2.1r2=1.34.2.1.2.2diff_format=u
Index: php-src/main/php_main.h
diff -u php-src/main/php_main.h:1.34.2.1.2.1 
php-src/main/php_main.h:1.34.2.1.2.2
--- php-src/main/php_main.h:1.34.2.1.2.1Mon Jan  1 09:36:11 2007
+++ php-src/main/php_main.h Mon Jan  8 03:39:09 2007
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: php_main.h,v 1.34.2.1.2.1 2007/01/01 09:36:11 sebastian Exp $ */
+/* $Id: php_main.h,v 1.34.2.1.2.2 2007/01/08 03:39:09 iliaa Exp $ */
 
 #ifndef PHP_MAIN_H
 #define PHP_MAIN_H
@@ -47,6 +47,7 @@
 PHPAPI int php_handle_auth_data(const char *auth TSRMLS_DC);
 
 PHPAPI void php_html_puts(const char *str, uint siz TSRMLS_DC);
+PHPAPI int php_stream_open_for_zend_ex(const char *filename, zend_file_handle 
*handle, int mode TSRMLS_DC);
 
 extern void php_call_shutdown_functions(TSRMLS_D);
 extern void php_free_shutdown_functions(TSRMLS_D);
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.52.2.28.2.11r2=1.52.2.28.2.12diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.52.2.28.2.11 
php-src/ext/spl/php_spl.c:1.52.2.28.2.12
--- php-src/ext/spl/php_spl.c:1.52.2.28.2.11Mon Jan  1 09:36:07 2007
+++ php-src/ext/spl/php_spl.c   Mon Jan  8 03:39:09 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.52.2.28.2.11 2007/01/01 09:36:07 sebastian Exp $ */
+/* $Id: php_spl.c,v 1.52.2.28.2.12 2007/01/08 03:39:09 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -24,6 +24,7 @@
 
 #include php.h
 #include php_ini.h
+#include php_main.h
 #include ext/standard/info.h
 #include php_spl.h
 #include spl_functions.h
@@ -207,7 +208,7 @@
 }
 /* }}} */
 
-int spl_autoload(const char *class_name, const char * lc_name, int 
class_name_len, const char * file_extension TSRMLS_DC) /* {{{ */
+static int spl_autoload(const char *class_name, const char * lc_name, int 
class_name_len, const char * file_extension TSRMLS_DC) /* {{{ */
 {
char *class_file;
int class_file_len;
@@ -215,23 +216,11 @@
zend_file_handle file_handle;
zend_op_array *new_op_array;
zval *result = NULL;
-   zval err_mode;
int ret;
 
class_file_len = spprintf(class_file, 0, %s%s, lc_name, 
file_extension);
 
-   ZVAL_LONG(err_mode, EG(error_reporting));
-   if (Z_LVAL(err_mode)) {
-   php_alter_ini_entry(error_reporting, 
sizeof(error_reporting), 0, 1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
-   }
-
-   ret = zend_stream_open(class_file, file_handle TSRMLS_CC);
-
-   if (!EG(error_reporting)  Z_LVAL(err_mode) != EG(error_reporting)) {
-   convert_to_string(err_mode);
-   zend_alter_ini_entry(error_reporting, 
sizeof(error_reporting), Z_STRVAL(err_mode), Z_STRLEN(err_mode), 
ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
-   zendi_zval_dtor(err_mode);
-   }
+   ret = php_stream_open_for_zend_ex(class_file, file_handle, 
ENFORCE_SAFE_MODE|USE_PATH|STREAM_OPEN_FOR_INCLUDE 

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

2006-11-04 Thread Marcus Boerger
helly   Sat Nov  4 20:27:28 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/splphp_spl.c php_spl.h 
  Log:
  - MFH Store length of autoload file exts
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.52.2.28.2.7r2=1.52.2.28.2.8diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.52.2.28.2.7 
php-src/ext/spl/php_spl.c:1.52.2.28.2.8
--- php-src/ext/spl/php_spl.c:1.52.2.28.2.7 Fri Nov  3 18:58:41 2006
+++ php-src/ext/spl/php_spl.c   Sat Nov  4 20:27:28 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.52.2.28.2.7 2006/11/03 18:58:41 helly Exp $ */
+/* $Id: php_spl.c,v 1.52.2.28.2.8 2006/11/04 20:27:28 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -55,9 +55,10 @@
  */
 static PHP_GINIT_FUNCTION(spl)
 {
-   spl_globals-autoload_extensions = NULL;
-   spl_globals-autoload_functions  = NULL;
-   spl_globals-autoload_running= 0;
+   spl_globals-autoload_extensions = NULL;
+   spl_globals-autoload_extensions_len = 0;
+   spl_globals-autoload_functions  = NULL;
+   spl_globals-autoload_running= 0;
 }
 /* }}} */
 
@@ -269,8 +270,8 @@
  Default implementation for __autoload() */
 PHP_FUNCTION(spl_autoload)
 {
-   char *class_name, *lc_name, *file_exts;
-   int class_name_len, file_exts_len, found = 0;
+   char *class_name, *lc_name, *file_exts = SPL_G(autoload_extensions);
+   int class_name_len, file_exts_len = SPL_G(autoload_extensions_len), 
found = 0;
char *copy, *pos1, *pos2;
zval **original_return_value = EG(return_value_ptr_ptr);
zend_op **original_opline_ptr = EG(opline_ptr);
@@ -281,7 +282,7 @@
RETURN_FALSE;
}
 
-   copy = pos1 = estrdup(ZEND_NUM_ARGS()  1 ? file_exts : 
SPL_G(autoload_extensions));
+   copy = pos1 = estrndup(file_exts, file_exts_len);
lc_name = zend_str_tolower_dup(class_name, class_name_len);
while(pos1  *pos1  !EG(exception)) {
EG(return_value_ptr_ptr) = original_return_value;
@@ -326,10 +327,11 @@
if (SPL_G(autoload_extensions)) {
efree(SPL_G(autoload_extensions));
}
-   SPL_G(autoload_extensions) = estrdup(file_exts);
+   SPL_G(autoload_extensions) = estrndup(file_exts, file_exts_len);
+   SPL_G(autoload_extensions_len) = file_exts_len;
}
 
-   RETURN_STRING(SPL_G(autoload_extensions), 1);
+   RETURN_STRINGL(SPL_G(autoload_extensions), 
SPL_G(autoload_extensions_len), 1);
 } /* }}} */
 
 typedef struct {
@@ -696,6 +698,7 @@
 PHP_RINIT_FUNCTION(spl) /* {{{ */
 {
SPL_G(autoload_extensions) = estrndup(.inc,.php, 
sizeof(.inc,.php)-1);
+   SPL_G(autoload_extensions_len) = sizeof(.inc,.php)-1;
SPL_G(autoload_functions) = NULL;
return SUCCESS;
 } /* }}} */
@@ -705,6 +708,7 @@
if (SPL_G(autoload_extensions)) {
efree(SPL_G(autoload_extensions));
SPL_G(autoload_extensions) = NULL;
+   SPL_G(autoload_extensions_len) = 0;
}
if (SPL_G(autoload_functions)) {
zend_hash_destroy(SPL_G(autoload_functions));
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.h?r1=1.17.2.1.2.1r2=1.17.2.1.2.2diff_format=u
Index: php-src/ext/spl/php_spl.h
diff -u php-src/ext/spl/php_spl.h:1.17.2.1.2.1 
php-src/ext/spl/php_spl.h:1.17.2.1.2.2
--- php-src/ext/spl/php_spl.h:1.17.2.1.2.1  Fri Nov  3 18:58:41 2006
+++ php-src/ext/spl/php_spl.h   Sat Nov  4 20:27:28 2006
@@ -59,6 +59,7 @@
char *   autoload_extensions;
HashTable *  autoload_functions;
int  autoload_running;
+   int  autoload_extensions_len;
 ZEND_END_MODULE_GLOBALS(spl)
 
 #ifdef ZTS

-- 
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 php_spl.c php_spl.h /ext/spl/examples directoryfilterdots.inc /ext/spl/internal recursiveiteratoriterator.inc /ext/spl/tests spl_autoload_009.phpt

2006-11-03 Thread Marcus Boerger
helly   Fri Nov  3 18:58:41 2006 UTC

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

  Modified files:  
/php-src/ext/splphp_spl.c php_spl.h 
/php-src/ext/spl/examples   directoryfilterdots.inc 
/php-src/ext/spl/internal   recursiveiteratoriterator.inc 
  Log:
  - MFH: Synch
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.52.2.28.2.6r2=1.52.2.28.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.6 
php-src/ext/spl/php_spl.c:1.52.2.28.2.7
--- php-src/ext/spl/php_spl.c:1.52.2.28.2.6 Mon Aug  7 09:49:53 2006
+++ php-src/ext/spl/php_spl.c   Fri Nov  3 18:58:41 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.52.2.28.2.6 2006/08/07 09:49:53 tony2001 Exp $ */
+/* $Id: php_spl.c,v 1.52.2.28.2.7 2006/11/03 18:58:41 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -57,6 +57,7 @@
 {
spl_globals-autoload_extensions = NULL;
spl_globals-autoload_functions  = NULL;
+   spl_globals-autoload_running= 0;
 }
 /* }}} */
 
@@ -305,7 +306,7 @@
EG(active_op_array) = original_active_op_array;
EG(function_state_ptr) = original_function_state_ptr;
 
-   if (!found) {
+   if (!found  !SPL_G(autoload_running)) {
zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, 
Class %s could not be loaded, class_name);
}
 } /* }}} */
@@ -361,6 +362,8 @@
}
 
if (SPL_G(autoload_functions)) {
+   int l_autoload_running = SPL_G(autoload_running);
+   SPL_G(autoload_running) = 1;
class_name_len = Z_STRLEN_P(class_name);
lc_name = zend_str_tolower_dup(Z_STRVAL_P(class_name), 
class_name_len);
zend_hash_internal_pointer_reset_ex(SPL_G(autoload_functions), 
function_pos);
@@ -377,6 +380,7 @@
zend_hash_move_forward_ex(SPL_G(autoload_functions), 
function_pos);
}
efree(lc_name);
+   SPL_G(autoload_running) = l_autoload_running;
} else {
/* do not use or overwrite EG(autoload_func) here */
zend_call_method_with_1_params(NULL, NULL, NULL, 
spl_autoload, NULL, class_name);
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.h?r1=1.17.2.1r2=1.17.2.1.2.1diff_format=u
Index: php-src/ext/spl/php_spl.h
diff -u php-src/ext/spl/php_spl.h:1.17.2.1 
php-src/ext/spl/php_spl.h:1.17.2.1.2.1
--- php-src/ext/spl/php_spl.h:1.17.2.1  Sun Jan  1 12:50:13 2006
+++ php-src/ext/spl/php_spl.h   Fri Nov  3 18:58:41 2006
@@ -58,6 +58,7 @@
 ZEND_BEGIN_MODULE_GLOBALS(spl)
char *   autoload_extensions;
HashTable *  autoload_functions;
+   int  autoload_running;
 ZEND_END_MODULE_GLOBALS(spl)
 
 #ifdef ZTS
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/examples/directoryfilterdots.inc?r1=1.6r2=1.6.4.1diff_format=u
Index: php-src/ext/spl/examples/directoryfilterdots.inc
diff -u php-src/ext/spl/examples/directoryfilterdots.inc:1.6 
php-src/ext/spl/examples/directoryfilterdots.inc:1.6.4.1
--- php-src/ext/spl/examples/directoryfilterdots.inc:1.6Tue Feb  8 
19:10:04 2005
+++ php-src/ext/spl/examples/directoryfilterdots.incFri Nov  3 18:58:41 2006
@@ -4,7 +4,7 @@
  * @ingroup Examples
  * @brief class DirectoryFilterDots
  * @author  Marcus Boerger
- * @date2003 - 2005
+ * @date2003 - 2006
  *
  * SPL - Standard PHP Library
  */
@@ -12,7 +12,7 @@
 /** @ingroup Examples
  * @brief   A filtered DirectoryIterator
  * @author  Marcus Boerger
- * @version 1.1
+ * @version 1.2
  *
  * This Iteraotr takes a pathname from which it creates a DirectoryIterator
  * and makes it recursive. Further more it filters the entries '.' and '..'.
@@ -24,7 +24,7 @@
 */
function __construct($path)
{
-   parent::__construct(new DirectoryIterator($path));
+   parent::__construct(new RecursiveDirectoryIterator($path));
}
 
/** @return whether the current entry is neither '.' nor '..'
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/internal/recursiveiteratoriterator.inc?r1=1.14.2.2r2=1.14.2.2.2.1diff_format=u
Index: php-src/ext/spl/internal/recursiveiteratoriterator.inc
diff -u php-src/ext/spl/internal/recursiveiteratoriterator.inc:1.14.2.2 
php-src/ext/spl/internal/recursiveiteratoriterator.inc:1.14.2.2.2.1
--- php-src/ext/spl/internal/recursiveiteratoriterator.inc:1.14.2.2 Sat Oct 
 8 19:09:58 2005
+++ php-src/ext/spl/internal/recursiveiteratoriterator.inc  Fri Nov  3 
18:58:41 2006
@@ -217,7 +217,7 @@
if ($after_move)
{
if (($this-mode == self::SELF_FIRST  
$this-callHasChildren())
-$this-mode == self::LEAVES_ONLY)
+   ||   

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

2006-08-07 Thread Antony Dovgal
tony2001Mon Aug  7 09:49:53 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/splphp_spl.c 
  Log:
  nuke unused variable
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.52.2.28.2.5r2=1.52.2.28.2.6diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.52.2.28.2.5 
php-src/ext/spl/php_spl.c:1.52.2.28.2.6
--- php-src/ext/spl/php_spl.c:1.52.2.28.2.5 Thu Aug  3 14:49:11 2006
+++ php-src/ext/spl/php_spl.c   Mon Aug  7 09:49:53 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.52.2.28.2.5 2006/08/03 14:49:11 iliaa Exp $ */
+/* $Id: php_spl.c,v 1.52.2.28.2.6 2006/08/07 09:49:53 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -275,7 +275,6 @@
zend_op **original_opline_ptr = EG(opline_ptr);
zend_op_array *original_active_op_array = EG(active_op_array);
zend_function_state *original_function_state_ptr = 
EG(function_state_ptr);
-   zval err_mode;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|s, 
class_name, class_name_len, file_exts, file_exts_len) == FAILURE) {
RETURN_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_2) /ext/spl php_spl.c /ext/spl/tests spl_005.phpt

2006-07-09 Thread Marcus Boerger
helly   Sun Jul  9 10:22:27 2006 UTC

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

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - MFH Add spl_object_hash()
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.52.2.28.2.3r2=1.52.2.28.2.4diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.52.2.28.2.3 
php-src/ext/spl/php_spl.c:1.52.2.28.2.4
--- php-src/ext/spl/php_spl.c:1.52.2.28.2.3 Thu Jun 15 18:33:08 2006
+++ php-src/ext/spl/php_spl.c   Sun Jul  9 10:22:27 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.52.2.28.2.3 2006/06/15 18:33:08 dmitry Exp $ */
+/* $Id: php_spl.c,v 1.52.2.28.2.4 2006/07/09 10:22:27 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -36,6 +36,7 @@
 #include spl_observer.h
 #include zend_exceptions.h
 #include zend_interfaces.h
+#include ext/standard/md5.h
 
 #ifdef COMPILE_DL_SPL
 ZEND_GET_MODULE(spl)
@@ -566,6 +567,32 @@
add_next_index_string(return_value, 
EG(autoload_func)-common.function_name, 1);
 } /* }}} */
 
+/* {{{ proto string spl_object_hash(object obj)
+ Return hash id for given object */
+PHP_FUNCTION(spl_object_hash)
+{
+   zval *obj;
+   int len;
+   char *hash;
+   char md5str[33];
+   PHP_MD5_CTX context;
+   unsigned char digest[16];
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, o, obj) == 
FAILURE) {
+   return;
+   }
+
+   len = spprintf(hash, 0, %p:%d, Z_OBJ_HT_P(obj), Z_OBJ_HANDLE_P(obj));
+   
+   md5str[0] = '\0';
+   PHP_MD5Init(context);
+   PHP_MD5Update(context, (unsigned char*)hash, len);
+   PHP_MD5Final(digest, context);
+   make_digest(md5str, digest);
+   RETVAL_STRING(md5str, 1);
+   efree(hash);
+}
+
 int spl_build_class_list_string(zval **entry, char **list TSRMLS_DC) /* {{{ */
 {
char *res;
@@ -632,6 +659,7 @@
PHP_FE(spl_autoload_call,   NULL)
PHP_FE(class_parents,   NULL)
PHP_FE(class_implements,NULL)
+   PHP_FE(spl_object_hash, NULL)
 #ifdef SPL_ITERATORS_H
PHP_FE(iterator_to_array,   arginfo_iterator)
PHP_FE(iterator_count,  arginfo_iterator)

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

var_dump(spl_object_hash(new stdClass));
var_dump(spl_object_hash(42));
var_dump(spl_object_hash());

?
===DONE===
?php exit(0); ?
--EXPECTF--
string(32) %s

Warning: spl_object_hash() expects parameter 1 to be object, integer given in 
%sspl_005.php on line %d
NULL

Warning: spl_object_hash() expects exactly 1 parameter, 0 given in 
%sspl_005.php 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_2) /ext/spl php_spl.c spl_iterators.c spl_iterators.h /ext/spl/tests spl_004.phpt

2006-06-07 Thread Marcus Boerger
helly   Wed Jun  7 09:44:42 2006 UTC

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

  Modified files:  
/php-src/ext/splphp_spl.c spl_iterators.c spl_iterators.h 
  Log:
  - MFH iterator_apply()
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/php_spl.c?r1=1.52.2.28.2.1r2=1.52.2.28.2.2diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.52.2.28.2.1 
php-src/ext/spl/php_spl.c:1.52.2.28.2.2
--- php-src/ext/spl/php_spl.c:1.52.2.28.2.1 Sun Jun  4 10:47:22 2006
+++ php-src/ext/spl/php_spl.c   Wed Jun  7 09:44:41 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.52.2.28.2.1 2006/06/04 10:47:22 helly Exp $ */
+/* $Id: php_spl.c,v 1.52.2.28.2.2 2006/06/07 09:44:41 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -610,7 +610,14 @@
 
 static
 ZEND_BEGIN_ARG_INFO(arginfo_iterator, 0)
-   ZEND_ARG_INFO(0, iterator)
+   ZEND_ARG_OBJ_INFO(0, iterator, Traversable, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_iterator_apply, 0, 0, 2)
+   ZEND_ARG_OBJ_INFO(0, iterator, Traversable, 0)
+   ZEND_ARG_INFO(0, function)
+   ZEND_ARG_ARRAY_INFO(0, args, 1)
 ZEND_END_ARG_INFO();
 
 /* {{{ spl_functions
@@ -628,6 +635,7 @@
 #ifdef SPL_ITERATORS_H
PHP_FE(iterator_to_array,   arginfo_iterator)
PHP_FE(iterator_count,  arginfo_iterator)
+   PHP_FE(iterator_apply,  arginfo_iterator_apply)
 #endif /* SPL_ITERATORS_H */
{NULL, NULL, NULL}
 };
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl_iterators.c?r1=1.73.2.30.2.10r2=1.73.2.30.2.11diff_format=u
Index: php-src/ext/spl/spl_iterators.c
diff -u php-src/ext/spl/spl_iterators.c:1.73.2.30.2.10 
php-src/ext/spl/spl_iterators.c:1.73.2.30.2.11
--- php-src/ext/spl/spl_iterators.c:1.73.2.30.2.10  Tue Jun  6 20:11:35 2006
+++ php-src/ext/spl/spl_iterators.c Wed Jun  7 09:44:41 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_iterators.c,v 1.73.2.30.2.10 2006/06/06 20:11:35 tony2001 Exp $ */
+/* $Id: spl_iterators.c,v 1.73.2.30.2.11 2006/06/07 09:44:41 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -2575,7 +2575,7 @@
Copy the iterator into an array */
 PHP_FUNCTION(iterator_to_array)
 {
-   zval   *obj;
+   zval  *obj;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, O, obj, 
zend_ce_traversable) == FAILURE) {
RETURN_FALSE;
@@ -2600,8 +2600,8 @@
Count the elements in an iterator */
 PHP_FUNCTION(iterator_count)
 {
-   zval   *obj;
-   longcount = 0;
+   zval  *obj;
+   long  count = 0;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, O, obj, 
zend_ce_traversable) == FAILURE) {
RETURN_FALSE;
@@ -2613,6 +2613,54 @@
 }
 /* }}} */
 
+typedef struct {
+   zval   *obj;
+   zval   *args;
+   long   count;
+   zend_fcall_infofci;
+   zend_fcall_info_cache  fcc;
+} spl_iterator_apply_info;
+
+static int spl_iterator_func_apply(zend_object_iterator *iter, void *puser 
TSRMLS_DC) /* {{{ */
+{
+   zval *retval;
+   spl_iterator_apply_info  *apply_info = (spl_iterator_apply_info*)puser;
+   int result;
+
+   apply_info-count++;
+   zend_fcall_info_call(apply_info-fci, apply_info-fcc, retval, NULL 
TSRMLS_CC);
+   if (retval) {
+   result = zend_is_true(retval) ? ZEND_HASH_APPLY_KEEP : 
ZEND_HASH_APPLY_STOP;
+   zval_ptr_dtor(retval);
+   } else {
+   result = ZEND_HASH_APPLY_STOP;
+   }
+   return result;
+}
+/* }}} */
+
+/* {{{ proto int iterator_apply(Traversable it, mixed function [, mixed 
params])
+   Calls a function for every element in an iterator */
+PHP_FUNCTION(iterator_apply)
+{
+   spl_iterator_apply_info  apply_info;
+
+   apply_info.args = NULL;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Of|a!, 
apply_info.obj, zend_ce_traversable, apply_info.fci, apply_info.fcc, 
apply_info.args) == FAILURE) {
+   return;
+   }
+
+   apply_info.count = 0;
+   zend_fcall_info_args(apply_info.fci, apply_info.args TSRMLS_CC);
+   if (spl_iterator_apply(apply_info.obj, spl_iterator_func_apply, 
(void*)apply_info TSRMLS_CC) == SUCCESS) {
+   RETVAL_LONG(apply_info.count);
+   } else {
+   RETVAL_FALSE;
+   }
+   zend_fcall_info_args(apply_info.fci, NULL TSRMLS_CC);
+}
+/* }}} */
+
 static zend_function_entry spl_funcs_OuterIterator[] = {
SPL_ABSTRACT_ME(OuterIterator, getInnerIterator,   NULL)
{NULL, NULL, NULL}
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl_iterators.h?r1=1.18.2.7.2.5r2=1.18.2.7.2.6diff_format=u
Index: 

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

2006-06-04 Thread Marcus Boerger
helly   Sun Jun  4 10:47:22 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/splphp_spl.c 
  Log:
  - Add missing classes
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/php_spl.c?r1=1.52.2.28r2=1.52.2.28.2.1diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.52.2.28 
php-src/ext/spl/php_spl.c:1.52.2.28.2.1
--- php-src/ext/spl/php_spl.c:1.52.2.28 Thu Mar 23 19:55:16 2006
+++ php-src/ext/spl/php_spl.c   Sun Jun  4 10:47:22 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.52.2.28 2006/03/23 19:55:16 helly Exp $ */
+/* $Id: php_spl.c,v 1.52.2.28.2.1 2006/06/04 10:47:22 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -180,6 +180,8 @@
SPL_ADD_CLASS(RecursiveFilterIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(RecursiveIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(RecursiveIteratorIterator, z_list, sub, allow, ce_flags); 
\
+   SPL_ADD_CLASS(RecursiveRegexIterator, z_list, sub, allow, ce_flags); \
+   SPL_ADD_CLASS(RegexIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(RuntimeException, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(SeekableIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(SimpleXMLIterator, z_list, sub, allow, ce_flags); \

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