Skip to content

Commit

Permalink
Fixed bug #73830 Directory does not exist.
Browse files Browse the repository at this point in the history
  • Loading branch information
weltling committed Nov 28, 2017
1 parent ee9e32c commit 578049f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions sapi/cli/php_cli_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -2552,6 +2552,10 @@ int do_cli_server(int argc, char **argv) /* {{{ */
const char *server_bind_address = NULL;
extern const opt_struct OPTIONS[];
const char *document_root = NULL;
#ifdef PHP_WIN32
char document_root_tmp[MAXPATHLEN];
size_t k;
#endif
const char *router = NULL;
char document_root_buf[MAXPATHLEN];

Expand All @@ -2561,7 +2565,23 @@ int do_cli_server(int argc, char **argv) /* {{{ */
server_bind_address = php_optarg;
break;
case 't':
#ifndef PHP_WIN32
document_root = php_optarg;
#else
k = strlen(php_optarg);
if (k + 1 > MAXPATHLEN) {
fprintf(stderr, "Document root path is too long.\n");
return 1;
}
memmove(document_root_tmp, php_optarg, k + 1);
/* Clean out any trailing garbage that might have been passed
from a batch script. */
do {
document_root_tmp[k] = '\0';
k--;
} while ('"' == document_root_tmp[k] || ' ' == document_root_tmp[k]);
document_root = document_root_tmp;
#endif
break;
}
}
Expand Down

0 comments on commit 578049f

Please sign in to comment.