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

2009-06-13 Thread Greg Beaver
cellog  Sat Jun 13 17:28:35 2009 UTC

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

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  fix Bug #48541: spl_autoload_register only registers first closure, then 
leaks the others
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.158r2=1.159diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.158 php-src/ext/spl/php_spl.c:1.159
--- php-src/ext/spl/php_spl.c:1.158 Tue Jun  9 01:57:57 2009
+++ php-src/ext/spl/php_spl.c   Sat Jun 13 17:28:35 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.158 2009/06/09 01:57:57 scottmac Exp $ */
+/* $Id: php_spl.c,v 1.159 2009/06/13 17:28:35 cellog Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -503,8 +503,24 @@
alfi.func_ptr = fcc.function_handler;
obj_ptr = fcc.object_ptr;
if (Z_TYPE_P(zcallable) == IS_OBJECT) {
+   zstr lc_name;
+
+   size_t func_name_len = Z_UNISIZE(zfunc_name);
+
alfi.closure = zcallable;
Z_ADDREF_P(zcallable);
+
+   lc_name.v = Z_UNIVAL(zfunc_name).v = 
erealloc(Z_UNIVAL(zfunc_name).v, func_name_len + 2 + 
sizeof(zcallable-value.obj.handle));
+   memcpy(lc_name.s + func_name_len, 
(zcallable-value.obj.handle), sizeof(zcallable-value.obj.handle));
+   func_name_len += sizeof(zcallable-value.obj.handle);
+   if (Z_TYPE(zfunc_name) == IS_UNICODE) {
+   func_name_len /= sizeof(UChar);
+   Z_STRLEN(zfunc_name) = func_name_len;
+   lc_name.u[func_name_len] = 0;
+   } else {
+   Z_STRLEN(zfunc_name) = func_name_len;
+   lc_name.s[func_name_len] = '\0';
+   }
}
if (error) {
efree(error);
@@ -512,6 +528,9 @@

zend_u_str_tolower(Z_TYPE(zfunc_name), Z_UNIVAL(zfunc_name), 
Z_UNILEN(zfunc_name));
if (SPL_G(autoload_functions)  
zend_u_hash_exists(SPL_G(autoload_functions), Z_TYPE(zfunc_name), 
Z_UNIVAL(zfunc_name), Z_UNILEN(zfunc_name)+1)) {
+   if (alfi.closure) {
+   Z_DELREF_P(zcallable);
+   }
goto skip;
}
 

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/spl_autoload_bug48541.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/spl_autoload_bug48541.phpt
+++ php-src/ext/spl/tests/spl_autoload_bug48541.phpt
--TEST--
SPL: spl_autoload_register() Bug #48541: registering multiple closures fails 
with memleaks
--FILE--
?php
$a = function ($class) {
echo a called\n;
};
$b = function ($class) {
eval('class ' . $class . '{function __construct(){echo foo\n;}}');
echo b called\n;
};
spl_autoload_register($a);
spl_autoload_register($b);

$c = $a;
spl_autoload_register($c);
$c = new foo;
?
===DONE===
--EXPECT--
a called
b called
foo
===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 php_spl.c /ext/spl/tests bug48493.phpt

2009-06-08 Thread Scott MacVicar
scottmacTue Jun  9 01:57:58 2009 UTC

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

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  Fix bug #48493 - spl_autoload_register can leave the HT in an inconsistent 
way.
  Need to point the second elements previous item to head so we can traverse 
upwards.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.157r2=1.158diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.157 php-src/ext/spl/php_spl.c:1.158
--- php-src/ext/spl/php_spl.c:1.157 Mon May 25 14:32:14 2009
+++ php-src/ext/spl/php_spl.c   Tue Jun  9 01:57:57 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.157 2009/05/25 14:32:14 felipe Exp $ */
+/* $Id: php_spl.c,v 1.158 2009/06/09 01:57:57 scottmac Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -409,6 +409,7 @@
(ht)-pListTail-pListNext = (ht)-pListHead;   \
(ht)-pListHead = (ht)-pListTail;  
\
(ht)-pListTail = (ht)-pListHead-pListLast;   \
+   (ht)-pListHead-pListNext-pListLast = (ht)-pListHead;\
(ht)-pListTail-pListNext = NULL;  
\
(ht)-pListHead-pListLast = NULL;
 

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug48493.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/bug48493.phpt
+++ php-src/ext/spl/tests/bug48493.phpt
--TEST--
SPL: Bug #48493 spl_autoload_unregister() can't handle prepended functions
--FILE--
?php
function autoload1() {}

function autoload2() {}

spl_autoload_register('autoload2');
spl_autoload_register('autoload1', true, true);
var_dump(spl_autoload_functions());

spl_autoload_unregister('autoload2');
var_dump(spl_autoload_functions());
?
--EXPECT--
array(2) {
  [0]=
  unicode(9) autoload1
  [1]=
  unicode(9) autoload2
}
array(1) {
  [0]=
  unicode(9) autoload1
}



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

2009-05-02 Thread Kalle Sommer Nielsen
kalle   Sat May  2 06:27:08 2009 UTC

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  Fix typo
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.155r2=1.156diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.155 php-src/ext/spl/php_spl.c:1.156
--- php-src/ext/spl/php_spl.c:1.155 Sat Apr 25 21:54:39 2009
+++ php-src/ext/spl/php_spl.c   Sat May  2 06:27:08 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.155 2009/04/25 21:54:39 lbarnaud Exp $ */
+/* $Id: php_spl.c,v 1.156 2009/05/02 06:27:08 kalle Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -223,7 +223,7 @@
zval *result = NULL;
int ret;
 
-   /* UTODO: We want the stream to acept a zstr for opening */
+   /* UTODO: We want the stream to accept a zstr for opening */
class_file_len = spprintf(class_file, 0, %v%v, lc_name, 
file_extension);
 
ret = php_stream_open_for_zend_ex(class_file, file_handle, 
ENFORCE_SAFE_MODE|USE_PATH|STREAM_OPEN_FOR_INCLUDE 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 php_spl.c

2009-04-25 Thread Arnaud Le Blanc
lbarnaudSat Apr 25 21:05:00 2009 UTC

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  MFB5.3 (Fixed bug #38325 (spl_autoload_register() gaves wrong line for 
  class not found))
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.153r2=1.154diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.153 php-src/ext/spl/php_spl.c:1.154
--- php-src/ext/spl/php_spl.c:1.153 Mon Apr 20 14:18:46 2009
+++ php-src/ext/spl/php_spl.c   Sat Apr 25 21:05:00 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.153 2009/04/20 14:18:46 colder Exp $ */
+/* $Id: php_spl.c,v 1.154 2009/04/25 21:05:00 lbarnaud Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -311,7 +311,22 @@
EG(active_op_array) = original_active_op_array;
 
if (!found  !SPL_G(autoload_running)) {
-   zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, 
Class %v could not be loaded, class_name);
+   /* For internal errors, we generate E_ERROR, for direct calls 
an exception is thrown.
+* The scope is determined by an opcode, if it is 
ZEND_FETCH_CLASS we know function was called indirectly by
+* the Zend engine.
+*/
+
+   char *sclass_name;
+   int sclass_name_len;
+
+   
zend_unicode_to_string(ZEND_U_CONVERTER(UG(output_encoding_conv)), 
sclass_name, sclass_name_len, 
+   class_name.u, class_name_len);
+
+   if (active_opline-opcode != ZEND_FETCH_CLASS) {
+   zend_throw_exception_ex(spl_ce_LogicException, 0 
TSRMLS_CC, Class %s could not be loaded, sclass_name);
+   } else {
+   php_error_docref(NULL TSRMLS_CC, E_ERROR, Class %s 
could not be loaded, sclass_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 php_spl.c

2009-04-25 Thread Arnaud Le Blanc
lbarnaudSat Apr 25 21:54:40 2009 UTC

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  Fix memleak
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.154r2=1.155diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.154 php-src/ext/spl/php_spl.c:1.155
--- php-src/ext/spl/php_spl.c:1.154 Sat Apr 25 21:05:00 2009
+++ php-src/ext/spl/php_spl.c   Sat Apr 25 21:54:39 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.154 2009/04/25 21:05:00 lbarnaud Exp $ */
+/* $Id: php_spl.c,v 1.155 2009/04/25 21:54:39 lbarnaud Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -315,17 +315,10 @@
 * The scope is determined by an opcode, if it is 
ZEND_FETCH_CLASS we know function was called indirectly by
 * the Zend engine.
 */
-
-   char *sclass_name;
-   int sclass_name_len;
-
-   
zend_unicode_to_string(ZEND_U_CONVERTER(UG(output_encoding_conv)), 
sclass_name, sclass_name_len, 
-   class_name.u, class_name_len);
-
if (active_opline-opcode != ZEND_FETCH_CLASS) {
-   zend_throw_exception_ex(spl_ce_LogicException, 0 
TSRMLS_CC, Class %s could not be loaded, sclass_name);
+   zend_throw_exception_ex(spl_ce_LogicException, 0 
TSRMLS_CC, Class %v could not be loaded, class_name.u);
} else {
-   php_error_docref(NULL TSRMLS_CC, E_ERROR, Class %s 
could not be loaded, sclass_name);
+   php_error_docref(NULL TSRMLS_CC, E_ERROR, Class %v 
could not be loaded, class_name.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 bug48023.phpt

2009-04-20 Thread Etienne Kneuss
colder  Mon Apr 20 14:18:46 2009 UTC

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

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  Fix #48023 (spl_autoload_register didn't store closures)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.152r2=1.153diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.152 php-src/ext/spl/php_spl.c:1.153
--- php-src/ext/spl/php_spl.c:1.152 Thu Mar 26 20:02:12 2009
+++ php-src/ext/spl/php_spl.c   Mon Apr 20 14:18:46 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.152 2009/03/26 20:02:12 felipe Exp $ */
+/* $Id: php_spl.c,v 1.153 2009/04/20 14:18:46 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -337,6 +337,7 @@
 typedef struct {
zend_function *func_ptr;
zval *obj;
+   zval *closure;
zend_class_entry *ce;
 } autoload_func_info;
 
@@ -345,6 +346,9 @@
if (alfi-obj) {
zval_ptr_dtor(alfi-obj);
}
+   if (alfi-closure) {
+   zval_ptr_dtor(alfi-closure);
+   }
 }
 
 /* {{{ proto void spl_autoload_call(string class_name) U
@@ -485,9 +489,14 @@
RETURN_FALSE;
}
}
+   alfi.closure = NULL;
alfi.ce = fcc.calling_scope;
alfi.func_ptr = fcc.function_handler;
obj_ptr = fcc.object_ptr;
+   if (Z_TYPE_P(zcallable) == IS_OBJECT) {
+   alfi.closure = zcallable;
+   Z_ADDREF_P(zcallable);
+   }
if (error) {
efree(error);
}
@@ -531,6 +540,7 @@
spl_alfi.func_ptr = spl_func_ptr;
spl_alfi.obj = NULL;
spl_alfi.ce = NULL;
+   spl_alfi.closure = 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 */

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug48023.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/bug48023.phpt
+++ php-src/ext/spl/tests/bug48023.phpt
--TEST--
Bug #48023 (spl_autoload_register didn't addref closures)
--FILE--
?php
spl_autoload_register(function(){});

new Foo;

?
===DONE===
--EXPECTF--
Fatal error: Class 'Foo' not found 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 php_spl.c php_spl.h

2009-01-26 Thread Etienne Kneuss
colder  Mon Jan 26 11:37:50 2009 UTC

  Modified files:  
/php-src/ext/splphp_spl.c php_spl.h 
  Log:
  Improve spl_object_hash()
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.149r2=1.150diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.149 php-src/ext/spl/php_spl.c:1.150
--- php-src/ext/spl/php_spl.c:1.149 Wed Dec 31 11:12:36 2008
+++ php-src/ext/spl/php_spl.c   Mon Jan 26 11:37:46 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.149 2008/12/31 11:12:36 sebastian Exp $ */
+/* $Id: php_spl.c,v 1.150 2009/01/26 11:37:46 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -39,7 +39,9 @@
 #include spl_fixedarray.h
 #include zend_exceptions.h
 #include zend_interfaces.h
-#include ext/standard/md5.h
+#include ext/standard/php_rand.h
+#include ext/standard/php_lcg.h
+#include main/snprintf.h
 
 #ifdef COMPILE_DL_SPL
 ZEND_GET_MODULE(spl)
@@ -689,34 +691,41 @@
 PHP_FUNCTION(spl_object_hash)
 {
zval *obj;
-   char* md5str;
+   char* hash;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, o, obj) == 
FAILURE) {
return;
}
 
-   md5str = emalloc(33);
-   php_spl_object_hash(obj, md5str TSRMLS_CC);
+   hash = emalloc(33);
+   php_spl_object_hash(obj, hash TSRMLS_CC);
 
-   RETVAL_STRING(md5str, 0);
+   RETVAL_STRING(hash, 0);
 }
 /* }}} */
 
-PHPAPI void php_spl_object_hash(zval *obj, char *md5str TSRMLS_DC) /* {{{*/
+PHPAPI void php_spl_object_hash(zval *obj, char *result TSRMLS_DC) /* {{{*/
 {
-   int len;
-   char *hash;
-   PHP_MD5_CTX context;
-   unsigned char digest[16];
-
-   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);
-   efree(hash);
+   intptr_t hash_handle, hash_handlers;
+   char *hex;
+
+   if (!SPL_G(hash_mask_init)) {
+   if (!BG(mt_rand_is_seeded)) {
+   php_mt_srand(GENERATE_SEED() TSRMLS_CC);
+   }
+
+   SPL_G(hash_mask_handle)   = (intptr_t)(php_mt_rand(TSRMLS_C)  
1);
+   SPL_G(hash_mask_handlers) = (intptr_t)(php_mt_rand(TSRMLS_C)  
1);
+   SPL_G(hash_mask_init) = 1;
+   }
+
+   hash_handle   = SPL_G(hash_mask_handle)^(intptr_t)Z_OBJ_HANDLE_P(obj);
+   hash_handlers = SPL_G(hash_mask_handlers)^(intptr_t)Z_OBJ_HT_P(obj);
+
+   spprintf(hex, 32, %016x%016x, hash_handle, hash_handlers);
+
+   strlcpy(result, hex, 33);
+   efree(hex);
 }
 /* }}} */
 
@@ -865,6 +874,8 @@
ZVAL_ASCII_STRINGL(SPL_G(autoload_extensions), .inc,.php, 
sizeof(.inc,.php)-1, 1);
SPL_G(autoload_functions) = NULL;
SPL_G(autoload_running) = 0;
+   SPL_G(autoload_running) = 0;
+   SPL_G(hash_mask_init) = 0;
return SUCCESS;
 } /* }}} */
 
@@ -879,6 +890,9 @@
FREE_HASHTABLE(SPL_G(autoload_functions));
SPL_G(autoload_functions) = NULL;
}
+   if (SPL_G(hash_mask_init)) {
+   SPL_G(hash_mask_init) = 0;
+   }
return SUCCESS;
 } /* }}} */
 
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.h?r1=1.28r2=1.29diff_format=u
Index: php-src/ext/spl/php_spl.h
diff -u php-src/ext/spl/php_spl.h:1.28 php-src/ext/spl/php_spl.h:1.29
--- php-src/ext/spl/php_spl.h:1.28  Wed Dec 31 11:12:36 2008
+++ php-src/ext/spl/php_spl.h   Mon Jan 26 11:37:46 2009
@@ -61,6 +61,9 @@
zval autoload_extensions;
HashTable *  autoload_functions;
int  autoload_running;
+   intptr_t hash_mask_handle;
+   intptr_t hash_mask_handlers;
+   int  hash_mask_init;
 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 /ext/spl php_spl.c

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

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  Fixed proto
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.146r2=1.147diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.146 php-src/ext/spl/php_spl.c:1.147
--- php-src/ext/spl/php_spl.c:1.146 Thu Nov 27 19:02:45 2008
+++ php-src/ext/spl/php_spl.c   Sun Nov 30 00:12:11 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.146 2008/11/27 19:02:45 dmitry Exp $ */
+/* $Id: php_spl.c,v 1.147 2008/11/30 00:12:11 bjori Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -79,7 +79,7 @@
return *ce;
 }
 
-/* {{{ proto array class_parents(object instance) U
+/* {{{ proto array class_parents(object instance [, boolean autoload = true]) U
  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 /ext/spl php_spl.c

2008-11-29 Thread Hannes Magnusson
bjori   Sun Nov 30 00:22:52 2008 UTC

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  Fix arginfo
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.147r2=1.148diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.147 php-src/ext/spl/php_spl.c:1.148
--- php-src/ext/spl/php_spl.c:1.147 Sun Nov 30 00:12:11 2008
+++ php-src/ext/spl/php_spl.c   Sun Nov 30 00:22:52 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.147 2008/11/30 00:12:11 bjori Exp $ */
+/* $Id: php_spl.c,v 1.148 2008/11/30 00:22:52 bjori Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -780,6 +780,7 @@
 
 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_parents, 0, 0, 1)
ZEND_ARG_INFO(0, instance)
+   ZEND_ARG_INFO(0, autoload)
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_implements, 0, 0, 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 php_spl.c

2008-08-23 Thread Felipe Pena
felipe  Sun Aug 24 04:18:23 2008 UTC

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Removed unused variable
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.140r2=1.141diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.140 php-src/ext/spl/php_spl.c:1.141
--- php-src/ext/spl/php_spl.c:1.140 Thu Aug 14 10:06:39 2008
+++ php-src/ext/spl/php_spl.c   Sun Aug 24 04:18:22 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.140 2008/08/14 10:06:39 helly Exp $ */
+/* $Id: php_spl.c,v 1.141 2008/08/24 04:18:22 felipe Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -373,7 +373,6 @@
ZVAL_ZSTRL(zclass_name, ZEND_STR_TYPE, class_name, class_name_len, 1);
if (SPL_G(autoload_functions)) {
int l_autoload_running = SPL_G(autoload_running);
-   zval *exception = NULL;
SPL_G(autoload_running) = 1;
lc_name = zend_u_str_tolower_dup(ZEND_STR_TYPE, class_name, 
class_name_len);
zend_hash_internal_pointer_reset_ex(SPL_G(autoload_functions), 
function_pos);



-- 
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 spl_iterators.c spl_iterators.h spl_observer.c spl_observer.h /ext/spl/examples multipleiterator.inc /ext/spl/internal multipleiterator.inc recursivetreeite

2008-07-22 Thread Marcus Boerger
helly   Tue Jul 22 22:54:15 2008 UTC

  Added files: 
/php-src/ext/spl/internal   multipleiterator.inc 
/php-src/ext/spl/tests  multiple_iterator_001.phpt 

  Removed files:   
/php-src/ext/spl/examples   multipleiterator.inc 

  Modified files:  
/php-src/ext/splphp_spl.c spl_iterators.c spl_iterators.h 
spl_observer.c spl_observer.h 
/php-src/ext/spl/internal   recursivetreeiterator.inc 
  Log:
  - Add MultipleIterator (Arnaud, Marcus)
  http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.136r2=1.137diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.136 php-src/ext/spl/php_spl.c:1.137
--- php-src/ext/spl/php_spl.c:1.136 Sun Jul 13 21:38:58 2008
+++ php-src/ext/spl/php_spl.c   Tue Jul 22 22:54:14 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.136 2008/07/13 21:38:58 helly Exp $ */
+/* $Id: php_spl.c,v 1.137 2008/07/22 22:54:14 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -150,14 +150,6 @@
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(SplHeap, z_list, sub, allow, ce_flags); \
-   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(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); \
@@ -174,6 +166,7 @@
SPL_ADD_CLASS(LengthException, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(LimitIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(LogicException, z_list, sub, allow, ce_flags); \
+   SPL_ADD_CLASS(MultipleIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(NoRewindIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(OuterIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(OutOfBoundsException, z_list, sub, allow, ce_flags); \
@@ -188,14 +181,23 @@
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(RecursiveTreeIterator, 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); \
+   SPL_ADD_CLASS(SplDoublyLinkedList, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(SplFileInfo, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(SplFileObject, z_list, sub, allow, ce_flags); \
+   SPL_ADD_CLASS(SplFixedArray, z_list, sub, allow, ce_flags); \
+   SPL_ADD_CLASS(SplHeap, z_list, sub, allow, ce_flags); \
+   SPL_ADD_CLASS(SplMinHeap, z_list, sub, allow, ce_flags); \
+   SPL_ADD_CLASS(SplMaxHeap, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(SplObjectStorage, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(SplObserver, z_list, sub, allow, ce_flags); \
+   SPL_ADD_CLASS(SplPriorityQueue, 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(SplSubject, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(SplTempFileObject, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(UnderflowException, z_list, sub, allow, ce_flags); \
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.173r2=1.174diff_format=u
Index: php-src/ext/spl/spl_iterators.c
diff -u php-src/ext/spl/spl_iterators.c:1.173 
php-src/ext/spl/spl_iterators.c:1.174
--- php-src/ext/spl/spl_iterators.c:1.173   Sat Jul 19 19:45:25 2008
+++ php-src/ext/spl/spl_iterators.c Tue Jul 22 22:54:14 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_iterators.c,v 1.173 2008/07/19 19:45:25 colder Exp $ */
+/* $Id: spl_iterators.c,v 1.174 2008/07/22 22:54:14 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -35,6 +35,7 @@
 #include 

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

2008-07-13 Thread Marcus Boerger
helly   Sun Jul 13 21:38:58 2008 UTC

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Use new helper
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.135r2=1.136diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.135 php-src/ext/spl/php_spl.c:1.136
--- php-src/ext/spl/php_spl.c:1.135 Sat Jul 12 14:58:06 2008
+++ php-src/ext/spl/php_spl.c   Sun Jul 13 21:38:58 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.135 2008/07/12 14:58:06 helly Exp $ */
+/* $Id: php_spl.c,v 1.136 2008/07/13 21:38:58 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -380,9 +380,7 @@

zend_hash_get_current_data_ex(SPL_G(autoload_functions), (void **) alfi, 
function_pos);
zend_u_call_method(alfi-obj ? alfi-obj : NULL, 
alfi-ce, alfi-func_ptr, func_name_type, func_name, func_name_len, retval, 
1, zclass_name, NULL TSRMLS_CC);
if (EG(exception)) {
-   if (exception) {
-   
zend_update_property(zend_exception_get_default(TSRMLS_C), EG(exception), 
previous, sizeof(previous)-1, exception TSRMLS_CC);
-   }
+   zend_exception_set_previous(exception 
TSRMLS_CC);
exception = EG(exception);
EG(exception) = 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 php_spl.c /ext/spl/tests spl_autoload_012.phpt

2008-07-12 Thread Marcus Boerger
helly   Sat Jul 12 14:58:07 2008 UTC

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

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Allow multiple exceptions in spl's autoload
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.134r2=1.135diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.134 php-src/ext/spl/php_spl.c:1.135
--- php-src/ext/spl/php_spl.c:1.134 Thu Jul  3 12:21:25 2008
+++ php-src/ext/spl/php_spl.c   Sat Jul 12 14:58:06 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.134 2008/07/03 12:21:25 felipe Exp $ */
+/* $Id: php_spl.c,v 1.135 2008/07/12 14:58:06 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -371,13 +371,21 @@
ZVAL_ZSTRL(zclass_name, ZEND_STR_TYPE, class_name, class_name_len, 1);
if (SPL_G(autoload_functions)) {
int l_autoload_running = SPL_G(autoload_running);
+   zval *exception = NULL;
SPL_G(autoload_running) = 1;
lc_name = zend_u_str_tolower_dup(ZEND_STR_TYPE, class_name, 
class_name_len);
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  !EG(exception)) {
+   while(zend_hash_has_more_elements_ex(SPL_G(autoload_functions), 
function_pos) == SUCCESS) {
func_name_type = 
zend_hash_get_current_key_ex(SPL_G(autoload_functions), func_name, 
func_name_len, dummy, 0, function_pos);

zend_hash_get_current_data_ex(SPL_G(autoload_functions), (void **) alfi, 
function_pos);
zend_u_call_method(alfi-obj ? alfi-obj : NULL, 
alfi-ce, alfi-func_ptr, func_name_type, func_name, func_name_len, retval, 
1, zclass_name, NULL TSRMLS_CC);
+   if (EG(exception)) {
+   if (exception) {
+   
zend_update_property(zend_exception_get_default(TSRMLS_C), EG(exception), 
previous, sizeof(previous)-1, exception TSRMLS_CC);
+   }
+   exception = EG(exception);
+   EG(exception) = NULL;
+   }
if (retval) {
zval_ptr_dtor(retval); 

}
@@ -386,6 +394,7 @@
}
zend_hash_move_forward_ex(SPL_G(autoload_functions), 
function_pos);
}
+   EG(exception) = exception;
efree(lc_name.v);
SPL_G(autoload_running) = l_autoload_running;
} else {

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/spl_autoload_012.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/spl_autoload_012.phpt
+++ php-src/ext/spl/tests/spl_autoload_012.phpt
--TEST--
SPL: spl_autoload() capturing multiple Exceptions in __autoload
--FILE--
?php

function autoload_first($name)
{
  echo __METHOD__ . \n;
  throw new Exception('first');
}

function autoload_second($name)
{
  echo __METHOD__ . \n;
  throw new Exception('second');
}

spl_autoload_register('autoload_first');
spl_autoload_register('autoload_second');

class_exists('ThisClassDoesNotExist');

?
===DONE===
--EXPECTF--
autoload_first
autoload_second

Fatal error: Uncaught exception 'Exception' with message 'first' in 
%sspl_autoload_012.php:%d
Stack trace:
#0 [internal function]: autoload_first('ThisClassDoesNo...')
#1 [internal function]: spl_autoload_call('ThisClassDoesNo...')
#2 %sspl_autoload_012.php(%d): class_exists('ThisClassDoesNo...')
#3 {main}

Next exception 'Exception' with message 'second' in %sspl_autoload_012.php:%d
Stack trace:
#0 [internal function]: autoload_second('ThisClassDoesNo...')
#1 [internal function]: spl_autoload_call('ThisClassDoesNo...')
#2 %sspl_autoload_012.php(%d): class_exists('ThisClassDoesNo...')
#3 {main}
  thrown in %sspl_autoload_012.php 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 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 php_spl.c

2008-04-29 Thread Dmitry Stogov
dmitry  Tue Apr 29 09:18:54 2008 UTC

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  Added missing lazy initialization
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.128r2=1.129diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.128 php-src/ext/spl/php_spl.c:1.129
--- php-src/ext/spl/php_spl.c:1.128 Wed Mar 26 14:46:16 2008
+++ php-src/ext/spl/php_spl.c   Tue Apr 29 09:18:54 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.128 2008/03/26 14:46:16 scottmac Exp $ */
+/* $Id: php_spl.c,v 1.129 2008/04/29 09:18:54 dmitry Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -238,6 +238,9 @@
if (new_op_array) {
EG(return_value_ptr_ptr) = result;
EG(active_op_array) = new_op_array;
+   if (!EG(active_symbol_table)) {
+   zend_rebuild_symbol_table(TSRMLS_C);
+   }
 
zend_execute(new_op_array 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 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 /ext/spl php_spl.c

2008-02-04 Thread Marcus Boerger
helly   Mon Feb  4 15:58:13 2008 UTC

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Fix message
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.124r2=1.125diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.124 php-src/ext/spl/php_spl.c:1.125
--- php-src/ext/spl/php_spl.c:1.124 Sat Feb  2 23:02:16 2008
+++ php-src/ext/spl/php_spl.c   Mon Feb  4 15:58:12 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.124 2008/02/02 23:02:16 helly Exp $ */
+/* $Id: php_spl.c,v 1.125 2008/02/04 15:58:12 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -447,7 +447,7 @@
RETURN_FALSE;
} else if (Z_TYPE_P(zcallable) == IS_STRING || 
Z_TYPE_P(zcallable) == IS_UNICODE) {
if (do_throw) {
-   
zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, Function '%R' not 
%s, (%s), Z_TYPE_P(zcallable), Z_UNIVAL_P(zcallable), alfi.func_ptr ? 
callable : found, error);
+   
zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, Function '%R' not 
%s (%s), Z_TYPE_P(zcallable), Z_UNIVAL_P(zcallable), alfi.func_ptr ? 
callable : found, error);
}
if (error) {
efree(error);

-- 
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-02-02 Thread Marcus Boerger
helly   Sat Feb  2 22:56:25 2008 UTC

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Add new classes
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.122r2=1.123diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.122 php-src/ext/spl/php_spl.c:1.123
--- php-src/ext/spl/php_spl.c:1.122 Sun Jan 27 15:03:55 2008
+++ php-src/ext/spl/php_spl.c   Sat Feb  2 22:56:25 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.122 2008/01/27 15:03:55 helly Exp $ */
+/* $Id: php_spl.c,v 1.123 2008/02/02 22:56:25 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -158,7 +158,9 @@
SPL_ADD_CLASS(DirectoryIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(DomainException, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(EmptyIterator, z_list, sub, allow, ce_flags); \
+   SPL_ADD_CLASS(FilesystemIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(FilterIterator, z_list, sub, allow, ce_flags); \
+   SPL_ADD_CLASS(GlobIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(InfiniteIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(InvalidArgumentException, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(IteratorIterator, z_list, sub, allow, ce_flags); \

-- 
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-02-02 Thread Marcus Boerger
helly   Sat Feb  2 23:02:16 2008 UTC

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Fix error handling
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.123r2=1.124diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.123 php-src/ext/spl/php_spl.c:1.124
--- php-src/ext/spl/php_spl.c:1.123 Sat Feb  2 22:56:25 2008
+++ php-src/ext/spl/php_spl.c   Sat Feb  2 23:02:16 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.123 2008/02/02 22:56:25 helly Exp $ */
+/* $Id: php_spl.c,v 1.124 2008/02/02 23:02:16 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -389,6 +389,7 @@
  Register given function as __autoload() implementation */
 PHP_FUNCTION(spl_autoload_register)
 {
+   char *error = NULL;
zval zfunc_name, ztmp;
zval *zcallable = NULL;
zend_bool do_throw = 1;
@@ -424,34 +425,49 @@
zval_dtor(ztmp);
}

-   if (!zend_is_callable_ex(zcallable, IS_CALLABLE_STRICT, 
zfunc_name, alfi.ce, alfi.func_ptr, obj_ptr TSRMLS_CC)) {
+   if (!zend_is_callable_ex(zcallable, IS_CALLABLE_STRICT, 
zfunc_name, alfi.ce, alfi.func_ptr, obj_ptr, error TSRMLS_CC)) {
if (Z_TYPE_P(zcallable) == IS_ARRAY) {
if (!obj_ptr  alfi.func_ptr  
!(alfi.func_ptr-common.fn_flags  ZEND_ACC_STATIC)) {
if (do_throw) {
-   
zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, Passed array 
specifies a non static method but no object);
+   
zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, Passed array 
specifies a non static method but no object (%s), error);
+   }
+   if (error) {
+   efree(error);
}
zval_dtor(zfunc_name);
RETURN_FALSE;
}
else if (do_throw) {
-   
zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, Passed array does 
not specify %s %smethod, alfi.func_ptr ? a callable : an existing, 
!obj_ptr ? static  : );
+   
zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, Passed array does 
not specify %s %smethod (%s), alfi.func_ptr ? a callable : an existing, 
!obj_ptr ? static  : , error);
+   }
+   if (error) {
+   efree(error);
}
zval_dtor(zfunc_name);
RETURN_FALSE;
} else if (Z_TYPE_P(zcallable) == IS_STRING || 
Z_TYPE_P(zcallable) == IS_UNICODE) {
if (do_throw) {
-   
zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, Function '%R' not 
%s, Z_TYPE_P(zcallable), Z_UNIVAL_P(zcallable), alfi.func_ptr ? callable : 
found);
+   
zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, Function '%R' not 
%s, (%s), Z_TYPE_P(zcallable), Z_UNIVAL_P(zcallable), alfi.func_ptr ? 
callable : found, error);
+   }
+   if (error) {
+   efree(error);
}
zval_dtor(zfunc_name);
RETURN_FALSE;
} else {
if (do_throw) {
-   
zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, Illegal value 
passed);
+   
zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, Illegal value 
passed (%s), error);
+   }
+   if (error) {
+   efree(error);
}
zval_dtor(zfunc_name);
RETURN_FALSE;
}
}
+   if (error) {
+   efree(error);
+   }

