diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-07-16 16:44:46 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-07-16 16:44:46 +0200 |
commit | 3faa903d47d8ece5a6256cf175b9af868779b061 (patch) | |
tree | 86ef2d048952d53067e3bc59ada3ceb7f818bbab /sapi/cli/php_cli.c | |
parent | 72c6ea9cb8e84cd6630c198d4b9416dc4c57ca9c (diff) | |
parent | 49bac9b77bc9cacc0f984092d226e951ae336b43 (diff) | |
download | php-git-3faa903d47d8ece5a6256cf175b9af868779b061.tar.gz |
Merge branch 'PHP-7.4'
Diffstat (limited to 'sapi/cli/php_cli.c')
-rw-r--r-- | sapi/cli/php_cli.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index 292955d7f1..2b0fb71fcc 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -589,18 +589,13 @@ static const char *param_mode_conflict = "Either execute direct code, process st */ static int cli_seek_file_begin(zend_file_handle *file_handle, char *script_file) { - // TODO: Is this still needed? - file_handle->type = ZEND_HANDLE_FP; - file_handle->opened_path = NULL; - file_handle->free_filename = 0; - if (!(file_handle->handle.fp = VCWD_FOPEN(script_file, "rb"))) { + FILE *fp = VCWD_FOPEN(script_file, "rb"); + if (!fp) { php_printf("Could not open input file: %s\n", script_file); return FAILURE; } - file_handle->filename = script_file; - - rewind(file_handle->handle.fp); + zend_stream_init_fp(file_handle, fp, script_file); return SUCCESS; } /* }}} */ @@ -916,12 +911,8 @@ static int do_cli(int argc, char **argv) /* {{{ */ /* here but this would make things only more complicated. And it */ /* is consitent with the way -R works where the stdin file handle*/ /* is also accessible. */ - file_handle.filename = "Standard input code"; - file_handle.handle.fp = stdin; + zend_stream_init_fp(&file_handle, stdin, "Standard input code"); } - file_handle.type = ZEND_HANDLE_FP; - file_handle.opened_path = NULL; - file_handle.free_filename = 0; php_self = (char*)file_handle.filename; /* before registering argv to module exchange the *new* argv[0] */ |