diff options
author | Stanley Sufficool <ssufficool@php.net> | 2014-10-20 21:33:32 -0700 |
---|---|---|
committer | Stanley Sufficool <ssufficool@php.net> | 2014-10-20 21:33:32 -0700 |
commit | 8defcb855ab01d9c8ab4759cb793d80149b55a8c (patch) | |
tree | ed51eb30a2cbc92b102557498fb3e4113da1bb07 /ext/zip/zip_stream.c | |
parent | 9c7dbb0487f5991fde03873ea8f5e66d6688415f (diff) | |
parent | baddb1c73a170ef1d2c31bd54cddbc6e1ab596b9 (diff) | |
download | php-git-8defcb855ab01d9c8ab4759cb793d80149b55a8c.tar.gz |
Merge branch 'master' of https://git.php.net/push/php-src
* 'master' of https://git.php.net/push/php-src: (6215 commits)
Extra comma
Moved proxy object support in ASSIGN_ADD (and family) from VM to slow paths of corresponding operators
Simplification
zend_get_property_info_quick() cleanup and optimization
initialize lineno before calling compile file file in phar
Use ADDREF instead of DUP, it must be enough.
Removed old irrelevant comment
fixed compilation error
Fix bug #68262: Broken reference across cloned objects
export functions needed for phpdbg
Fixed compilation
Optimized property access handlers. Removed EG(std_property_info).
Fixed bug #68199 (PDO::pgsqlGetNotify doesn't support NOTIFY payloads)
Don't make difference between undefined and unaccessible properies when call __get() and family
Don't make useless CSE
array_pop/array_shift optimization
check for zlib headers as well as lib for mysqlnd
a realpath cache key can be int or float, catching this
News entry for new curl constants
News entry for new curl constants
...
Diffstat (limited to 'ext/zip/zip_stream.c')
-rw-r--r-- | ext/zip/zip_stream.c | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/ext/zip/zip_stream.c b/ext/zip/zip_stream.c index 79b54cbbb0..c542340170 100644 --- a/ext/zip/zip_stream.c +++ b/ext/zip/zip_stream.c @@ -1,3 +1,21 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 7 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2014 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt. | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Piere-Alain Joye <pierre@php.net> | + +----------------------------------------------------------------------+ +*/ + /* $Id$ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -6,8 +24,6 @@ #if HAVE_ZIP #ifdef ZEND_ENGINE_2 -#include "lib/zip.h" - #include "php_streams.h" #include "ext/standard/file.h" #include "ext/standard/php_string.h" @@ -102,13 +118,12 @@ static int php_zip_ops_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_D struct zip_stat sb; const char *path = stream->orig_path; int path_len = strlen(stream->orig_path); - char *file_basename; - size_t file_basename_len; char file_dirname[MAXPATHLEN]; struct zip *za; char *fragment; int fragment_len; int err; + zend_string *file_basename; fragment = strchr(path, '#'); if (!fragment) { @@ -133,11 +148,11 @@ static int php_zip_ops_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_D memcpy(file_dirname, path, path_len - fragment_len); file_dirname[path_len - fragment_len] = '\0'; - php_basename((char *)path, path_len - fragment_len, NULL, 0, &file_basename, &file_basename_len TSRMLS_CC); + file_basename = php_basename((char *)path, path_len - fragment_len, NULL, 0 TSRMLS_CC); fragment++; if (ZIP_OPENBASEDIR_CHECKPATH(file_dirname)) { - efree(file_basename); + zend_string_release(file_basename); return -1; } @@ -145,7 +160,7 @@ static int php_zip_ops_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_D if (za) { memset(ssb, 0, sizeof(php_stream_statbuf)); if (zip_stat(za, fragment, ZIP_FL_NOCASE, &sb) != 0) { - efree(file_basename); + zend_string_release(file_basename); return -1; } zip_close(za); @@ -169,7 +184,7 @@ static int php_zip_ops_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_D #endif ssb->sb.st_ino = -1; } - efree(file_basename); + zend_string_release(file_basename); return 0; } /* }}} */ @@ -243,8 +258,7 @@ php_stream *php_stream_zip_opener(php_stream_wrapper *wrapper, { int path_len; - char *file_basename; - size_t file_basename_len; + zend_string *file_basename; char file_dirname[MAXPATHLEN]; struct zip *za; @@ -278,11 +292,11 @@ php_stream *php_stream_zip_opener(php_stream_wrapper *wrapper, memcpy(file_dirname, path, path_len - fragment_len); file_dirname[path_len - fragment_len] = '\0'; - php_basename(path, path_len - fragment_len, NULL, 0, &file_basename, &file_basename_len TSRMLS_CC); + file_basename = php_basename(path, path_len - fragment_len, NULL, 0 TSRMLS_CC); fragment++; if (ZIP_OPENBASEDIR_CHECKPATH(file_dirname)) { - efree(file_basename); + zend_string_release(file_basename); return NULL; } @@ -306,7 +320,7 @@ php_stream *php_stream_zip_opener(php_stream_wrapper *wrapper, } } - efree(file_basename); + zend_string_release(file_basename); if (!stream) { return NULL; |