cvs: php4 /sapi/cgi cgi_main.c
| From: | Zeev Suraski | Date: | Mon, 06 Nov 2000 09:55:53 +0000 |
| Subject: | cvs: php4 /sapi/cgi cgi_main.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-2499@lists.php.net to get a copy of this message | ||
zeev Mon Nov 6 01:55:53 2000 EDT
Modified files:
/php4/sapi/cgi cgi_main.c
Log:
Fixed a bug in $argv and $argc not being properly defined in command-line mode
@- Fixed a bug that prevented $argv and $argc from being defined in the command
@ line version of PHP (Stas)
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.83 php4/sapi/cgi/cgi_main.c:1.84
--- php4/sapi/cgi/cgi_main.c:1.83 Mon Nov 6 01:31:48 2000
+++ php4/sapi/cgi/cgi_main.c Mon Nov 6 01:55:53 2000
@@ -645,6 +645,25 @@
EG(interactive) = interactive;
#endif
+ if (!cgi) {
+ if (!SG(request_info).query_string) {
+ for (i = ap_php_optind, len = 0; i < argc; i++) {
+ len += strlen(argv[i]) + 1;
+ }
+
+ s = malloc(len + 1); /* leak - but only for command line version, so ok */
+ *s = '\0'; /* we are pretending it came from the environment */
+ for (i = ap_php_optind, len = 0; i < argc; i++) {
+ strcat(s, argv[i]);
+ if (i < (argc - 1)) {
+ strcat(s, "+");
+ }
+ }
+ SG(request_info).query_string = s;
+ }
+ }
+
+
if (!cgi_started) {
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
php_module_shutdown();
@@ -664,21 +683,9 @@
zend_llist_destroy(&global_vars);
if (!cgi) {
- if (!SG(request_info).query_string) {
- for (i = ap_php_optind, len = 0; i < argc; i++)
- len += strlen(argv[i]) + 1;
-
- s = malloc(len + 1); /* leak - but only for command line version, so ok */
- *s = '\0'; /* we are pretending it came from the environment */
- for (i = ap_php_optind, len = 0; i < argc; i++) {
- strcat(s, argv[i]);
- if (i < (argc - 1))
- strcat(s, "+");
- }
- SG(request_info).query_string = s;
- }
- if (!SG(request_info).path_translated && argc > ap_php_optind)
+ if (!SG(request_info).path_translated && argc > ap_php_optind) {
SG(request_info).path_translated = estrdup(argv[ap_php_optind]);
+ }
} else {
/* If for some reason the CGI interface is not setting the
PATH_TRANSLATED correctly, SG(request_info).path_translated is NULL.