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) /* {{{ */
{
if (!handle->opened_path) {
handle->opened_path = entry;
}
+ if (entry != filename) {
+ handle->free_filename = 1;
+ }
return SUCCESS;
}
if (entry != filename) {
}
}
/* 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);
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;
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;