pollita         Tue Oct  3 16:28:02 2006 UTC

  Modified files:              
    /ZendEngine2        zend.c zend.h zend_builtin_functions.c 
    /php-src/main       main.c 
  Log:
  PHP6 Update for get_included_files() and export of path decode for Zend
  
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend.c?r1=1.373&r2=1.374&diff_format=u
Index: ZendEngine2/zend.c
diff -u ZendEngine2/zend.c:1.373 ZendEngine2/zend.c:1.374
--- ZendEngine2/zend.c:1.373    Fri Sep 29 20:59:26 2006
+++ ZendEngine2/zend.c  Tue Oct  3 16:28:02 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend.c,v 1.373 2006/09/29 20:59:26 andrei Exp $ */
+/* $Id: zend.c,v 1.374 2006/10/03 16:28:02 pollita Exp $ */
 
 #include "zend.h"
 #include "zend_extensions.h"
@@ -56,6 +56,7 @@
 ZEND_API int (*zend_printf)(const char *format, ...);
 ZEND_API zend_write_func_t zend_write;
 ZEND_API int (*zend_path_encode)(char **encpath, int *encpath_len, const UChar 
*path, int path_len TSRMLS_DC);
+ZEND_API int (*zend_path_decode)(UChar **decpath, int *decpath_len, const char 
*path, int path_len TSRMLS_DC);
 ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path);
 ZEND_API int (*zend_stream_open_function)(const char *filename, 
zend_file_handle *handle TSRMLS_DC);
 ZEND_API void (*zend_block_interruptions)(void);
@@ -624,6 +625,22 @@
        return SUCCESS;
 }
 