zend_u_str_tolower(Z_TYPE(zfunc_name), Z_UNIVAL(zfunc_name), 
Z_UNILEN(zfunc_name));
if (SPL_G(autoload_functions)  
zend_u_hash_exists(SPL_G(autoload_functions), Z_TYPE(zfunc_name), 
Z_UNIVAL(zfunc_name), Z_UNILEN(zfunc_name)+1)) {
@@ -512,6 +528,7 @@
  Unregister given function as __autoload() implementation */
 

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

2008-01-27 Thread Marcus Boerger
helly   Sun Jan 27 15:03:55 2008 UTC

  Modified files:  
/php-src/ext/splphp_spl.c php_spl.h 
/php-src/ext/tidy   php_tidy.h tidy.c 
  Log:
  - revert over constfying
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.121r2=1.122diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.121 php-src/ext/spl/php_spl.c:1.122
--- php-src/ext/spl/php_spl.c:1.121 Fri Jan 25 20:30:36 2008
+++ php-src/ext/spl/php_spl.c   Sun Jan 27 15:03:55 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.121 2008/01/25 20:30:36 nlopess Exp $ */
+/* $Id: php_spl.c,v 1.122 2008/01/27 15:03:55 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -781,7 +781,7 @@
 
 /* {{{ spl_module_entry
  */
-const zend_module_entry spl_module_entry = {
+zend_module_entry spl_module_entry = {
 #ifdef HAVE_SIMPLEXML
STANDARD_MODULE_HEADER_EX, NULL,
spl_deps,
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.h?r1=1.25r2=1.26diff_format=u
Index: php-src/ext/spl/php_spl.h
diff -u php-src/ext/spl/php_spl.h:1.25 php-src/ext/spl/php_spl.h:1.26
--- php-src/ext/spl/php_spl.h:1.25  Fri Jan 25 20:30:36 2008
+++ php-src/ext/spl/php_spl.h   Sun Jan 27 15:03:55 2008
@@ -28,7 +28,7 @@
 #define SPL_DEBUG(x)
 #endif
 
-extern const zend_module_entry spl_module_entry;
+extern zend_module_entry spl_module_entry;
 #define phpext_spl_ptr spl_module_entry
 
 #ifdef PHP_WIN32
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/php_tidy.h?r1=1.37r2=1.38diff_format=u
Index: php-src/ext/tidy/php_tidy.h
diff -u php-src/ext/tidy/php_tidy.h:1.37 php-src/ext/tidy/php_tidy.h:1.38
--- php-src/ext/tidy/php_tidy.h:1.37Fri Jan 25 20:30:36 2008
+++ php-src/ext/tidy/php_tidy.h Sun Jan 27 15:03:55 2008
@@ -16,12 +16,12 @@
   +--+
 */
 
-/* $Id: php_tidy.h,v 1.37 2008/01/25 20:30:36 nlopess Exp $ */
+/* $Id: php_tidy.h,v 1.38 2008/01/27 15:03:55 helly Exp $ */
 
 #ifndef PHP_TIDY_H
 #define PHP_TIDY_H
 
-extern const zend_module_entry tidy_module_entry;
+extern zend_module_entry tidy_module_entry;
 #define phpext_tidy_ptr tidy_module_entry
 
 #define TIDY_METHOD_MAP(name, func_name, arg_types) \
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.119r2=1.120diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.119 php-src/ext/tidy/tidy.c:1.120
--- php-src/ext/tidy/tidy.c:1.119   Fri Jan 25 20:30:36 2008
+++ php-src/ext/tidy/tidy.c Sun Jan 27 15:03:55 2008
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.119 2008/01/25 20:30:36 nlopess Exp $ */
+/* $Id: tidy.c,v 1.120 2008/01/27 15:03:55 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -359,7 +359,7 @@
 static zend_object_handlers tidy_object_handlers_doc;
 static zend_object_handlers tidy_object_handlers_node;
 
-const zend_module_entry tidy_module_entry = {
+zend_module_entry tidy_module_entry = {
STANDARD_MODULE_HEADER,
tidy,
tidy_functions,
@@ -1062,7 +1062,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.119 2008/01/25 20:30:36 nlopess Exp 
$));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.120 2008/01/27 15:03:55 helly Exp 
$));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();

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



Re: [PHP-CVS] cvs: php-src /ext/spl php_spl.c php_spl.h /ext/tidy php_tidy.h tidy.c

2008-01-27 Thread Nuno Lopes
Thank you for reverting this. It seems that the Zend engine really requires 
right access to these structures. The engine needs fixing first.

Thanks,
Nuno

- Original Message - 
From: Marcus Boerger [EMAIL PROTECTED]

To: php-cvs@lists.php.net
Sent: Sunday, January 27, 2008 3:03 PM
Subject: [PHP-CVS] cvs: php-src /ext/spl php_spl.c php_spl.h /ext/tidy 
php_tidy.h tidy.c




helly Sun Jan 27 15:03:55 2008 UTC

 Modified files:
   /php-src/ext/spl php_spl.c php_spl.h
   /php-src/ext/tidy php_tidy.h tidy.c
 Log:
 - revert over constfying

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.121r2=1.122diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.121 php-src/ext/spl/php_spl.c:1.122
--- php-src/ext/spl/php_spl.c:1.121 Fri Jan 25 20:30:36 2008
+++ php-src/ext/spl/php_spl.c Sun Jan 27 15:03:55 2008
@@ -16,7 +16,7 @@

+--+
 */

-/* $Id: php_spl.c,v 1.121 2008/01/25 20:30:36 nlopess Exp $ */
+/* $Id: php_spl.c,v 1.122 2008/01/27 15:03:55 helly Exp $ */

#ifdef HAVE_CONFIG_H
#include config.h
@@ -781,7 +781,7 @@

/* {{{ spl_module_entry
 */
-const zend_module_entry spl_module_entry = {
+zend_module_entry spl_module_entry = {
#ifdef HAVE_SIMPLEXML
 STANDARD_MODULE_HEADER_EX, NULL,
 spl_deps,
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.h?r1=1.25r2=1.26diff_format=u
Index: php-src/ext/spl/php_spl.h
diff -u php-src/ext/spl/php_spl.h:1.25 php-src/ext/spl/php_spl.h:1.26
--- php-src/ext/spl/php_spl.h:1.25 Fri Jan 25 20:30:36 2008
+++ php-src/ext/spl/php_spl.h Sun Jan 27 15:03:55 2008
@@ -28,7 +28,7 @@
#define SPL_DEBUG(x)
#endif

-extern const zend_module_entry spl_module_entry;
+extern zend_module_entry spl_module_entry;
#define phpext_spl_ptr spl_module_entry

#ifdef PHP_WIN32
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/php_tidy.h?r1=1.37r2=1.38diff_format=u
Index: php-src/ext/tidy/php_tidy.h
diff -u php-src/ext/tidy/php_tidy.h:1.37 php-src/ext/tidy/php_tidy.h:1.38
--- php-src/ext/tidy/php_tidy.h:1.37 Fri Jan 25 20:30:36 2008
+++ php-src/ext/tidy/php_tidy.h Sun Jan 27 15:03:55 2008
@@ -16,12 +16,12 @@
  +--+
*/

-/* $Id: php_tidy.h,v 1.37 2008/01/25 20:30:36 nlopess Exp $ */
+/* $Id: php_tidy.h,v 1.38 2008/01/27 15:03:55 helly Exp $ */

#ifndef PHP_TIDY_H
#define PHP_TIDY_H

-extern const zend_module_entry tidy_module_entry;
+extern zend_module_entry tidy_module_entry;
#define phpext_tidy_ptr tidy_module_entry

#define TIDY_METHOD_MAP(name, func_name, arg_types) \
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.119r2=1.120diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.119 php-src/ext/tidy/tidy.c:1.120
--- php-src/ext/tidy/tidy.c:1.119 Fri Jan 25 20:30:36 2008
+++ php-src/ext/tidy/tidy.c Sun Jan 27 15:03:55 2008
@@ -16,7 +16,7 @@
  +--+
*/

-/* $Id: tidy.c,v 1.119 2008/01/25 20:30:36 nlopess Exp $ */
+/* $Id: tidy.c,v 1.120 2008/01/27 15:03:55 helly Exp $ */

#ifdef HAVE_CONFIG_H
#include config.h
@@ -359,7 +359,7 @@
static zend_object_handlers tidy_object_handlers_doc;
static zend_object_handlers tidy_object_handlers_node;

-const zend_module_entry tidy_module_entry = {
+zend_module_entry tidy_module_entry = {
 STANDARD_MODULE_HEADER,
 tidy,
 tidy_functions,
@@ -1062,7 +1062,7 @@
 php_info_print_table_start();
 php_info_print_table_header(2, Tidy support, enabled);
 php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
- php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION 
 ($Id: tidy.c,v 1.119 2008/01/25 20:30:36 nlopess Exp $));
+ php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION 
 ($Id: tidy.c,v 1.120 2008/01/27 15:03:55 helly Exp $));

 php_info_print_table_end();

 DISPLAY_INI_ENTRIES();

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


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



Re: [PHP-CVS] cvs: php-src /ext/spl php_spl.c php_spl.h /ext/tidy php_tidy.h tidy.c

2008-01-27 Thread Marcus Boerger
Hello Nuno,

  it writes the module number in the structure. We could have the macros
create a static non const int that receives the module number and reference
that from the struct via a pointer, which would be compatible to the struct
being static const then.

marcus

Sunday, January 27, 2008, 6:08:47 PM, you wrote:

 Thank you for reverting this. It seems that the Zend engine really requires 
 right access to these structures. The engine needs fixing first.
 Thanks,
 Nuno

 - Original Message - 
 From: Marcus Boerger [EMAIL PROTECTED]
 To: php-cvs@lists.php.net
 Sent: Sunday, January 27, 2008 3:03 PM
 Subject: [PHP-CVS] cvs: php-src /ext/spl php_spl.c php_spl.h /ext/tidy 
 php_tidy.h tidy.c


 helly Sun Jan 27 15:03:55 2008 UTC

  Modified files:
/php-src/ext/spl php_spl.c php_spl.h
/php-src/ext/tidy php_tidy.h tidy.c
  Log:
  - revert over constfying

 http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.121r2=1.122diff_format=u
 Index: php-src/ext/spl/php_spl.c
 diff -u php-src/ext/spl/php_spl.c:1.121 php-src/ext/spl/php_spl.c:1.122
 --- php-src/ext/spl/php_spl.c:1.121 Fri Jan 25 20:30:36 2008
 +++ php-src/ext/spl/php_spl.c Sun Jan 27 15:03:55 2008
 @@ -16,7 +16,7 @@
 
 +--+
  */

 -/* $Id: php_spl.c,v 1.121 2008/01/25 20:30:36 nlopess Exp $ */
 +/* $Id: php_spl.c,v 1.122 2008/01/27 15:03:55 helly Exp $ */

 #ifdef HAVE_CONFIG_H
 #include config.h
 @@ -781,7 +781,7 @@

 /* {{{ spl_module_entry
  */
 -const zend_module_entry spl_module_entry = {
 +zend_module_entry spl_module_entry = {
 #ifdef HAVE_SIMPLEXML
  STANDARD_MODULE_HEADER_EX, NULL,
  spl_deps,
 http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.h?r1=1.25r2=1.26diff_format=u
 Index: php-src/ext/spl/php_spl.h
 diff -u php-src/ext/spl/php_spl.h:1.25 php-src/ext/spl/php_spl.h:1.26
 --- php-src/ext/spl/php_spl.h:1.25 Fri Jan 25 20:30:36 2008
 +++ php-src/ext/spl/php_spl.h Sun Jan 27 15:03:55 2008
 @@ -28,7 +28,7 @@
 #define SPL_DEBUG(x)
 #endif

 -extern const zend_module_entry spl_module_entry;
 +extern zend_module_entry spl_module_entry;
 #define phpext_spl_ptr spl_module_entry

 #ifdef PHP_WIN32
 http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/php_tidy.h?r1=1.37r2=1.38diff_format=u
 Index: php-src/ext/tidy/php_tidy.h
 diff -u php-src/ext/tidy/php_tidy.h:1.37 php-src/ext/tidy/php_tidy.h:1.38
 --- php-src/ext/tidy/php_tidy.h:1.37 Fri Jan 25 20:30:36 2008
 +++ php-src/ext/tidy/php_tidy.h Sun Jan 27 15:03:55 2008
 @@ -16,12 +16,12 @@
   +--+
 */

 -/* $Id: php_tidy.h,v 1.37 2008/01/25 20:30:36 nlopess Exp $ */
 +/* $Id: php_tidy.h,v 1.38 2008/01/27 15:03:55 helly Exp $ */

 #ifndef PHP_TIDY_H
 #define PHP_TIDY_H

 -extern const zend_module_entry tidy_module_entry;
 +extern zend_module_entry tidy_module_entry;
 #define phpext_tidy_ptr tidy_module_entry

 #define TIDY_METHOD_MAP(name, func_name, arg_types) \
 http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.119r2=1.120diff_format=u
 Index: php-src/ext/tidy/tidy.c
 diff -u php-src/ext/tidy/tidy.c:1.119 php-src/ext/tidy/tidy.c:1.120
 --- php-src/ext/tidy/tidy.c:1.119 Fri Jan 25 20:30:36 2008
 +++ php-src/ext/tidy/tidy.c Sun Jan 27 15:03:55 2008
 @@ -16,7 +16,7 @@
   +--+
 */

 -/* $Id: tidy.c,v 1.119 2008/01/25 20:30:36 nlopess Exp $ */
 +/* $Id: tidy.c,v 1.120 2008/01/27 15:03:55 helly Exp $ */

 #ifdef HAVE_CONFIG_H
 #include config.h
 @@ -359,7 +359,7 @@
 static zend_object_handlers tidy_object_handlers_doc;
 static zend_object_handlers tidy_object_handlers_node;

 -const zend_module_entry tidy_module_entry = {
 +zend_module_entry tidy_module_entry = {
  STANDARD_MODULE_HEADER,
  tidy,
  tidy_functions,
 @@ -1062,7 +1062,7 @@
  php_info_print_table_start();
  php_info_print_table_header(2, Tidy support, enabled);
  php_info_print_table_row(2, libTidy Release, (char 
 *)tidyReleaseDate());
 - php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION 
  ($Id: tidy.c,v 1.119 2008/01/25 20:30:36 nlopess Exp $));
 + php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION 
  ($Id: tidy.c,v 1.120 2008/01/27 15:03:55 helly Exp $));
  php_info_print_table_end();

  DISPLAY_INI_ENTRIES();

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




Best regards,
 Marcus

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



Re: [PHP-CVS] cvs: php-src /ext/spl php_spl.c php_spl.h /ext/tidy php_tidy.h tidy.c

2008-01-27 Thread Nuno Lopes
I'll take a look into that to see how feasible it is and if it presents any 
useful gains.


Thanks,
Nuno


- Original Message -

Hello Nuno,

 it writes the module number in the structure. We could have the macros
create a static non const int that receives the module number and 
reference
that from the struct via a pointer, which would be compatible to the 
struct

being static const then.

marcus

Sunday, January 27, 2008, 6:08:47 PM, you wrote:

Thank you for reverting this. It seems that the Zend engine really 
requires

right access to these structures. The engine needs fixing first.
Thanks,
Nuno


- Original Message - 
From: Marcus Boerger [EMAIL PROTECTED]

To: php-cvs@lists.php.net
Sent: Sunday, January 27, 2008 3:03 PM
Subject: [PHP-CVS] cvs: php-src /ext/spl php_spl.c php_spl.h /ext/tidy
php_tidy.h tidy.c




helly Sun Jan 27 15:03:55 2008 UTC

 Modified files:
   /php-src/ext/spl php_spl.c php_spl.h
   /php-src/ext/tidy php_tidy.h tidy.c
 Log:
 - revert over constfying

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.121r2=1.122diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.121 php-src/ext/spl/php_spl.c:1.122
--- php-src/ext/spl/php_spl.c:1.121 Fri Jan 25 20:30:36 2008
+++ php-src/ext/spl/php_spl.c Sun Jan 27 15:03:55 2008
@@ -16,7 +16,7 @@

+--+
 */

-/* $Id: php_spl.c,v 1.121 2008/01/25 20:30:36 nlopess Exp $ */
+/* $Id: php_spl.c,v 1.122 2008/01/27 15:03:55 helly Exp $ */

#ifdef HAVE_CONFIG_H
#include config.h
@@ -781,7 +781,7 @@

/* {{{ spl_module_entry
 */
-const zend_module_entry spl_module_entry = {
+zend_module_entry spl_module_entry = {
#ifdef HAVE_SIMPLEXML
 STANDARD_MODULE_HEADER_EX, NULL,
 spl_deps,
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.h?r1=1.25r2=1.26diff_format=u
Index: php-src/ext/spl/php_spl.h
diff -u php-src/ext/spl/php_spl.h:1.25 php-src/ext/spl/php_spl.h:1.26
--- php-src/ext/spl/php_spl.h:1.25 Fri Jan 25 20:30:36 2008
+++ php-src/ext/spl/php_spl.h Sun Jan 27 15:03:55 2008
@@ -28,7 +28,7 @@
#define SPL_DEBUG(x)
#endif

-extern const zend_module_entry spl_module_entry;
+extern zend_module_entry spl_module_entry;
#define phpext_spl_ptr spl_module_entry

#ifdef PHP_WIN32
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/php_tidy.h?r1=1.37r2=1.38diff_format=u
Index: php-src/ext/tidy/php_tidy.h
diff -u php-src/ext/tidy/php_tidy.h:1.37 
php-src/ext/tidy/php_tidy.h:1.38

--- php-src/ext/tidy/php_tidy.h:1.37 Fri Jan 25 20:30:36 2008
+++ php-src/ext/tidy/php_tidy.h Sun Jan 27 15:03:55 2008
@@ -16,12 +16,12 @@

+--+
*/

-/* $Id: php_tidy.h,v 1.37 2008/01/25 20:30:36 nlopess Exp $ */
+/* $Id: php_tidy.h,v 1.38 2008/01/27 15:03:55 helly Exp $ */

#ifndef PHP_TIDY_H
#define PHP_TIDY_H

-extern const zend_module_entry tidy_module_entry;
+extern zend_module_entry tidy_module_entry;
#define phpext_tidy_ptr tidy_module_entry

#define TIDY_METHOD_MAP(name, func_name, arg_types) \
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.119r2=1.120diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.119 php-src/ext/tidy/tidy.c:1.120
--- php-src/ext/tidy/tidy.c:1.119 Fri Jan 25 20:30:36 2008
+++ php-src/ext/tidy/tidy.c Sun Jan 27 15:03:55 2008
@@ -16,7 +16,7 @@

+--+
*/

-/* $Id: tidy.c,v 1.119 2008/01/25 20:30:36 nlopess Exp $ */
+/* $Id: tidy.c,v 1.120 2008/01/27 15:03:55 helly Exp $ */

#ifdef HAVE_CONFIG_H
#include config.h
@@ -359,7 +359,7 @@
static zend_object_handlers tidy_object_handlers_doc;
static zend_object_handlers tidy_object_handlers_node;

-const zend_module_entry tidy_module_entry = {
+zend_module_entry tidy_module_entry = {
 STANDARD_MODULE_HEADER,
 tidy,
 tidy_functions,
@@ -1062,7 +1062,7 @@
 php_info_print_table_start();
 php_info_print_table_header(2, Tidy support, enabled);
 php_info_print_table_row(2, libTidy Release, (char
*)tidyReleaseDate());
- php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION

 ($Id: tidy.c,v 1.119 2008/01/25 20:30:36 nlopess Exp $));
+ php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION

 ($Id: tidy.c,v 1.120 2008/01/27 15:03:55 helly Exp $));
 php_info_print_table_end();

 DISPLAY_INI_ENTRIES(); 


--
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 php_spl.h /ext/tidy php_tidy.h tidy.c

2008-01-25 Thread Nuno Lopes
nlopess Fri Jan 25 20:30:36 2008 UTC

  Modified files:  
/php-src/ext/splphp_spl.c php_spl.h 
/php-src/ext/tidy   php_tidy.h tidy.c 
  Log:
  MFB: const keywording
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.120r2=1.121diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.120 php-src/ext/spl/php_spl.c:1.121
--- php-src/ext/spl/php_spl.c:1.120 Tue Jan 15 09:37:50 2008
+++ php-src/ext/spl/php_spl.c   Fri Jan 25 20:30:36 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.120 2008/01/15 09:37:50 colder Exp $ */
+/* $Id: php_spl.c,v 1.121 2008/01/25 20:30:36 nlopess Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -46,13 +46,6 @@
 
 ZEND_DECLARE_MODULE_GLOBALS(spl)
 
-/* {{{ spl_functions_none
- */
-const zend_function_entry spl_functions_none[] = {
-   {NULL, NULL, NULL}
-};
-/* }}} */
-
 /* {{{ PHP_GINIT_FUNCTION
  */
 static PHP_GINIT_FUNCTION(spl)
@@ -788,7 +781,7 @@
 
 /* {{{ spl_module_entry
  */
-zend_module_entry spl_module_entry = {
+const zend_module_entry spl_module_entry = {
 #ifdef HAVE_SIMPLEXML
STANDARD_MODULE_HEADER_EX, NULL,
spl_deps,
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.h?r1=1.24r2=1.25diff_format=u
Index: php-src/ext/spl/php_spl.h
diff -u php-src/ext/spl/php_spl.h:1.24 php-src/ext/spl/php_spl.h:1.25
--- php-src/ext/spl/php_spl.h:1.24  Mon Dec 31 07:12:14 2007
+++ php-src/ext/spl/php_spl.h   Fri Jan 25 20:30:36 2008
@@ -28,7 +28,7 @@
 #define SPL_DEBUG(x)
 #endif
 
-extern zend_module_entry spl_module_entry;
+extern const zend_module_entry spl_module_entry;
 #define phpext_spl_ptr spl_module_entry
 
 #ifdef PHP_WIN32
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/php_tidy.h?r1=1.36r2=1.37diff_format=u
Index: php-src/ext/tidy/php_tidy.h
diff -u php-src/ext/tidy/php_tidy.h:1.36 php-src/ext/tidy/php_tidy.h:1.37
--- php-src/ext/tidy/php_tidy.h:1.36Mon Dec 31 07:12:17 2007
+++ php-src/ext/tidy/php_tidy.h Fri Jan 25 20:30:36 2008
@@ -16,12 +16,12 @@
   +--+
 */
 
-/* $Id: php_tidy.h,v 1.36 2007/12/31 07:12:17 sebastian Exp $ */
+/* $Id: php_tidy.h,v 1.37 2008/01/25 20:30:36 nlopess Exp $ */
 
 #ifndef PHP_TIDY_H
 #define PHP_TIDY_H
 
-extern zend_module_entry tidy_module_entry;
+extern const zend_module_entry tidy_module_entry;
 #define phpext_tidy_ptr tidy_module_entry
 
 #define TIDY_METHOD_MAP(name, func_name, arg_types) \
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.118r2=1.119diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.118 php-src/ext/tidy/tidy.c:1.119
--- php-src/ext/tidy/tidy.c:1.118   Mon Dec 31 07:12:17 2007
+++ php-src/ext/tidy/tidy.c Fri Jan 25 20:30:36 2008
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.118 2007/12/31 07:12:17 sebastian Exp $ */
+/* $Id: tidy.c,v 1.119 2008/01/25 20:30:36 nlopess Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -359,7 +359,7 @@
 static zend_object_handlers tidy_object_handlers_doc;
 static zend_object_handlers tidy_object_handlers_node;
 
-zend_module_entry tidy_module_entry = {
+const zend_module_entry tidy_module_entry = {
STANDARD_MODULE_HEADER,
tidy,
tidy_functions,
@@ -1062,7 +1062,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.118 2007/12/31 07:12:17 sebastian 
Exp $));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.119 2008/01/25 20:30:36 nlopess Exp 
$));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();

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

2007-11-01 Thread Jani Taskinen
janiThu Nov  1 22:31:40 2007 UTC

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - CPP macros are supposed to start at column 1 (# at least)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.116r2=1.117diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.116 php-src/ext/spl/php_spl.c:1.117
--- php-src/ext/spl/php_spl.c:1.116 Sun Oct  7 05:15:05 2007
+++ php-src/ext/spl/php_spl.c   Thu Nov  1 22:31:39 2007
@@ -16,10 +16,10 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.116 2007/10/07 05:15:05 davidw Exp $ */
+/* $Id: php_spl.c,v 1.117 2007/11/01 22:31:39 jani Exp $ */
 
 #ifdef HAVE_CONFIG_H
-   #include config.h
+#include config.h
 #endif
 
 #include php.h

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

2007-04-09 Thread Dmitry Stogov
dmitry  Mon Apr  9 15:33:59 2007 UTC

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  Usage of sizeof(void*) is not portable
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.113r2=1.114diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.113 php-src/ext/spl/php_spl.c:1.114
--- php-src/ext/spl/php_spl.c:1.113 Fri Apr  6 21:07:48 2007
+++ php-src/ext/spl/php_spl.c   Mon Apr  9 15:33:59 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.113 2007/04/06 21:07:48 helly Exp $ */
+/* $Id: php_spl.c,v 1.114 2007/04/09 15:33:59 dmitry Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -549,7 +549,7 @@
if (success != SUCCESS  obj_ptr) {
size_t func_name_len = Z_UNISIZE(zfunc_name);
lc_name.v = erealloc(lc_name.v, func_name_len + 
2 + sizeof(zend_object_handle));
-   memcpy(lc_name.v + func_name_len, 
Z_OBJ_HANDLE_PP(obj_ptr), sizeof(zend_object_handle));
+   memcpy(lc_name.s + func_name_len, 
Z_OBJ_HANDLE_PP(obj_ptr), sizeof(zend_object_handle));
func_name_len += sizeof(zend_object_handle);
if (Z_TYPE(zfunc_name) == IS_UNICODE) {
func_name_len /= sizeof(UChar);

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



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

2007-04-09 Thread Marcus Boerger
Hello Dmitry,


 thanks for this fix

best regards
marcus

Monday, April 9, 2007, 5:33:59 PM, you wrote:

 dmitry  Mon Apr  9 15:33:59 2007 UTC

   Modified files:  
 /php-src/ext/splphp_spl.c 
   Log:
   Usage of sizeof(void*) is not portable
   
   
 http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.113r2=1.114diff_format=u
 Index: php-src/ext/spl/php_spl.c
 diff -u php-src/ext/spl/php_spl.c:1.113 php-src/ext/spl/php_spl.c:1.114
 --- php-src/ext/spl/php_spl.c:1.113 Fri Apr  6 21:07:48 2007
 +++ php-src/ext/spl/php_spl.c   Mon Apr  9 15:33:59 2007
 @@ -16,7 +16,7 @@
 +--+
   */
  
 -/* $Id: php_spl.c,v 1.113 2007/04/06 21:07:48 helly Exp $ */
 +/* $Id: php_spl.c,v 1.114 2007/04/09 15:33:59 dmitry Exp $ */
  
  #ifdef HAVE_CONFIG_H
 #include config.h
 @@ -549,7 +549,7 @@
 if (success != SUCCESS  obj_ptr) {
 size_t func_name_len = Z_UNISIZE(zfunc_name);
 lc_name.v = erealloc(lc_name.v,
 func_name_len + 2 + sizeof(zend_object_handle));
 -   memcpy(lc_name.v + func_name_len,
 Z_OBJ_HANDLE_PP(obj_ptr), sizeof(zend_object_handle));
 +   memcpy(lc_name.s + func_name_len,
 Z_OBJ_HANDLE_PP(obj_ptr), sizeof(zend_object_handle));
 func_name_len += sizeof(zend_object_handle);
 if (Z_TYPE(zfunc_name) == IS_UNICODE) {
 func_name_len /= sizeof(UChar);




Best regards,
 Marcus

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

2007-04-06 Thread Marcus Boerger
helly   Fri Apr  6 19:04:53 2007 UTC

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Fix types
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.110r2=1.111diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.110 php-src/ext/spl/php_spl.c:1.111
--- php-src/ext/spl/php_spl.c:1.110 Fri Apr  6 18:50:07 2007
+++ php-src/ext/spl/php_spl.c   Fri Apr  6 19:04:53 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.110 2007/04/06 18:50:07 helly Exp $ */
+/* $Id: php_spl.c,v 1.111 2007/04/06 19:04:53 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -546,9 +546,9 @@
success = zend_u_hash_del(SPL_G(autoload_functions), 
Z_TYPE(zfunc_name), lc_name, Z_UNILEN(zfunc_name)+1);
if (success != SUCCESS  obj_ptr) {
size_t func_name_len = Z_UNISIZE(zfunc_name);
-   lc_name.v = erealloc(lc_name.v, func_name_len + 
1 + sizeof(long));
-   memcpy(lc_name.v + func_name_len, 
Z_OBJ_HANDLE_PP(obj_ptr), sizeof(long));
-   func_name_len += sizeof(long);
+   lc_name.v = erealloc(lc_name.v, func_name_len + 
1 + sizeof(zend_object_handle));
+   memcpy(lc_name.v + func_name_len, 
Z_OBJ_HANDLE_PP(obj_ptr), sizeof(zend_object_handle));
+   func_name_len += sizeof(zend_object_handle);
lc_name.s[func_name_len] = '\0';
if (Z_TYPE(zfunc_name) == IS_UNICODE) {
func_name_len /= sizeof(UChar);


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

2007-04-06 Thread Marcus Boerger
helly   Fri Apr  6 21:02:20 2007 UTC

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Fix unicode issue (our string termination test checks both ending bytes 
instead of just one)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.111r2=1.112diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.111 php-src/ext/spl/php_spl.c:1.112
--- php-src/ext/spl/php_spl.c:1.111 Fri Apr  6 19:04:53 2007
+++ php-src/ext/spl/php_spl.c   Fri Apr  6 21:02:20 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.111 2007/04/06 19:04:53 helly Exp $ */
+/* $Id: php_spl.c,v 1.112 2007/04/06 21:02:20 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -466,16 +466,18 @@
/* add object id to the hash to ensure uniqueness, for 
more reference look at bug #40091 */
zstr lc_name;
size_t func_name_len = Z_UNISIZE(zfunc_name);
-   lc_name.v = Z_UNIVAL(zfunc_name).v = 
erealloc(Z_UNIVAL(zfunc_name).v, func_name_len + 1 + sizeof(long));
+   lc_name.v = Z_UNIVAL(zfunc_name).v = 
erealloc(Z_UNIVAL(zfunc_name).v, func_name_len + 2 + 
sizeof(zend_object_handle));
memcpy(lc_name.s + func_name_len, 
Z_OBJ_HANDLE_PP(obj_ptr), sizeof(zend_object_handle));
func_name_len += sizeof(zend_object_handle);
-   lc_name.s[func_name_len] = '\0';
alfi.obj = *obj_ptr;
alfi.obj-refcount++;
if (Z_TYPE(zfunc_name) == IS_UNICODE) {
-   Z_UNILEN(zfunc_name) = func_name_len / 
sizeof(UChar);
+   func_name_len /= sizeof(UChar);
+   Z_STRLEN(zfunc_name) = func_name_len;
+   lc_name.u[func_name_len] = '\0';
} else {
-   Z_UNILEN(zfunc_name) = func_name_len;
+   Z_STRLEN(zfunc_name) = func_name_len;
+   lc_name.s[func_name_len] = '\0';
}
} else {
alfi.obj = 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 php_spl.c

2007-04-06 Thread Marcus Boerger
helly   Fri Apr  6 21:07:48 2007 UTC

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Fix unicode issue in unregister according to register solution
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.112r2=1.113diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.112 php-src/ext/spl/php_spl.c:1.113
--- php-src/ext/spl/php_spl.c:1.112 Fri Apr  6 21:02:20 2007
+++ php-src/ext/spl/php_spl.c   Fri Apr  6 21:07:48 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.112 2007/04/06 21:02:20 helly Exp $ */
+/* $Id: php_spl.c,v 1.113 2007/04/06 21:07:48 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -474,7 +474,7 @@
if (Z_TYPE(zfunc_name) == IS_UNICODE) {
func_name_len /= sizeof(UChar);
Z_STRLEN(zfunc_name) = func_name_len;
-   lc_name.u[func_name_len] = '\0';
+   lc_name.u[func_name_len] = 0;
} else {
Z_STRLEN(zfunc_name) = func_name_len;
lc_name.s[func_name_len] = '\0';
@@ -548,12 +548,14 @@
success = zend_u_hash_del(SPL_G(autoload_functions), 
Z_TYPE(zfunc_name), lc_name, Z_UNILEN(zfunc_name)+1);
if (success != SUCCESS  obj_ptr) {
size_t func_name_len = Z_UNISIZE(zfunc_name);
-   lc_name.v = erealloc(lc_name.v, func_name_len + 
1 + sizeof(zend_object_handle));
+   lc_name.v = erealloc(lc_name.v, func_name_len + 
2 + sizeof(zend_object_handle));
memcpy(lc_name.v + func_name_len, 
Z_OBJ_HANDLE_PP(obj_ptr), sizeof(zend_object_handle));
func_name_len += sizeof(zend_object_handle);
-   lc_name.s[func_name_len] = '\0';
if (Z_TYPE(zfunc_name) == IS_UNICODE) {
func_name_len /= sizeof(UChar);
+   lc_name.u[func_name_len] = 0;
+   } else {
+   lc_name.s[func_name_len] = '\0';
}
success = 
zend_u_hash_del(SPL_G(autoload_functions), Z_TYPE(zfunc_name), lc_name, 
func_name_len+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 php_spl.c php_spl.h spl_observer.c /ext/spl/tests observer_004.phpt observer_005.phpt

2007-01-19 Thread Marcus Boerger
helly   Fri Jan 19 23:23:08 2007 UTC

  Modified files:  
/php-src/ext/splphp_spl.c php_spl.h spl_observer.c 
/php-src/ext/spl/tests  observer_004.phpt observer_005.phpt 
  Log:
  - Make use of get_debug_info handler in SplObjectStorage
  http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.108r2=1.109diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.108 php-src/ext/spl/php_spl.c:1.109
--- php-src/ext/spl/php_spl.c:1.108 Fri Jan 12 22:28:05 2007
+++ php-src/ext/spl/php_spl.c   Fri Jan 19 23:23:08 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.108 2007/01/12 22:28:05 helly Exp $ */
+/* $Id: php_spl.c,v 1.109 2007/01/19 23:23:08 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -593,16 +593,26 @@
 PHP_FUNCTION(spl_object_hash)
 {
zval *obj;
-   int len;
-   char *hash;
-   char md5str[33];
-   PHP_MD5_CTX context;
-   unsigned char digest[16];
+   char* md5str;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, o, obj) == 
FAILURE) {
return;
}
 
+   md5str = emalloc(33);
+   php_spl_object_hash(obj, md5str TSRMLS_CC);
+
+   RETVAL_STRING(md5str, 0);
+}
+/* }}} */
+
+PHPAPI void php_spl_object_hash(zval *obj, char *md5str TSRMLS_DC) /* {{{*/
+{
+   int len;
+   char *hash;
+   PHP_MD5_CTX context;
+   unsigned char digest[16];
+
len = spprintf(hash, 0, %p:%d, Z_OBJ_HT_P(obj), Z_OBJ_HANDLE_P(obj));

md5str[0] = '\0';
@@ -610,9 +620,9 @@
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) /* {{{ */
 {
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.h?r1=1.22r2=1.23diff_format=u
Index: php-src/ext/spl/php_spl.h
diff -u php-src/ext/spl/php_spl.h:1.22 php-src/ext/spl/php_spl.h:1.23
--- php-src/ext/spl/php_spl.h:1.22  Mon Jan  1 09:29:29 2007
+++ php-src/ext/spl/php_spl.h   Fri Jan 19 23:23:08 2007
@@ -73,6 +73,8 @@
 PHP_FUNCTION(class_parents);
 PHP_FUNCTION(class_implements);
 
+PHPAPI void php_spl_object_hash(zval *obj, char* md5str TSRMLS_DC);
+
 #endif /* PHP_SPL_H */
 
 /*
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_observer.c?r1=1.15r2=1.16diff_format=u
Index: php-src/ext/spl/spl_observer.c
diff -u php-src/ext/spl/spl_observer.c:1.15 php-src/ext/spl/spl_observer.c:1.16
--- php-src/ext/spl/spl_observer.c:1.15 Mon Jan  1 09:29:29 2007
+++ php-src/ext/spl/spl_observer.c  Fri Jan 19 23:23:08 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_observer.c,v 1.15 2007/01/01 09:29:29 sebastian Exp $ */
+/* $Id: spl_observer.c,v 1.16 2007/01/19 23:23:08 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -116,6 +116,53 @@
 }
 /* }}} */
 
+static HashTable* spl_object_storage_debug_infos(zval *obj, int *is_temp 
TSRMLS_DC) /* {{{ */
+{
+   spl_SplObjectStorage *intern = 
(spl_SplObjectStorage*)zend_object_store_get_object(obj TSRMLS_CC);
+   HashTable *rv, *props;
+   HashPosition pos;
+   zval *tmp, *storage, **entry;
+   char md5str[33], *name;
+   int name_len;
+   zstr zname, zclass, zprop;
+
+   *is_temp = 1;
+
+   props = Z_OBJPROP_P(obj);
+   ALLOC_HASHTABLE(rv);
+   ZEND_INIT_SYMTABLE_EX(rv, zend_hash_num_elements(props) + 1, 0);
+   
+   zend_hash_copy(rv, props, (copy_ctor_func_t) zval_add_ref, (void *) 
tmp, sizeof(zval *));
+
+   MAKE_STD_ZVAL(storage);
+   array_init(storage);
+
+   zend_hash_internal_pointer_reset_ex(intern-storage, pos);
+   while (zend_hash_get_current_data_ex(intern-storage, (void **)entry, 
pos) == SUCCESS) {
+   php_spl_object_hash(*entry, md5str TSRMLS_CC);
+   zval_add_ref(entry);
+   add_assoc_zval_ex(storage, md5str, 33, *entry);
+   zend_hash_move_forward_ex(intern-storage, pos);
+   }
+
+   if (UG(unicode)) {
+   zclass.u = USTR_MAKE(SplObjectStorage);
+   zprop.u = USTR_MAKE(storage);
+   zend_u_mangle_property_name(zname, name_len, IS_UNICODE, 
zclass, sizeof(SplObjectStorage)-1, zprop, sizeof(storage)-1, 0);
+   zend_u_symtable_update(rv, IS_UNICODE, zname, name_len+1, 
storage, sizeof(zval *), NULL);
+   efree(zname.v);
+   efree(zclass.v);
+   efree(zprop.v);
+   } else {
+   zend_mangle_property_name(name, name_len, SplObjectStorage, 
sizeof(SplObjectStorage)-1, storage, sizeof(storage)-1, 0);
+   zend_symtable_update(rv, name, name_len+1, storage, 
sizeof(zval *), NULL);
+   efree(name);
+   }
+
+   return 

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

2007-01-12 Thread Marcus Boerger
helly   Fri Jan 12 22:28:06 2007 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.107r2=1.108diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.107 php-src/ext/spl/php_spl.c:1.108
--- php-src/ext/spl/php_spl.c:1.107 Tue Jan  9 18:38:38 2007
+++ php-src/ext/spl/php_spl.c   Fri Jan 12 22:28:05 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.107 2007/01/09 18:38:38 helly Exp $ */
+/* $Id: php_spl.c,v 1.108 2007/01/12 22:28:05 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -215,7 +215,7 @@
zval *result = NULL;
int ret;
 
-   /* UTODO: Wewant the stream toacept a zstrfor opening */
+   /* UTODO: We want the stream to acept a zstr for opening */
class_file_len = spprintf(class_file, 0, %v%v, lc_name, 
file_extension);
 
ret = php_stream_open_for_zend_ex(class_file, file_handle, 
ENFORCE_SAFE_MODE|USE_PATH|STREAM_OPEN_FOR_INCLUDE 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 php_spl.c spl_array.c /ext/spl/tests bug40036.phpt /main main.c php_main.h

2007-01-09 Thread Marcus Boerger
helly   Tue Jan  9 18:38:38 2007 UTC

  Modified files:  
/php-src/ext/splphp_spl.c spl_array.c 
/php-src/ext/spl/tests  bug40036.phpt 
/php-src/main   main.c php_main.h 
  Log:
  - MFH (Ilia's changes)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.106r2=1.107diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.106 php-src/ext/spl/php_spl.c:1.107
--- php-src/ext/spl/php_spl.c:1.106 Mon Jan  1 09:29:29 2007
+++ php-src/ext/spl/php_spl.c   Tue Jan  9 18:38:38 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.106 2007/01/01 09:29:29 sebastian Exp $ */
+/* $Id: php_spl.c,v 1.107 2007/01/09 18:38:38 helly 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
@@ -212,24 +213,12 @@
zend_file_handle file_handle;
zend_op_array *new_op_array;
zval *result = NULL;
-   zval err_mode;
int ret;
 
/* UTODO: Wewant the stream toacept a zstrfor opening */
class_file_len = spprintf(class_file, 0, %v%v, 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 TSRMLS_CC);
 
if (ret == SUCCESS) {
if (!file_handle.opened_path) {
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.116r2=1.117diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.116 php-src/ext/spl/spl_array.c:1.117
--- php-src/ext/spl/spl_array.c:1.116   Tue Jan  2 18:15:22 2007
+++ php-src/ext/spl/spl_array.c Tue Jan  9 18:38:38 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.116 2007/01/02 18:15:22 helly Exp $ */
+/* $Id: spl_array.c,v 1.117 2007/01/09 18:38:38 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -481,7 +481,16 @@
switch(Z_TYPE_P(offset)) {
case IS_STRING:
case IS_UNICODE:
-   return zend_u_symtable_exists(spl_array_get_hash_table(intern, 
0 TSRMLS_CC), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1);
+   if (check_empty) {
+   zval **tmp;
+   HashTable *ht = spl_array_get_hash_table(intern, 0 
TSRMLS_CC);
+   if (zend_u_hash_find(ht, Z_TYPE_P(offset), 
Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, (void **) tmp) != FAILURE  
zend_is_true(*tmp)) {
+   return 1;
+   }
+   return 0;
+   } else {
+   return 
zend_u_symtable_exists(spl_array_get_hash_table(intern, 0 TSRMLS_CC), 
Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1);
+   }
case IS_DOUBLE:
case IS_RESOURCE:
case IS_BOOL: 
@@ -491,7 +500,16 @@
} else {
index = Z_LVAL_P(offset);
}
-   return zend_hash_index_exists(spl_array_get_hash_table(intern, 
0 TSRMLS_CC), index);
+   if (check_empty) {
+   zval **tmp;
+   HashTable *ht = spl_array_get_hash_table(intern, 0 
TSRMLS_CC);
+   if (zend_hash_index_find(ht, index, (void **)tmp) != 
FAILURE  zend_is_true(*tmp)) {
+   return 1;
+   }
+   return 0;
+   } else {
+   return 
zend_hash_index_exists(spl_array_get_hash_table(intern, 0 TSRMLS_CC), index);
+   }
default:
zend_error(E_WARNING, Illegal offset type);
}
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug40036.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/spl/tests/bug40036.phpt
diff -u /dev/null php-src/ext/spl/tests/bug40036.phpt:1.2
--- /dev/null   Tue Jan  9 18:38:38 2007
+++ php-src/ext/spl/tests/bug40036.phpt Tue Jan  9 18:38:38 2007
@@ -0,0 +1,34 @@
+--TEST--
+Bug #40036 (empty() does not work correctly with ArrayObject when using 
ARRAY_AS_PROPS)
+--SKIPIF--
+?php if (!extension_loaded(spl)) print 

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

2006-12-21 Thread Marcus Boerger
helly   Fri Dec 22 00:57:52 2006 UTC

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Fix memory allocation/deallocation to match
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.104r2=1.105diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.104 php-src/ext/spl/php_spl.c:1.105
--- php-src/ext/spl/php_spl.c:1.104 Wed Dec 20 22:11:14 2006
+++ php-src/ext/spl/php_spl.c   Fri Dec 22 00:57:51 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.104 2006/12/20 22:11:14 helly Exp $ */
+/* $Id: php_spl.c,v 1.105 2006/12/22 00:57:51 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -282,7 +282,7 @@
RETURN_FALSE;
}
 
-   copy = pos1 = zend_zstrndup(ZEND_STR_TYPE, file_exts, file_exts_len);
+   copy = pos1 = ezstrndup(ZEND_STR_TYPE, file_exts, file_exts_len);
lc_name = zend_u_str_tolower_dup(ZEND_STR_TYPE, class_name, 
class_name_len);
while(pos1.v  (unicode ? *pos1.u : *pos1.s)  !EG(exception)) {
EG(return_value_ptr_ptr) = original_return_value;
@@ -310,12 +310,9 @@
}
efree(lc_name.v);
 
-#if MBO_0
-   /* UTODO: This is actually correct but sometimesfails in tests, no idea 
why */
if (copy.v) {
efree(copy.v);
}
-#endif
 
EG(return_value_ptr_ptr) = original_return_value;
EG(opline_ptr) = original_opline_ptr;

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

2006-12-20 Thread Marcus Boerger
helly   Wed Dec 20 22:11:14 2006 UTC

  Modified files:  
/php-src/ext/splphp_spl.c php_spl.h 
  Log:
  - More unicode
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.103r2=1.104diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.103 php-src/ext/spl/php_spl.c:1.104
--- php-src/ext/spl/php_spl.c:1.103 Tue Dec 19 22:31:26 2006
+++ php-src/ext/spl/php_spl.c   Wed Dec 20 22:11:14 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.103 2006/12/19 22:31:26 helly Exp $ */
+/* $Id: php_spl.c,v 1.104 2006/12/20 22:11:14 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -55,8 +55,7 @@
  */
 static PHP_GINIT_FUNCTION(spl)
 {
-   spl_globals-autoload_extensions = NULL;
-   spl_globals-autoload_extensions_len = 0;
+   ZVAL_NULL(spl_globals-autoload_extensions);
spl_globals-autoload_functions  = NULL;
spl_globals-autoload_running= 0;
 }
@@ -205,7 +204,7 @@
 }
 /* }}} */
 
-int spl_autoload(const char *class_name, const char * lc_name, int 
class_name_len, const char * file_extension TSRMLS_DC) /* {{{ */
+int spl_autoload(const zstr class_name, const zstr lc_name, int 
class_name_len, const zstr file_extension TSRMLS_DC) /* {{{ */
 {
char *class_file;
int class_file_len;
@@ -216,7 +215,8 @@
zval err_mode;
int ret;
 
-   class_file_len = spprintf(class_file, 0, %s%s, lc_name, 
file_extension);
+   /* UTODO: Wewant the stream toacept a zstrfor opening */
+   class_file_len = spprintf(class_file, 0, %v%v, lc_name, 
file_extension);
 
ZVAL_LONG(err_mode, EG(error_reporting));
if (Z_LVAL(err_mode)) {
@@ -257,48 +257,65 @@
}
 
efree(class_file);
-   return zend_hash_exists(EG(class_table), 
(char*)lc_name, class_name_len+1);
+   return zend_u_hash_exists(EG(class_table), 
ZEND_STR_TYPE, lc_name, class_name_len+1);
}
}
efree(class_file);
return 0;
 } /* }}} */
 
-/* {{{ proto void spl_autoload(string class_name [, string file_extensions])
+/* {{{ proto void spl_autoload(string class_name [, string file_extensions]) U
  Default implementation for __autoload() */
 PHP_FUNCTION(spl_autoload)
 {
-   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;
+   zstr class_name, lc_name;
+   zstr file_exts = Z_UNIVAL(SPL_G(autoload_extensions));
+   int class_name_len, file_exts_len = 
Z_UNILEN(SPL_G(autoload_extensions)), found = 0;
+   int unicode = UG(unicode);
+   zstr copy, pos1, pos2;
zval **original_return_value = EG(return_value_ptr_ptr);
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);

-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|s, 
class_name, class_name_len, file_exts, file_exts_len) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, x|x, 
class_name, class_name_len, file_exts, file_exts_len) == FAILURE) {
RETURN_FALSE;
}
 
-   copy = pos1 = estrndup(file_exts, file_exts_len);
-   lc_name = zend_str_tolower_dup(class_name, class_name_len);
-   while(pos1  *pos1  !EG(exception)) {
+   copy = pos1 = zend_zstrndup(ZEND_STR_TYPE, file_exts, file_exts_len);
+   lc_name = zend_u_str_tolower_dup(ZEND_STR_TYPE, class_name, 
class_name_len);
+   while(pos1.v  (unicode ? *pos1.u : *pos1.s)  !EG(exception)) {
EG(return_value_ptr_ptr) = original_return_value;
EG(opline_ptr) = original_opline_ptr;
EG(active_op_array) = original_active_op_array;
EG(function_state_ptr) = original_function_state_ptr;
-   pos2 = strchr(pos1, ',');
-   if (pos2) *pos2 = '\0';
+   if (unicode) {
+   pos2.u = u_strchr(pos1.u, ',');
+   if (pos2.u) *pos2.u = '\0';
+   } else {
+   pos2.s = strchr(pos1.s, ',');
+   if (pos2.s) *pos2.s = '\0';
+   }
if (spl_autoload(class_name, lc_name, class_name_len, pos1 
TSRMLS_CC)) {
found = 1;
break; /* loaded */
}
-   pos1 = pos2 ? pos2 + 1 : NULL;
+   if (!pos2.v) {
+   pos1.v = NULL;
+   } else if (unicode) {
+   pos1.u = pos2.u + 1;
+   } else{
+   pos1.s = pos2.s + 1;
+   }
}
-   

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

2006-12-19 Thread Marcus Boerger
helly   Tue Dec 19 22:31:00 2006 UTC

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Make spl_autoload_call() unicode safe
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.101r2=1.102diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.101 php-src/ext/spl/php_spl.c:1.102
--- php-src/ext/spl/php_spl.c:1.101 Mon Nov 20 20:03:46 2006
+++ php-src/ext/spl/php_spl.c   Tue Dec 19 22:30:59 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.101 2006/11/20 20:03:46 helly Exp $ */
+/* $Id: php_spl.c,v 1.102 2006/12/19 22:30:59 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -345,39 +345,37 @@
}
 }
 
-/* {{{ proto void spl_autoload_call(string class_name)
+/* {{{ proto void spl_autoload_call(string class_name) U
  Try all registerd autoload function to load the requested class */
 PHP_FUNCTION(spl_autoload_call)
 {
-   zval *class_name, *retval = NULL;
-   int class_name_len, class_name_type;
-   zstr func_name, lc_name;
+   zval *zclass_name, *retval = NULL;
+   int class_name_len, func_name_type;
+   zstr class_name, func_name, lc_name;
uint func_name_len;
ulong dummy;
HashPosition function_pos;
autoload_func_info *alfi;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z, class_name) 
== FAILURE ||
-   Z_TYPE_P(class_name) != (UG(unicode)?IS_UNICODE:IS_STRING)) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, UG(unicode) ? u 
: s, class_name, class_name_len) == FAILURE) {
return;
}
 
+   MAKE_STD_ZVAL(zclass_name);
+   ZVAL_ZSTRL(zclass_name, ZEND_STR_TYPE, class_name, class_name_len, 1);
if (SPL_G(autoload_functions)) {
int l_autoload_running = SPL_G(autoload_running);
SPL_G(autoload_running) = 1;
-   class_name_type = Z_TYPE_P(class_name);
-   class_name_len = Z_UNILEN_P(class_name);
-   lc_name = zend_u_str_tolower_dup(class_name_type, 
Z_UNIVAL_P(class_name), class_name_len);
+   lc_name = zend_u_str_tolower_dup(ZEND_STR_TYPE, class_name, 
class_name_len);
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  !EG(exception)) {
-   zend_hash_get_current_key_ex(SPL_G(autoload_functions), 
func_name, func_name_len, dummy, 0, function_pos);
+   func_name_type = 
zend_hash_get_current_key_ex(SPL_G(autoload_functions), func_name, 
func_name_len, dummy, 0, function_pos);

zend_hash_get_current_data_ex(SPL_G(autoload_functions), (void **) alfi, 
function_pos);
-   /* TODO: Unicode support??? */
-   zend_call_method(alfi-obj ? alfi-obj : NULL, 
alfi-ce, alfi-func_ptr, func_name.s, func_name_len, retval, 1, class_name, 
NULL TSRMLS_CC);
+   zend_u_call_method(alfi-obj ? alfi-obj : NULL, 
alfi-ce, alfi-func_ptr, func_name_type, func_name, func_name_len, retval, 
1, zclass_name, NULL TSRMLS_CC);
if (retval) {
zval_ptr_dtor(retval); 

}
-   if (zend_u_hash_exists(EG(class_table), 
class_name_type, lc_name, class_name_len+1)) {
+   if (zend_u_hash_exists(EG(class_table), ZEND_STR_TYPE, 
lc_name, class_name_len+1)) {
break;
}
zend_hash_move_forward_ex(SPL_G(autoload_functions), 
function_pos);
@@ -386,8 +384,9 @@
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);
+   zend_call_method_with_1_params(NULL, NULL, NULL, 
spl_autoload, NULL, zclass_name);
}
+   zval_ptr_dtor(zclass_name);
 } /* }}} */
 
 /* {{{ proto bool spl_autoload_register([mixed autoload_function = 
spl_autoload [, throw = true]]) 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

2006-12-19 Thread Marcus Boerger
helly   Tue Dec 19 22:31:26 2006 UTC

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Use new 'x' parameter parsing
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.102r2=1.103diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.102 php-src/ext/spl/php_spl.c:1.103
--- php-src/ext/spl/php_spl.c:1.102 Tue Dec 19 22:30:59 2006
+++ php-src/ext/spl/php_spl.c   Tue Dec 19 22:31:26 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.102 2006/12/19 22:30:59 helly Exp $ */
+/* $Id: php_spl.c,v 1.103 2006/12/19 22:31:26 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -357,7 +357,7 @@
HashPosition function_pos;
autoload_func_info *alfi;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, UG(unicode) ? u 
: s, class_name, class_name_len) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, x, class_name, 
class_name_len) == FAILURE) {
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 php_spl.c

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

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Mark some funcs as unicode ready
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.97r2=1.98diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.97 php-src/ext/spl/php_spl.c:1.98
--- php-src/ext/spl/php_spl.c:1.97  Tue Oct 31 23:18:00 2006
+++ php-src/ext/spl/php_spl.c   Sat Nov  4 20:12:26 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.97 2006/10/31 23:18:00 helly Exp $ */
+/* $Id: php_spl.c,v 1.98 2006/11/04 20:12:26 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -83,7 +83,7 @@
return *ce;
 }
 
-/* {{{ proto array class_parents(object instance)
+/* {{{ proto array class_parents(object instance) U
  Return an array containing the names of all parent classes */
 PHP_FUNCTION(class_parents)
 {
@@ -117,7 +117,7 @@
 }
 /* }}} */
 
-/* {{{ proto array class_implements(mixed what [, bool autoload ])
+/* {{{ proto array class_implements(mixed what [, bool autoload ]) U
  Return all classes and interfaces implemented by SPL */
 PHP_FUNCTION(class_implements)
 {
@@ -194,7 +194,7 @@
SPL_ADD_CLASS(UnderflowException, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(UnexpectedValueException, z_list, sub, allow, ce_flags); \
 
-/* {{{ proto array spl_classes()
+/* {{{ proto array spl_classes() U
  Return an array containing the names of all clsses and interfaces defined in 
SPL */
 PHP_FUNCTION(spl_classes)
 {
@@ -388,7 +388,7 @@
}
 } /* }}} */
 
-/* {{{ proto bool spl_autoload_register([mixed autoload_function = 
spl_autoload [, throw = true]])
+/* {{{ proto bool spl_autoload_register([mixed autoload_function = 
spl_autoload [, throw = true]]) U
  Register given function as __autoload() implementation */
 PHP_FUNCTION(spl_autoload_register)
 {
@@ -493,7 +493,7 @@
RETURN_TRUE;
 } /* }}} */
 
-/* {{{ proto bool spl_autoload_unregister(mixed autoload_function)
+/* {{{ proto bool spl_autoload_unregister(mixed autoload_function) U
  Unregister given function as __autoload() implementation */
 PHP_FUNCTION(spl_autoload_unregister)
 {
@@ -544,7 +544,7 @@
RETURN_BOOL(success == SUCCESS);
 } /* }}} */
 
-/* {{{ proto false|array spl_autoload_functions()
+/* {{{ proto false|array spl_autoload_functions() U
  Return all registered __autoload() functionns */
 PHP_FUNCTION(spl_autoload_functions)
 {
@@ -587,7 +587,7 @@
add_next_index_text(return_value, 
EG(autoload_func)-common.function_name, 1);
 } /* }}} */
 
-/* {{{ proto string spl_object_hash(object obj)
+/* {{{ proto string spl_object_hash(object obj) U
  Return hash id for given object */
 PHP_FUNCTION(spl_object_hash)
 {

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

2006-11-04 Thread Marcus Boerger
helly   Sat Nov  4 20:22:29 2006 UTC

  Modified files:  
/php-src/ext/splphp_spl.c php_spl.h 
  Log:
  - Store length of autoload file exts
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.98r2=1.99diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.98 php-src/ext/spl/php_spl.c:1.99
--- php-src/ext/spl/php_spl.c:1.98  Sat Nov  4 20:12:26 2006
+++ php-src/ext/spl/php_spl.c   Sat Nov  4 20:22:29 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.98 2006/11/04 20:12:26 helly Exp $ */
+/* $Id: php_spl.c,v 1.99 2006/11/04 20:22:29 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;
 }
 /* }}} */
 
@@ -267,8 +268,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);
@@ -279,7 +280,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;
@@ -324,10 +325,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 {
@@ -707,7 +709,9 @@
 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;
+   SPL_G(autoload_running) = 0;
return SUCCESS;
 } /* }}} */
 
@@ -716,6 +720,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.19r2=1.20diff_format=u
Index: php-src/ext/spl/php_spl.h
diff -u php-src/ext/spl/php_spl.h:1.19 php-src/ext/spl/php_spl.h:1.20
--- php-src/ext/spl/php_spl.h:1.19  Tue Oct 31 23:18:00 2006
+++ php-src/ext/spl/php_spl.h   Sat Nov  4 20:22:29 2006
@@ -57,6 +57,7 @@
 
 ZEND_BEGIN_MODULE_GLOBALS(spl)
char *   autoload_extensions;
+   int  autoload_extensions_len;
HashTable *  autoload_functions;
int  autoload_running;
 ZEND_END_MODULE_GLOBALS(spl)

-- 
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 php_spl.h /ext/spl/tests spl_autoload_009.phpt

2006-10-31 Thread Marcus Boerger
helly   Tue Oct 31 23:18:00 2006 UTC

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

  Modified files:  
/php-src/ext/splphp_spl.c php_spl.h 
  Log:
  - Fixed Bug #39313 spl_autoload triggers Fatal error
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.96r2=1.97diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.96 php-src/ext/spl/php_spl.c:1.97
--- php-src/ext/spl/php_spl.c:1.96  Thu Aug  3 14:53:51 2006
+++ php-src/ext/spl/php_spl.c   Tue Oct 31 23:18:00 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.96 2006/08/03 14:53:51 iliaa Exp $ */
+/* $Id: php_spl.c,v 1.97 2006/10/31 23:18:00 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;
 }
 /* }}} */
 
@@ -303,7 +304,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);
}
 } /* }}} */
@@ -360,6 +361,8 @@
}
 
if (SPL_G(autoload_functions)) {
+   int l_autoload_running = SPL_G(autoload_running);
+   SPL_G(autoload_running) = 1;
class_name_type = Z_TYPE_P(class_name);
class_name_len = Z_UNILEN_P(class_name);
lc_name = zend_u_str_tolower_dup(class_name_type, 
Z_UNIVAL_P(class_name), class_name_len);
@@ -378,6 +381,7 @@
zend_hash_move_forward_ex(SPL_G(autoload_functions), 
function_pos);
}
efree(lc_name.v);
+   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.18r2=1.19diff_format=u
Index: php-src/ext/spl/php_spl.h
diff -u php-src/ext/spl/php_spl.h:1.18 php-src/ext/spl/php_spl.h:1.19
--- php-src/ext/spl/php_spl.h:1.18  Sun Jan  1 13:09:54 2006
+++ php-src/ext/spl/php_spl.h   Tue Oct 31 23:18:00 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/tests/spl_autoload_009.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/spl_autoload_009.phpt
+++ php-src/ext/spl/tests/spl_autoload_009.phpt
--TEST--
SPL: spl_autoload() and friends
--SKIPIF--
?php if (!extension_loaded(spl)) print skip; ?
--INI--
include_path=.
--FILE--
?php

function my_autoload($name)
{
require $name . '.class.inc';
var_dump(class_exists($name));
}

spl_autoload_register(spl_autoload);
spl_autoload_register(my_autoload);

$obj = new testclass;

?
===DONE===
?php exit(0); ?
--EXPECTF--
%stestclass.inc
%stestclass.class.inc
bool(true)
===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 php_spl.c

2006-08-03 Thread Ilia Alshanetsky
iliaa   Thu Aug  3 14:53:51 2006 UTC

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  MFB:  Fixed bug #38303 (spl_autoload_register() supress all errors
  silently).
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.95r2=1.96diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.95 php-src/ext/spl/php_spl.c:1.96
--- php-src/ext/spl/php_spl.c:1.95  Sun Jul  9 10:22:03 2006
+++ php-src/ext/spl/php_spl.c   Thu Aug  3 14:53:51 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.95 2006/07/09 10:22:03 helly Exp $ */
+/* $Id: php_spl.c,v 1.96 2006/08/03 14:53:51 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -211,10 +211,25 @@
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);
 
-   if (zend_stream_open(class_file, file_handle TSRMLS_CC) == SUCCESS) {
+   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);
+   }
+
+   if (ret == SUCCESS) {
if (!file_handle.opened_path) {
file_handle.opened_path = estrndup(class_file, 
class_file_len);
}
@@ -228,7 +243,7 @@
if (new_op_array) {
EG(return_value_ptr_ptr) = result;
EG(active_op_array) = new_op_array;
-   
+
zend_execute(new_op_array TSRMLS_CC);

destroy_op_array(new_op_array TSRMLS_CC);
@@ -258,15 +273,11 @@
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;
}
 
-   ZVAL_LONG(err_mode, EG(error_reporting));
-   php_alter_ini_entry(error_reporting, sizeof(error_reporting), 0, 
1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); 
-
copy = pos1 = estrdup(ZEND_NUM_ARGS()  1 ? file_exts : 
SPL_G(autoload_extensions));
lc_name = zend_str_tolower_dup(class_name, class_name_len);
while(pos1  *pos1  !EG(exception)) {
@@ -287,12 +298,6 @@
efree(copy);
}
 
-   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);
-   }
-
EG(return_value_ptr_ptr) = original_return_value;
EG(opline_ptr) = original_opline_ptr;
EG(active_op_array) = original_active_op_array;

-- 
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_005.phpt

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

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

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Add spl_object_hash()
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.94r2=1.95diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.94 php-src/ext/spl/php_spl.c:1.95
--- php-src/ext/spl/php_spl.c:1.94  Tue Jun 13 13:12:19 2006
+++ php-src/ext/spl/php_spl.c   Sun Jul  9 10:22:03 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.94 2006/06/13 13:12:19 dmitry Exp $ */
+/* $Id: php_spl.c,v 1.95 2006/07/09 10:22:03 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)
@@ -577,6 +578,32 @@
add_next_index_text(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;
@@ -643,6 +670,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 /ext/spl php_spl.c spl_iterators.c spl_iterators.h

2006-05-25 Thread Marcus Boerger
helly   Fri May 26 00:37:33 2006 UTC

  Modified files:  
/php-src/ext/splphp_spl.c spl_iterators.c spl_iterators.h 
  Log:
  - Add function iterator_apply()
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/php_spl.c?r1=1.90r2=1.91diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.90 php-src/ext/spl/php_spl.c:1.91
--- php-src/ext/spl/php_spl.c:1.90  Wed May 10 21:09:31 2006
+++ php-src/ext/spl/php_spl.c   Fri May 26 00:37:32 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.90 2006/05/10 21:09:31 helly Exp $ */
+/* $Id: php_spl.c,v 1.91 2006/05/26 00:37:32 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -621,7 +621,14 @@
 
 static
 ZEND_BEGIN_ARG_INFO(arginfo_iterator, 0)
-   ZEND_ARG_INFO(0, iterator)
+   ZEND_ARG_OBJ_INFO(0, iterator, Iterator, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_iterator_apply, 0, 0, 2)
+   ZEND_ARG_OBJ_INFO(0, iterator, Iterator, 0)
+   ZEND_ARG_INFO(0, function)
+   ZEND_ARG_ARRAY_INFO(0, args, 0)
 ZEND_END_ARG_INFO();
 
 /* {{{ spl_functions
@@ -639,6 +646,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.134r2=1.135diff_format=u
Index: php-src/ext/spl/spl_iterators.c
diff -u php-src/ext/spl/spl_iterators.c:1.134 
php-src/ext/spl/spl_iterators.c:1.135
--- php-src/ext/spl/spl_iterators.c:1.134   Sun May 21 17:36:52 2006
+++ php-src/ext/spl/spl_iterators.c Fri May 26 00:37:33 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_iterators.c,v 1.134 2006/05/21 17:36:52 helly Exp $ */
+/* $Id: spl_iterators.c,v 1.135 2006/05/26 00:37:33 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -2612,7 +2612,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;
@@ -2637,8 +2637,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;
@@ -2650,6 +2650,53 @@
 }
 /* }}} */
 
+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;
+
+   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_FALSE;
+   }
+
+   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.35r2=1.36diff_format=u
Index: php-src/ext/spl/spl_iterators.h
diff -u php-src/ext/spl/spl_iterators.h:1.35 
php-src/ext/spl/spl_iterators.h:1.36
--- php-src/ext/spl/spl_iterators.h:1.35Sun May 21 17:27:12 2006
+++ php-src/ext/spl/spl_iterators.h Fri May 26 00:37:33 2006
@@ -16,7 +16,7 @@
  

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

2006-05-25 Thread Marcus Boerger
helly   Fri May 26 00:49:02 2006 UTC

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Fix type hint
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/php_spl.c?r1=1.91r2=1.92diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.91 php-src/ext/spl/php_spl.c:1.92
--- php-src/ext/spl/php_spl.c:1.91  Fri May 26 00:37:32 2006
+++ php-src/ext/spl/php_spl.c   Fri May 26 00:49:02 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.91 2006/05/26 00:37:32 helly Exp $ */
+/* $Id: php_spl.c,v 1.92 2006/05/26 00:49:02 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -621,12 +621,12 @@
 
 static
 ZEND_BEGIN_ARG_INFO(arginfo_iterator, 0)
-   ZEND_ARG_OBJ_INFO(0, iterator, Iterator, 0)
+   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, Iterator, 0)
+   ZEND_ARG_OBJ_INFO(0, iterator, Traversable, 0)
ZEND_ARG_INFO(0, function)
ZEND_ARG_ARRAY_INFO(0, args, 0)
 ZEND_END_ARG_INFO();

-- 
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 spl_iterators.c /ext/spl/tests spl_004.phpt

2006-05-25 Thread Marcus Boerger
helly   Fri May 26 01:40:57 2006 UTC

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

  Modified files:  
/php-src/ext/splphp_spl.c spl_iterators.c 
  Log:
  - Fix handling of third parameter to iterator_apply()
  - Add test
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/php_spl.c?r1=1.92r2=1.93diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.92 php-src/ext/spl/php_spl.c:1.93
--- php-src/ext/spl/php_spl.c:1.92  Fri May 26 00:49:02 2006
+++ php-src/ext/spl/php_spl.c   Fri May 26 01:40:57 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.92 2006/05/26 00:49:02 helly Exp $ */
+/* $Id: php_spl.c,v 1.93 2006/05/26 01:40:57 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -628,7 +628,7 @@
 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, 0)
+   ZEND_ARG_ARRAY_INFO(0, args, 1)
 ZEND_END_ARG_INFO();
 
 /* {{{ spl_functions
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl_iterators.c?r1=1.135r2=1.136diff_format=u
Index: php-src/ext/spl/spl_iterators.c
diff -u php-src/ext/spl/spl_iterators.c:1.135 
php-src/ext/spl/spl_iterators.c:1.136
--- php-src/ext/spl/spl_iterators.c:1.135   Fri May 26 00:37:33 2006
+++ php-src/ext/spl/spl_iterators.c Fri May 26 01:40:57 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_iterators.c,v 1.135 2006/05/26 00:37:33 helly Exp $ */
+/* $Id: spl_iterators.c,v 1.136 2006/05/26 01:40:57 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -2682,8 +2682,9 @@
 {
spl_iterator_apply_info  apply_info;
 
-   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_FALSE;
+   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;

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

function my_error_handler($errno, $errstr, $errfile, $errline) {
echo Error: $errstr\n;
}

set_error_handler('my_error_handler');

function test_arg($arg)
{
if ($arg instanceof Iterator)
{
var_dump($arg-key());
var_dump($arg-current());
}
else
{
var_dump($arg);
}
return true;
}

function test()
{
static $arg = 0;
var_dump($arg++);
return true;
}

$it = new RecursiveArrayIterator(array(1, array(21, 22), 3));

var_dump(iterator_apply($it, 'test', NULL));

echo ===ARGS===\n;
var_dump(iterator_apply($it, 'test_arg', array($it)));

echo ===RECURSIVE===\n;
$it = new RecursiveIteratorIterator($it);
var_dump(iterator_apply($it, 'test'));

echo ===ERRORS===\n;
var_dump(iterator_apply($it, 'test', 1));
var_dump(iterator_apply($it, 'non_existing_functon'));
var_dump(iterator_apply($it, 'non_existing_functon', NULL, 2));

?
===DONE===
?php exit(0); ?
--EXPECTF--
int(0)
int(1)
int(2)
int(3)
===ARGS===
int(0)
int(1)
int(1)
array(2) {
  [0]=
  int(21)
  [1]=
  int(22)
}
int(2)
int(3)
int(3)
===RECURSIVE===
int(3)
int(4)
int(5)
int(6)
int(4)
===ERRORS===
Error: Argument 3 passed to iterator_apply() must be an array, integer given
Error: iterator_apply() expects parameter 3 to be array, integer given
NULL
Error: iterator_apply() expects parameter 2 to be function,%sstring given
NULL
Error: iterator_apply() expects at most 3 parameters, 4 given
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 php_spl.c

2006-05-10 Thread Marcus Boerger
helly   Wed May 10 21:09:31 2006 UTC

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - s/RegExIterator/RegexIterator/
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/php_spl.c?r1=1.89r2=1.90diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.89 php-src/ext/spl/php_spl.c:1.90
--- php-src/ext/spl/php_spl.c:1.89  Thu Mar 23 19:34:20 2006
+++ php-src/ext/spl/php_spl.c   Wed May 10 21:09:31 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.89 2006/03/23 19:34:20 helly Exp $ */
+/* $Id: php_spl.c,v 1.90 2006/05/10 21:09:31 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -178,8 +178,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(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



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

2006-03-23 Thread Marcus Boerger
helly   Thu Mar 23 12:55:58 2006 UTC

  Modified files:  
/php-src/ext/splphp_spl.c 
/php-src/ext/spl/tests  spl_autoload_008.phpt 
  Log:
  - Make spl_autoload_unregister() accept any callable like 
spl_autoload_register()
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/php_spl.c?r1=1.87r2=1.88diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.87 php-src/ext/spl/php_spl.c:1.88
--- php-src/ext/spl/php_spl.c:1.87  Tue Feb 21 20:12:42 2006
+++ php-src/ext/spl/php_spl.c   Thu Mar 23 12:55:58 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.87 2006/02/21 20:12:42 dmitry Exp $ */
+/* $Id: php_spl.c,v 1.88 2006/03/23 12:55:58 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -378,7 +378,7 @@
}
 } /* }}} */
 
-/* {{{ proto void spl_autoload_register([string autoload_function = 
spl_autoload [, throw = true]])
+/* {{{ proto void spl_autoload_register([mixed autoload_function = 
spl_autoload [, throw = true]])
  Register given function as __autoload() implementation */
 PHP_FUNCTION(spl_autoload_register)
 {
@@ -482,24 +482,30 @@
}
 } /* }}} */
 
-/* {{{ proto bool spl_autoload_unregister(string autoload_function)
+/* {{{ proto bool spl_autoload_unregister(mixed autoload_function)
  Unregister given function as __autoload() implementation */
 PHP_FUNCTION(spl_autoload_unregister)
 {
-   zstr func_name, lc_name;
-   int func_name_len, success = FAILURE;
+   zval zfunc_name;
+   zval *zcallable;
+   zstr lc_name;
+   int success = FAILURE;
zend_function *spl_func_ptr;
-   zend_uchar func_name_type;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, t, func_name, 
func_name_len, func_name_type) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z, zcallable) 
== FAILURE) {
+   return;
+   }
+
+   if (!zend_is_callable_ex(zcallable, IS_CALLABLE_CHECK_SYNTAX_ONLY, 
zfunc_name, NULL, NULL, NULL TSRMLS_CC)) {
+   zval_dtor(zfunc_name);
return;
}
 
-   lc_name = zend_u_str_tolower_dup(func_name_type, func_name, 
func_name_len);
+   lc_name = zend_u_str_tolower_dup(Z_TYPE(zfunc_name), 
Z_UNIVAL(zfunc_name), Z_UNILEN(zfunc_name));
 
if (SPL_G(autoload_functions)) {
-   if ((func_name_len == sizeof(spl_autoload_call)-1) 
-   (ZEND_U_EQUAL(func_name_type, lc_name, func_name_len, 
spl_autoload_call, sizeof(spl_autoload_call)-1))) {
+   if ((Z_UNILEN(zfunc_name) == sizeof(spl_autoload_call)-1) 
+   (ZEND_U_EQUAL(Z_TYPE(zfunc_name), lc_name, 
Z_UNILEN(zfunc_name), spl_autoload_call, sizeof(spl_autoload_call)-1))) {
/* remove all */
zend_hash_destroy(SPL_G(autoload_functions));
FREE_HASHTABLE(SPL_G(autoload_functions));
@@ -508,10 +514,10 @@
success = SUCCESS;
} else {
/* remove specific */
-   success = zend_u_hash_del(SPL_G(autoload_functions), 
func_name_type, lc_name, func_name_len+1);
+   success = zend_u_hash_del(SPL_G(autoload_functions), 
Z_TYPE(zfunc_name), lc_name, Z_UNILEN(zfunc_name)+1);
}
-   } else if ((func_name_len == sizeof(spl_autoload)-1) 
-  (ZEND_U_EQUAL(func_name_type, lc_name, func_name_len, 
spl_autoload, sizeof(spl_autoload)-1))) {
+   } else if ((Z_UNILEN(zfunc_name) == sizeof(spl_autoload)-1) 
+  (ZEND_U_EQUAL(Z_TYPE(zfunc_name), lc_name, 
Z_UNILEN(zfunc_name), spl_autoload, sizeof(spl_autoload)-1))) {
/* register single spl_autoload() */
zend_hash_find(EG(function_table), spl_autoload, 
sizeof(spl_autoload), (void **) spl_func_ptr);
 
@@ -522,6 +528,7 @@
}
 
efree(lc_name.v);
+   zval_dtor(zfunc_name);

RETURN_BOOL(success == SUCCESS);
 } /* }}} */
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/tests/spl_autoload_008.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/spl/tests/spl_autoload_008.phpt
diff -u php-src/ext/spl/tests/spl_autoload_008.phpt:1.1 
php-src/ext/spl/tests/spl_autoload_008.phpt:1.2
--- php-src/ext/spl/tests/spl_autoload_008.phpt:1.1 Thu Mar 23 12:20:35 2006
+++ php-src/ext/spl/tests/spl_autoload_008.phpt Thu Mar 23 12:55:58 2006
@@ -60,12 +60,6 @@
echo get_class($e) . :  . $e-getMessage() . \n;
}
 
-   if (is_array($func)) {
-   if (is_object($func[0])) {
-   $func[0] = get_class($func[0]);
-   }
-   $func = join('::', $func);
-   }
spl_autoload_unregister($func);
var_dump(count(spl_autoload_functions()));
 }

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

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

