mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Revert "Drop free_filename field from zend_file_handle"
This reverts commit e0eca26285.
free_filename is used by the wincache extension, restore this
field for PHP 7.4.
This commit is contained in:
@@ -292,6 +292,9 @@ ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle)
|
||||
zend_llist_del_element(&CG(open_files), file_handle, (int (*)(void *, void *)) zend_compare_file_handles);
|
||||
/* zend_file_handle_dtor() operates on the copy, so we have to NULLify the original here */
|
||||
file_handle->opened_path = NULL;
|
||||
if (file_handle->free_filename) {
|
||||
file_handle->filename = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_API void zend_lex_tstring(zval *zv)
|
||||
|
||||
@@ -223,6 +223,10 @@ ZEND_API void zend_file_handle_dtor(zend_file_handle *fh) /* {{{ */
|
||||
efree(fh->buf);
|
||||
fh->buf = NULL;
|
||||
}
|
||||
if (fh->free_filename && fh->filename) {
|
||||
efree((char*)fh->filename);
|
||||
fh->filename = NULL;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -56,6 +56,9 @@ typedef struct _zend_file_handle {
|
||||
const char *filename;
|
||||
zend_string *opened_path;
|
||||
zend_stream_type type;
|
||||
/* free_filename is used by wincache */
|
||||
/* TODO: Clean up filename vs opened_path mess */
|
||||
zend_bool free_filename;
|
||||
char *buf;
|
||||
size_t len;
|
||||
} zend_file_handle;
|
||||
|
||||
@@ -3261,6 +3261,7 @@ static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type)
|
||||
efree(f.opened_path);
|
||||
}
|
||||
f.opened_path = file_handle->opened_path;
|
||||
f.free_filename = file_handle->free_filename;
|
||||
|
||||
switch (file_handle->type) {
|
||||
case ZEND_HANDLE_STREAM:
|
||||
|
||||
@@ -1338,6 +1338,7 @@ static int cli_main( int argc, char * argv[] )
|
||||
highlight_file(SG(request_info).path_translated, &syntax_highlighter_ini);
|
||||
} else if (source_highlight == 2) {
|
||||
file_handle.filename = *p;
|
||||
file_handle.free_filename = 0;
|
||||
file_handle.opened_path = NULL;
|
||||
ret = php_lint_script(&file_handle);
|
||||
if (ret==SUCCESS) {
|
||||
@@ -1348,6 +1349,7 @@ static int cli_main( int argc, char * argv[] )
|
||||
|
||||
} else {
|
||||
file_handle.filename = *p;
|
||||
file_handle.free_filename = 0;
|
||||
file_handle.opened_path = NULL;
|
||||
|
||||
php_execute_script(&file_handle);
|
||||
|
||||
@@ -294,6 +294,10 @@ zend_op_array *phpdbg_init_compile_file(zend_file_handle *file, int type) {
|
||||
zend_string_release(file->opened_path);
|
||||
file->opened_path = zend_string_init(filename, strlen(filename), 0);
|
||||
} else {
|
||||
if (file->free_filename) {
|
||||
efree((char *) file->filename);
|
||||
}
|
||||
file->free_filename = 0;
|
||||
file->filename = filename;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user