cvs: php4 /sapi/cli php_cli.c
| From: | Edin Kadribasic | Date: | Mon, 28 Apr 2003 10:04:51 +0000 |
| Subject: | cvs: php4 /sapi/cli php_cli.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-20532@lists.php.net to get a copy of this message | ||
edink Mon Apr 28 06:04:51 2003 EDT
Modified files:
/php4/sapi/cli php_cli.c
Log:
More clean way of ignoring headers in CLI since we do not need to
disable them selectively. This fixes problems for people who want
to use session module in CLI.
Index: php4/sapi/cli/php_cli.c
diff -u php4/sapi/cli/php_cli.c:1.88 php4/sapi/cli/php_cli.c:1.89
--- php4/sapi/cli/php_cli.c:1.88 Sun Apr 27 15:41:36 2003
+++ php4/sapi/cli/php_cli.c Mon Apr 28 06:04:50 2003
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_cli.c,v 1.88 2003/04/27 19:41:36 helly Exp $ */
+/* $Id: php_cli.c,v 1.89 2003/04/28 10:04:50 edink Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -263,10 +263,6 @@
static void sapi_cli_send_header(sapi_header_struct *sapi_header, void *server_context TSRMLS_DC)
{
- if (sapi_header) {
- PHPWRITE_H(sapi_header->header, sapi_header->header_len);
- PHPWRITE_H("\r\n", 2);
- }
}
@@ -478,8 +474,6 @@
*lineno = 1;
if (!(file_handle->handle.fp = VCWD_FOPEN(script_file, "rb"))) {
- SG(headers_sent) = 1;
- SG(request_info).no_headers = 1;
php_printf("Could not open input file: %s.\n", script_file);
return FAILURE;
}
@@ -514,7 +508,6 @@
zend_file_handle file_handle;
/* temporary locals */
int behavior=PHP_MODE_STANDARD;
- int no_headers=1;
int orig_optind=optind;
char *orig_optarg=optarg;
char *arg_free=NULL, **arg_excp=&arg_free;
@@ -608,8 +601,6 @@
EG(uninitialized_zval_ptr) = NULL;
if (cli_sapi_module.php_ini_path_override && cli_sapi_module.php_ini_ignore) {
- SG(headers_sent) = 1;
- SG(request_info).no_headers = 1;
PUTS("You cannot use both -n and -c switch. Use -h for help.\n");
exit_status=1;
goto out_err;
@@ -620,10 +611,8 @@
case 'h': /* help & quit */
case '?':
- no_headers = 1;
php_output_startup();
php_output_activate(TSRMLS_C);
- SG(headers_sent) = 1;
php_cli_usage(argv[0]);
php_end_ob_buffers(1 TSRMLS_CC);
exit_status=1;
@@ -634,10 +623,6 @@
if (php_request_startup(TSRMLS_C)==FAILURE) {
goto err;
}
- if (no_headers) {
- SG(headers_sent) = 1;
- SG(request_info).no_headers = 1;
- }
php_print_info(0xFFFFFFFF TSRMLS_CC);
php_end_ob_buffers(1 TSRMLS_CC);
exit_status=1;
@@ -646,7 +631,6 @@
case 'm': /* list compiled in modules */
php_output_startup();
php_output_activate(TSRMLS_C);
- SG(headers_sent) = 1;
php_printf("[PHP Modules]\n");
print_modules(TSRMLS_C);
php_printf("\n[Zend Modules]\n");
@@ -657,14 +641,9 @@
goto out_err;
case 'v': /* show php version & quit */
- no_headers = 1;
if (php_request_startup(TSRMLS_C)==FAILURE) {
goto err;
}
- if (no_headers) {
- SG(headers_sent) = 1;
- SG(request_info).no_headers = 1;
- }
php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2003 The PHP Group\n%s",
PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
php_end_ob_buffers(1 TSRMLS_CC);
exit_status=1;
@@ -716,7 +695,6 @@
}
behavior=PHP_MODE_PROCESS_STDIN;
script_file = optarg;
- no_headers = 1;
break;
case 'f': /* parse file */
@@ -728,7 +706,6 @@
break;
}
script_file = optarg;
- no_headers = 1;
break;
case 'g': /* define global variables on command line */
@@ -743,7 +720,6 @@
if (behavior != PHP_MODE_STANDARD) {
break;
}
- no_headers = 1;
behavior=PHP_MODE_LINT;
break;
@@ -847,8 +823,6 @@
}
if (param_error) {
- SG(headers_sent) = 1;
- SG(request_info).no_headers = 1;
PUTS(param_error);
exit_status=1;
goto out_err;
@@ -863,7 +837,6 @@
&& behavior!=PHP_MODE_PROCESS_STDIN
&& strcmp(argv[optind-1],"--"))
{
- no_headers = 1;
script_file=argv[optind];
optind++;
}
@@ -897,8 +870,6 @@
if (php_request_startup(TSRMLS_C)==FAILURE) {
*arg_excp = arg_free;
fclose(file_handle.handle.fp);
- SG(headers_sent) = 1;
- SG(request_info).no_headers = 1;
php_request_shutdown((void *) 0);
PUTS("Could not startup.\n");
goto err;
@@ -911,11 +882,6 @@
for (i = 1; i < argc; i++) {
memset(argv[i], 0, strlen(argv[i]));
}
- }
-
- if (no_headers) {
- SG(headers_sent) = 1;
- SG(request_info).no_headers = 1;
}
/* This actually destructs the elements of the list - ugly hack */