2006-03-23 Thread Marcus Boerger
helly   Thu Mar 23 19:34:20 2006 UTC

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Make spl_autoload_register() return bool
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/php_spl.c?r1=1.88r2=1.89diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.88 php-src/ext/spl/php_spl.c:1.89
--- php-src/ext/spl/php_spl.c:1.88  Thu Mar 23 12:55:58 2006
+++ php-src/ext/spl/php_spl.c   Thu Mar 23 19:34:20 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.88 2006/03/23 12:55:58 helly Exp $ */
+/* $Id: php_spl.c,v 1.89 2006/03/23 19:34:20 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -378,7 +378,7 @@
}
 } /* }}} */
 
-/* {{{ proto void spl_autoload_register([mixed autoload_function = 
spl_autoload [, throw = true]])
+/* {{{ proto bool spl_autoload_register([mixed autoload_function = 
spl_autoload [, throw = true]])
  Register given function as __autoload() implementation */
 PHP_FUNCTION(spl_autoload_register)
 {
@@ -400,7 +400,7 @@
if (do_throw) {

zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, Function 
spl_autoload_call() cannot be registered);
}
-   return;
+   RETURN_FALSE;
}
}
} else if (Z_TYPE_P(zcallable) == IS_UNICODE) {
@@ -411,7 +411,7 @@

zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, Function 
spl_autoload_call() cannot be registered);
}
zval_dtor(ztmp);
-   return;
+   RETURN_FALSE;
}
}
zval_dtor(ztmp);
@@ -424,25 +424,25 @@

zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, Passed array 
specifies a non static method but no object);
}
zval_dtor(zfunc_name);
-   return;
+   RETURN_FALSE;
}
else if (do_throw) {

zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, Passed array does 
not specify %s %smethod, alfi.func_ptr ? a callable : an existing, 
!obj_ptr ? static  : );
}
zval_dtor(zfunc_name);
-   return;
+   RETURN_FALSE;
} else if (Z_TYPE_P(zcallable) == IS_STRING || 
Z_TYPE_P(zcallable) == IS_UNICODE) {
if (do_throw) {

zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, Function '%R' not 
%s, Z_TYPE_P(zcallable), Z_UNIVAL_P(zcallable), alfi.func_ptr ? callable : 
found);
}
zval_dtor(zfunc_name);
-   return;
+   RETURN_FALSE;
} else {
if (do_throw) {

zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, Illegal value 
passed);
}
zval_dtor(zfunc_name);
-   return;
+   RETURN_FALSE;
}
}

@@ -480,6 +480,7 @@
} else {
zend_hash_find(EG(function_table), spl_autoload, 
sizeof(spl_autoload), (void **) EG(autoload_func));
}
+   RETURN_TRUE;
 } /* }}} */
 
 /* {{{ proto bool spl_autoload_unregister(mixed autoload_function)
@@ -498,7 +499,7 @@
 
if (!zend_is_callable_ex(zcallable, IS_CALLABLE_CHECK_SYNTAX_ONLY, 
zfunc_name, NULL, NULL, NULL TSRMLS_CC)) {
zval_dtor(zfunc_name);
-   return;
+   RETURN_FALSE;
}
 
lc_name = zend_u_str_tolower_dup(Z_TYPE(zfunc_name), 
Z_UNIVAL(zfunc_name), Z_UNILEN(zfunc_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 php_spl.c

2006-02-20 Thread Marcus Boerger
helly   Mon Feb 20 22:23:27 2006 UTC

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Add some arginfo
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/php_spl.c?r1=1.85r2=1.86diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.85 php-src/ext/spl/php_spl.c:1.86
--- php-src/ext/spl/php_spl.c:1.85  Mon Feb 13 10:23:57 2006
+++ php-src/ext/spl/php_spl.c   Mon Feb 20 22:23:27 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.85 2006/02/13 10:23:57 dmitry Exp $ */
+/* $Id: php_spl.c,v 1.86 2006/02/20 22:23:27 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -610,6 +610,11 @@
 }
 /* }}} */
 
+static
+ZEND_BEGIN_ARG_INFO(arginfo_iterator, 0)
+   ZEND_ARG_INFO(0, iterator)
+ZEND_END_ARG_INFO();
+
 /* {{{ spl_functions
  */
 zend_function_entry spl_functions[] = {
@@ -623,8 +628,8 @@
PHP_FE(class_parents,   NULL)
PHP_FE(class_implements,NULL)
 #ifdef SPL_ITERATORS_H
-   PHP_FE(iterator_to_array,   NULL)
-   PHP_FE(iterator_count,  NULL)
+   PHP_FE(iterator_to_array,   arginfo_iterator)
+   PHP_FE(iterator_count,  arginfo_iterator)
 #endif /* SPL_ITERATORS_H */
{NULL, NULL, 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 php_spl.c spl_array.c

2006-02-12 Thread Marcus Boerger
helly   Sun Feb 12 16:43:30 2006 UTC

  Modified files:  
/php-src/ext/splphp_spl.c spl_array.c 
  Log:
  - No more old parameter api usage
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/php_spl.c?r1=1.83r2=1.84diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.83 php-src/ext/spl/php_spl.c:1.84
--- php-src/ext/spl/php_spl.c:1.83  Tue Jan 17 12:18:52 2006
+++ php-src/ext/spl/php_spl.c   Sun Feb 12 16:43:30 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.83 2006/01/17 12:18:52 dmitry Exp $ */
+/* $Id: php_spl.c,v 1.84 2006/02/12 16:43:30 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -340,7 +340,7 @@
  Try all registerd autoload function to load the requested class */
 PHP_FUNCTION(spl_autoload_call)
 {
-   zval **class_name, *retval = NULL;
+   zval *class_name, *retval = NULL;
int class_name_len, class_name_type;
char *func_name, *lc_name;
uint func_name_len;
@@ -348,20 +348,20 @@
HashPosition function_pos;
autoload_func_info *alfi;
 
-   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, class_name) == 
FAILURE || 
-   Z_TYPE_PP(class_name) != (UG(unicode)?IS_UNICODE:IS_STRING)) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z, class_name) 
== FAILURE ||
+   Z_TYPE_P(class_name) != (UG(unicode)?IS_UNICODE:IS_STRING)) {
return;
}
 
if (SPL_G(autoload_functions)) {
-   class_name_type = Z_TYPE_PP(class_name);
-   class_name_len = Z_UNILEN_PP(class_name);
-   lc_name = zend_u_str_tolower_dup(class_name_type, 
Z_UNIVAL_PP(class_name), Z_UNILEN_PP(class_name));
+   class_name_type = Z_TYPE_P(class_name);
+   class_name_len = Z_UNILEN_P(class_name);
+   lc_name = zend_u_str_tolower_dup(class_name_type, 
Z_UNIVAL_P(class_name), class_name_len);
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  !EG(exception)) {
zend_hash_get_current_key_ex(SPL_G(autoload_functions), 
func_name, func_name_len, dummy, 0, function_pos);

zend_hash_get_current_data_ex(SPL_G(autoload_functions), (void **) alfi, 
function_pos);
-   zend_call_method(alfi-obj ? alfi-obj : NULL, 
alfi-ce, alfi-func_ptr, func_name, func_name_len, retval, 1, *class_name, 
NULL TSRMLS_CC);
+   zend_call_method(alfi-obj ? alfi-obj : NULL, 
alfi-ce, alfi-func_ptr, func_name, func_name_len, retval, 1, class_name, 
NULL TSRMLS_CC);
if (retval) {
zval_ptr_dtor(retval); 

}
@@ -373,7 +373,7 @@
efree(lc_name);
} else {
/* do not use or overwrite EG(autoload_func) here */
-   zend_call_method_with_1_params(NULL, NULL, NULL, 
spl_autoload, NULL, *class_name);
+   zend_call_method_with_1_params(NULL, NULL, NULL, 
spl_autoload, NULL, class_name);
}
 } /* }}} */
 
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl_array.c?r1=1.96r2=1.97diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.96 php-src/ext/spl/spl_array.c:1.97
--- php-src/ext/spl/spl_array.c:1.96Mon Feb  6 02:07:08 2006
+++ php-src/ext/spl/spl_array.c Sun Feb 12 16:43:30 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.96 2006/02/06 02:07:08 helly Exp $ */
+/* $Id: spl_array.c,v 1.97 2006/02/12 16:43:30 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -978,7 +978,7 @@
array_init(return_value);
zend_hash_copy(HASH_OF(return_value), spl_array_get_hash_table(intern, 
0 TSRMLS_CC), (copy_ctor_func_t) zval_add_ref, tmp, sizeof(zval*));

-   if (ZEND_NUM_ARGS()  1 || zend_get_parameters_ex(1, array) == 
FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z, array) == 
FAILURE) {
WRONG_PARAM_COUNT;
}
if (Z_TYPE_PP(array) == IS_OBJECT  intern == 
(spl_array_object*)zend_object_store_get_object(object TSRMLS_CC))
@@ -1119,18 +1119,18 @@
 {
spl_array_object *intern = 
(spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
-   zval tmp, **arg;
+   zval tmp, *arg;

INIT_PZVAL(tmp);
Z_TYPE(tmp) = IS_ARRAY;
Z_ARRVAL(tmp) = aht;

if (use_arg) {
-   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, arg) == 
FAILURE) {
+   if (ZEND_NUM_ARGS() != 1 || 

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

2005-12-21 Thread Marcus Boerger
helly   Wed Dec 21 20:12:44 2005 EDT

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - MFB Need to store length (and type) of class name
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/php_spl.c?r1=1.80r2=1.81diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.80 php-src/ext/spl/php_spl.c:1.81
--- php-src/ext/spl/php_spl.c:1.80  Sun Dec 18 15:47:03 2005
+++ php-src/ext/spl/php_spl.c   Wed Dec 21 20:12:44 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.80 2005/12/18 15:47:03 zeev Exp $ */
+/* $Id: php_spl.c,v 1.81 2005/12/21 20:12:44 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -341,6 +341,7 @@
 PHP_FUNCTION(spl_autoload_call)
 {
zval **class_name, *retval = NULL;
+   int class_name_len, class_name_type;
char *func_name, *lc_name;
uint func_name_len;
ulong dummy;
@@ -353,7 +354,9 @@
}
 
if (SPL_G(autoload_functions)) {
-   lc_name = zend_u_str_tolower_dup(Z_TYPE_PP(class_name), 
Z_UNIVAL_PP(class_name), Z_UNILEN_PP(class_name));
+   class_name_type = Z_TYPE_PP(class_name);
+   class_name_len = Z_UNILEN_PP(class_name);
+   lc_name = zend_u_str_tolower_dup(class_name_type, 
Z_UNIVAL_PP(class_name), Z_UNILEN_PP(class_name));
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  !EG(exception)) {
zend_hash_get_current_key_ex(SPL_G(autoload_functions), 
func_name, func_name_len, dummy, 0, function_pos);
@@ -362,7 +365,7 @@
if (retval) {
zval_ptr_dtor(retval); 

}
-   if (zend_u_hash_exists(EG(class_table), 
Z_TYPE_PP(class_name), lc_name, Z_UNILEN_PP(class_name)+1)) {
+   if (zend_u_hash_exists(EG(class_table), 
class_name_type, lc_name, class_name_len+1)) {
break;
}
zend_hash_move_forward_ex(SPL_G(autoload_functions), 
function_pos);

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

2005-12-18 Thread Zeev Suraski
zeevSun Dec 18 15:41:22 2005 EDT

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  Prototype fixes (MFB)
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/php_spl.c?r1=1.78r2=1.79diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.78 php-src/ext/spl/php_spl.c:1.79
--- php-src/ext/spl/php_spl.c:1.78  Sat Dec 17 00:09:06 2005
+++ php-src/ext/spl/php_spl.c   Sun Dec 18 15:41:22 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.78 2005/12/17 00:09:06 helly Exp $ */
+/* $Id: php_spl.c,v 1.79 2005/12/18 15:41:22 zeev Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -81,7 +81,7 @@
return *ce;
 }
 
-/* {{{ array class_parents(object instance)
+/* {{{ proto array class_parents(object instance)
  Return an array containing the names of all parent classes */
 PHP_FUNCTION(class_parents)
 {
@@ -246,7 +246,7 @@
return 0;
 } /* }}} */
 
-/* {{{ void spl_autoload(string class_name [, string file_extensions])
+/* {{{ proto void spl_autoload(string class_name [, string file_extensions])
  Default implementation for __autoload() */
 PHP_FUNCTION(spl_autoload)
 {
@@ -302,7 +302,7 @@
}
 } /* }}} */
 
-/* {{{ void string spl_autoload_extensions([string file_extensions])
+/* {{{ proto void string spl_autoload_extensions([string file_extensions])
  Register and return default file extensions for spl_autoload */
 PHP_FUNCTION(spl_autoload_extensions)
 {
@@ -336,7 +336,7 @@
}
 }
 
-/* {{{ void spl_autoload_call(string class_name)
+/* {{{ proto void spl_autoload_call(string class_name)
  Try all registerd autoload function to load the requested class */
 PHP_FUNCTION(spl_autoload_call)
 {
@@ -374,7 +374,7 @@
}
 } /* }}} */
 
-/* {{{ void spl_autoload_register([string autoload_function = spl_autoload 
[, throw = true]])
+/* {{{ proto void spl_autoload_register([string autoload_function = 
spl_autoload [, throw = true]])
  Register given function as __autoload() implementation */
 PHP_FUNCTION(spl_autoload_register)
 {
@@ -479,7 +479,7 @@
}
 } /* }}} */
 
-/* {{{ bool spl_autoload_unregister(string autoload_function)
+/* {{{ proto bool spl_autoload_unregister(string autoload_function)
  Unregister given function as __autoload() implementation */
 PHP_FUNCTION(spl_autoload_unregister)
 {
@@ -523,7 +523,7 @@
RETURN_BOOL(success == SUCCESS);
 } /* }}} */
 