+static int zend_path_decode_wrapper(UChar **decpath, int *decpath_len, const 
char *path, int path_len TSRMLS_DC)
+{
+       UErrorCode status = U_ZERO_ERROR;
+
+       
zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(filesystem_encoding_conv)), 
decpath, decpath_len, path, path_len, &status);
+
+       if (U_FAILURE(status)) {
+               efree(*decpath);
+               *decpath = NULL;
+               *decpath_len = 0;
+               return FAILURE;
+       }
+
+       return SUCCESS;
+}
+
 static FILE *zend_fopen_wrapper(const char *filename, char **opened_path)
 {
        if (opened_path) {
@@ -1012,6 +1029,10 @@
        if (!zend_path_encode) {
                zend_path_encode = zend_path_encode_wrapper;
        }
+       zend_path_decode = utility_functions->path_decode_function;
+       if (!zend_path_decode) {
+               zend_path_decode = zend_path_decode_wrapper;
+       }
        zend_fopen = utility_functions->fopen_function;
        if (!zend_fopen) {
                zend_fopen = zend_fopen_wrapper;
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend.h?r1=1.327&r2=1.328&diff_format=u
Index: ZendEngine2/zend.h
diff -u ZendEngine2/zend.h:1.327 ZendEngine2/zend.h:1.328
--- ZendEngine2/zend.h:1.327    Thu Sep 14 10:32:57 2006
+++ ZendEngine2/zend.h  Tue Oct  3 16:28:02 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend.h,v 1.327 2006/09/14 10:32:57 dmitry Exp $ */
+/* $Id: zend.h,v 1.328 2006/10/03 16:28:02 pollita Exp $ */
 
 #ifndef ZEND_H
 #define ZEND_H
@@ -411,6 +411,7 @@
        int (*printf_function)(const char *format, ...);
        int (*write_function)(const char *str, uint str_length);
        int (*path_encode_function)(char **encpath, int *encpath_len, const 
UChar *path, int path_len TSRMLS_DC);
+       int (*path_decode_function)(UChar **decpath, int *decpath_len, const 
char *path, int path_len TSRMLS_DC);
        FILE *(*fopen_function)(const char *filename, char **opened_path);
        void (*message_handler)(long message, void *data);
        void (*block_interruptions)(void);
@@ -557,6 +558,7 @@
 extern ZEND_API int (*zend_printf)(const char *format, ...);
 extern ZEND_API zend_write_func_t zend_write;
 extern ZEND_API int (*zend_path_encode)(char **encpath, int *encpath_len, 
const UChar *path, int path_len TSRMLS_DC);
+extern ZEND_API int (*zend_path_decode)(UChar **decpath, int *decpath_len, 
const char *path, int path_len TSRMLS_DC);
 extern ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path);
 extern ZEND_API void (*zend_block_interruptions)(void);
 extern ZEND_API void (*zend_unblock_interruptions)(void);
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_builtin_functions.c?r1=1.326&r2=1.327&diff_format=u
Index: ZendEngine2/zend_builtin_functions.c
diff -u ZendEngine2/zend_builtin_functions.c:1.326 
ZendEngine2/zend_builtin_functions.c:1.327
--- ZendEngine2/zend_builtin_functions.c:1.326  Tue Sep 26 07:55:40 2006
+++ ZendEngine2/zend_builtin_functions.c        Tue Oct  3 16:28:02 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_builtin_functions.c,v 1.326 2006/09/26 07:55:40 dmitry Exp $ */
+/* $Id: zend_builtin_functions.c,v 1.327 2006/10/03 16:28:02 pollita Exp $ */
 
 #include "zend.h"
 #include "zend_API.h"
@@ -1197,22 +1197,28 @@
 
 #endif /* ZEND_DEBUG */
 
-/* {{{ proto array get_included_files(void)
-   Returns an array with the file names that were include_once()'d */
+/* {{{ proto array get_included_files(void) U
+   Returns an array with the file names that were included (includes require 
and once varieties) */
 ZEND_FUNCTION(get_included_files)
 {
+       HashPosition pos;
+       UChar *ustr;
        zstr entry;
+       int len, ustr_len;
+
        if (ZEND_NUM_ARGS() != 0) {
                ZEND_WRONG_PARAM_COUNT();
        }
 
        array_init(return_value);
-       zend_hash_internal_pointer_reset(&EG(included_files));
-       while (zend_hash_get_current_key(&EG(included_files), &entry, NULL, 0) 
== HASH_KEY_IS_STRING) {
-               /* UTODO Not sure this should be runtime encoding.. maybe 
filename encoding
-                * instead */
-               add_next_index_rt_string(return_value, entry.s, 1);
-               zend_hash_move_forward(&EG(included_files));
+       zend_hash_internal_pointer_reset_ex(&EG(included_files), &pos);
+       while (zend_hash_get_current_key_ex(&EG(included_files), &entry, &len, 
NULL, 0, &pos) == HASH_KEY_IS_STRING) {
+               if (UG(unicode) && SUCCESS == zend_path_decode(&ustr, 
&ustr_len, entry.s, len - 1 TSRMLS_CC)) {
+                       add_next_index_unicodel(return_value, ustr, ustr_len, 
0);
+               } else {
+                       add_next_index_stringl(return_value, entry.s, len - 1, 
1);
+               }
+               zend_hash_move_forward_ex(&EG(included_files), &pos);
        }
 }
 /* }}} */
http://cvs.php.net/viewvc.cgi/php-src/main/main.c?r1=1.703&r2=1.704&diff_format=u
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.703 php-src/main/main.c:1.704
--- php-src/main/main.c:1.703   Mon Sep 25 14:49:34 2006
+++ php-src/main/main.c Tue Oct  3 16:28:02 2006
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: main.c,v 1.703 2006/09/25 14:49:34 iliaa Exp $ */
+/* $Id: main.c,v 1.704 2006/10/03 16:28:02 pollita Exp $ */
 
 /* {{{ includes
  */
@@ -983,6 +983,14 @@
 }
 /* }}} */
 
+/* {{{ php_path_decode_for_zend
+ */
+static int php_path_decode_for_zend(UChar **decpath, int *decpath_len, const 
char *path, int path_len TSRMLS_DC)
+{
+       return php_stream_path_decode(NULL, decpath, decpath_len, path, 
path_len, 0, NULL);
+}
+/* }}} */
+
 /* {{{ php_fopen_wrapper_for_zend
  */
 static FILE *php_fopen_wrapper_for_zend(const char *filename, char 
**opened_path)
@@ -1550,6 +1558,7 @@
        zuf.printf_function = php_printf;
        zuf.write_function = php_output_wrapper;
        zuf.path_encode_function = php_path_encode_for_zend;
+       zuf.path_decode_function = php_path_decode_for_zend;
        zuf.fopen_function = php_fopen_wrapper_for_zend;
        zuf.message_handler = php_message_handler_for_zend;
        zuf.block_interruptions = sapi_module.block_interruptions;

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

Reply via email to