cvs: pecl /phar phar.c util.c

From: Date: Sat, 22 Mar 2008 21:54:55 +0000
Subject: cvs: pecl /phar phar.c util.c
Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-10018@lists.php.net to get a copy of this message
cellog Sat Mar 22 21:54:55 2008 UTC Modified files: /pecl/phar phar.c util.c Log: fix memleak in php 5.2, simplify code slightly http://cvs.php.net/viewvc.cgi/pecl/phar/phar.c?r1=1.317&r2=1.318&diff_format=u Index: pecl/phar/phar.c diff -u pecl/phar/phar.c:1.317 pecl/phar/phar.c:1.318 --- pecl/phar/phar.c:1.317 Sat Mar 22 17:09:23 2008 +++ pecl/phar/phar.c Sat Mar 22 21:54:54 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: phar.c,v 1.317 2008/03/22 17:09:23 sfox Exp $ */ +/* $Id: phar.c,v 1.318 2008/03/22 21:54:54 cellog Exp $ */ #define PHAR_MAIN 1 #include "phar_internal.h" @@ -2555,21 +2555,13 @@ zend_op_array *(*phar_orig_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC); #if PHP_VERSION_ID >= 50300 #define phar_orig_zend_open zend_stream_open_function -#else -int (*phar_orig_zend_open)(const char *filename, zend_file_handle *handle TSRMLS_DC); -#endif - -/* - Used to add the fake CWD to include_path prior to parsing it in PHP 5.3+ - Does complete include_path scan for file in PHP 5.2 - - This is only called in PHP 5.2 if we know for certain that we are running within - a phar, and only supports phar stream wrapper in 5.2. - */ char *phar_resolve_path(const char *filename, int filename_len TSRMLS_DC) { return phar_find_in_include_path((char *) filename, filename_len, NULL TSRMLS_CC); } +#else +int (*phar_orig_zend_open)(const char *filename, zend_file_handle *handle TSRMLS_DC); +#endif static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC) /* {{{ */ { @@ -2669,6 +2661,9 @@ if (!handle->opened_path) { handle->opened_path = entry; } + if (entry != filename) { + handle->free_filename = 1; + } return SUCCESS; } if (entry != filename) { @@ -2833,7 +2828,7 @@ php_info_print_table_header(2, "Phar: PHP Archive support", "enabled"); php_info_print_table_row(2, "Phar EXT version", PHP_PHAR_VERSION); php_info_print_table_row(2, "Phar API version", PHP_PHAR_API_VERSION); - php_info_print_table_row(2, "CVS revision", "$Revision: 1.317 $"); + php_info_print_table_row(2, "CVS revision", "$Revision: 1.318 $"); php_info_print_table_row(2, "Phar-based phar archives", "enabled"); php_info_print_table_row(2, "Tar-based phar archives", "enabled"); php_info_print_table_row(2, "ZIP-based phar archives", "enabled"); http://cvs.php.net/viewvc.cgi/pecl/phar/util.c?r1=1.29&r2=1.30&diff_format=u Index: pecl/phar/util.c diff -u pecl/phar/util.c:1.29 pecl/phar/util.c:1.30 --- pecl/phar/util.c:1.29 Sat Mar 22 16:33:32 2008 +++ pecl/phar/util.c Sat Mar 22 21:54:54 2008 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: util.c,v 1.29 2008/03/22 16:33:32 helly Exp $ */ +/* $Id: util.c,v 1.30 2008/03/22 21:54:54 cellog Exp $ */ #include "phar_internal.h" #if !defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300 @@ -361,10 +361,7 @@ } } /* test for stream wrappers and return */ - for (p = filename; p - filename < filename_len && (isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'); p++) { - n++; - } - + for (p = filename; p - filename < filename_len && (isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'); p++, n++); if (n < filename_len - 3 && (*p == ':') && (!strncmp("//", p+1, 2) || ( filename_len > 4 && !memcmp("data", filename, 4)))) { /* found stream wrapper, this is an absolute path until stream wrappers implement realpath */ return estrndup(filename, filename_len); @@ -381,9 +378,7 @@ maybe_stream = 0; goto not_stream; } - for (p = ptr, n = 0; p < end && (isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'); p++) { - n++; - } + for (p = ptr, n = 0; p < end && (isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'); p++, n++); if (n == end - ptr && *p && !strncmp("//", p+1, 2)) { is_stream_wrapper = 1; @@ -480,9 +475,7 @@ memcpy(trypath+exec_fname_length + 1, filename, filename_len+1); /* search for stream wrapper */ - for (p = trypath; isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'; p++) { - n++; - } + for (p = trypath; isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'; p++, n++); if (n < exec_fname_length - 3 && (*p == ':') && (n > 1) && (!strncmp("//", p+1, 2) || !memcmp("data", trypath, 4))) { char *actual;

« previous php.pecl.cvs (#10018) next »