-/* {{{ false|array spl_autoload_functions()
+/* {{{ proto false|array spl_autoload_functions()
  Return all registered __autoload() functionns */
 PHP_FUNCTION(spl_autoload_functions)
 {

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

2005-12-18 Thread Zeev Suraski
zeevSun Dec 18 15:47:04 2005 EDT

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  Prototype fix (MFB)
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/php_spl.c?r1=1.79r2=1.80diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.79 php-src/ext/spl/php_spl.c:1.80
--- php-src/ext/spl/php_spl.c:1.79  Sun Dec 18 15:41:22 2005
+++ php-src/ext/spl/php_spl.c   Sun Dec 18 15:47:03 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.79 2005/12/18 15:41:22 zeev Exp $ */
+/* $Id: php_spl.c,v 1.80 2005/12/18 15:47:03 zeev Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -302,7 +302,7 @@
}
 } /* }}} */
 
-/* {{{ proto void string spl_autoload_extensions([string file_extensions])
+/* {{{ proto string spl_autoload_extensions([string file_extensions])
  Register and return default file extensions for spl_autoload */
 PHP_FUNCTION(spl_autoload_extensions)
 {

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

2005-12-16 Thread Marcus Boerger
helly   Sat Dec 17 00:09:06 2005 EDT

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - MFB
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/php_spl.c?r1=1.77r2=1.78diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.77 php-src/ext/spl/php_spl.c:1.78
--- php-src/ext/spl/php_spl.c:1.77  Tue Dec  6 02:00:06 2005
+++ php-src/ext/spl/php_spl.c   Sat Dec 17 00:09:06 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.77 2005/12/06 02:00:06 sniper Exp $ */
+/* $Id: php_spl.c,v 1.78 2005/12/17 00:09:06 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -378,68 +378,79 @@
  Register given function as __autoload() implementation */
 PHP_FUNCTION(spl_autoload_register)
 {
-   zval zfunc_name;
-   char *func_name;
-   uint func_name_len;
-   char *lc_name = NULL;
+   zval zfunc_name, ztmp;
zval *zcallable = NULL;
zend_bool do_throw = 1;
zend_function *spl_func_ptr;
autoload_func_info alfi;
zval **obj_ptr;
-   zend_uchar func_name_type;
 
-   if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() 
TSRMLS_CC, |tb, func_name, func_name_len, func_name_type, do_throw) == 
FAILURE) {
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, a|b, 
zcallable, do_throw) == FAILURE) {
-   return;
-   }
-   if (!zend_is_callable_ex(zcallable, 
IS_CALLABLE_CHECK_IS_STATIC, zfunc_name, alfi.ce, alfi.func_ptr, obj_ptr 
TSRMLS_CC)) {
-   if (do_throw) {
-   
zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, 
Passed array does not specify a callable static method);
+   if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() 
TSRMLS_CC, |zb, zcallable, do_throw) == FAILURE) {
+   return;
+   }
+
+   if (ZEND_NUM_ARGS()) {
+   if (Z_TYPE_P(zcallable) == IS_STRING) {
+   if (Z_STRLEN_P(zcallable) == 
sizeof(spl_autoload_call) - 1) {
+   if 
(!zend_binary_strcasecmp(Z_STRVAL_P(zcallable), sizeof(spl_autoload_call), 
spl_autoload_call, sizeof(spl_autoload_call))) {
+   if (do_throw) {
+   
zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, Function 
spl_autoload_call() cannot be registered);
+   }
+   return;
+   }
}
-   zval_dtor(zfunc_name);
-   return;
-   } else if (!obj_ptr  alfi.func_ptr  
!(alfi.func_ptr-common.fn_flags  ZEND_ACC_STATIC)) {
-   if (do_throw) {
-   
zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, 
Passed array specifies a non static method but no object);
+   } else if (Z_TYPE_P(zcallable) == IS_UNICODE) {
+   ZVAL_STRINGL(ztmp, spl_autoload_call, 
sizeof(spl_autoload_call), 1);
+   convert_to_unicode(ztmp);
+   if (zend_u_binary_zval_strcmp(ztmp, zcallable)) {
+   if 
(!zend_binary_strcasecmp(Z_STRVAL_P(zcallable), sizeof(spl_autoload_call), 
spl_autoload_call, sizeof(spl_autoload_call))) {
+   if (do_throw) {
+   
zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, Function 
spl_autoload_call() cannot be registered);
+   }
+   zval_dtor(ztmp);
+   return;
+   }
}
-   zval_dtor(zfunc_name);
-   return;
+   zval_dtor(ztmp);
}
-   func_name_type = Z_TYPE(zfunc_name);
-   func_name_len = Z_UNILEN(zfunc_name);
-   lc_name = zend_u_str_tolower_dup(func_name_type, 
Z_UNIVAL(zfunc_name), func_name_len);
-   zval_dtor(zfunc_name);
+   
+   if (!zend_is_callable_ex(zcallable, IS_CALLABLE_STRICT, 
zfunc_name, alfi.ce, alfi.func_ptr, obj_ptr TSRMLS_CC)) {
+   if (Z_TYPE_P(zcallable) == IS_ARRAY) {
+   if (!obj_ptr  alfi.func_ptr  
!(alfi.func_ptr-common.fn_flags  ZEND_ACC_STATIC)) {
+   if (do_throw) {
+   
zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, 
Passed array specifies a non static method but no object);
+   }
+   

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

2005-12-05 Thread Jani Taskinen
sniper  Mon Dec  5 21:00:09 2005 EDT

  Modified files:  
/php-src/ext/splphp_spl.c spl_functions.c spl_functions.h 
spl_iterators.c 
  Log:
  - function_entry - zend_function_entry (php3 legacy!)
  
http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.76r2=1.77ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.76 php-src/ext/spl/php_spl.c:1.77
--- php-src/ext/spl/php_spl.c:1.76  Sun Nov 20 10:21:23 2005
+++ php-src/ext/spl/php_spl.c   Mon Dec  5 21:00:06 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.76 2005/11/20 15:21:23 johannes Exp $ */
+/* $Id: php_spl.c,v 1.77 2005/12/06 02:00:06 sniper Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -45,7 +45,7 @@
 
 /* {{{ spl_functions_none
  */
-function_entry spl_functions_none[] = {
+zend_function_entry spl_functions_none[] = {
{NULL, NULL, NULL}
 };
 /* }}} */
@@ -599,7 +599,7 @@
 
 /* {{{ spl_functions
  */
-function_entry spl_functions[] = {
+zend_function_entry spl_functions[] = {
PHP_FE(spl_classes, NULL)
PHP_FE(spl_autoload,NULL)
PHP_FE(spl_autoload_extensions, NULL)
http://cvs.php.net/diff.php/php-src/ext/spl/spl_functions.c?r1=1.32r2=1.33ty=u
Index: php-src/ext/spl/spl_functions.c
diff -u php-src/ext/spl/spl_functions.c:1.32 
php-src/ext/spl/spl_functions.c:1.33
--- php-src/ext/spl/spl_functions.c:1.32Tue Aug 23 05:33:45 2005
+++ php-src/ext/spl/spl_functions.c Mon Dec  5 21:00:07 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_functions.c,v 1.32 2005/08/23 09:33:45 dmitry Exp $ */
+/* $Id: spl_functions.c,v 1.33 2005/12/06 02:00:07 sniper Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -36,7 +36,7 @@
 /* }}} */
 
 /* {{{ spl_register_interface */
-void spl_register_interface(zend_class_entry ** ppce, char * class_name, 
zend_function_entry *functions TSRMLS_DC)
+void spl_register_interface(zend_class_entry ** ppce, char * class_name, 
zend_function_entry * functions TSRMLS_DC)
 {
zend_class_entry ce;

@@ -50,7 +50,7 @@
 /* }}} */
 
 /* {{{ spl_register_std_class */
-void spl_register_std_class(zend_class_entry ** ppce, char * class_name, void 
* obj_ctor, function_entry * function_list TSRMLS_DC)
+void spl_register_std_class(zend_class_entry ** ppce, char * class_name, void 
* obj_ctor, zend_function_entry * function_list TSRMLS_DC)
 {
zend_class_entry ce;

@@ -66,7 +66,7 @@
 /* }}} */
 
 /* {{{ spl_register_sub_class */
-void spl_register_sub_class(zend_class_entry ** ppce, zend_class_entry * 
parent_ce, char * class_name, void *obj_ctor, function_entry * function_list 
TSRMLS_DC)
+void spl_register_sub_class(zend_class_entry ** ppce, zend_class_entry * 
parent_ce, char * class_name, void *obj_ctor, zend_function_entry * 
function_list TSRMLS_DC)
 {
zend_class_entry ce;

@@ -91,7 +91,7 @@
 /* }}} */
 
 /* {{{ spl_register_functions */
-void spl_register_functions(zend_class_entry * class_entry, function_entry * 
function_list TSRMLS_DC)
+void spl_register_functions(zend_class_entry * class_entry, 
zend_function_entry * function_list TSRMLS_DC)
 {
zend_register_functions(class_entry, function_list, 
class_entry-function_table, MODULE_PERSISTENT TSRMLS_CC);
 }
http://cvs.php.net/diff.php/php-src/ext/spl/spl_functions.h?r1=1.21r2=1.22ty=u
Index: php-src/ext/spl/spl_functions.h
diff -u php-src/ext/spl/spl_functions.h:1.21 
php-src/ext/spl/spl_functions.h:1.22
--- php-src/ext/spl/spl_functions.h:1.21Wed Sep 14 23:31:36 2005
+++ php-src/ext/spl/spl_functions.h Mon Dec  5 21:00:07 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_functions.h,v 1.21 2005/09/15 03:31:36 helly Exp $ */
+/* $Id: spl_functions.h,v 1.22 2005/12/06 02:00:07 sniper Exp $ */
 
 #ifndef PHP_FUNCTIONS_H
 #define PHP_FUNCTIONS_H
@@ -57,13 +57,13 @@
 
 void spl_destroy_class(zend_class_entry ** ppce);
 
-void spl_register_std_class(zend_class_entry ** ppce, char * class_name, 
create_object_func_t ctor, function_entry * function_list TSRMLS_DC);
-void spl_register_sub_class(zend_class_entry ** ppce, zend_class_entry * 
parent_ce, char * class_name, create_object_func_t ctor, function_entry * 
function_list TSRMLS_DC);
+void spl_register_std_class(zend_class_entry ** ppce, char * class_name, 
create_object_func_t ctor, zend_function_entry * function_list TSRMLS_DC);
+void spl_register_sub_class(zend_class_entry ** ppce, zend_class_entry * 
parent_ce, char * class_name, create_object_func_t ctor, zend_function_entry * 
function_list TSRMLS_DC);
 
 void spl_register_interface(zend_class_entry ** ppce, char * class_name, 
zend_function_entry *functions TSRMLS_DC);
 
 void spl_register_parent_ce(zend_class_entry * 

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

2005-11-20 Thread Johannes Schl
johannesSun Nov 20 10:21:24 2005 EDT

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Fix SPL class listing for phpinfo in unicode mode
  
http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.75r2=1.76ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.75 php-src/ext/spl/php_spl.c:1.76
--- php-src/ext/spl/php_spl.c:1.75  Thu Nov  3 17:04:35 2005
+++ php-src/ext/spl/php_spl.c   Sun Nov 20 10:21:23 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.75 2005/11/03 22:04:35 helly Exp $ */
+/* $Id: php_spl.c,v 1.76 2005/11/20 15:21:23 johannes Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -559,7 +559,7 @@
 {
char *res;

-   spprintf(res, 0, %s, %s, *list, Z_STRVAL_PP(entry));
+   spprintf(res, 0, %s, %v, *list, Z_STRVAL_PP(entry));
efree(*list);
*list = res;
return ZEND_HASH_APPLY_KEEP;

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

2005-11-03 Thread Marcus Boerger
helly   Thu Nov  3 16:28:30 2005 EDT

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Add missing check
  
http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.72r2=1.73ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.72 php-src/ext/spl/php_spl.c:1.73
--- php-src/ext/spl/php_spl.c:1.72  Sat Oct 29 11:10:55 2005
+++ php-src/ext/spl/php_spl.c   Thu Nov  3 16:28:16 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.72 2005/10/29 15:10:55 helly Exp $ */
+/* $Id: php_spl.c,v 1.73 2005/11/03 21:28:16 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -399,7 +399,7 @@
}
zval_dtor(zfunc_name);
return;
-   } else if (!obj_ptr  !(alfi.func_ptr-common.fn_flags  
ZEND_ACC_STATIC)) {
+   } else if (!obj_ptr  alfi.func_ptr  
!(alfi.func_ptr-common.fn_flags  ZEND_ACC_STATIC)) {
if (do_throw) {

zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, 
Passed array specifies a non static method but no object);
}

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

2005-11-03 Thread Marcus Boerger
helly   Thu Nov  3 16:58:44 2005 EDT

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Tray fixing #35088
  
http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.73r2=1.74ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.73 php-src/ext/spl/php_spl.c:1.74
--- php-src/ext/spl/php_spl.c:1.73  Thu Nov  3 16:28:16 2005
+++ php-src/ext/spl/php_spl.c   Thu Nov  3 16:58:42 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.73 2005/11/03 21:28:16 helly Exp $ */
+/* $Id: php_spl.c,v 1.74 2005/11/03 21:58:42 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -448,7 +448,11 @@
zend_hash_find(EG(function_table), spl_autoload, 
sizeof(spl_autoload), (void **) spl_func_ptr);
 
if (EG(autoload_func) == spl_func_ptr) { /* registered already, 
so we insert that first */
-   autoload_func_info spl_alfi = {spl_func_ptr, NULL, 
NULL};
+   autoload_func_info spl_alfi;
+
+   spl_alfi.func_ptr = spl_func_ptr;
+   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);
}
 

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

2005-11-03 Thread Marcus Boerger
helly   Thu Nov  3 17:04:38 2005 EDT

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Add missing check flag
  
http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.74r2=1.75ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.74 php-src/ext/spl/php_spl.c:1.75
--- php-src/ext/spl/php_spl.c:1.74  Thu Nov  3 16:58:42 2005
+++ php-src/ext/spl/php_spl.c   Thu Nov  3 17:04:35 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.74 2005/11/03 21:58:42 helly Exp $ */
+/* $Id: php_spl.c,v 1.75 2005/11/03 22:04:35 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -393,7 +393,7 @@
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, a|b, 
zcallable, do_throw) == FAILURE) {
return;
}
-   if (!zend_is_callable_ex(zcallable, 0, zfunc_name, alfi.ce, 
alfi.func_ptr, obj_ptr TSRMLS_CC)) {
+   if (!zend_is_callable_ex(zcallable, 
IS_CALLABLE_CHECK_IS_STATIC, zfunc_name, alfi.ce, alfi.func_ptr, obj_ptr 
TSRMLS_CC)) {
if (do_throw) {

zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, 
Passed array does not specify a callable static method);
}

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

2005-10-29 Thread Marcus Boerger
helly   Sat Oct 29 11:10:56 2005 EDT

  Modified files:  
/php-src/ext/splspl_directory.c php_spl.c 
  Log:
  - Add class SplTempFileObject
  http://cvs.php.net/diff.php/php-src/ext/spl/spl_directory.c?r1=1.52r2=1.53ty=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.52 
php-src/ext/spl/spl_directory.c:1.53
--- php-src/ext/spl/spl_directory.c:1.52Mon Oct 10 17:06:54 2005
+++ php-src/ext/spl/spl_directory.c Sat Oct 29 11:10:55 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_directory.c,v 1.52 2005/10/10 21:06:54 helly Exp $ */
+/* $Id: spl_directory.c,v 1.53 2005/10/29 15:10:55 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -52,6 +52,7 @@
 PHPAPI zend_class_entry *spl_ce_DirectoryIterator;
 PHPAPI zend_class_entry *spl_ce_RecursiveDirectoryIterator;
 PHPAPI zend_class_entry *spl_ce_SplFileObject;
+PHPAPI zend_class_entry *spl_ce_SplTempFileObject;
 
 static void spl_filesystem_file_free_line(spl_filesystem_object *intern 
TSRMLS_DC) /* {{{ */
 {
@@ -1120,7 +1121,7 @@
 
 /* the method table */
 /* each method can have its own parameters and visibility */
-static zend_function_entry spl_filesystem_info_class_functions[] = {
+static zend_function_entry spl_SplFileInfo_functions[] = {
SPL_ME(SplFileInfo,   __construct,   arginfo_info___construct, 
ZEND_ACC_PUBLIC)
SPL_ME(SplFileInfo,   getPath,   NULL, ZEND_ACC_PUBLIC)
SPL_ME(SplFileInfo,   getFilename,   NULL, ZEND_ACC_PUBLIC)
@@ -1154,7 +1155,7 @@
 
 /* the method table */
 /* each method can have its own parameters and visibility */
-static zend_function_entry spl_filesystem_dir_class_functions[] = {
+static zend_function_entry spl_DirectoryIterator_functions[] = {
SPL_ME(DirectoryIterator, __construct,   arginfo_dir___construct, 
ZEND_ACC_PUBLIC)
SPL_ME(DirectoryIterator, getFilename,   NULL, ZEND_ACC_PUBLIC)
SPL_ME(DirectoryIterator, isDot, NULL, ZEND_ACC_PUBLIC)
@@ -1167,7 +1168,7 @@
{NULL, NULL, NULL}
 };
 
-static zend_function_entry spl_filesystem_tree_class_functions[] = {
+static zend_function_entry spl_RecursiveDirectoryIterator_functions[] = {
SPL_ME(RecursiveDirectoryIterator, rewind,NULL, ZEND_ACC_PUBLIC)
SPL_ME(RecursiveDirectoryIterator, next,  NULL, ZEND_ACC_PUBLIC)
SPL_ME(RecursiveDirectoryIterator, key,   NULL, ZEND_ACC_PUBLIC)
@@ -1266,7 +1267,7 @@
 } /* }}} */
 
 /* {{{ proto void SplFileObject::__construct(string filename [, string mode = 
'r' [, bool use_include_path  [, resource context)
-   Construct a new file reader */
+   Construct a new file object */
 SPL_METHOD(SplFileObject, __construct)
 {
spl_filesystem_object *intern = 
(spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
@@ -1300,6 +1301,43 @@
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
 } /* }}} */
 
+/* {{{ proto void SplFileObject::__construct([int max_memory])
+   Construct a new temp file object */
+SPL_METHOD(SplTempFileObject, __construct)
+{
+   long max_memory = PHP_STREAM_MAX_MEM;
+   char tmp_fname[32];
+   spl_filesystem_object *intern = 
(spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
+
+   php_set_error_handling(EH_THROW, U_CLASS_ENTRY(spl_ce_RuntimeException) 
TSRMLS_CC);
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |l, max_memory) 
== FAILURE) {
+   php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
+   return;
+   }
+
+   if (max_memory  0) {
+   intern-file_name = php://memory;
+   intern-file_name_len = 12;
+   } else if (ZEND_NUM_ARGS()) {
+   intern-file_name_len = snprintf(tmp_fname, sizeof(tmp_fname), 
php://temp/maxmemory:%ld, max_memory);
+   intern-file_name = tmp_fname;
+   } else {
+   intern-file_name = php://temp;
+   intern-file_name_len = 10;
+   }
+   intern-u.file.open_mode = wb;
+   intern-u.file.open_mode_len = 1;
+   intern-u.file.zcontext = NULL;
+   
+   spl_filesystem_file_open(intern, 0, 0 TSRMLS_CC);
+
+   intern-path_len = 0;
+   intern-path = estrndup(, 0);
+
+   php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
+} /* }}} */
+
 /* {{{ proto void SplFileObject::rewind()
Rewind the file and read the first line */
 SPL_METHOD(SplFileObject, rewind)
@@ -1774,7 +1812,7 @@
ZEND_ARG_INFO(0, line_pos)
 ZEND_END_ARG_INFO();
 
-static zend_function_entry spl_filesystem_file_class_functions[] = {
+static zend_function_entry spl_SplFileObject_functions[] = {
SPL_ME(SplFileObject, __construct,arginfo_file_object___construct,  
 ZEND_ACC_PUBLIC)
SPL_ME(SplFileObject, getFilename,NULL, ZEND_ACC_PUBLIC)
SPL_ME(SplFileObject, rewind, NULL, ZEND_ACC_PUBLIC)
@@ 

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

2005-10-26 Thread Antony Dovgal
tony2001Wed Oct 26 18:46:53 2005 EDT

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  make compilers happy
  
  
http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.70r2=1.71ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.70 php-src/ext/spl/php_spl.c:1.71
--- php-src/ext/spl/php_spl.c:1.70  Tue Oct 25 15:38:49 2005
+++ php-src/ext/spl/php_spl.c   Wed Oct 26 18:46:51 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.70 2005/10/25 19:38:49 helly Exp $ */
+/* $Id: php_spl.c,v 1.71 2005/10/26 22:46:51 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -341,8 +341,8 @@
 {
zval **class_name, *retval = NULL;
char *func_name, *lc_name;
-   int func_name_len;
-   long dummy;
+   uint func_name_len;
+   ulong dummy;
HashPosition function_pos;
autoload_func_info *alfi;
 

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

2005-10-25 Thread Marcus Boerger
helly   Tue Oct 25 15:38:58 2005 EDT

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - zend_is_callable_ex() was changed
  
http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.69r2=1.70ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.69 php-src/ext/spl/php_spl.c:1.70
--- php-src/ext/spl/php_spl.c:1.69  Mon Oct 10 19:58:40 2005
+++ php-src/ext/spl/php_spl.c   Tue Oct 25 15:38:49 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.69 2005/10/10 23:58:40 helly Exp $ */
+/* $Id: php_spl.c,v 1.70 2005/10/25 19:38:49 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -392,7 +392,7 @@
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, a|b, 
zcallable, do_throw) == FAILURE) {
return;
}
-   if (!zend_is_callable_ex(zcallable, 0, zfunc_name, 
alfi.func_ptr, obj_ptr TSRMLS_CC)) {
+   if (!zend_is_callable_ex(zcallable, 0, zfunc_name, alfi.ce, 
alfi.func_ptr, obj_ptr TSRMLS_CC)) {
if (do_throw) {

zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, 
Passed array does not specify a callable static method);
}
@@ -412,10 +412,8 @@
if (obj_ptr  !(alfi.func_ptr-common.fn_flags  
ZEND_ACC_STATIC)) {
alfi.obj = *obj_ptr;
alfi.obj-refcount++;
-   alfi.ce = Z_OBJCE_P(alfi.obj);
} else {
alfi.obj = NULL;
-   alfi.ce = NULL;
}
} else if (ZEND_NUM_ARGS()) {
lc_name = zend_u_str_tolower_dup(func_name_type, func_name, 
func_name_len);

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

2005-10-10 Thread Marcus Boerger
helly   Mon Oct 10 17:45:13 2005 EDT

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Register new class
  
http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.67r2=1.68ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.67 php-src/ext/spl/php_spl.c:1.68
--- php-src/ext/spl/php_spl.c:1.67  Mon Sep 26 13:54:57 2005
+++ php-src/ext/spl/php_spl.c   Mon Oct 10 17:45:09 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.67 2005/09/26 17:54:57 helly Exp $ */
+/* $Id: php_spl.c,v 1.68 2005/10/10 21:45:09 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -181,6 +181,7 @@
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); \
+   SPL_ADD_CLASS(SplFileInfo, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(SplFileObject, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(SplObjectStorage, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(SplObserver, z_list, sub, allow, ce_flags); \

-- 
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 spl_iterators.c spl_iterators.h /ext/spl/tests iterator_029.phpt

2005-10-10 Thread Marcus Boerger
helly   Mon Oct 10 19:58:42 2005 EDT

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

  Modified files:  
/php-src/ext/splphp_spl.c spl_iterators.c spl_iterators.h 
  Log:
  - Add (Recursive)RegExIterator
  
  http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.68r2=1.69ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.68 php-src/ext/spl/php_spl.c:1.69
--- php-src/ext/spl/php_spl.c:1.68  Mon Oct 10 17:45:09 2005
+++ php-src/ext/spl/php_spl.c   Mon Oct 10 19:58:40 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.68 2005/10/10 21:45:09 helly Exp $ */
+/* $Id: php_spl.c,v 1.69 2005/10/10 23:58:40 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -178,6 +178,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); \
http://cvs.php.net/diff.php/php-src/ext/spl/spl_iterators.c?r1=1.89r2=1.90ty=u
Index: php-src/ext/spl/spl_iterators.c
diff -u php-src/ext/spl/spl_iterators.c:1.89 
php-src/ext/spl/spl_iterators.c:1.90
--- php-src/ext/spl/spl_iterators.c:1.89Wed Oct  5 17:57:45 2005
+++ php-src/ext/spl/spl_iterators.c Mon Oct 10 19:58:40 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_iterators.c,v 1.89 2005/10/05 21:57:45 helly Exp $ */
+/* $Id: spl_iterators.c,v 1.90 2005/10/10 23:58:40 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -53,6 +53,8 @@
 PHPAPI zend_class_entry *spl_ce_InfiniteIterator;
 PHPAPI zend_class_entry *spl_ce_EmptyIterator;
 PHPAPI zend_class_entry *spl_ce_AppendIterator;
+PHPAPI zend_class_entry *spl_ce_RegExIterator;
+PHPAPI zend_class_entry *spl_ce_RecursiveRegExIterator;
 
 function_entry spl_funcs_RecursiveIterator[] = {
SPL_ABSTRACT_ME(RecursiveIterator, hasChildren,  NULL)
@@ -897,6 +899,23 @@
intern-u.append.iterator = 
U_CLASS_ENTRY(spl_ce_ArrayIterator)-get_iterator(U_CLASS_ENTRY(spl_ce_ArrayIterator),
 intern-u.append.zarrayit TSRMLS_CC);
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
return intern;
+#if HAVE_PCRE || HAVE_BUNDLED_PCRE
+   case DIT_RegExIterator:
+   case DIT_RecursiveRegExIterator: {
+   char *regex;
+   int len;
+
+   intern-u.regex.flags = 0;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
Os|l, zobject, ce_inner, regex, len, intern-u.regex.flags) == FAILURE) {
+   php_set_error_handling(EH_NORMAL, NULL 
TSRMLS_CC);
+   return NULL;
+   }
+   intern-u.regex.extra = NULL;
+   intern-u.regex.options = 0;
+   intern-u.regex.re = pcre_get_compiled_regex(regex, 
intern-u.regex.extra, intern-u.regex.options TSRMLS_CC);
+   break;;
+   }
+#endif
default:
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
O, zobject, ce_inner) == FAILURE) {
php_set_error_handling(EH_NORMAL, NULL 
TSRMLS_CC);
@@ -1229,6 +1248,62 @@
zval_ptr_dtor(retval);
 } /* }}} */
 
+#if HAVE_PCRE || HAVE_BUNDLED_PCRE
+/* {{{ proto RegExIterator::__construct(Iterator it, string $regex [, int 
$flags]) 
+   Create an RegExIterator from another iterator and a regular expression */
+SPL_METHOD(RegExIterator, __construct)
+{
+   spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, 
U_CLASS_ENTRY(zend_ce_iterator), DIT_RegExIterator);
+} /* }}} */
+
+/* {{{ proto bool RegExIterator::accept()
+   Match (string)current() against regular expression */
+SPL_METHOD(RegExIterator, accept)
+{
+   spl_dual_it_object   *intern;
+   int count;
+   char *subject, tmp[32];
+   int subject_len, use_copy = 0;
+   zval subject_copy;
+
+   intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() 
TSRMLS_CC);
+   
+   if (intern-u.regex.flags) {
+   if (intern-current.key_type == HASH_KEY_IS_LONG) {
+   subject_len = snprintf(tmp, sizeof(tmp), %ld, 
intern-current.int_key);
+   subject = tmp[0];
+   } else {
+   

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

2005-09-26 Thread Marcus Boerger
helly   Mon Sep 26 13:54:59 2005 EDT

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Reset global pointer to NULL after mem free (required for apache 1.3)
  
http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.66r2=1.67ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.66 php-src/ext/spl/php_spl.c:1.67
--- php-src/ext/spl/php_spl.c:1.66  Sun Sep 25 14:06:08 2005
+++ php-src/ext/spl/php_spl.c   Mon Sep 26 13:54:57 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.66 2005/09/25 18:06:08 helly Exp $ */
+/* $Id: php_spl.c,v 1.67 2005/09/26 17:54:57 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -631,6 +631,7 @@
 PHP_RINIT_FUNCTION(spl) /* {{{ */
 {
SPL_G(autoload_extensions) = estrndup(.inc,.php, 
sizeof(.inc,.php)-1);
+   SPL_G(autoload_functions) = NULL;
return SUCCESS;
 } /* }}} */
 
@@ -643,6 +644,7 @@
if (SPL_G(autoload_functions)) {
zend_hash_destroy(SPL_G(autoload_functions));
FREE_HASHTABLE(SPL_G(autoload_functions));
+   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 /ext/spl php_spl.c

2005-09-25 Thread Marcus Boerger
helly   Sun Sep 25 14:06:08 2005 EDT

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Make code more readable, fix issue with parameter parsing introduced with
unicode update
  
  
http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.65r2=1.66ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.65 php-src/ext/spl/php_spl.c:1.66
--- php-src/ext/spl/php_spl.c:1.65  Sun Sep 18 12:51:20 2005
+++ php-src/ext/spl/php_spl.c   Sun Sep 25 14:06:08 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.65 2005/09/18 16:51:20 helly Exp $ */
+/* $Id: php_spl.c,v 1.66 2005/09/25 18:06:08 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -374,6 +374,7 @@
  Register given function as __autoload() implementation */
 PHP_FUNCTION(spl_autoload_register)
 {
+   zval zfunc_name;
char *func_name;
uint func_name_len;
char *lc_name = NULL;
@@ -385,28 +386,26 @@
zend_uchar func_name_type;
 
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() 
TSRMLS_CC, |tb, func_name, func_name_len, func_name_type, do_throw) == 
FAILURE) {
-   zval func_name;
-
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, a|b, 
zcallable, func_name_len, do_throw) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, a|b, 
zcallable, do_throw) == FAILURE) {
return;
}
-   if (!zend_is_callable_ex(zcallable, 0, func_name, 
alfi.func_ptr, obj_ptr TSRMLS_CC)) {
+   if (!zend_is_callable_ex(zcallable, 0, zfunc_name, 
alfi.func_ptr, obj_ptr TSRMLS_CC)) {
if (do_throw) {

zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, 
Passed array does not specify a callable static method);
}
-   zval_dtor(func_name);
+   zval_dtor(zfunc_name);
return;
} else if (!obj_ptr  !(alfi.func_ptr-common.fn_flags  
ZEND_ACC_STATIC)) {
if (do_throw) {

zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, 
Passed array specifies a non static method but no object);
}
-   zval_dtor(func_name);
+   zval_dtor(zfunc_name);
return;
}
-   func_name_type = Z_TYPE(func_name);
-   func_name_len = Z_UNILEN(func_name);
-   lc_name = zend_u_str_tolower_dup(func_name_type, 
Z_UNIVAL(func_name), func_name_len);
-   zval_dtor(func_name);
+   func_name_type = Z_TYPE(zfunc_name);
+   func_name_len = Z_UNILEN(zfunc_name);
+   lc_name = zend_u_str_tolower_dup(func_name_type, 
Z_UNIVAL(zfunc_name), func_name_len);
+   zval_dtor(zfunc_name);
if (obj_ptr  !(alfi.func_ptr-common.fn_flags  
ZEND_ACC_STATIC)) {
alfi.obj = *obj_ptr;
alfi.obj-refcount++;

-- 
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 spl.php spl_iterators.c spl_iterators.h /ext/spl/examples directorygraphiterator.inc directorytreeiterator.inc /ext/spl/internal cachingrecursiveiterator.in

2005-09-18 Thread Marcus Boerger
helly   Sun Sep 18 12:51:24 2005 EDT

  Added files: 
/php-src/ext/spl/internal   recursivecachingiterator.inc 

  Removed files:   
/php-src/ext/spl/internal   cachingrecursiveiterator.inc 

  Modified files:  
/php-src/ext/splphp_spl.c spl.php spl_iterators.c spl_iterators.h 
/php-src/ext/spl/examples   directorygraphiterator.inc 
directorytreeiterator.inc 
/php-src/ext/spl/tests  iterator_026.phpt 
  Log:
  - Rename 'CachingRecursiveIterator' to 'RecursiveCachingIterator' so that
all of those follow the naming scheme 'Recursive*Iterator'
  
  http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.64r2=1.65ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.64 php-src/ext/spl/php_spl.c:1.65
--- php-src/ext/spl/php_spl.c:1.64  Sun Sep 18 07:34:33 2005
+++ php-src/ext/spl/php_spl.c   Sun Sep 18 12:51:20 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.64 2005/09/18 11:34:33 helly Exp $ */
+/* $Id: php_spl.c,v 1.65 2005/09/18 16:51:20 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -154,7 +154,6 @@
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); \
-   SPL_ADD_CLASS(CachingRecursiveIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(Countable, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(DirectoryIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(DomainException, z_list, sub, allow, ce_flags); \
@@ -173,9 +172,10 @@
SPL_ADD_CLASS(OverflowException, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(ParentIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(RangeException, z_list, sub, allow, ce_flags); \
+   SPL_ADD_CLASS(RecursiveArrayIterator, z_list, sub, allow, ce_flags); \
+   SPL_ADD_CLASS(RecursiveCachingIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(RecursiveDirectoryIterator, z_list, sub, allow, 
ce_flags); \
SPL_ADD_CLASS(RecursiveFilterIterator, z_list, sub, allow, ce_flags); \
-   SPL_ADD_CLASS(RecursiveArrayIterator, 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(RuntimeException, z_list, sub, allow, ce_flags); \
http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.53r2=1.54ty=u
Index: php-src/ext/spl/spl.php
diff -u php-src/ext/spl/spl.php:1.53 php-src/ext/spl/spl.php:1.54
--- php-src/ext/spl/spl.php:1.53Sun Sep 18 07:34:33 2005
+++ php-src/ext/spl/spl.php Sun Sep 18 12:51:20 2005
@@ -40,7 +40,7 @@
  * - interface SeekableIterator implements Iterator
  * - class LimitIterator implements OuterIterator
  * - class CachingIterator implements OuterIterator
- * - class CachingRecursiveIterator extends CachingIterator implements 
RecursiveIterator
+ * - class RecursiveCachingIterator extends CachingIterator implements 
RecursiveIterator
  * - class IteratorIterator implements OuterIterator
  * - class NoRewindIterator implements OuterIterator
  * - class EmptyIterator implements Iterator
http://cvs.php.net/diff.php/php-src/ext/spl/spl_iterators.c?r1=1.84r2=1.85ty=u
Index: php-src/ext/spl/spl_iterators.c
diff -u php-src/ext/spl/spl_iterators.c:1.84 
php-src/ext/spl/spl_iterators.c:1.85
--- php-src/ext/spl/spl_iterators.c:1.84Sun Sep 18 07:34:34 2005
+++ php-src/ext/spl/spl_iterators.c Sun Sep 18 12:51:20 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_iterators.c,v 1.84 2005/09/18 11:34:34 helly Exp $ */
+/* $Id: spl_iterators.c,v 1.85 2005/09/18 16:51:20 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -46,7 +46,7 @@
 PHPAPI zend_class_entry *spl_ce_SeekableIterator;
 PHPAPI zend_class_entry *spl_ce_LimitIterator;
 PHPAPI zend_class_entry *spl_ce_CachingIterator;
-PHPAPI zend_class_entry *spl_ce_CachingRecursiveIterator;
+PHPAPI zend_class_entry *spl_ce_RecursiveCachingIterator;
 PHPAPI zend_class_entry *spl_ce_OuterIterator;
 PHPAPI zend_class_entry *spl_ce_IteratorIterator;
 PHPAPI zend_class_entry *spl_ce_NoRewindIterator;
@@ -794,7 +794,7 @@
break;
}
case DIT_CachingIterator:
-   case DIT_CachingRecursiveIterator: {
+   case DIT_RecursiveCachingIterator: {
long flags = CIT_CALL_TOSTRING;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
O|l, zobject, ce_inner, flags) == FAILURE) {
php_set_error_handling(EH_NORMAL, NULL 
TSRMLS_CC);
@@ -906,7 

[PHP-CVS] cvs: php-src /ext/spl php_spl.c spl.php spl_directory.c spl_directory.h /ext/spl/internal fileobject.inc splfileobject.inc /ext/spl/tests fileobject_001.phpt fileobject_002.phpt

2005-09-15 Thread Marcus Boerger
helly   Thu Sep 15 10:07:39 2005 EDT

  Added files: 
/php-src/ext/spl/internal   splfileobject.inc 

  Removed files:   
/php-src/ext/spl/internal   fileobject.inc 

  Modified files:  
/php-src/ext/splphp_spl.c spl.php spl_directory.c spl_directory.h 
/php-src/ext/spl/tests  fileobject_001.phpt fileobject_002.phpt 
  Log:
  - Rename file class again by popular demmand: calling it SplFileObject now
  # Any other idea about the name? Or should i come up with a renaming plan
  # for the upcoming versions? :-)
  
  http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.62r2=1.63ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.62 php-src/ext/spl/php_spl.c:1.63
--- php-src/ext/spl/php_spl.c:1.62  Wed Sep 14 23:31:36 2005
+++ php-src/ext/spl/php_spl.c   Thu Sep 15 10:07:38 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.62 2005/09/15 03:31:36 helly Exp $ */
+/* $Id: php_spl.c,v 1.63 2005/09/15 14:07:38 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -159,7 +159,6 @@
SPL_ADD_CLASS(DirectoryIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(DomainException, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(EmptyIterator, z_list, sub, allow, ce_flags); \
-   SPL_ADD_CLASS(FileObject, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(FilterIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(InfiniteIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(InvalidArgumentException, z_list, sub, allow, ce_flags); \
@@ -181,6 +180,7 @@
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); \
+   SPL_ADD_CLASS(SplFileObject, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(SplObjectStorage, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(SplObserver, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(SplSubject, z_list, sub, allow, ce_flags); \
http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.51r2=1.52ty=u
Index: php-src/ext/spl/spl.php
diff -u php-src/ext/spl/spl.php:1.51 php-src/ext/spl/spl.php:1.52
--- php-src/ext/spl/spl.php:1.51Wed Sep 14 23:31:36 2005
+++ php-src/ext/spl/spl.php Thu Sep 15 10:07:38 2005
@@ -53,7 +53,7 @@
  * 
  * - class DirectoryIterator implements Iterator
  * - class RecursiveDirectoryIterator extends DirectoryIterator implements 
RecursiveIterator
- * - class FileObject implements RecursiveIterator, SeekableIterator
+ * - class SplFileObject implements RecursiveIterator, SeekableIterator
  * 
  * 3) XML
  * 
@@ -761,16 +761,16 @@
 */
function __toString();
 
-   /** Open the current file as a FileObject instance
+   /** Open the current file as a SplFileObject instance
 *
 * @param mode  open mode
 * @param use_include_path  whether to search include paths (don't use)
 * @param context   resource context to pased to open function
 * @throw RuntimeException  if file cannot be opened (e.g. insufficient 
 *  access rights).
-* @return The opened file as a FileObject instance
+* @return The opened file as a SplFileObject instance
 *
-* @see FileObject
+* @see SplFileObject
 * @see file()
 */
function DirectoryIterator::openFile($mode = 'r', $use_include_path = 
false, $context = NULL);
http://cvs.php.net/diff.php/php-src/ext/spl/spl_directory.c?r1=1.47r2=1.48ty=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.47 
php-src/ext/spl/spl_directory.c:1.48
--- php-src/ext/spl/spl_directory.c:1.47Wed Sep 14 23:31:36 2005
+++ php-src/ext/spl/spl_directory.c Thu Sep 15 10:07:38 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_directory.c,v 1.47 2005/09/15 03:31:36 helly Exp $ */
+/* $Id: spl_directory.c,v 1.48 2005/09/15 14:07:38 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -50,7 +50,7 @@
 /* decalre the class entry */
 PHPAPI zend_class_entry *spl_ce_DirectoryIterator;
 PHPAPI zend_class_entry *spl_ce_RecursiveDirectoryIterator;
-PHPAPI zend_class_entry *spl_ce_FileObject;
+PHPAPI zend_class_entry *spl_ce_SplFileObject;
 
 static zend_object_value spl_file_object_new_ex(zend_class_entry *class_type, 
spl_file_object **obj TSRMLS_DC);
 static int spl_file_object_open(spl_file_object *intern, int use_include_path, 
int silent TSRMLS_DC);
@@ -428,7 +428,7 @@
 DirectoryFunction(isLink, FS_IS_LINK)
 /* }}} */
 
-/* {{{ proto FileObject DirectoryIterator::openFile([string mode = 'r' [, bool 
use_include_path  [, resource context]]])
+/* {{{ 

[PHP-CVS] cvs: php-src /ext/spl php_spl.c spl.php spl_array.c spl_directory.c spl_functions.h spl_iterators.c spl_observer.c spl_observer.h /ext/spl/examples directorygraphiterator.inc directorytreei

2005-09-14 Thread Marcus Boerger
helly   Wed Sep 14 23:31:38 2005 EDT

  Modified files:  
/php-src/ext/splphp_spl.c spl.php spl_array.c spl_directory.c 
spl_functions.h spl_iterators.c spl_observer.c 
spl_observer.h 
/php-src/ext/spl/examples   directorygraphiterator.inc 
directorytreeiterator.inc 
/php-src/ext/spl/internal   cachingiterator.inc 
cachingrecursiveiterator.inc 
fileobject.inc 
recursivefilteriterator.inc 
recursiveiteratoriterator.inc 
/php-src/ext/spl/tests  array_009.phpt fileobject_001.phpt 
iterator_002.phpt iterator_023.phpt 
observer_001.phpt observer_002.phpt 
sxe_004.phpt 
  Log:
  - Rename Observer to SplObserver
  - Rename Subject to SplSubject
  - Move SPL constants to class constants
  - Update docu
  
  http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.61r2=1.62ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.61 php-src/ext/spl/php_spl.c:1.62
--- php-src/ext/spl/php_spl.c:1.61  Wed Aug 24 06:16:45 2005
+++ php-src/ext/spl/php_spl.c   Wed Sep 14 23:31:36 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.61 2005/08/24 10:16:45 johannes Exp $ */
+/* $Id: php_spl.c,v 1.62 2005/09/15 03:31:36 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -168,7 +168,6 @@
SPL_ADD_CLASS(LimitIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(LogicException, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(NoRewindIterator, z_list, sub, allow, ce_flags); \
-   SPL_ADD_CLASS(Observer, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(OuterIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(OutOfBoundsException, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(OutOfRangeException, z_list, sub, allow, ce_flags); \
@@ -183,7 +182,8 @@
SPL_ADD_CLASS(SeekableIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(SimpleXMLIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(SplObjectStorage, z_list, sub, allow, ce_flags); \
-   SPL_ADD_CLASS(Subject, z_list, sub, allow, ce_flags); \
+   SPL_ADD_CLASS(SplObserver, z_list, sub, allow, ce_flags); \
+   SPL_ADD_CLASS(SplSubject, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(UnderflowException, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(UnexpectedValueException, z_list, sub, allow, ce_flags); \
 
http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.50r2=1.51ty=u
Index: php-src/ext/spl/spl.php
diff -u php-src/ext/spl/spl.php:1.50 php-src/ext/spl/spl.php:1.51
--- php-src/ext/spl/spl.php:1.50Fri Sep  2 15:10:51 2005
+++ php-src/ext/spl/spl.php Wed Sep 14 23:31:36 2005
@@ -59,7 +59,7 @@
  * 
  * SPL offers an advanced XML handling class:
  * 
- * - class SimpleXMLIterator extends simplexml_element extends 
recursiveiterator
+ * - class SimpleXMLIterator extends simplexml_element implements 
RecursiveIterator
  * 
  * 4) Array Overloading
  * 
@@ -97,8 +97,9 @@
  *
  * SPL suggests a standard way of implementing the observer pattern.
  *
- * - interface Observer
- * - interface Subject
+ * - interface SplObserver
+ * - interface SplSubject
+ * - class SplObjectStorage
  * 
  * Some articles about SPL:
  * - a 
href=http://www.sitepoint.com/article/php5-standard-library/1;Introducing PHP 
5's Standard Library/a
@@ -106,10 +107,14 @@
  * - a 
href=http://www.phpriot.com/d/articles/php/oop/oop-with-spl-php-5-1/index.html;Advanced
 OOP with SPL in PHP 5/a
  * - a 
href=http://www.devshed.com/c/a/PHP/The-Standard-PHP-Library-Part-1/;The 
Standard PHP Library, Part 1/a
  * - 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.wiki.cc/php/SPL;SPL on PHP Wiki/a
+ * - a 
href=http://www.professionelle-softwareentwicklung-mit-php5.de/erste_auflage/oop.iterators.spl.html;Die
 Standard PHP Library (SPL) [german]/a
  *
  * Talks on SPL:
- * - a 
href=http://somabo.de/talks/200504_php_quebec_spl_for_the_masses.pps;SPL for 
the masses [pps]/a
- * - a 
href=http://somabo.de/talks/200504_php_quebec_spl_for_the_masses.pdf;SPL for 
the masses [pdf]/a
+ * - SPL for the masses a 
href=http://somabo.de/talks/200504_php_quebec_spl_for_the_masses.pps;[pps]/a,
 a 
href=http://somabo.de/talks/200504_php_quebec_spl_for_the_masses.pdf;[pdf]/a
+ * - Debug session 1 a 
href=http://somabo.de/talks/200504_php_quebec_iterator_debug_session_1.pps;[pps]/a,
 a 
href=http://somabo.de/talks/200504_php_quebec_iterator_debug_session_1.pdf;[pdf]/a
+ * - Debug session 2 a 

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

2005-08-24 Thread Johannes Schl
johannesWed Aug 24 06:16:48 2005 EDT

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Fix alphabetic order and add missing class
  
http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.60r2=1.61ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.60 php-src/ext/spl/php_spl.c:1.61
--- php-src/ext/spl/php_spl.c:1.60  Mon Aug 22 09:32:46 2005
+++ php-src/ext/spl/php_spl.c   Wed Aug 24 06:16:45 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.60 2005/08/22 13:32:46 dmitry Exp $ */
+/* $Id: php_spl.c,v 1.61 2005/08/24 10:16:45 johannes Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -149,8 +149,8 @@
 
 #define SPL_LIST_CLASSES(z_list, sub, allow, ce_flags) \
SPL_ADD_CLASS(AppendIterator, z_list, sub, allow, ce_flags); \
-   SPL_ADD_CLASS(ArrayObject, 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(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); \
@@ -170,8 +170,8 @@
SPL_ADD_CLASS(NoRewindIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(Observer, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(OuterIterator, z_list, sub, allow, ce_flags); \
-   SPL_ADD_CLASS(OutOfRangeException, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(OutOfBoundsException, z_list, sub, allow, ce_flags); \
+   SPL_ADD_CLASS(OutOfRangeException, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(OverflowException, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(ParentIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(RangeException, z_list, sub, allow, ce_flags); \
@@ -185,6 +185,7 @@
SPL_ADD_CLASS(SplObjectStorage, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(Subject, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(UnderflowException, z_list, sub, allow, ce_flags); \
+   SPL_ADD_CLASS(UnexpectedValueException, z_list, sub, allow, ce_flags); \
 
 /* {{{ proto array spl_classes()
  Return an array containing the names of all clsses and interfaces defined in 
SPL */

-- 
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_002.phpt spl_autoload_004.phpt

2005-08-22 Thread Dmitry Stogov
dmitry  Mon Aug 22 09:32:47 2005 EDT

  Modified files:  
/php-src/ext/splphp_spl.c 
/php-src/ext/spl/tests  spl_autoload_002.phpt spl_autoload_004.phpt 
  Log:
  Unicode support
  
  
http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.59r2=1.60ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.59 php-src/ext/spl/php_spl.c:1.60
--- php-src/ext/spl/php_spl.c:1.59  Mon Aug 22 08:22:12 2005
+++ php-src/ext/spl/php_spl.c   Mon Aug 22 09:32:46 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.59 2005/08/22 12:22:12 dmitry Exp $ */
+/* $Id: php_spl.c,v 1.60 2005/08/22 13:32:46 dmitry Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -341,12 +341,13 @@
HashPosition function_pos;
autoload_func_info *alfi;
 
-   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, class_name) == 
FAILURE || Z_TYPE_PP(class_name) != IS_STRING) {
+   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, class_name) == 
FAILURE || 
+   Z_TYPE_PP(class_name) != (UG(unicode)?IS_UNICODE:IS_STRING)) {
return;
}
 
if (SPL_G(autoload_functions)) {
-   lc_name = zend_str_tolower_dup(Z_STRVAL_PP(class_name), 
Z_STRLEN_PP(class_name));
+   lc_name = zend_u_str_tolower_dup(Z_TYPE_PP(class_name), 
Z_UNIVAL_PP(class_name), Z_UNILEN_PP(class_name));
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  !EG(exception)) {
zend_hash_get_current_key_ex(SPL_G(autoload_functions), 
func_name, func_name_len, dummy, 0, function_pos);
@@ -355,7 +356,7 @@
if (retval) {
zval_ptr_dtor(retval); 

}
-   if (zend_hash_exists(EG(class_table), lc_name, 
Z_STRLEN_PP(class_name)+1)) {
+   if (zend_u_hash_exists(EG(class_table), 
Z_TYPE_PP(class_name), lc_name, Z_UNILEN_PP(class_name)+1)) {
break;
}
zend_hash_move_forward_ex(SPL_G(autoload_functions), 
function_pos);
@@ -415,7 +416,8 @@
} else if (ZEND_NUM_ARGS()) {
lc_name = zend_u_str_tolower_dup(func_name_type, func_name, 
func_name_len);

-   if (!strcmp(lc_name, spl_autoload_call)) {
+   if ((func_name_len == sizeof(spl_autoload_call)-1) 
+   (ZEND_U_EQUAL(func_name_type, lc_name, func_name_len, 
spl_autoload_call, sizeof(spl_autoload_call)-1))) {
if (do_throw) {

zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, 
Function spl_autoload_call() cannot be registered);
}
@@ -475,7 +477,8 @@
lc_name = zend_u_str_tolower_dup(func_name_type, func_name, 
func_name_len);
 
if (SPL_G(autoload_functions)) {
-   if (!strcmp(lc_name, spl_autoload_call)) {
+   if ((func_name_len == sizeof(spl_autoload_call)-1) 
+   (ZEND_U_EQUAL(func_name_type, lc_name, func_name_len, 
spl_autoload_call, sizeof(spl_autoload_call)-1))) {
/* remove all */
zend_hash_destroy(SPL_G(autoload_functions));
FREE_HASHTABLE(SPL_G(autoload_functions));
@@ -486,7 +489,8 @@
/* remove specific */
success = zend_u_hash_del(SPL_G(autoload_functions), 
func_name_type, lc_name, func_name_len+1);
}
-   } else if (!strcmp(lc_name, spl_autoload)) {
+   } else if ((func_name_len == sizeof(spl_autoload)-1) 
+  (ZEND_U_EQUAL(func_name_type, lc_name, func_name_len, 
spl_autoload, sizeof(spl_autoload)-1))) {
/* register single spl_autoload() */
zend_hash_find(EG(function_table), spl_autoload, 
sizeof(spl_autoload), (void **) spl_func_ptr);
 
@@ -529,11 +533,11 @@
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);
+   add_next_index_text(tmp, 
(*func_ptr_ptr)-common.scope-name, 1);
+   add_next_index_text(tmp, 
(*func_ptr_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);
+   

[PHP-CVS] cvs: php-src /ext/spl php_spl.c spl_functions.c spl_functions.h spl_iterators.c /ext/spl/tests spl_003.phpt /ext/standard array.c

2005-08-15 Thread Dmitry Stogov
dmitry  Mon Aug 15 13:29:09 2005 EDT

  Modified files:  
/php-src/ext/splphp_spl.c spl_functions.c spl_functions.h 
spl_iterators.c 
/php-src/ext/spl/tests  spl_003.phpt 
/php-src/ext/standard   array.c 
  Log:
  Unicode support
  
  http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.57r2=1.58ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.57 php-src/ext/spl/php_spl.c:1.58
--- php-src/ext/spl/php_spl.c:1.57  Fri Aug 12 07:29:32 2005
+++ php-src/ext/spl/php_spl.c   Mon Aug 15 13:29:04 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.57 2005/08/12 11:29:32 dmitry Exp $ */
+/* $Id: php_spl.c,v 1.58 2005/08/15 17:29:04 dmitry Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -59,23 +59,22 @@
 }
 /* }}} */
 
-static zend_class_entry * spl_find_ce_by_name(char *name, int len, zend_bool 
autoload TSRMLS_DC)
+static zend_class_entry * spl_find_ce_by_name(zend_uchar ztype, void *name, 
int len, zend_bool autoload TSRMLS_DC)
 {
zend_class_entry **ce;
int found;
+
if (!autoload) {
char *lc_name;
 
-   lc_name = do_alloca(len + 1);
-   zend_str_tolower_copy(lc_name, name, len);
-
-   found = zend_hash_find(EG(class_table), lc_name, len +1, (void 
**) ce);
-   free_alloca(lc_name);
+   lc_name = zend_u_str_tolower_dup(ztype, name, len);
+   found = zend_u_hash_find(EG(class_table), ztype, lc_name, len 
+1, (void **) ce);
+   efree(lc_name);
} else {
-   found = zend_lookup_class(name, len, ce TSRMLS_CC);
+   found = zend_u_lookup_class(ztype, name, len, ce TSRMLS_CC);
}
if (found != SUCCESS) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Class %s does not 
exist%s, name, autoload ?  and could not be loaded : );
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Class %v does not 
exist%s, name, autoload ?  and could not be loaded : );
return NULL;
}

@@ -94,13 +93,13 @@
RETURN_FALSE;
}

-   if (Z_TYPE_P(obj) != IS_OBJECT  Z_TYPE_P(obj) != IS_STRING) {
+   if (Z_TYPE_P(obj) != IS_OBJECT  Z_TYPE_P(obj) != IS_STRING  
Z_TYPE_P(obj) != IS_UNICODE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, object or string 
expected);
RETURN_FALSE;
}

-   if (Z_TYPE_P(obj) == IS_STRING) {
-   if (NULL == (ce = spl_find_ce_by_name(Z_STRVAL_P(obj), 
Z_STRLEN_P(obj), autoload TSRMLS_CC))) {
+   if (Z_TYPE_P(obj) == IS_STRING || Z_TYPE_P(obj) == IS_UNICODE) {
+   if (NULL == (ce = spl_find_ce_by_name(Z_TYPE_P(obj), 
Z_UNIVAL_P(obj), Z_UNILEN_P(obj), autoload TSRMLS_CC))) {
RETURN_FALSE;
}
} else {
@@ -127,13 +126,13 @@
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z|b, obj, 
autoload) == FAILURE) {
RETURN_FALSE;
}
-   if (Z_TYPE_P(obj) != IS_OBJECT  Z_TYPE_P(obj) != IS_STRING) {
+   if (Z_TYPE_P(obj) != IS_OBJECT  Z_TYPE_P(obj) != IS_STRING  
Z_TYPE_P(obj) != IS_UNICODE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, object or string 
expected);
RETURN_FALSE;
}

-   if (Z_TYPE_P(obj) == IS_STRING) {
-   if (NULL == (ce = spl_find_ce_by_name(Z_STRVAL_P(obj), 
Z_STRLEN_P(obj), autoload TSRMLS_CC))) {
+   if (Z_TYPE_P(obj) == IS_STRING || Z_TYPE_P(obj) == IS_UNICODE) {
+   if (NULL == (ce = spl_find_ce_by_name(Z_TYPE_P(obj), 
Z_UNIVAL_P(obj), Z_UNILEN_P(obj), autoload TSRMLS_CC))) {
RETURN_FALSE;
}
} else {
@@ -146,7 +145,7 @@
 /* }}} */
 
 #define SPL_ADD_CLASS(class_name, z_list, sub, allow, ce_flags) \
-   spl_add_classes(spl_ce_ ## class_name, z_list, sub, allow, ce_flags 
TSRMLS_CC)
+   spl_add_classes(U_CLASS_ENTRY(spl_ce_ ## class_name), z_list, sub, 
allow, ce_flags TSRMLS_CC)
 
 #define SPL_LIST_CLASSES(z_list, sub, allow, ce_flags) \
SPL_ADD_CLASS(AppendIterator, z_list, sub, allow, ce_flags); \
http://cvs.php.net/diff.php/php-src/ext/spl/spl_functions.c?r1=1.29r2=1.30ty=u
Index: php-src/ext/spl/spl_functions.c
diff -u php-src/ext/spl/spl_functions.c:1.29 
php-src/ext/spl/spl_functions.c:1.30
--- php-src/ext/spl/spl_functions.c:1.29Thu Aug 11 19:35:55 2005
+++ php-src/ext/spl/spl_functions.c Mon Aug 15 13:29:04 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_functions.c,v 1.29 2005/08/11 23:35:55 andrei Exp $ */
+/* $Id: spl_functions.c,v 1.30 2005/08/15 17:29:04 dmitry Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -115,11 +115,16 @@
if (!allow || (allow  

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

2005-08-10 Thread Marcus Boerger
helly   Wed Aug 10 04:31:57 2005 EDT

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

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Support sttaic class loader methods
  
http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.53r2=1.54ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.53 php-src/ext/spl/php_spl.c:1.54
--- php-src/ext/spl/php_spl.c:1.53  Tue Aug  9 17:11:42 2005
+++ php-src/ext/spl/php_spl.c   Wed Aug 10 04:31:56 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.53 2005/08/09 21:11:42 helly Exp $ */
+/* $Id: php_spl.c,v 1.54 2005/08/10 08:31:56 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -367,22 +367,18 @@
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, a|b, 
zcallable, func_name_len, do_throw) == FAILURE) {
return;
}
-#if MBO_0
if (!zend_is_callable_ex(zcallable, 
IS_CALLABLE_CHECK_IS_STATIC, func_name, func_name_len, func_ptr, NULL 
TSRMLS_CC)) {
if (do_throw) {
if (func_ptr) {

zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, Non static methods 
are not supported yet);
} else {
-   
zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, Passed array does 
not specify a callable method or method);
+   
zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, Passed array does 
not specify a callable sttaic method);
}
}
return;
}
lc_name = do_alloca(func_name_len + 1);
zend_str_tolower_copy(lc_name, func_name, func_name_len);
-#else
-   php_error_docref(NULL TSRMLS_CC, E_ERROR, Loader methods are 
not yet supported);
-#endif
} else if (ZEND_NUM_ARGS()) {
lc_name = do_alloca(func_name_len + 1);
zend_str_tolower_copy(lc_name, func_name, func_name_len);
@@ -493,7 +489,6 @@
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 MBO_0
if ((*func_ptr_ptr)-common.scope) {
zval *tmp;
MAKE_STD_ZVAL(tmp);
@@ -503,7 +498,6 @@
add_next_index_string(tmp, 
(*func_ptr_ptr)-common.function_name, 1);
add_next_index_zval(return_value, tmp);
} else
-#endif
add_next_index_string(return_value, 
(*func_ptr_ptr)-common.function_name, 1);
 
zend_hash_move_forward_ex(SPL_G(autoload_functions), 
function_pos);
@@ -596,7 +590,7 @@
 
 PHP_RINIT_FUNCTION(spl) /* {{{ */
 {
-   SPL_G(autoload_extensions) = estrdup(.inc,.php);
+   SPL_G(autoload_extensions) = estrndup(.inc,.php, 
sizeof(.inc,.php)-1);
return SUCCESS;
 } /* }}} */
 

http://cvs.php.net/co.php/php-src/ext/spl/tests/spl_autoload_004.phpt?r=1.1p=1
Index: php-src/ext/spl/tests/spl_autoload_004.phpt
+++ php-src/ext/spl/tests/spl_autoload_004.phpt
--TEST--
SPL: spl_autoload() with static methods
--INI--
include_path=.
--FILE--
?php

class MyAutoLoader {

static function autoLoad($className) {
echo __METHOD__ . ($className)\n;
}
}

spl_autoload_register(array('MyAutoLoader', 'autoLoad'));

// and

$myAutoLoader = new MyAutoLoader();

spl_autoload_register(array($myAutoLoader, 'autoLoad'));

var_dump(spl_autoload_functions());

// check
var_dump(class_exists(TestClass, true));

?
===DONE===
?php exit(0); ?
--EXPECTF--
array(1) {
  [0]=
  array(2) {
[0]=
string(12) MyAutoLoader
[1]=
string(8) autoLoad
  }
}
MyAutoLoader::autoLoad(TestClass)
bool(false)
===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 php_spl.c spl_iterators.h spl_observer.h

2005-08-10 Thread Marcus Boerger
helly   Wed Aug 10 18:01:16 2005 EDT

  Modified files:  
/php-src/ext/splphp_spl.c spl_iterators.h spl_observer.h 
  Log:
  - Register new classes with spl_classes()
  
  
http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.54r2=1.55ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.54 php-src/ext/spl/php_spl.c:1.55
--- php-src/ext/spl/php_spl.c:1.54  Wed Aug 10 04:31:56 2005
+++ php-src/ext/spl/php_spl.c   Wed Aug 10 18:01:15 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.54 2005/08/10 08:31:56 helly Exp $ */
+/* $Id: php_spl.c,v 1.55 2005/08/10 22:01:15 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -177,11 +177,13 @@
SPL_ADD_CLASS(ParentIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(RangeException, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(RecursiveDirectoryIterator, z_list, sub, allow, 
ce_flags); \
+   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(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); \
+   SPL_ADD_CLASS(SplObjectStorage, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(Subject, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(UnderflowException, z_list, sub, allow, ce_flags); \
 
http://cvs.php.net/diff.php/php-src/ext/spl/spl_iterators.h?r1=1.18r2=1.19ty=u
Index: php-src/ext/spl/spl_iterators.h
diff -u php-src/ext/spl/spl_iterators.h:1.18 
php-src/ext/spl/spl_iterators.h:1.19
--- php-src/ext/spl/spl_iterators.h:1.18Wed Aug  3 10:07:53 2005
+++ php-src/ext/spl/spl_iterators.h Wed Aug 10 18:01:15 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_iterators.h,v 1.18 2005/08/03 14:07:53 sniper Exp $ */
+/* $Id: spl_iterators.h,v 1.19 2005/08/10 22:01:15 helly Exp $ */
 
 #ifndef SPL_ITERATORS_H
 #define SPL_ITERATORS_H
@@ -33,6 +33,7 @@
 extern PHPAPI zend_class_entry *spl_ce_RecursiveIterator;
 extern PHPAPI zend_class_entry *spl_ce_RecursiveIteratorIterator;
 extern PHPAPI zend_class_entry *spl_ce_FilterIterator;
+extern PHPAPI zend_class_entry *spl_ce_RecursiveFilterIterator;
 extern PHPAPI zend_class_entry *spl_ce_ParentIterator;
 extern PHPAPI zend_class_entry *spl_ce_SeekableIterator;
 extern PHPAPI zend_class_entry *spl_ce_LimitIterator;
http://cvs.php.net/diff.php/php-src/ext/spl/spl_observer.h?r1=1.2r2=1.3ty=u
Index: php-src/ext/spl/spl_observer.h
diff -u php-src/ext/spl/spl_observer.h:1.2 php-src/ext/spl/spl_observer.h:1.3
--- php-src/ext/spl/spl_observer.h:1.2  Wed Aug  3 10:07:53 2005
+++ php-src/ext/spl/spl_observer.h  Wed Aug 10 18:01:15 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_observer.h,v 1.2 2005/08/03 14:07:53 sniper Exp $ */
+/* $Id: spl_observer.h,v 1.3 2005/08/10 22:01:15 helly Exp $ */
 
 #ifndef SPL_OBSERVER_H
 #define SPL_OBSERVER_H
@@ -26,6 +26,7 @@
 
 extern PHPAPI zend_class_entry *spl_ce_Observer;
 extern PHPAPI zend_class_entry *spl_ce_Subject;
+extern PHPAPI zend_class_entry *spl_ce_SplObjectStorage;
 
 PHP_MINIT_FUNCTION(spl_observer);
 

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



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

2005-08-02 Thread Zeev Suraski

At 05:20 02/08/2005, Marcus Boerger wrote:

helly   Mon Aug  1 22:20:04 2005 EDT

  Modified files:
/php-src/ext/splphp_spl.c
  Log:
  - Need to expose this one too

http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.50r2=1.51ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.50 php-src/ext/spl/php_spl.c:1.51
--- php-src/ext/spl/php_spl.c:1.50  Thu Jul 28 16:59:44 2005
+++ php-src/ext/spl/php_spl.c   Mon Aug  1 22:20:01 2005
@@ -16,7 +16,7 @@
+--+
  */

-/* $Id: php_spl.c,v 1.50 2005/07/28 20:59:44 helly Exp $ */
+/* $Id: php_spl.c,v 1.51 2005/08/02 02:20:01 helly Exp $ */

 #ifdef HAVE_CONFIG_H
#include config.h
@@ -153,6 +153,7 @@
SPL_ADD_CLASS(ArrayObject, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(ArrayIterator, 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); \
SPL_ADD_CLASS(CachingRecursiveIterator, z_list, sub, allow, 
ce_flags); \

SPL_ADD_CLASS(Countable, z_list, sub, allow, ce_flags); \


Speaking of coding standards, is there any particular reason we don't 
prefix the SPL classes with Spl?  We're quickly 'polluting' our class 
namespace with more and more classes.


Zeev

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



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

2005-08-02 Thread Marcus Boerger
Hello Zeev,

Tuesday, August 2, 2005, 10:20:59 AM, you wrote:

 At 05:20 02/08/2005, Marcus Boerger wrote:
helly   Mon Aug  1 22:20:04 2005 EDT

   Modified files:
 /php-src/ext/splphp_spl.c
   Log:
   - Need to expose this one too

http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.50r2=1.51ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.50 php-src/ext/spl/php_spl.c:1.51
--- php-src/ext/spl/php_spl.c:1.50  Thu Jul 28 16:59:44 2005
+++ php-src/ext/spl/php_spl.c   Mon Aug  1 22:20:01 2005
@@ -16,7 +16,7 @@

 +--+
   */

-/* $Id: php_spl.c,v 1.50 2005/07/28 20:59:44 helly Exp $ */
+/* $Id: php_spl.c,v 1.51 2005/08/02 02:20:01 helly Exp $ */

  #ifdef HAVE_CONFIG_H
 #include config.h
@@ -153,6 +153,7 @@
 SPL_ADD_CLASS(ArrayObject, z_list, sub, allow, ce_flags); \
 SPL_ADD_CLASS(ArrayIterator, 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); \
 SPL_ADD_CLASS(CachingRecursiveIterator, z_list, sub, allow, 
 ce_flags); \
 SPL_ADD_CLASS(Countable, z_list, sub, allow, ce_flags); \

 Speaking of coding standards, is there any particular reason we don't 
 prefix the SPL classes with Spl?  We're quickly 'polluting' our class 
 namespace with more and more classes.

That's why dropping namespace support was a very bad i dea and why we need
it asap. I suggest we put all SPL classes and interfaces in a spl namespace
once we have that. Until that i don't see all classes being prefixed, should
i? I fear that if i do we end up in spl:spl... which is kind of suoer ugly
isn't it. Anyway what are we doing? Any new class namespaced by extension
name sa prefix followed by hyper ugly underscore? Or just the extension
name so we end up with just the extension name i ncase of single class
support in an ext like we are having in with pdo? I guess in case of spl
using 'Spl' as prefix without an underscore is pretty fine for the upcoming
classes. Agree?

Best regards,
 Marcus

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

2005-08-01 Thread Marcus Boerger
helly   Mon Aug  1 22:20:04 2005 EDT

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Need to expose this one too
  
http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.50r2=1.51ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.50 php-src/ext/spl/php_spl.c:1.51
--- php-src/ext/spl/php_spl.c:1.50  Thu Jul 28 16:59:44 2005
+++ php-src/ext/spl/php_spl.c   Mon Aug  1 22:20:01 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.50 2005/07/28 20:59:44 helly Exp $ */
+/* $Id: php_spl.c,v 1.51 2005/08/02 02:20:01 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -153,6 +153,7 @@
SPL_ADD_CLASS(ArrayObject, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(ArrayIterator, 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); \
SPL_ADD_CLASS(CachingRecursiveIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(Countable, z_list, sub, allow, ce_flags); \

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

2005-07-28 Thread Marcus Boerger
helly   Thu Jul 28 16:59:45 2005 EDT

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Allow static loader functions (but only for 5.1.1 as discussed with Andi)
  
  
http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.49r2=1.50ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.49 php-src/ext/spl/php_spl.c:1.50
--- php-src/ext/spl/php_spl.c:1.49  Fri Jun 17 12:42:53 2005
+++ php-src/ext/spl/php_spl.c   Thu Jul 28 16:59:44 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.49 2005/06/17 16:42:53 sniper Exp $ */
+/* $Id: php_spl.c,v 1.50 2005/07/28 20:59:44 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -356,16 +356,33 @@
  Register given function as __autoload() implementation */
 PHP_FUNCTION(spl_autoload_register)
 {
-   char *func_name, *lc_name;
+   char *func_name, *lc_name = NULL;
+   zval *zcallable = NULL;
int func_name_len;
zend_bool do_throw = 1;
zend_function *spl_func_ptr, *func_ptr, **func_ptr_ptr;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |sb, func_name, 
func_name_len, do_throw) == FAILURE) {
-   return;
-   }
-   
-   if (ZEND_NUM_ARGS()) {
+   if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() 
TSRMLS_CC, |sb, func_name, func_name_len, do_throw) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, a|b, 
zcallable, func_name_len, do_throw) == FAILURE) {
+   return;
+   }
+#if MBO_0
+   if (!zend_is_callable_ex(zcallable, 
IS_CALLABLE_CHECK_IS_STATIC, func_name, func_name_len, func_ptr, NULL 
TSRMLS_CC)) {
+   if (do_throw) {
+   if (func_ptr) {
+   
zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, Non static methods 
are not supported yet);
+   } else {
+   
zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, Passed array does 
not specify a callable method or method);
+   }
+   }
+   return;
+   }
+   lc_name = do_alloca(func_name_len + 1);
+   zend_str_tolower_copy(lc_name, func_name, func_name_len);
+#else
+   php_error_docref(NULL TSRMLS_CC, E_ERROR, Loader methods are 
not yet supported);
+#endif
+   } else if (ZEND_NUM_ARGS()) {
lc_name = do_alloca(func_name_len + 1);
zend_str_tolower_copy(lc_name, func_name, func_name_len);

@@ -384,7 +401,9 @@
free_alloca(lc_name);
return;
}
-   
+   }
+   
+   if (ZEND_NUM_ARGS()) {
if (!SPL_G(autoload_functions)) {
ALLOC_HASHTABLE(SPL_G(autoload_functions));
zend_hash_init(SPL_G(autoload_functions), 1, NULL, 
NULL, 0);
@@ -473,7 +492,19 @@
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);
-   add_next_index_string(return_value, 
(*func_ptr_ptr)-common.function_name, 1);
+#if MBO_0
+   if ((*func_ptr_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);
+   add_next_index_zval(return_value, tmp);
+   } else
+#endif
+   add_next_index_string(return_value, 
(*func_ptr_ptr)-common.function_name, 1);
+
zend_hash_move_forward_ex(SPL_G(autoload_functions), 
function_pos);
}
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 php_spl.c /ext/sqlite sqlite.c /ext/xmlreader php_xmlreader.c

2005-06-17 Thread Jani Taskinen
sniper  Fri Jun 17 12:42:54 2005 EDT

  Modified files:  
/php-src/ext/splphp_spl.c 
/php-src/ext/sqlite sqlite.c 
/php-src/ext/xmlreader  php_xmlreader.c 
  Log:
  Use the new dependency system
  
http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.48r2=1.49ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.48 php-src/ext/spl/php_spl.c:1.49
--- php-src/ext/spl/php_spl.c:1.48  Thu May 12 17:23:56 2005
+++ php-src/ext/spl/php_spl.c   Fri Jun 17 12:42:53 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.48 2005/05/12 21:23:56 helly Exp $ */
+/* $Id: php_spl.c,v 1.49 2005/06/17 16:42:53 sniper Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -581,10 +581,23 @@
return SUCCESS;
 } /* }}} */
 
+#ifdef HAVE_SIMPLEXML
+static zend_module_dep spl_deps[] = {
+   ZEND_MOD_REQUIRED(libxml)
+   ZEND_MOD_REQUIRED(simplexml)
+   {NULL, NULL, NULL}
+};
+#endif
+
 /* {{{ spl_module_entry
  */
 zend_module_entry spl_module_entry = {
+#ifdef HAVE_SIMPLEXML
+   STANDARD_MODULE_HEADER_EX, NULL,
+   spl_deps,
+#else
STANDARD_MODULE_HEADER,
+#endif
SPL,
spl_functions,
PHP_MINIT(spl),
http://cvs.php.net/diff.php/php-src/ext/sqlite/sqlite.c?r1=1.164r2=1.165ty=u
Index: php-src/ext/sqlite/sqlite.c
diff -u php-src/ext/sqlite/sqlite.c:1.164 php-src/ext/sqlite/sqlite.c:1.165
--- php-src/ext/sqlite/sqlite.c:1.164   Fri Jun 17 05:39:20 2005
+++ php-src/ext/sqlite/sqlite.c Fri Jun 17 12:42:53 2005
@@ -17,7 +17,7 @@
|  Marcus Boerger [EMAIL PROTECTED]  |
+--+
 
-   $Id: sqlite.c,v 1.164 2005/06/17 09:39:20 dmitry Exp $ 
+   $Id: sqlite.c,v 1.165 2005/06/17 16:42:53 sniper Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -275,7 +275,7 @@
 #if HAVE_PHP_SESSION  !defined(COMPILE_DL_SESSION)
ZEND_MOD_REQUIRED(session)
 #endif
-#if PHP_SQLITE2_HAVE_PDO
+#ifdef PHP_SQLITE2_HAVE_PDO
ZEND_MOD_REQUIRED(pdo)
 #endif
{NULL, NULL, NULL}
@@ -1096,7 +1096,7 @@
REGISTER_LONG_CONSTANT(SQLITE_ROW,SQLITE_ROW, 
CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(SQLITE_DONE,   SQLITE_DONE, 
CONST_CS|CONST_PERSISTENT);
 
-#if PHP_SQLITE2_HAVE_PDO
+#ifdef PHP_SQLITE2_HAVE_PDO
 if (FAILURE == php_pdo_register_driver(pdo_sqlite2_driver)) {
 return FAILURE;
 }
@@ -1109,7 +1109,7 @@
 {
UNREGISTER_INI_ENTRIES();
 
-#if PHP_SQLITE2_HAVE_PDO
+#ifdef PHP_SQLITE2_HAVE_PDO
 php_pdo_unregister_driver(pdo_sqlite2_driver);
 #endif
 
@@ -1125,7 +1125,7 @@
 {
php_info_print_table_start();
php_info_print_table_header(2, SQLite support, enabled);
-   php_info_print_table_row(2, PECL Module version, 
PHP_SQLITE_MODULE_VERSION  $Id: sqlite.c,v 1.164 2005/06/17 09:39:20 dmitry 
Exp $);
+   php_info_print_table_row(2, PECL Module version, 
PHP_SQLITE_MODULE_VERSION  $Id: sqlite.c,v 1.165 2005/06/17 16:42:53 sniper 
Exp $);
php_info_print_table_row(2, SQLite Library, sqlite_libversion());
php_info_print_table_row(2, SQLite Encoding, sqlite_libencoding());
php_info_print_table_end();
http://cvs.php.net/diff.php/php-src/ext/xmlreader/php_xmlreader.c?r1=1.11r2=1.12ty=u
Index: php-src/ext/xmlreader/php_xmlreader.c
diff -u php-src/ext/xmlreader/php_xmlreader.c:1.11 
php-src/ext/xmlreader/php_xmlreader.c:1.12
--- php-src/ext/xmlreader/php_xmlreader.c:1.11  Sun Apr 17 22:43:42 2005
+++ php-src/ext/xmlreader/php_xmlreader.c   Fri Jun 17 12:42:54 2005
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: php_xmlreader.c,v 1.11 2005/04/18 02:43:42 iliaa Exp $ */
+/* $Id: php_xmlreader.c,v 1.12 2005/06/17 16:42:54 sniper Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -276,10 +276,16 @@
 }
 #endif
 
+static zend_module_dep xmlreader_deps[] = {
+   ZEND_MOD_REQUIRED(libxml)
+   {NULL, NULL, NULL}
+};
+
 /* {{{ xmlreader_module_entry
  */
 zend_module_entry xmlreader_module_entry = {
-   STANDARD_MODULE_HEADER,
+   STANDARD_MODULE_HEADER_EX, NULL,
+   xmlreader_deps,
xmlreader,
NULL,
PHP_MINIT(xmlreader),

-- 
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 spl.php spl_directory.c spl_directory.h /ext/spl/internal file.inc fileobject.inc

2005-04-14 Thread Marcus Boerger
helly   Thu Apr 14 17:02:09 2005 EDT

  Added files: 
/php-src/ext/spl/internal   fileobject.inc 

  Removed files:   
/php-src/ext/spl/internal   file.inc 

  Modified files:  
/php-src/ext/splphp_spl.c spl.php spl_directory.c spl_directory.h 
  Log:
  - Rename class File to FileObject
  # by popular demand
  
  http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.46r2=1.47ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.46 php-src/ext/spl/php_spl.c:1.47
--- php-src/ext/spl/php_spl.c:1.46  Wed Apr  6 11:16:43 2005
+++ php-src/ext/spl/php_spl.c   Thu Apr 14 17:02:08 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.46 2005/04/06 15:16:43 helly Exp $ */
+/* $Id: php_spl.c,v 1.47 2005/04/14 21:02:08 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -159,7 +159,7 @@
SPL_ADD_CLASS(DirectoryIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(DomainException, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(EmptyIterator, z_list, sub, allow, ce_flags); \
-   SPL_ADD_CLASS(File, z_list, sub, allow, ce_flags); \
+   SPL_ADD_CLASS(FileObject, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(FilterIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(InfiniteIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(InvalidArgumentException, z_list, sub, allow, ce_flags); \
http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.46r2=1.47ty=u
Index: php-src/ext/spl/spl.php
diff -u php-src/ext/spl/spl.php:1.46 php-src/ext/spl/spl.php:1.47
--- php-src/ext/spl/spl.php:1.46Sat Mar 12 18:03:31 2005
+++ php-src/ext/spl/spl.php Thu Apr 14 17:02:08 2005
@@ -47,12 +47,13 @@
  * - class InfiniteIterator extends IteratorIterator
  * - class AppendIterator implements OuterIterator
  * 
- * 2) Directories
+ * 2) Directories and Files
  * 
- * SPL offers two advanced directory classes:
+ * SPL offers two advanced directory and file handling classes:
  * 
  * - class DirectoryIterator implements Iterator
  * - class RecursiveDirectoryIterator extends DirectoryIterator implements 
RecursiveIterator
+ * - class FileObject implements RecursiveIterator
  * 
  * 3) XML
  * 
@@ -99,8 +100,14 @@
  * - interface Observer
  * - interface Subject
  * 
- * A nice article about SPL can be found 
- * a href=http://www.sitepoint.com/article/php5-standard-library/1;here/a.
+ * Some articles about SPL:
+ * - a 
href=http://www.sitepoint.com/article/php5-standard-library/1;Introducing PHP 
5's Standard Library/a
+ * - a 
href=http://www.phpriot.com/d/articles/php/oop/oop-with-spl-php-5-1/index.html;Advanced
 OOP with SPL in PHP 5/a
+ * - a 
href=http://www.devshed.com/c/a/PHP/The-Standard-PHP-Library-Part-1/;The 
Standard PHP Library, Part 1/a
+ *
+ * Talks on PL:
+ * - a 
href=http://somabo.de/talks/200504_php_quebec_spl_for_the_masses.pps;SPL for 
the masses [pps]/a
+ * - a 
href=http://somabo.de/talks/200504_php_quebec_spl_for_the_masses.pdf;SPL for 
the masses [pdf]/a
  *
  * You can download this documentation as a chm file 
  * a href=http://php.net/~helly/php/ext/spl/spl.chm;here/a.
@@ -697,6 +704,20 @@
/** @return getFilename()
 */
function __toString();
+
+   /** Open the current file as a FileObject instance
+*
+* @param mode  open mode
+* @param use_include_path  whether to search include paths (don't use)
+* @param context   resource context to pased to open function
+* @throw RuntimeException  if file cannot be opened (e.g. insufficient 
+*  access rights).
+* @return The opened file as a FileObject instance
+*
+* @see FileObject
+* @see file()
+*/
+   function DirectoryIterator::openFile($mode = 'r', $use_include_path = 
false, $context = NULL);
 }
 
 /** @ingroup SPL
http://cvs.php.net/diff.php/php-src/ext/spl/spl_directory.c?r1=1.41r2=1.42ty=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.41 
php-src/ext/spl/spl_directory.c:1.42
--- php-src/ext/spl/spl_directory.c:1.41Thu Mar 31 18:02:20 2005
+++ php-src/ext/spl/spl_directory.c Thu Apr 14 17:02:08 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_directory.c,v 1.41 2005/03/31 23:02:20 helly Exp $ */
+/* $Id: spl_directory.c,v 1.42 2005/04/14 21:02:08 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -50,7 +50,7 @@
 /* decalre the class entry */
 PHPAPI zend_class_entry *spl_ce_DirectoryIterator;
 PHPAPI zend_class_entry *spl_ce_RecursiveDirectoryIterator;
-PHPAPI zend_class_entry *spl_ce_File;
+PHPAPI zend_class_entry *spl_ce_FileObject;
 
 static zend_object_value spl_file_object_new_ex(zend_class_entry *class_type, 

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

2005-04-13 Thread Andi Gutmans
I think both of those names are OK. I doubt they will clash with existing 
scripts.
Took me sometime to respond as I'm travelling and haven't had time to 
answer all my mails.

At 08:25 PM 4/11/2005 +0200, Marcus Boerger wrote:
Hello Andi,
Monday, April 11, 2005, 12:35:34 AM, you wrote:
 Hi,
 Andrey might have a point. Unlike the other names you've defined, this one
 feels as if it'll break lots of apps.
 How about FileIterator?
  very missleading. Maybe FileObject or FileInstance or whatever to habe
something longer but then again many scripts will fail for the same reason.
And i tempt to think many people implementing such a class might have
avoided the name 'File' to differentiate from function 'File' (which is
one of the reasons i chose the short name).
regards
marcus
 Andi
 At 05:43 AM 4/5/2005 -0400, Marcus Boerger wrote:
Hello Andrey,

   this happens with any other class/interface we define also. And we've
discussed that before. The result was that we use the names in c we want
and try to do the best common implementation possible to keep everybody
as happy as possible.

Unfortunatley we couldn't add namespaces to php

marcus

Tuesday, April 5, 2005, 5:30:22 AM, you wrote:

Marcus,
  isn't this going to blow up existing applications that define class 
File ?

  Andrey

  Marcus Boerger wrote:
  helly Tue Apr  5 05:24:53 2005 EDT
 
Modified files:
  /php-src/ext/spl  php_spl.c
Log:
- Register class File
- Remove superflous ;
- Stop spl_autoloading on pending exception
 
 
 
 http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.44r2=1.45ty=u
  Index: php-src/ext/spl/php_spl.c
  diff -u php-src/ext/spl/php_spl.c:1.44 php-src/ext/spl/php_spl.c:1.45
  --- php-src/ext/spl/php_spl.c:1.44Thu Mar 31 12:17:38 2005
  +++ php-src/ext/spl/php_spl.c Tue Apr  5 05:24:53 2005
  @@ -16,7 +16,7 @@
 
 
 +--+
*/
 
  -/* $Id: php_spl.c,v 1.44 2005/03/31 17:17:38 helly Exp $ */
  +/* $Id: php_spl.c,v 1.45 2005/04/05 09:24:53 helly Exp $ */
 
   #ifdef HAVE_CONFIG_H
#include config.h
  @@ -106,6 +106,7 @@
SPL_ADD_CLASS(DirectoryIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(DomainException, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(EmptyIterator, z_list, sub, allow, ce_flags); \
  + SPL_ADD_CLASS(File, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(FilterIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(InfiniteIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(InvalidArgumentException, z_list, sub, allow,
 ce_flags); \
  @@ -148,9 +149,7 @@
zend_file_handle file_handle;
zend_op_array *new_op_array;
zval *result = NULL;
  -
  - ;
  -
  +
class_file_len = spprintf(class_file, 0, %s%s, lc_name,
 file_extension);
 
if (zend_stream_open(class_file, file_handle TSRMLS_CC) ==
 SUCCESS) {
  @@ -281,7 +280,7 @@
if (SPL_G(autoload_functions)) {
lc_name = zend_str_tolower_dup(Z_STRVAL_PP(class_name),
 Z_STRLEN_PP(class_name));
 
  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) {
  +
  while(zend_hash_has_more_elements_ex(SPL_G(autoload_functions),
  function_pos) == SUCCESS  !EG(exception)) {
 
  zend_hash_get_current_key_ex(SPL_G(autoload_functions), func_name,
  func_name_len, dummy, 0, function_pos);
 
  zend_hash_get_current_data_ex(SPL_G(autoload_functions), (void **)
  func_ptr_ptr, function_pos);
zend_call_method(NULL, NULL, func_ptr_ptr,
  func_name, func_name_len, retval, 1, *class_name, NULL TSRMLS_CC);
 

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


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

2005-04-11 Thread Andi Gutmans
Hi,
Andrey might have a point. Unlike the other names you've defined, this one 
feels as if it'll break lots of apps.
How about FileIterator?

Andi
At 05:43 AM 4/5/2005 -0400, Marcus Boerger wrote:
Hello Andrey,
  this happens with any other class/interface we define also. And we've
discussed that before. The result was that we use the names in c we want
and try to do the best common implementation possible to keep everybody
as happy as possible.
Unfortunatley we couldn't add namespaces to php
marcus
Tuesday, April 5, 2005, 5:30:22 AM, you wrote:
   Marcus,
 isn't this going to blow up existing applications that define class File ?
 Andrey
 Marcus Boerger wrote:
 helly Tue Apr  5 05:24:53 2005 EDT

   Modified files:
 /php-src/ext/spl  php_spl.c
   Log:
   - Register class File
   - Remove superflous ;
   - Stop spl_autoloading on pending exception


 http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.44r2=1.45ty=u
 Index: php-src/ext/spl/php_spl.c
 diff -u php-src/ext/spl/php_spl.c:1.44 php-src/ext/spl/php_spl.c:1.45
 --- php-src/ext/spl/php_spl.c:1.44Thu Mar 31 12:17:38 2005
 +++ php-src/ext/spl/php_spl.c Tue Apr  5 05:24:53 2005
 @@ -16,7 +16,7 @@

 +--+
   */

 -/* $Id: php_spl.c,v 1.44 2005/03/31 17:17:38 helly Exp $ */
 +/* $Id: php_spl.c,v 1.45 2005/04/05 09:24:53 helly Exp $ */

  #ifdef HAVE_CONFIG_H
   #include config.h
 @@ -106,6 +106,7 @@
   SPL_ADD_CLASS(DirectoryIterator, z_list, sub, allow, ce_flags); \
   SPL_ADD_CLASS(DomainException, z_list, sub, allow, ce_flags); \
   SPL_ADD_CLASS(EmptyIterator, z_list, sub, allow, ce_flags); \
 + SPL_ADD_CLASS(File, z_list, sub, allow, ce_flags); \
   SPL_ADD_CLASS(FilterIterator, z_list, sub, allow, ce_flags); \
   SPL_ADD_CLASS(InfiniteIterator, z_list, sub, allow, ce_flags); \
   SPL_ADD_CLASS(InvalidArgumentException, z_list, sub, allow, 
ce_flags); \
 @@ -148,9 +149,7 @@
   zend_file_handle file_handle;
   zend_op_array *new_op_array;
   zval *result = NULL;
 -
 - ;
 -
 +
   class_file_len = spprintf(class_file, 0, %s%s, lc_name, 
file_extension);

   if (zend_stream_open(class_file, file_handle TSRMLS_CC) == 
SUCCESS) {
 @@ -281,7 +280,7 @@
   if (SPL_G(autoload_functions)) {
   lc_name = zend_str_tolower_dup(Z_STRVAL_PP(class_name), 
Z_STRLEN_PP(class_name));

 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) {
 +
 while(zend_hash_has_more_elements_ex(SPL_G(autoload_functions),
 function_pos) == SUCCESS  !EG(exception)) {

 zend_hash_get_current_key_ex(SPL_G(autoload_functions), func_name,
 func_name_len, dummy, 0, function_pos);

 zend_hash_get_current_data_ex(SPL_G(autoload_functions), (void **)
 func_ptr_ptr, function_pos);
   zend_call_method(NULL, NULL, func_ptr_ptr,
 func_name, func_name_len, retval, 1, *class_name, NULL TSRMLS_CC);



--
Best regards,
 Marcusmailto:[EMAIL PROTECTED]
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


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

2005-04-11 Thread Marcus Boerger
Hello Andi,

Monday, April 11, 2005, 12:35:34 AM, you wrote:

 Hi,

 Andrey might have a point. Unlike the other names you've defined, this one
 feels as if it'll break lots of apps.
 How about FileIterator?

  very missleading. Maybe FileObject or FileInstance or whatever to habe
something longer but then again many scripts will fail for the same reason.
And i tempt to think many people implementing such a class might have
avoided the name 'File' to differentiate from function 'File' (which is
one of the reasons i chose the short name).

regards
marcus

 Andi

 At 05:43 AM 4/5/2005 -0400, Marcus Boerger wrote:
Hello Andrey,

   this happens with any other class/interface we define also. And we've
discussed that before. The result was that we use the names in c we want
and try to do the best common implementation possible to keep everybody
as happy as possible.

Unfortunatley we couldn't add namespaces to php

marcus

Tuesday, April 5, 2005, 5:30:22 AM, you wrote:

Marcus,
  isn't this going to blow up existing applications that define class File ?

  Andrey

  Marcus Boerger wrote:
  helly Tue Apr  5 05:24:53 2005 EDT
 
Modified files:
  /php-src/ext/spl  php_spl.c
Log:
- Register class File
- Remove superflous ;
- Stop spl_autoloading on pending exception
 
 
 
 http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.44r2=1.45ty=u
  Index: php-src/ext/spl/php_spl.c
  diff -u php-src/ext/spl/php_spl.c:1.44 php-src/ext/spl/php_spl.c:1.45
  --- php-src/ext/spl/php_spl.c:1.44Thu Mar 31 12:17:38 2005
  +++ php-src/ext/spl/php_spl.c Tue Apr  5 05:24:53 2005
  @@ -16,7 +16,7 @@
 
 
 +--+
*/
 
  -/* $Id: php_spl.c,v 1.44 2005/03/31 17:17:38 helly Exp $ */
  +/* $Id: php_spl.c,v 1.45 2005/04/05 09:24:53 helly Exp $ */
 
   #ifdef HAVE_CONFIG_H
#include config.h
  @@ -106,6 +106,7 @@
SPL_ADD_CLASS(DirectoryIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(DomainException, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(EmptyIterator, z_list, sub, allow, ce_flags); \
  + SPL_ADD_CLASS(File, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(FilterIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(InfiniteIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(InvalidArgumentException, z_list, sub, allow, 
 ce_flags); \
  @@ -148,9 +149,7 @@
zend_file_handle file_handle;
zend_op_array *new_op_array;
zval *result = NULL;
  -
  - ;
  -
  +
class_file_len = spprintf(class_file, 0, %s%s, lc_name, 
 file_extension);
 
if (zend_stream_open(class_file, file_handle TSRMLS_CC) == 
 SUCCESS) {
  @@ -281,7 +280,7 @@
if (SPL_G(autoload_functions)) {
lc_name = zend_str_tolower_dup(Z_STRVAL_PP(class_name), 
 Z_STRLEN_PP(class_name));
 
  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) {
  +
  while(zend_hash_has_more_elements_ex(SPL_G(autoload_functions),
  function_pos) == SUCCESS  !EG(exception)) {
 
  zend_hash_get_current_key_ex(SPL_G(autoload_functions), func_name,
  func_name_len, dummy, 0, function_pos);
 
  zend_hash_get_current_data_ex(SPL_G(autoload_functions), (void **)
  func_ptr_ptr, function_pos);
zend_call_method(NULL, NULL, func_ptr_ptr,
  func_name, func_name_len, retval, 1, *class_name, 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 php_spl.c /ext/spl/tests spl_003.phpt

2005-04-06 Thread Marcus Boerger
helly   Wed Apr  6 11:16:45 2005 EDT

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

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Make class_parentS() and class_implements() accepts class names as well
  
  
http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.45r2=1.46ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.45 php-src/ext/spl/php_spl.c:1.46
--- php-src/ext/spl/php_spl.c:1.45  Tue Apr  5 05:24:53 2005
+++ php-src/ext/spl/php_spl.c   Wed Apr  6 11:16:43 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.45 2005/04/05 09:24:53 helly Exp $ */
+/* $Id: php_spl.c,v 1.46 2005/04/06 15:16:43 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -59,18 +59,56 @@
 }
 /* }}} */
 
+static zend_class_entry * spl_find_ce_by_name(char *name, int len, zend_bool 
autoload TSRMLS_DC)
+{
+   zend_class_entry **ce;
+   int found;
+   if (!autoload) {
+   char *lc_name;
+
+   lc_name = do_alloca(len + 1);
+   zend_str_tolower_copy(lc_name, name, len);
+
+   found = zend_hash_find(EG(class_table), lc_name, len +1, (void 
**) ce);
+   free_alloca(lc_name);
+   } else {
+   found = zend_lookup_class(name, len, ce TSRMLS_CC);
+   }
+   if (found != SUCCESS) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Class %s does not 
exist%s, name, autoload ?  and could not be loaded : );
+   return NULL;
+   }
+   
+   return *ce;
+}
+
 /* {{{ array class_parents(object instance)
  Return an array containing the names of all parent classes */
 PHP_FUNCTION(class_parents)
 {
zval *obj;
-   zend_class_entry *parent_class;
+   zend_class_entry *parent_class, *ce;
+   zend_bool autoload = 1;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, o, obj) == 
FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z|b, obj, 
autoload) == FAILURE) {
+   RETURN_FALSE;
+   }
+   
+   if (Z_TYPE_P(obj) != IS_OBJECT  Z_TYPE_P(obj) != IS_STRING) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, object or string 
expected);
RETURN_FALSE;
}
+   
+   if (Z_TYPE_P(obj) == IS_STRING) {
+   if (NULL == (ce = spl_find_ce_by_name(Z_STRVAL_P(obj), 
Z_STRLEN_P(obj), autoload TSRMLS_CC))) {
+   RETURN_FALSE;
+   }
+   } else {
+   ce = Z_OBJCE_P(obj);
+   }
+   
array_init(return_value);
-   parent_class = Z_OBJCE_P(obj)-parent;
+   parent_class = ce-parent;
while (parent_class) {
spl_add_class_name(return_value, parent_class, 0, 0 TSRMLS_CC);
parent_class = parent_class-parent;
@@ -78,17 +116,32 @@
 }
 /* }}} */
 
-/* {{{ proto array class_implements()
+/* {{{ proto array class_implements(mixed what [, bool autoload ])
  Return all classes and interfaces implemented by SPL */
 PHP_FUNCTION(class_implements)
 {
zval *obj;
-
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, o, obj) == 
FAILURE) {
+   zend_bool autoload = 1;
+   zend_class_entry *ce;
+   
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z|b, obj, 
autoload) == FAILURE) {
RETURN_FALSE;
}
+   if (Z_TYPE_P(obj) != IS_OBJECT  Z_TYPE_P(obj) != IS_STRING) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, object or string 
expected);
+   RETURN_FALSE;
+   }
+   
+   if (Z_TYPE_P(obj) == IS_STRING) {
+   if (NULL == (ce = spl_find_ce_by_name(Z_STRVAL_P(obj), 
Z_STRLEN_P(obj), autoload TSRMLS_CC))) {
+   RETURN_FALSE;
+   }
+   } else {
+   ce = Z_OBJCE_P(obj);
+   }
+   
array_init(return_value);
-   spl_add_interfaces(return_value, Z_OBJCE_P(obj), 1, ZEND_ACC_INTERFACE 
TSRMLS_CC);
+   spl_add_interfaces(return_value, ce, 1, ZEND_ACC_INTERFACE TSRMLS_CC);
 }
 /* }}} */
 

http://cvs.php.net/co.php/php-src/ext/spl/tests/spl_003.phpt?r=1.1p=1
Index: php-src/ext/spl/tests/spl_003.phpt
+++ php-src/ext/spl/tests/spl_003.phpt
--TEST--
SPL: class_parents() and class_implements()
--SKIPIF--
?php if (!extension_loaded(spl)) print skip; ?
--FILE--
?php
class a{}
class b extends a{}
class c extends b{}
class d{}
var_dump(class_parents(new c),
 class_parents(c),
 class_parents(new b),
 class_parents(b),
 class_parents(d),
 class_parents(foo, 0),
 class_parents(foo, 1)
);

interface iface1{}
interface iface2{}
class f implements iface1, iface2{}
var_dump(class_implements(new a),
 class_implements(a),
 class_implements(aaa),
 class_implements(bbb, 0)
);

function __autoload($cname) {

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

2005-04-05 Thread Marcus Boerger
helly   Tue Apr  5 05:24:53 2005 EDT

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Register class File
  - Remove superflous ;
  - Stop spl_autoloading on pending exception
  
  
http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.44r2=1.45ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.44 php-src/ext/spl/php_spl.c:1.45
--- php-src/ext/spl/php_spl.c:1.44  Thu Mar 31 12:17:38 2005
+++ php-src/ext/spl/php_spl.c   Tue Apr  5 05:24:53 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.44 2005/03/31 17:17:38 helly Exp $ */
+/* $Id: php_spl.c,v 1.45 2005/04/05 09:24:53 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -106,6 +106,7 @@
SPL_ADD_CLASS(DirectoryIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(DomainException, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(EmptyIterator, z_list, sub, allow, ce_flags); \
+   SPL_ADD_CLASS(File, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(FilterIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(InfiniteIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(InvalidArgumentException, z_list, sub, allow, ce_flags); \
@@ -148,9 +149,7 @@
zend_file_handle file_handle;
zend_op_array *new_op_array;
zval *result = NULL;
-   
-   ;
-   
+
class_file_len = spprintf(class_file, 0, %s%s, lc_name, 
file_extension);
 
if (zend_stream_open(class_file, file_handle TSRMLS_CC) == SUCCESS) {
@@ -281,7 +280,7 @@
if (SPL_G(autoload_functions)) {
lc_name = zend_str_tolower_dup(Z_STRVAL_PP(class_name), 
Z_STRLEN_PP(class_name));
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) {
+   while(zend_hash_has_more_elements_ex(SPL_G(autoload_functions), 
function_pos) == SUCCESS  !EG(exception)) {
zend_hash_get_current_key_ex(SPL_G(autoload_functions), 
func_name, func_name_len, dummy, 0, function_pos);

zend_hash_get_current_data_ex(SPL_G(autoload_functions), (void **) 
func_ptr_ptr, function_pos);
zend_call_method(NULL, NULL, func_ptr_ptr, func_name, 
func_name_len, retval, 1, *class_name, NULL TSRMLS_CC);

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



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

2005-04-05 Thread Andrey Hristov
 Marcus,
isn't this going to blow up existing applications that define class File ?
Andrey
Marcus Boerger wrote:
helly   Tue Apr  5 05:24:53 2005 EDT
  Modified files:  
/php-src/ext/spl	php_spl.c 
  Log:
  - Register class File
  - Remove superflous ;
  - Stop spl_autoloading on pending exception
  
  
http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.44r2=1.45ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.44 php-src/ext/spl/php_spl.c:1.45
--- php-src/ext/spl/php_spl.c:1.44	Thu Mar 31 12:17:38 2005
+++ php-src/ext/spl/php_spl.c	Tue Apr  5 05:24:53 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.44 2005/03/31 17:17:38 helly Exp $ */
+/* $Id: php_spl.c,v 1.45 2005/04/05 09:24:53 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 	#include config.h
@@ -106,6 +106,7 @@
 	SPL_ADD_CLASS(DirectoryIterator, z_list, sub, allow, ce_flags); \
 	SPL_ADD_CLASS(DomainException, z_list, sub, allow, ce_flags); \
 	SPL_ADD_CLASS(EmptyIterator, z_list, sub, allow, ce_flags); \
+	SPL_ADD_CLASS(File, z_list, sub, allow, ce_flags); \
 	SPL_ADD_CLASS(FilterIterator, z_list, sub, allow, ce_flags); \
 	SPL_ADD_CLASS(InfiniteIterator, z_list, sub, allow, ce_flags); \
 	SPL_ADD_CLASS(InvalidArgumentException, z_list, sub, allow, ce_flags); \
@@ -148,9 +149,7 @@
 	zend_file_handle file_handle;
 	zend_op_array *new_op_array;
 	zval *result = NULL;
-	
-	;
-	
+
 	class_file_len = spprintf(class_file, 0, %s%s, lc_name, file_extension);
 
 	if (zend_stream_open(class_file, file_handle TSRMLS_CC) == SUCCESS) {
@@ -281,7 +280,7 @@
 	if (SPL_G(autoload_functions)) {
 		lc_name = zend_str_tolower_dup(Z_STRVAL_PP(class_name), Z_STRLEN_PP(class_name));
 		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) {
+		while(zend_hash_has_more_elements_ex(SPL_G(autoload_functions), function_pos) == SUCCESS  !EG(exception)) {
 			zend_hash_get_current_key_ex(SPL_G(autoload_functions), func_name, func_name_len, dummy, 0, function_pos);
 			zend_hash_get_current_data_ex(SPL_G(autoload_functions), (void **) func_ptr_ptr, function_pos);
 			zend_call_method(NULL, NULL, func_ptr_ptr, func_name, func_name_len, retval, 1, *class_name, NULL TSRMLS_CC);

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


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

2005-04-05 Thread Marcus Boerger
Hello Andrey,

  this happens with any other class/interface we define also. And we've
discussed that before. The result was that we use the names in c we want
and try to do the best common implementation possible to keep everybody
as happy as possible.

Unfortunatley we couldn't add namespaces to php

marcus

Tuesday, April 5, 2005, 5:30:22 AM, you wrote:

   Marcus,
 isn't this going to blow up existing applications that define class File ?

 Andrey

 Marcus Boerger wrote:
 helly Tue Apr  5 05:24:53 2005 EDT
 
   Modified files:  
 /php-src/ext/spl  php_spl.c 
   Log:
   - Register class File
   - Remove superflous ;
   - Stop spl_autoloading on pending exception
   
   
 http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.44r2=1.45ty=u
 Index: php-src/ext/spl/php_spl.c
 diff -u php-src/ext/spl/php_spl.c:1.44 php-src/ext/spl/php_spl.c:1.45
 --- php-src/ext/spl/php_spl.c:1.44Thu Mar 31 12:17:38 2005
 +++ php-src/ext/spl/php_spl.c Tue Apr  5 05:24:53 2005
 @@ -16,7 +16,7 @@

 +--+
   */
  
 -/* $Id: php_spl.c,v 1.44 2005/03/31 17:17:38 helly Exp $ */
 +/* $Id: php_spl.c,v 1.45 2005/04/05 09:24:53 helly Exp $ */
  
  #ifdef HAVE_CONFIG_H
   #include config.h
 @@ -106,6 +106,7 @@
   SPL_ADD_CLASS(DirectoryIterator, z_list, sub, allow, ce_flags); \
   SPL_ADD_CLASS(DomainException, z_list, sub, allow, ce_flags); \
   SPL_ADD_CLASS(EmptyIterator, z_list, sub, allow, ce_flags); \
 + SPL_ADD_CLASS(File, z_list, sub, allow, ce_flags); \
   SPL_ADD_CLASS(FilterIterator, z_list, sub, allow, ce_flags); \
   SPL_ADD_CLASS(InfiniteIterator, z_list, sub, allow, ce_flags); \
   SPL_ADD_CLASS(InvalidArgumentException, z_list, sub, allow, ce_flags); 
 \
 @@ -148,9 +149,7 @@
   zend_file_handle file_handle;
   zend_op_array *new_op_array;
   zval *result = NULL;
 - 
 - ;
 - 
 +
   class_file_len = spprintf(class_file, 0, %s%s, lc_name, 
 file_extension);
  
   if (zend_stream_open(class_file, file_handle TSRMLS_CC) == SUCCESS) {
 @@ -281,7 +280,7 @@
   if (SPL_G(autoload_functions)) {
   lc_name = zend_str_tolower_dup(Z_STRVAL_PP(class_name), 
 Z_STRLEN_PP(class_name));
  
 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) {
 +
 while(zend_hash_has_more_elements_ex(SPL_G(autoload_functions),
 function_pos) == SUCCESS  !EG(exception)) {
  
 zend_hash_get_current_key_ex(SPL_G(autoload_functions), func_name,
 func_name_len, dummy, 0, function_pos);
  
 zend_hash_get_current_data_ex(SPL_G(autoload_functions), (void **)
 func_ptr_ptr, function_pos);
   zend_call_method(NULL, NULL, func_ptr_ptr,
 func_name, func_name_len, retval, 1, *class_name, NULL TSRMLS_CC);
 




-- 
Best regards,
 Marcusmailto:[EMAIL PROTECTED]

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

2005-03-31 Thread Marcus Boerger
helly   Thu Mar 31 12:17:39 2005 EDT

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Bugfix #32521 (apache2handler accidental crashes caused by SPL)
  
http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.43r2=1.44ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.43 php-src/ext/spl/php_spl.c:1.44
--- php-src/ext/spl/php_spl.c:1.43  Wed Mar  2 19:20:56 2005
+++ php-src/ext/spl/php_spl.c   Thu Mar 31 12:17:38 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.43 2005/03/03 00:20:56 helly Exp $ */
+/* $Id: php_spl.c,v 1.44 2005/03/31 17:17:38 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -54,7 +54,7 @@
  */
 static void spl_init_globals(zend_spl_globals *spl_globals)
 {
-   spl_globals-autoload_extensions = .inc,.inc.php;
+   spl_globals-autoload_extensions = NULL;
spl_globals-autoload_functions  = NULL;
 }
 /* }}} */
@@ -507,7 +507,7 @@
 
 PHP_RINIT_FUNCTION(spl) /* {{{ */
 {
-   SPL_G(autoload_extensions) = estrdup(SPL_G(autoload_extensions));
+   SPL_G(autoload_extensions) = estrdup(.inc,.inc.php);
return SUCCESS;
 } /* }}} */
 
@@ -515,6 +515,7 @@
 {
if (SPL_G(autoload_extensions)) {
efree(SPL_G(autoload_extensions));
+   SPL_G(autoload_extensions) = NULL;
}
if (SPL_G(autoload_functions)) {
zend_hash_destroy(SPL_G(autoload_functions));

-- 
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_001.phpt

2005-03-02 Thread Marcus Boerger
helly   Wed Mar  2 15:59:06 2005 EDT

  Modified files:  
/php-src/ext/splphp_spl.c 
/php-src/ext/spl/tests  spl_autoload_001.phpt 
  Log:
  - Let spl_autoload_extensions() always return what's registered
  
  
http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.41r2=1.42ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.41 php-src/ext/spl/php_spl.c:1.42
--- php-src/ext/spl/php_spl.c:1.41  Tue Mar  1 20:14:40 2005
+++ php-src/ext/spl/php_spl.c   Wed Mar  2 15:59:05 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.41 2005/03/02 01:14:40 helly Exp $ */
+/* $Id: php_spl.c,v 1.42 2005/03/02 20:59:05 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -242,21 +242,25 @@
}
 } /* }}} */
 
-/* {{{ void spl_autoload_extensions(string file_extensions])
- Register default file extensions for spl_autoload */
+/* {{{ void string spl_autoload_extensions([string file_extensions])
+ Register and return default file extensions for spl_autoload */
 PHP_FUNCTION(spl_autoload_extensions)
 {
char *file_exts;
int file_exts_len;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, file_exts, 
file_exts_len) == FAILURE) {
-   return;
+   if (ZEND_NUM_ARGS()  0) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, 
file_exts, file_exts_len) == FAILURE) {
+   return;
+   }
+   
+   if (SPL_G(autoload_extensions)) {
+   efree(SPL_G(autoload_extensions));
+   }
+   SPL_G(autoload_extensions) = estrdup(file_exts);
}
 
-   if (SPL_G(autoload_extensions)) {
-   efree(SPL_G(autoload_extensions));
-   }
-   SPL_G(autoload_extensions) = estrdup(file_exts);
+   RETURN_STRING(SPL_G(autoload_extensions), 1);
 } /* }}} */
 
 /* {{{ void spl_autoload_call(string class_name)
http://cvs.php.net/diff.php/php-src/ext/spl/tests/spl_autoload_001.phpt?r1=1.1r2=1.2ty=u
Index: php-src/ext/spl/tests/spl_autoload_001.phpt
diff -u php-src/ext/spl/tests/spl_autoload_001.phpt:1.1 
php-src/ext/spl/tests/spl_autoload_001.phpt:1.2
--- php-src/ext/spl/tests/spl_autoload_001.phpt:1.1 Tue Mar  1 20:14:41 2005
+++ php-src/ext/spl/tests/spl_autoload_001.phpt Wed Mar  2 15:59:06 2005
@@ -1,5 +1,5 @@
 --TEST--
-SPL spl_autoload() and friends
+SPL: spl_autoload() and friends
 --INI--
 include_path=.
 --FILE--
@@ -7,6 +7,8 @@
 
 echo ===EMPTY===\n;
 
+var_dump(spl_autoload_extensions());
+
 try
 {
spl_autoload(TestClass);
@@ -57,7 +59,7 @@
 
 try
 {
-   spl_autoload_extensions(.inc);
+   var_dump(spl_autoload_extensions(.inc));
var_dump(class_exists(TestClass, true));
 }
 catch(Exception $e)
@@ -102,6 +104,7 @@
 ?php exit(0); ?
 --EXPECTF--
 ===EMPTY===
+string(13) .inc,.inc.php
 %stestclass.inc
 Exception: Class TestClass could not be loaded
 ===()===
@@ -116,6 +119,7 @@
 Exception: Class TestClass could not be loaded
 Exception: Class TestClass could not be loaded
 ===SPL_AUTOLOAD()===
+string(4) .inc
 Exception: Class TestClass could not be loaded
 ===REGISTER===
 TestFunc1(TestClass)

-- 
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_001.phpt spl_autoload_002.phpt

2005-03-02 Thread Marcus Boerger
helly   Wed Mar  2 19:20:58 2005 EDT

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

  Modified files:  
/php-src/ext/splphp_spl.c 
/php-src/ext/spl/tests  spl_autoload_001.phpt 
  Log:
  - Finish work on spl_autoload*()
  
http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.42r2=1.43ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.42 php-src/ext/spl/php_spl.c:1.43
--- php-src/ext/spl/php_spl.c:1.42  Wed Mar  2 15:59:05 2005
+++ php-src/ext/spl/php_spl.c   Wed Mar  2 19:20:56 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.42 2005/03/02 20:59:05 helly Exp $ */
+/* $Id: php_spl.c,v 1.43 2005/03/03 00:20:56 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -301,12 +301,12 @@
 } /* }}} */
 
 /* {{{ void spl_autoload_register([string autoload_function = spl_autoload])
- Register given function as __autoload() implementation*/
+ Register given function as __autoload() implementation */
 PHP_FUNCTION(spl_autoload_register)
 {
char *func_name, *lc_name;
int func_name_len;
-   zend_function *func_ptr, **func_ptr_ptr;
+   zend_function *spl_func_ptr, *func_ptr, **func_ptr_ptr;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |s, func_name, 
func_name_len) == FAILURE) {
return;
@@ -315,6 +315,12 @@
if (ZEND_NUM_ARGS()) {
lc_name = do_alloca(func_name_len + 1);
zend_str_tolower_copy(lc_name, func_name, func_name_len);
+   
+   if (!strcmp(lc_name, spl_autoload_call)) {
+   zend_throw_exception_ex(spl_ce_LogicException, 0 
TSRMLS_CC, Function spl_autoload_call() cannot be registered, func_name);
+   free_alloca(lc_name);
+   return;
+   }
 
if (zend_hash_find(EG(function_table), lc_name, 
func_name_len+1, (void **) func_ptr) == FAILURE) {
zend_throw_exception_ex(spl_ce_LogicException, 0 
TSRMLS_CC, Function '%s' not found, func_name);
@@ -327,6 +333,12 @@
zend_hash_init(SPL_G(autoload_functions), 1, NULL, 
NULL, 0);
}
 
+   zend_hash_find(EG(function_table), spl_autoload, 
sizeof(spl_autoload), (void **) spl_func_ptr);
+
+   if (EG(autoload_func) == spl_func_ptr) { /* registered already, 
so we insert that first */
+   zend_hash_add(SPL_G(autoload_functions), 
spl_autoload, sizeof(spl_autoload), spl_func_ptr, sizeof(void*), 
(void**)func_ptr_ptr);
+   }
+
zend_hash_add(SPL_G(autoload_functions), lc_name, 
func_name_len+1, func_ptr, sizeof(void*), (void**)func_ptr_ptr);
 
free_alloca(lc_name);
@@ -339,6 +351,81 @@
}
 } /* }}} */
 
+/* {{{ bool spl_autoload_unregister(string autoload_function)
+ Unregister given function as __autoload() implementation */
+PHP_FUNCTION(spl_autoload_unregister)
+{
+   char *func_name, *lc_name;
+   int func_name_len, success = FAILURE;
+   zend_function *spl_func_ptr;
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, func_name, 
func_name_len) == FAILURE) {
+   return;
+   }
+
+   lc_name = do_alloca(func_name_len + 1);
+   zend_str_tolower_copy(lc_name, func_name, func_name_len);
+
+   if (SPL_G(autoload_functions)) {
+   if (!strcmp(lc_name, spl_autoload_call)) {
+   /* remove all */
+   zend_hash_destroy(SPL_G(autoload_functions));
+   FREE_HASHTABLE(SPL_G(autoload_functions));
+   SPL_G(autoload_functions) = NULL;
+   EG(autoload_func) = NULL;
+   success = SUCCESS;
+   } else {
+   /* remove specific */
+   success = zend_hash_del(SPL_G(autoload_functions), 
lc_name, func_name_len+1);
+   }
+   } else if (!strcmp(lc_name, spl_autoload)) {
+   /* register single spl_autoload() */
+   zend_hash_find(EG(function_table), spl_autoload, 
sizeof(spl_autoload), (void **) spl_func_ptr);
+
+   if (EG(autoload_func) == spl_func_ptr) {
+   success = SUCCESS;
+   EG(autoload_func) = NULL;
+   }
+   }
+
+   free_alloca(lc_name);
+   
+   RETURN_BOOL(success == SUCCESS);
+} /* }}} */
+
+/* {{{ false|array spl_autoload_functions()
+ Return all registered __autoload() functionns */
+PHP_FUNCTION(spl_autoload_functions)
+{
+   zend_function *fptr, **func_ptr_ptr;
+   HashPosition function_pos;
+
+   if (!EG(autoload_func)) {
+   if (zend_hash_find(EG(function_table), ZEND_AUTOLOAD_FUNC_NAME, 
sizeof(ZEND_AUTOLOAD_FUNC_NAME), (void **) fptr) == SUCCESS) {
+ 

[PHP-CVS] cvs: php-src /ext/spl php_spl.c php_spl.h /ext/spl/tests spl_autoload_001.phpt testclass testclass.class.inc testclass.inc testclass.php.inc

2005-03-01 Thread Marcus Boerger
helly   Tue Mar  1 20:14:41 2005 EDT

  Added files: 
/php-src/ext/spl/tests  spl_autoload_001.phpt testclass 
testclass.class.inc testclass.inc 
testclass.php.inc 

  Modified files:  
/php-src/ext/splphp_spl.c php_spl.h 
  Log:
  - Add new functions
  
  http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.40r2=1.41ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.40 php-src/ext/spl/php_spl.c:1.41
--- php-src/ext/spl/php_spl.c:1.40  Sun Feb 13 13:30:26 2005
+++ php-src/ext/spl/php_spl.c   Tue Mar  1 20:14:40 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.40 2005/02/13 18:30:26 helly Exp $ */
+/* $Id: php_spl.c,v 1.41 2005/03/02 01:14:40 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -34,6 +34,8 @@
 #include spl_sxe.h
 #include spl_exceptions.h
 #include spl_observer.h
+#include zend_exceptions.h
+#include zend_interfaces.h
 
 #ifdef COMPILE_DL_SPL
 ZEND_GET_MODULE(spl)
@@ -52,6 +54,8 @@
  */
 static void spl_init_globals(zend_spl_globals *spl_globals)
 {
+   spl_globals-autoload_extensions = .inc,.inc.php;
+   spl_globals-autoload_functions  = NULL;
 }
 /* }}} */
 
@@ -136,6 +140,201 @@
 }
 /* }}} */
 
+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;
+   int dummy = 1;
+   zend_file_handle file_handle;
+   zend_op_array *new_op_array;
+   zval *result = NULL;
+   
+   ;
+   
+   class_file_len = spprintf(class_file, 0, %s%s, lc_name, 
file_extension);
+
+   if (zend_stream_open(class_file, file_handle TSRMLS_CC) == SUCCESS) {
+   if (!file_handle.opened_path) {
+   file_handle.opened_path = estrndup(class_file, 
class_file_len);
+   }
+   if (zend_hash_add(EG(included_files), file_handle.opened_path, 
strlen(file_handle.opened_path)+1, (void *)dummy, sizeof(int), NULL)==SUCCESS) 
{
+   new_op_array = zend_compile_file(file_handle, 
ZEND_REQUIRE TSRMLS_CC);
+   zend_destroy_file_handle(file_handle TSRMLS_CC);
+   } else {
+   new_op_array = NULL;
+   zend_file_handle_dtor(file_handle);
+   }
+   if (new_op_array) {
+   EG(return_value_ptr_ptr) = result;
+   EG(active_op_array) = new_op_array;
+   
+   zend_execute(new_op_array TSRMLS_CC);
+   
+   destroy_op_array(new_op_array TSRMLS_CC);
+   efree(new_op_array);
+   if (!EG(exception)) {
+   if (EG(return_value_ptr_ptr)) {
+   zval_ptr_dtor(EG(return_value_ptr_ptr));
+   }
+   }
+
+   efree(class_file);
+   return zend_hash_exists(EG(class_table), 
(char*)lc_name, class_name_len+1);
+   }
+   }
+   efree(class_file);
+   return 0;
+} /* }}} */
+
+/* {{{ void spl_autoload(string class_name [, string file_extensions])
+ 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 *copy, *pos1, *pos2;
+   zval **original_return_value = EG(return_value_ptr_ptr);
+   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;
+   }
+
+   ZVAL_LONG(err_mode, EG(error_reporting));
+   php_alter_ini_entry(error_reporting, sizeof(error_reporting), 0, 
1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); 
+
+   copy = pos1 = estrdup(ZEND_NUM_ARGS()  1 ? file_exts : 
SPL_G(autoload_extensions));
+   lc_name = zend_str_tolower_dup(class_name, class_name_len);
+   while(pos1  *pos1  !EG(exception)) {
+   EG(return_value_ptr_ptr) = original_return_value;
+   EG(opline_ptr) = original_opline_ptr;
+   EG(active_op_array) = original_active_op_array;
+   EG(function_state_ptr) = original_function_state_ptr;
+   pos2 = strchr(pos1, ',');
+   if (pos2) *pos2 = '\0';
+   if (spl_autoload(class_name, lc_name, class_name_len, pos1 
TSRMLS_CC)) {
+   found = 1;
+   break; /* 

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

2005-02-13 Thread Marcus Boerger
helly   Sun Feb 13 13:14:34 2005 EDT

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Drop unneccessary rinit/rshutown,mshutdown
  - Add protos
  
  
http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.38r2=1.39ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.38 php-src/ext/spl/php_spl.c:1.39
--- php-src/ext/spl/php_spl.c:1.38  Tue Feb  8 15:42:47 2005
+++ php-src/ext/spl/php_spl.c   Sun Feb 13 13:14:34 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.38 2005/02/08 20:42:47 helly Exp $ */
+/* $Id: php_spl.c,v 1.39 2005/02/13 18:14:34 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -62,9 +62,9 @@
SPL,
spl_functions,
PHP_MINIT(spl),
-   PHP_MSHUTDOWN(spl),
-   PHP_RINIT(spl),
-   PHP_RSHUTDOWN(spl),
+   NULL,
+   NULL,
+   NULL,
PHP_MINFO(spl),
0.2,
STANDARD_MODULE_PROPERTIES
@@ -102,34 +102,8 @@
 }
 /* }}} */
 
-/* {{{ PHP_RINIT_FUNCTION(spl)
- */
-PHP_RINIT_FUNCTION(spl)
-{
-   return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RSHUTDOWN_FUNCTION(spl)
- */
-PHP_RSHUTDOWN_FUNCTION(spl)
-{  
-   return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION(spl)
- */
-PHP_MSHUTDOWN_FUNCTION(spl)
-{  
-   SPL_DEBUG(fprintf(stderr, %s\n, Shutting down SPL);)
-
-   return SUCCESS;
-}
-/* }}} */
-
-/* {{{ class_parents
- */
+/* {{{ array class_parents(object instance)
+ Return an array containing the names of all parent classes */
 PHP_FUNCTION(class_parents)
 {
zval *obj;
@@ -147,8 +121,8 @@
 }
 /* }}} */
 
-/* {{{ class_implements
- */
+/* {{{ proto array class_implements()
+ Return all classes and interfaces implemented by SPL */
 PHP_FUNCTION(class_implements)
 {
zval *obj;
@@ -199,7 +173,8 @@
SPL_ADD_CLASS(Subject, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(UnderflowException, z_list, sub, allow, ce_flags); \
 
-/* {{{ spl_classes */
+/* {{{ proto array spl_classes()
+ Return an array containing the names of all clsses and interfaces defined in 
SPL */
 PHP_FUNCTION(spl_classes)
 {
array_init(return_value);

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

2005-02-13 Thread Marcus Boerger
helly   Sun Feb 13 13:30:26 2005 EDT

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  - Little code reordering
  
http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.39r2=1.40ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.39 php-src/ext/spl/php_spl.c:1.40
--- php-src/ext/spl/php_spl.c:1.39  Sun Feb 13 13:14:34 2005
+++ php-src/ext/spl/php_spl.c   Sun Feb 13 13:30:26 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.39 2005/02/13 18:14:34 helly Exp $ */
+/* $Id: php_spl.c,v 1.40 2005/02/13 18:30:26 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -41,36 +41,6 @@
 
 ZEND_DECLARE_MODULE_GLOBALS(spl)
 
-/* {{{ spl_functions
- */
-function_entry spl_functions[] = {
-   PHP_FE(spl_classes, NULL)
-   PHP_FE(class_parents,   NULL)
-   PHP_FE(class_implements,NULL)
-#ifdef SPL_ITERATORS_H
-   PHP_FE(iterator_to_array,   NULL)
-   PHP_FE(iterator_count,  NULL)
-#endif /* SPL_ITERATORS_H */
-   {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ spl_module_entry
- */
-zend_module_entry spl_module_entry = {
-   STANDARD_MODULE_HEADER,
-   SPL,
-   spl_functions,
-   PHP_MINIT(spl),
-   NULL,
-   NULL,
-   NULL,
-   PHP_MINFO(spl),
-   0.2,
-   STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
 /* {{{ spl_functions_none
  */
 function_entry spl_functions_none[] = {
@@ -85,23 +55,6 @@
 }
 /* }}} */
 
-/* {{{ PHP_MINIT_FUNCTION(spl)
- */
-PHP_MINIT_FUNCTION(spl)
-{
-   ZEND_INIT_MODULE_GLOBALS(spl, spl_init_globals, NULL);
-
-   PHP_MINIT(spl_iterators)(INIT_FUNC_ARGS_PASSTHRU);
-   PHP_MINIT(spl_array)(INIT_FUNC_ARGS_PASSTHRU);
-   PHP_MINIT(spl_directory)(INIT_FUNC_ARGS_PASSTHRU);
-   PHP_MINIT(spl_sxe)(INIT_FUNC_ARGS_PASSTHRU);
-   PHP_MINIT(spl_exceptions)(INIT_FUNC_ARGS_PASSTHRU);
-   PHP_MINIT(spl_observer)(INIT_FUNC_ARGS_PASSTHRU);
-
-   return SUCCESS;
-}
-/* }}} */
-
 /* {{{ array class_parents(object instance)
  Return an array containing the names of all parent classes */
 PHP_FUNCTION(class_parents)
@@ -183,7 +136,7 @@
 }
 /* }}} */
 
-int spl_build_class_list_string(zval **entry, char **list TSRMLS_DC)
+int spl_build_class_list_string(zval **entry, char **list TSRMLS_DC) /* {{{ */
 {
char *res;

@@ -191,7 +144,7 @@
efree(*list);
*list = res;
return ZEND_HASH_APPLY_KEEP;
-}
+} /* }}} */
 
 /* {{{ PHP_MINFO(spl)
  */
@@ -225,6 +178,53 @@
 }
 /* }}} */
 
+/* {{{ spl_functions
+ */
+function_entry spl_functions[] = {
+   PHP_FE(spl_classes, NULL)
+   PHP_FE(class_parents,   NULL)
+   PHP_FE(class_implements,NULL)
+#ifdef SPL_ITERATORS_H
+   PHP_FE(iterator_to_array,   NULL)
+   PHP_FE(iterator_count,  NULL)
+#endif /* SPL_ITERATORS_H */
+   {NULL, NULL, NULL}
+};
+/* }}} */
+
+/* {{{ PHP_MINIT_FUNCTION(spl)
+ */
+PHP_MINIT_FUNCTION(spl)
+{
+   ZEND_INIT_MODULE_GLOBALS(spl, spl_init_globals, NULL);
+
+   PHP_MINIT(spl_iterators)(INIT_FUNC_ARGS_PASSTHRU);
+   PHP_MINIT(spl_array)(INIT_FUNC_ARGS_PASSTHRU);
+   PHP_MINIT(spl_directory)(INIT_FUNC_ARGS_PASSTHRU);
+   PHP_MINIT(spl_sxe)(INIT_FUNC_ARGS_PASSTHRU);
+   PHP_MINIT(spl_exceptions)(INIT_FUNC_ARGS_PASSTHRU);
+   PHP_MINIT(spl_observer)(INIT_FUNC_ARGS_PASSTHRU);
+
+   return SUCCESS;
+}
+/* }}} */
+
+/* {{{ spl_module_entry
+ */
+zend_module_entry spl_module_entry = {
+   STANDARD_MODULE_HEADER,
+   SPL,
+   spl_functions,
+   PHP_MINIT(spl),
+   NULL,
+   NULL,
+   NULL,
+   PHP_MINFO(spl),
+   0.2,
+   STANDARD_MODULE_PROPERTIES
+};
+/* }}} */
+
 /*
  * 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 php_spl.c spl.php spl_exceptions.c spl_exceptions.h spl_iterators.c

2004-11-01 Thread Marcus Boerger
helly   Mon Nov  1 12:40:01 2004 EDT

  Modified files:  
/php-src/ext/splphp_spl.c spl.php spl_exceptions.c 
spl_exceptions.h spl_iterators.c 
  Log:
  - Two new exceptions
  - Make use of new exception classes
  
  http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.36r2=1.37ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.36 php-src/ext/spl/php_spl.c:1.37
--- php-src/ext/spl/php_spl.c:1.36  Mon Nov  1 10:50:25 2004
+++ php-src/ext/spl/php_spl.c   Mon Nov  1 12:39:59 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.36 2004/11/01 15:50:25 helly Exp $ */
+/* $Id: php_spl.c,v 1.37 2004/11/01 17:39:59 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -166,6 +166,7 @@
SPL_ADD_CLASS(AppendIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(ArrayObject, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(ArrayIterator, z_list, sub, allow, ce_flags); \
+   SPL_ADD_CLASS(BadFunctionCallException, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(CachingIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(CachingRecursiveIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(Countable, z_list, sub, allow, ce_flags); \
http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.36r2=1.37ty=u
Index: php-src/ext/spl/spl.php
diff -u php-src/ext/spl/spl.php:1.36 php-src/ext/spl/spl.php:1.37
--- php-src/ext/spl/spl.php:1.36Mon Nov  1 12:05:45 2004
+++ php-src/ext/spl/spl.php Mon Nov  1 12:39:59 2004
@@ -146,6 +146,20 @@
 }
 
 /** @ingroup SPL
+ * @brief Exception thrown when a function call was illegal.
+ */
+class BadFunctionCallException extends LogicException
+{
+}
+
+/** @ingroup SPL
+ * @brief Exception thrown when a method call was illegal.
+ */
+class BadMethodCallException extends BadFunctionCallException
+{
+}
+
+/** @ingroup SPL
  * @brief Exception that denotes a value not in the valid domain was used.
  *
  * This kind of exception should be used to inform about domain erors in 
http://cvs.php.net/diff.php/php-src/ext/spl/spl_exceptions.c?r1=1.2r2=1.3ty=u
Index: php-src/ext/spl/spl_exceptions.c
diff -u php-src/ext/spl/spl_exceptions.c:1.2 php-src/ext/spl/spl_exceptions.c:1.3
--- php-src/ext/spl/spl_exceptions.c:1.2Mon Nov  1 12:26:15 2004
+++ php-src/ext/spl/spl_exceptions.cMon Nov  1 12:39:59 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_exceptions.c,v 1.2 2004/11/01 17:26:15 helly Exp $ */
+/* $Id: spl_exceptions.c,v 1.3 2004/11/01 17:39:59 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -34,6 +34,8 @@
 #include spl_exceptions.h
 
 zend_class_entry *spl_ce_LogicException;
+zend_class_entry *spl_ce_BadFunctionCallException;
+zend_class_entry *spl_ce_BadMethodCallException;
 zend_class_entry *spl_ce_DomainException;
 zend_class_entry *spl_ce_InvalidArgumentException;
 zend_class_entry *spl_ce_LengthException;
@@ -50,6 +52,8 @@
 PHP_MINIT_FUNCTION(spl_exceptions)
 {
 REGISTER_SPL_SUB_CLASS_EX(LogicException,   Exception,NULL, NULL);
+REGISTER_SPL_SUB_CLASS_EX(BadFunctionCallException, LogicException,   NULL, NULL);
+REGISTER_SPL_SUB_CLASS_EX(BadMethodCallException,   BadFunctionCallException,   
NULL, NULL);
 REGISTER_SPL_SUB_CLASS_EX(DomainException,  LogicException,   NULL, NULL);
 REGISTER_SPL_SUB_CLASS_EX(InvalidArgumentException, LogicException,   NULL, NULL);
 REGISTER_SPL_SUB_CLASS_EX(LengthException,  LogicException,   NULL, NULL);
http://cvs.php.net/diff.php/php-src/ext/spl/spl_exceptions.h?r1=1.1r2=1.2ty=u
Index: php-src/ext/spl/spl_exceptions.h
diff -u php-src/ext/spl/spl_exceptions.h:1.1 php-src/ext/spl/spl_exceptions.h:1.2
--- php-src/ext/spl/spl_exceptions.h:1.1Mon Nov  1 10:50:25 2004
+++ php-src/ext/spl/spl_exceptions.hMon Nov  1 12:39:59 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_exceptions.h,v 1.1 2004/11/01 15:50:25 helly Exp $ */
+/* $Id: spl_exceptions.h,v 1.2 2004/11/01 17:39:59 helly Exp $ */
 
 #ifndef SPL_EXCEPTIONS_H
 #define SPL_EXCEPTIONS_H
@@ -25,6 +25,8 @@
 #include php_spl.h
 
 extern zend_class_entry *spl_ce_LogicException;
+extern zend_class_entry *spl_ce_BadFunctionCallException;
+extern zend_class_entry *spl_ce_BadMethodCallException;
 extern zend_class_entry *spl_ce_DomainException;
 extern zend_class_entry *spl_ce_InvalidArgumentException;
 extern zend_class_entry *spl_ce_LengthException;
http://cvs.php.net/diff.php/php-src/ext/spl/spl_iterators.c?r1=1.49r2=1.50ty=u
Index: php-src/ext/spl/spl_iterators.c
diff -u php-src/ext/spl/spl_iterators.c:1.49 php-src/ext/spl/spl_iterators.c:1.50
--- php-src/ext/spl/spl_iterators.c:1.49Sun Oct 31 19:26:57 2004
+++ 

[PHP-CVS] cvs: php-src /ext/spl php_spl.c spl_functions.c spl_iterators.c spl_iterators.h /ext/spl/examples emptyiterator.inc /ext/spl/internal emptyiterator.inc /ext/spl/tests iterator_009.phpt

2004-10-31 Thread Marcus Boerger
helly   Sun Oct 31 15:59:39 2004 EDT

  Added files: 
/php-src/ext/spl/internal   emptyiterator.inc 
/php-src/ext/spl/tests  iterator_009.phpt 

  Removed files:   
/php-src/ext/spl/examples   emptyiterator.inc 

  Modified files:  
/php-src/ext/splphp_spl.c spl_functions.c spl_iterators.c 
spl_iterators.h 
  Log:
  - Implement EmptyIterator in C
  
  
http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.32r2=1.33ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.32 php-src/ext/spl/php_spl.c:1.33
--- php-src/ext/spl/php_spl.c:1.32  Sun Oct 31 14:49:15 2004
+++ php-src/ext/spl/php_spl.c   Sun Oct 31 15:59:37 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.32 2004/10/31 19:49:15 helly Exp $ */
+/* $Id: php_spl.c,v 1.33 2004/10/31 20:59:37 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -166,6 +166,7 @@
SPL_ADD_CLASS(CachingIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(CachingRecursiveIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(DirectoryIterator, z_list, sub, allow, ce_flags); \
+   SPL_ADD_CLASS(EmptyIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(FilterIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(InfiniteIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(IteratorIterator, z_list, sub, allow, ce_flags); \
http://cvs.php.net/diff.php/php-src/ext/spl/spl_functions.c?r1=1.25r2=1.26ty=u
Index: php-src/ext/spl/spl_functions.c
diff -u php-src/ext/spl/spl_functions.c:1.25 php-src/ext/spl/spl_functions.c:1.26
--- php-src/ext/spl/spl_functions.c:1.25Tue Mar  9 11:38:37 2004
+++ php-src/ext/spl/spl_functions.c Sun Oct 31 15:59:37 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_functions.c,v 1.25 2004/03/09 16:38:37 helly Exp $ */
+/* $Id: spl_functions.c,v 1.26 2004/10/31 20:59:37 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -59,7 +59,9 @@
*ppce = zend_register_internal_class(ce TSRMLS_CC);
 
/* entries changed by initialize */
-   (*ppce)-create_object = obj_ctor;
+   if (obj_ctor) {
+   (*ppce)-create_object = obj_ctor;
+   }
 }
 /* }}} */
 
http://cvs.php.net/diff.php/php-src/ext/spl/spl_iterators.c?r1=1.47r2=1.48ty=u
Index: php-src/ext/spl/spl_iterators.c
diff -u php-src/ext/spl/spl_iterators.c:1.47 php-src/ext/spl/spl_iterators.c:1.48
--- php-src/ext/spl/spl_iterators.c:1.47Sun Oct 31 14:49:15 2004
+++ php-src/ext/spl/spl_iterators.c Sun Oct 31 15:59:37 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_iterators.c,v 1.47 2004/10/31 19:49:15 helly Exp $ */
+/* $Id: spl_iterators.c,v 1.48 2004/10/31 20:59:37 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -48,6 +48,7 @@
 zend_class_entry *spl_ce_IteratorIterator;
 zend_class_entry *spl_ce_NoRewindIterator;
 zend_class_entry *spl_ce_InfiniteIterator;
+zend_class_entry *spl_ce_EmptyIterator;
 
 function_entry spl_funcs_RecursiveIterator[] = {
SPL_ABSTRACT_ME(RecursiveIterator, hasChildren,  NULL)
@@ -1465,7 +1466,6 @@
spl_dual_it_fetch(intern, 0 TSRMLS_CC);
}
}
-
 } /* }}} */
 
 static zend_function_entry spl_funcs_InfiniteIterator[] = {
@@ -1473,6 +1473,47 @@
SPL_ME(InfiniteIterator, next, NULL, ZEND_ACC_PUBLIC)
 };
 
+/* {{{ proto EmptyIterator::rewind()
+   Does nothing  */
+SPL_METHOD(EmptyIterator, rewind)
+{
+} /* }}} */
+
+/* {{{ proto EmptyIterator::valid()
+   Return false */
+SPL_METHOD(EmptyIterator, valid)
+{
+   RETURN_FALSE;
+} /* }}} */
+
+/* {{{ proto EmptyIterator::key()
+   Throws exception */
+SPL_METHOD(EmptyIterator, key)
+{
+   zend_throw_exception(NULL, Accessing the key of an EmptyIterator, 0 
TSRMLS_CC);
+} /* }}} */
+
+/* {{{ proto EmptyIterator::current()
+   Throws exception */
+SPL_METHOD(EmptyIterator, current)
+{
+   zend_throw_exception(NULL, Accessing the value of an EmptyIterator, 0 
TSRMLS_CC);
+} /* }}} */
+
+/* {{{ proto EmptyIterator::next()
+   Does nothing */
+SPL_METHOD(EmptyIterator, next)
+{
+} /* }}} */
+
+static zend_function_entry spl_funcs_EmptyIterator[] = {
+   SPL_ME(EmptyIterator, rewind,   NULL, ZEND_ACC_PUBLIC)
+   SPL_ME(EmptyIterator, valid,NULL, ZEND_ACC_PUBLIC)
+   SPL_ME(EmptyIterator, key,  NULL, ZEND_ACC_PUBLIC)
+   SPL_ME(EmptyIterator, current,  NULL, ZEND_ACC_PUBLIC)
+   SPL_ME(EmptyIterator, next, NULL, ZEND_ACC_PUBLIC)
+};
+
 /* {{{ array iterator_to_array(IteratorAggregate it) 
Copy the iterator into an array */
 PHP_FUNCTION(iterator_to_array)
@@ -1607,6 +1648,9 @@

[PHP-CVS] cvs: php-src /ext/spl php_spl.c spl_array.c spl_array.h spl_iterators.c spl_iterators.h /ext/spl/examples appenditerator.inc /ext/spl/examples/tests examples.inc /ext/spl/internal appenditerator.inc /ext/spl/tests iterator_001.phpt iterator_007.phpt iterator_010.phpt iterator_011.phpt iterator_012.phpt iterator_013.phpt

2004-10-31 Thread Marcus Boerger
helly   Sun Oct 31 19:27:00 2004 EDT

  Added files: 
/php-src/ext/spl/internal   appenditerator.inc 
/php-src/ext/spl/tests  iterator_010.phpt iterator_011.phpt 
iterator_012.phpt iterator_013.phpt 

  Removed files:   
/php-src/ext/spl/examples   appenditerator.inc 

  Modified files:  
/php-src/ext/splphp_spl.c spl_array.c spl_array.h spl_iterators.c 
spl_iterators.h 
/php-src/ext/spl/examples/tests examples.inc 
/php-src/ext/spl/tests  iterator_001.phpt iterator_007.phpt 
  Log:
  - Minor fixes
  - Implement AppendIterator in C
  
  http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.33r2=1.34ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.33 php-src/ext/spl/php_spl.c:1.34
--- php-src/ext/spl/php_spl.c:1.33  Sun Oct 31 15:59:37 2004
+++ php-src/ext/spl/php_spl.c   Sun Oct 31 19:26:57 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.33 2004/10/31 20:59:37 helly Exp $ */
+/* $Id: php_spl.c,v 1.34 2004/11/01 00:26:57 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -161,6 +161,7 @@
spl_add_classes(spl_ce_ ## class_name, z_list, sub, allow, ce_flags TSRMLS_CC)
 
 #define SPL_LIST_CLASSES(z_list, sub, allow, ce_flags) \
+   SPL_ADD_CLASS(AppendIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(ArrayObject, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(ArrayIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(CachingIterator, z_list, sub, allow, ce_flags); \
http://cvs.php.net/diff.php/php-src/ext/spl/spl_array.c?r1=1.52r2=1.53ty=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.52 php-src/ext/spl/spl_array.c:1.53
--- php-src/ext/spl/spl_array.c:1.52Mon Oct  4 16:17:06 2004
+++ php-src/ext/spl/spl_array.c Sun Oct 31 19:26:57 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.52 2004/10/04 20:17:06 andi Exp $ */
+/* $Id: spl_array.c,v 1.53 2004/11/01 00:26:57 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -371,20 +371,12 @@
spl_array_write_dimension(getThis(), index, value TSRMLS_CC);
 } /* }}} */
 
-/* {{{ proto void ArrayObject::append(mixed $newval)
-   proto void ArrayIterator::append(mixed $newval)
- Appends the value (cannot be called for objects). */
-SPL_METHOD(Array, append)
+
+void spl_array_iterator_append(zval *object, zval *append_value TSRMLS_DC) /* {{{ */
 {
-   zval *object = getThis();
spl_array_object *intern = 
(spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
HashTable *aht = HASH_OF(intern-array);
 
-   zval *value;
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z, value) == FAILURE) {
-   return;
-   }
-
if (!aht) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, Array was modified outside 
object and is no longer an array);
return;
@@ -394,12 +386,25 @@
php_error_docref(NULL TSRMLS_CC, E_ERROR, Cannot append properties to 
objects, use %s::offsetSet() instead, Z_OBJCE_P(object)-name);
}
 
-   spl_array_write_dimension(object, NULL, value TSRMLS_CC);
+   spl_array_write_dimension(object, NULL, append_value TSRMLS_CC);
if (!intern-pos) {
intern-pos = aht-pListTail;
}
 } /* }}} */
 
+/* {{{ proto void ArrayObject::append(mixed $newval)
+   proto void ArrayIterator::append(mixed $newval)
+ Appends the value (cannot be called for objects). */
+SPL_METHOD(Array, append)
+{
+   zval *value;
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z, value) == FAILURE) {
+   return;
+   }
+   spl_array_iterator_append(getThis(), value TSRMLS_CC);
+} /* }}} */
+
 /* {{{ proto void ArrayObject::offsetUnset(mixed $index)
proto void ArrayIterator::offsetUnset(mixed $index)
  Unsets the value at the specified $index. */
http://cvs.php.net/diff.php/php-src/ext/spl/spl_array.h?r1=1.9r2=1.10ty=u
Index: php-src/ext/spl/spl_array.h
diff -u php-src/ext/spl/spl_array.h:1.9 php-src/ext/spl/spl_array.h:1.10
--- php-src/ext/spl/spl_array.h:1.9 Tue Jan 20 15:59:45 2004
+++ php-src/ext/spl/spl_array.h Sun Oct 31 19:26:57 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.h,v 1.9 2004/01/20 20:59:45 helly Exp $ */
+/* $Id: spl_array.h,v 1.10 2004/11/01 00:26:57 helly Exp $ */
 
 #ifndef SPL_ARRAY_H
 #define SPL_ARRAY_H
@@ -29,6 +29,8 @@
 
 PHP_MINIT_FUNCTION(spl_array);
 
+extern void spl_array_iterator_append(zval *object, zval *append_value TSRMLS_DC);
+
 #endif /* SPL_ARRAY_H */
 
 /*
http://cvs.php.net/diff.php/php-src/ext/spl/spl_iterators.c?r1=1.48r2=1.49ty=u

[PHP-CVS] cvs: php-src /ext/spl php_spl.c spl_iterators.c spl_iterators.h /ext/spl/examples outeriterator.inc /ext/spl/internal cachingiterator.inc filteriterator.inc limititerator.inc outeriterator.inc recursiveiteratoriterator.inc

2004-10-29 Thread Marcus Boerger
helly   Fri Oct 29 16:12:58 2004 EDT

  Added files: 
/php-src/ext/spl/internal   outeriterator.inc 

  Removed files:   
/php-src/ext/spl/examples   outeriterator.inc 

  Modified files:  
/php-src/ext/splphp_spl.c spl_iterators.c spl_iterators.h 
/php-src/ext/spl/internal   cachingiterator.inc filteriterator.inc 
limititerator.inc 
recursiveiteratoriterator.inc 
  Log:
  - Implement OuterIterator in C
  
  http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.29r2=1.30ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.29 php-src/ext/spl/php_spl.c:1.30
--- php-src/ext/spl/php_spl.c:1.29  Thu Oct  7 19:08:16 2004
+++ php-src/ext/spl/php_spl.c   Fri Oct 29 16:12:54 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.29 2004/10/07 23:08:16 helly Exp $ */
+/* $Id: php_spl.c,v 1.30 2004/10/29 20:12:54 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -168,6 +168,7 @@
SPL_ADD_CLASS(DirectoryIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(FilterIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(LimitIterator, z_list, sub, allow, ce_flags); \
+   SPL_ADD_CLASS(OuterIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(ParentIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(RecursiveDirectoryIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(RecursiveIterator, z_list, sub, allow, ce_flags); \
http://cvs.php.net/diff.php/php-src/ext/spl/spl_iterators.c?r1=1.40r2=1.41ty=u
Index: php-src/ext/spl/spl_iterators.c
diff -u php-src/ext/spl/spl_iterators.c:1.40 php-src/ext/spl/spl_iterators.c:1.41
--- php-src/ext/spl/spl_iterators.c:1.40Thu Oct  7 19:08:16 2004
+++ php-src/ext/spl/spl_iterators.c Fri Oct 29 16:12:54 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_iterators.c,v 1.40 2004/10/07 23:08:16 helly Exp $ */
+/* $Id: spl_iterators.c,v 1.41 2004/10/29 20:12:54 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -44,6 +44,7 @@
 zend_class_entry *spl_ce_LimitIterator;
 zend_class_entry *spl_ce_CachingIterator;
 zend_class_entry *spl_ce_CachingRecursiveIterator;
+zend_class_entry *spl_ce_OuterIterator;
 
 function_entry spl_funcs_RecursiveIterator[] = {
SPL_ABSTRACT_ME(RecursiveIterator, hasChildren,  NULL)
@@ -59,6 +60,7 @@
 SPL_METHOD(RecursiveIteratorIterator, next);
 SPL_METHOD(RecursiveIteratorIterator, getDepth);
 SPL_METHOD(RecursiveIteratorIterator, getSubIterator);
+SPL_METHOD(RecursiveIteratorIterator, getInnerIterator);
 
 static
 ZEND_BEGIN_ARG_INFO(arginfo_recursive_it___construct, 0) 
@@ -80,6 +82,7 @@
SPL_ME(RecursiveIteratorIterator, next,  NULL, ZEND_ACC_PUBLIC)
SPL_ME(RecursiveIteratorIterator, getDepth,  NULL, ZEND_ACC_PUBLIC)
SPL_ME(RecursiveIteratorIterator, 
getSubIterator,arginfo_recursive_it_getSubIterator, ZEND_ACC_PUBLIC)
+   SPL_ME(RecursiveIteratorIterator, getInnerIterator,NULL, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
 };
 
@@ -414,8 +417,8 @@
RETURN_LONG(object-level);
 } /* }}} */
 
-/* {{{ proto RecursiveIterator RecursiveIteratorIterator::getSubIterator()
-   The current active sub iterator */
+/* {{{ proto RecursiveIterator RecursiveIteratorIterator::getSubIterator([int level])
+   The current active sub iterator or the iterator at specified level */
 SPL_METHOD(RecursiveIteratorIterator, getSubIterator)
 {
spl_recursive_it_object   *object = 
(spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
@@ -430,6 +433,16 @@
RETURN_ZVAL(object-iterators[level].zobject, 1, 0);
 } /* }}} */
 
+/* {{{ proto RecursiveIterator RecursiveIteratorIterator::getInnerIterator()
+   The current active sub iterator */
+SPL_METHOD(RecursiveIteratorIterator, getInnerIterator)
+{
+   spl_recursive_it_object   *object = 
(spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
+   long  level = object-level;
+   
+   RETURN_ZVAL(object-iterators[level].zobject, 1, 0);
+} /* }}} */
+
 /* {{{ spl_RecursiveIteratorIterator_dtor */
 static void spl_RecursiveIteratorIterator_free_storage(void *_object TSRMLS_DC)
 {
@@ -1386,6 +1399,11 @@
 }
 /* }}} */
 
+static zend_function_entry spl_funcs_OuterIterator[] = {
+   SPL_ABSTRACT_ME(OuterIterator, getInnerIterator,   NULL)
+   {NULL, NULL, NULL}
+};
+
 /* {{{ PHP_MINIT_FUNCTION(spl_iterators)
  */
 PHP_MINIT_FUNCTION(spl_iterators)
@@ -1432,7 +1450,15 @@
 
REGISTER_SPL_SUB_CLASS_EX(CachingRecursiveIterator, CachingIterator, 
spl_dual_it_new, spl_funcs_CachingRecursiveIterator);
REGISTER_SPL_IMPLEMENTS(CachingRecursiveIterator, RecursiveIterator);
-  
+   
+   

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

2004-10-07 Thread Marcus Boerger
helly   Thu Oct  7 19:08:19 2004 EDT

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

  Modified files:  
/php-src/ext/splphp_spl.c spl_iterators.c spl_iterators.h 
  Log:
  - Added iterator_to_array() and iterator_count()
  
  
http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.28r2=1.29ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.28 php-src/ext/spl/php_spl.c:1.29
--- php-src/ext/spl/php_spl.c:1.28  Thu Apr 29 19:02:11 2004
+++ php-src/ext/spl/php_spl.c   Thu Oct  7 19:08:16 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.28 2004/04/29 23:02:11 helly Exp $ */
+/* $Id: php_spl.c,v 1.29 2004/10/07 23:08:16 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -45,6 +45,10 @@
PHP_FE(spl_classes, NULL)
PHP_FE(class_parents,   NULL)
PHP_FE(class_implements,NULL)
+#ifdef SPL_ITERATORS_H
+   PHP_FE(iterator_to_array,   NULL)
+   PHP_FE(iterator_count,  NULL)
+#endif /* SPL_ITERATORS_H */
{NULL, NULL, NULL}
 };
 /* }}} */
http://cvs.php.net/diff.php/php-src/ext/spl/spl_iterators.c?r1=1.39r2=1.40ty=u
Index: php-src/ext/spl/spl_iterators.c
diff -u php-src/ext/spl/spl_iterators.c:1.39 php-src/ext/spl/spl_iterators.c:1.40
--- php-src/ext/spl/spl_iterators.c:1.39Wed Jul 28 18:53:10 2004
+++ php-src/ext/spl/spl_iterators.c Thu Oct  7 19:08:16 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_iterators.c,v 1.39 2004/07/28 22:53:10 helly Exp $ */
+/* $Id: spl_iterators.c,v 1.40 2004/10/07 23:08:16 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -1322,6 +1322,70 @@
{NULL, NULL, NULL}
 };
 
+/* {{{ array iterator_to_array(IteratorAggregate $it) 
+   Copy the iterator into an array */
+PHP_FUNCTION(iterator_to_array)
+{
+   zval   *obj, **data;
+   zend_object_iterator   *iter;
+   char   *str_key;
+   uintstr_key_len;
+   ulong   int_key;
+   int key_type;
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, O, obj, 
zend_ce_aggregate) == FAILURE) {
+   RETURN_FALSE;
+   }
+   
+   array_init(return_value);
+   
+   iter = Z_OBJCE_P(obj)-get_iterator(Z_OBJCE_P(obj), obj TSRMLS_CC);
+
+   iter-funcs-rewind(iter TSRMLS_CC);
+   while (iter-funcs-valid(iter TSRMLS_CC) == SUCCESS) {
+   key_type = iter-funcs-get_current_key(iter, str_key, str_key_len, 
int_key TSRMLS_CC);
+   iter-funcs-get_current_data(iter, data TSRMLS_CC);
+   (*data)-refcount++;
+   switch(key_type) {
+   case HASH_KEY_IS_STRING:
+   add_assoc_zval_ex(return_value, str_key, str_key_len, 
*data);
+   efree(str_key);
+   break;
+   case HASH_KEY_IS_LONG:
+   add_index_zval(return_value, int_key, *data);
+   break;
+   }
+   iter-funcs-move_forward(iter TSRMLS_CC);
+   }
+   iter-funcs-dtor(iter TSRMLS_CC);
+}
+/* }}} */
+
+/* {{{ int iterator_count(IteratorAggregate $it) 
+   Count the elements in an iterator */
+PHP_FUNCTION(iterator_count)
+{
+   zval   *obj;
+   zend_object_iterator   *iter;
+   longcount = 0;
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, O, obj, 
zend_ce_aggregate) == FAILURE) {
+   RETURN_FALSE;
+   }
+   
+   iter = Z_OBJCE_P(obj)-get_iterator(Z_OBJCE_P(obj), obj TSRMLS_CC);
+
+   iter-funcs-rewind(iter TSRMLS_CC);
+   while (iter-funcs-valid(iter TSRMLS_CC) == SUCCESS) {
+   count++;
+   iter-funcs-move_forward(iter TSRMLS_CC);
+   }
+   iter-funcs-dtor(iter TSRMLS_CC);
+   
+   RETURN_LONG(count);
+}
+/* }}} */
+
 /* {{{ PHP_MINIT_FUNCTION(spl_iterators)
  */
 PHP_MINIT_FUNCTION(spl_iterators)
http://cvs.php.net/diff.php/php-src/ext/spl/spl_iterators.h?r1=1.9r2=1.10ty=u
Index: php-src/ext/spl/spl_iterators.h
diff -u php-src/ext/spl/spl_iterators.h:1.9 php-src/ext/spl/spl_iterators.h:1.10
--- php-src/ext/spl/spl_iterators.h:1.9 Mon Mar  8 13:05:41 2004
+++ php-src/ext/spl/spl_iterators.h Thu Oct  7 19:08:16 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_iterators.h,v 1.9 2004/03/08 18:05:41 helly Exp $ */
+/* $Id: spl_iterators.h,v 1.10 2004/10/07 23:08:16 helly Exp $ */
 
 #ifndef SPL_ITERATORS_H
 #define SPL_ITERATORS_H
@@ -35,6 +35,9 @@
 
 PHP_MINIT_FUNCTION(spl_iterators);
 
+PHP_FUNCTION(iterator_to_array);

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

2004-04-29 Thread Marcus Boerger
helly   Thu Apr 29 19:02:11 2004 EDT

  Modified files:  
/php-src/ext/splphp_spl.c 
  Log:
  SPL is meant to be in uppercase letters, do it now it works
  
http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.27r2=1.28ty=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.27 php-src/ext/spl/php_spl.c:1.28
--- php-src/ext/spl/php_spl.c:1.27  Sun Jan 25 12:30:19 2004
+++ php-src/ext/spl/php_spl.c   Thu Apr 29 19:02:11 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_spl.c,v 1.27 2004/01/25 17:30:19 helly Exp $ */
+/* $Id: php_spl.c,v 1.28 2004/04/29 23:02:11 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
#include config.h
@@ -53,7 +53,7 @@
  */
 zend_module_entry spl_module_entry = {
STANDARD_MODULE_HEADER,
-   spl,
+   SPL,
spl_functions,
PHP_MINIT(spl),
PHP_MSHUTDOWN(spl),

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



  1   2   >