diff options
author | Ondřej Surý <ondrej@sury.org> | 2012-05-28 16:52:15 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2012-05-28 16:52:15 +0200 |
commit | 01c525f668ecff08bea21c4ff22745b8f77e8c3a (patch) | |
tree | 07ebb675549d7a8ceb905676e4894151122321ac /sapi/cli/php_cli.c | |
parent | d4d61a2bcb9975c8aeddbc6603211064174087a9 (diff) | |
download | php-upstream/5.4.4_rc1.tar.gz |
Imported Upstream version 5.4.4~rc1upstream/5.4.4_rc1
Diffstat (limited to 'sapi/cli/php_cli.c')
-rw-r--r-- | sapi/cli/php_cli.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index 801e53ba2..205b9db3f 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -662,7 +662,7 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */ int php_optind = 1, orig_optind = 1; char *exec_direct=NULL, *exec_run=NULL, *exec_begin=NULL, *exec_end=NULL; char *arg_free=NULL, **arg_excp=&arg_free; - char *script_file=NULL; + char *script_file=NULL, *translated_path = NULL; int interactive=0; int lineno = 0; const char *param_error=NULL; @@ -927,8 +927,13 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */ if (script_file) { if (cli_seek_file_begin(&file_handle, script_file, &lineno TSRMLS_CC) != SUCCESS) { goto err; + } else { + char real_path[MAXPATHLEN]; + if (VCWD_REALPATH(script_file, real_path)) { + translated_path = strdup(real_path); + } + script_filename = script_file; } - script_filename = script_file; } else { /* We could handle PHP_MODE_PROCESS_STDIN in a different manner */ /* here but this would make things only more complicated. And it */ @@ -947,7 +952,7 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */ SG(request_info).argc=argc-php_optind+1; arg_excp = argv+php_optind-1; arg_free = argv[php_optind-1]; - SG(request_info).path_translated = (char*)file_handle.filename; + SG(request_info).path_translated = translated_path? translated_path: (char*)file_handle.filename; argv[php_optind-1] = (char*)file_handle.filename; SG(request_info).argv=argv+php_optind-1; |