Re: [PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2003-06-01 Thread Moriyoshi Koizumi
This should be a kind of new feature. Is it worth MFHing?

Moriyoshi

Jani Taskinen [EMAIL PROTECTED] wrote:

 
 Are you gonna MFH that?
 
 --Jani
 
 
 On Fri, 30 May 2003, Moriyoshi Koizumi wrote:
 
 moriyoshiFri May 30 18:31:12 2003 EDT
 
   Modified files:  
 /php4/sapi/cgi   cgi_main.c 
   Log:
   CGI SAPI should honour this setting
   
   
 Index: php4/sapi/cgi/cgi_main.c
 diff -u php4/sapi/cgi/cgi_main.c:1.230 php4/sapi/cgi/cgi_main.c:1.231
 --- php4/sapi/cgi/cgi_main.c:1.230   Fri May 30 12:10:58 2003
 +++ php4/sapi/cgi/cgi_main.c Fri May 30 18:31:12 2003
 @@ -20,7 +20,7 @@
 +--+
  */
  
 -/* $Id: cgi_main.c,v 1.230 2003/05/30 16:10:58 derick Exp $ */
 +/* $Id: cgi_main.c,v 1.231 2003/05/30 22:31:12 moriyoshi Exp $ */
  
  #include php.h
  #include php_globals.h
 @@ -1444,7 +1444,7 @@
  for (i = optind, len = 0; i  argc; i++) {
  strcat(s, argv[i]);
  if (i  (argc - 1)) {
 -strcat(s, );
 +strcat(s, PG(arg_separator).input);
  }
  }
  SG(request_info).query_string = s;
 
 
 
 
 
 -- 
 https://www.paypal.com/xclick/[EMAIL PROTECTED]no_note=1tax=0currency_code=EUR
  
 


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2003-06-01 Thread Derick Rethans
On Sun, 1 Jun 2003, Moriyoshi Koizumi wrote:

 This should be a kind of new feature. Is it worth MFHing?

Yes, I think so.

Derick

-- 
my other box is your windows PC
-
 Derick Rethans http://derickrethans.nl/ 
 International PHP Magazine  http://php-mag.net/
-

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c /sapi/cli php_cli.c

2003-05-31 Thread Derick Rethans
derick  Fri May 30 12:10:59 2003 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
/php4/sapi/cli  php_cli.c 
  Log:
  - MFB: Version output beautification
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.229 php4/sapi/cgi/cgi_main.c:1.230
--- php4/sapi/cgi/cgi_main.c:1.229  Mon May 26 19:22:05 2003
+++ php4/sapi/cgi/cgi_main.cFri May 30 12:10:58 2003
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: cgi_main.c,v 1.229 2003/05/26 23:22:05 sniper Exp $ */
+/* $Id: cgi_main.c,v 1.230 2003/05/30 16:10:58 derick Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -1384,7 +1384,11 @@
SG(headers_sent) = 1;
SG(request_info).no_headers = 
1;
}
-   php_printf(PHP %s (%s), Copyright (c) 
1997-2003 The PHP Group\n%s, PHP_VERSION, sapi_module.name, get_zend_version());
+#if ZEND_DEBUG
+   php_printf(PHP %s (%s) (built: %s %s) 
(DEBUG)\nCopyright (c) 1997-2003 The PHP Group\n%s, PHP_VERSION, sapi_module.name, 
__DATE__, __TIME__, get_zend_version());
+#else
+   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());
+#endif
php_end_ob_buffers(1 TSRMLS_CC);
exit(1);
break;
Index: php4/sapi/cli/php_cli.c
diff -u php4/sapi/cli/php_cli.c:1.92 php4/sapi/cli/php_cli.c:1.93
--- php4/sapi/cli/php_cli.c:1.92Thu May 29 20:11:37 2003
+++ php4/sapi/cli/php_cli.c Fri May 30 12:10:58 2003
@@ -19,7 +19,7 @@
+--+
 */
 
-/* $Id: php_cli.c,v 1.92 2003/05/30 00:11:37 helly Exp $ */
+/* $Id: php_cli.c,v 1.93 2003/05/30 16:10:58 derick Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -651,7 +651,11 @@
if (php_request_startup(TSRMLS_C)==FAILURE) {
goto err;
}
+#if ZEND_DEBUG
+   php_printf(PHP %s (%s) (built: %s %s) 
(DEBUG)\nCopyright (c) 1997-2003 The PHP Group\n%s, PHP_VERSION, sapi_module.name, 
__DATE__, __TIME__, get_zend_version());
+#else
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());
+#endif
php_end_ob_buffers(1 TSRMLS_CC);
exit_status=1;
goto out;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2003-05-31 Thread Moriyoshi Koizumi
moriyoshi   Fri May 30 18:31:12 2003 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
  Log:
  CGI SAPI should honour this setting
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.230 php4/sapi/cgi/cgi_main.c:1.231
--- php4/sapi/cgi/cgi_main.c:1.230  Fri May 30 12:10:58 2003
+++ php4/sapi/cgi/cgi_main.cFri May 30 18:31:12 2003
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: cgi_main.c,v 1.230 2003/05/30 16:10:58 derick Exp $ */
+/* $Id: cgi_main.c,v 1.231 2003/05/30 22:31:12 moriyoshi Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -1444,7 +1444,7 @@
for (i = optind, len = 0; i  argc; i++) {
strcat(s, argv[i]);
if (i  (argc - 1)) {
-   strcat(s, );
+   strcat(s, PG(arg_separator).input);
}
}
SG(request_info).query_string = s;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2003-05-31 Thread Jani Taskinen

Are you gonna MFH that?

--Jani


On Fri, 30 May 2003, Moriyoshi Koizumi wrote:

moriyoshi  Fri May 30 18:31:12 2003 EDT

  Modified files:  
/php4/sapi/cgi cgi_main.c 
  Log:
  CGI SAPI should honour this setting
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.230 php4/sapi/cgi/cgi_main.c:1.231
--- php4/sapi/cgi/cgi_main.c:1.230 Fri May 30 12:10:58 2003
+++ php4/sapi/cgi/cgi_main.c   Fri May 30 18:31:12 2003
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: cgi_main.c,v 1.230 2003/05/30 16:10:58 derick Exp $ */
+/* $Id: cgi_main.c,v 1.231 2003/05/30 22:31:12 moriyoshi Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -1444,7 +1444,7 @@
   for (i = optind, len = 0; i  argc; i++) {
   strcat(s, argv[i]);
   if (i  (argc - 1)) {
-  strcat(s, );
+  strcat(s, PG(arg_separator).input);
   }
   }
   SG(request_info).query_string = s;





-- 
https://www.paypal.com/xclick/[EMAIL PROTECTED]no_note=1tax=0currency_code=EUR
 


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2003-03-29 Thread Moriyoshi Koizumi
moriyoshi   Sat Mar 29 11:13:51 2003 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
  Log:
  CS  WS fixes
  
  Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.222 php4/sapi/cgi/cgi_main.c:1.223
--- php4/sapi/cgi/cgi_main.c:1.222  Fri Mar 28 13:24:02 2003
+++ php4/sapi/cgi/cgi_main.cSat Mar 29 11:13:51 2003
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: cgi_main.c,v 1.222 2003/03/28 18:24:02 moriyoshi Exp $ */
+/* $Id: cgi_main.c,v 1.223 2003/03/29 16:13:51 moriyoshi Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -249,8 +249,7 @@
uint remaining = str_length;
size_t ret;
 
-   while (remaining  0)
-   {
+   while (remaining  0) {
ret = sapi_cgibin_single_write(ptr, remaining TSRMLS_CC);
if (!ret) {
php_handle_aborted_connection();
@@ -272,7 +271,8 @@
if(!request || FCGX_FFlush( request-out ) == -1 ) {
php_handle_aborted_connection();
}
-   } else
+   return;
+   }
 #endif
if (fflush(stdout)==EOF) {
php_handle_aborted_connection();
@@ -354,9 +354,10 @@
FCGX_Request *request = (FCGX_Request *)SG(server_context);
tmp_read_bytes = FCGX_GetStr( pos, count_bytes-read_bytes, 
request-in );
pos += tmp_read_bytes;
-   } else
+   } else {
 #endif
tmp_read_bytes = read(0, buffer+read_bytes, 
count_bytes-read_bytes);
+   }
 
if (tmp_read_bytes=0) {
break;
@@ -387,7 +388,9 @@
 {
int len=0;
char *buf = NULL;
-   if (!name) return NULL;
+   if (!name) {
+   return NULL;
+   }
len = strlen(name) + (value?strlen(value):0) + sizeof(=) + 2;
buf = (char *)malloc(len);
if (buf == NULL) {
@@ -480,7 +483,7 @@
 
 static int php_cgi_startup(sapi_module_struct *sapi_module)
 {
-   if (php_module_startup(sapi_module, NULL, 0)==FAILURE) {
+   if (php_module_startup(sapi_module, NULL, 0) == FAILURE) {
return FAILURE;
}
return SUCCESS;
@@ -639,8 +642,9 @@
/* some broken servers do not have script_filename or argv0
   an example, IIS configured in some ways.  then they do more
   broken stuff and set path_translated to the cgi script location */
-   if (!script_path_translated  env_path_translated)
-   script_path_translated = env_path_translated; 
+   if (!script_path_translated  env_path_translated) {
+   script_path_translated = env_path_translated;
+   }
 #endif
 
/* initialize the defaults */
@@ -670,22 +674,25 @@
if (fix_pathinfo) {
 
/* save the originals first for anything we change later */
-   if (env_path_translated)
+   if (env_path_translated) {

_sapi_cgibin_putenv(ORIG_PATH_TRANSLATED,env_path_translated TSRMLS_CC);
-   if (env_path_info)
+   }
+   if (env_path_info) {
_sapi_cgibin_putenv(ORIG_PATH_INFO,env_path_info 
TSRMLS_CC);
-   if (env_script_name)
+   }
+   if (env_script_name) {
_sapi_cgibin_putenv(ORIG_SCRIPT_NAME,env_script_name 
TSRMLS_CC);
-   if (env_script_filename)
+   }
+   if (env_script_filename) {

_sapi_cgibin_putenv(ORIG_SCRIPT_FILENAME,env_script_filename TSRMLS_CC);
-
+   }
if (!env_document_root) {
/* IIS version of DOCUMENT_ROOT, not avail in cgi, but 
is in fastcgi */
env_document_root = 
sapi_cgibin_getenv(APPL_PHYSICAL_PATH,0 TSRMLS_CC);
/* ini version of document root */
-   if (!env_document_root)
+   if (!env_document_root) {
env_document_root = PG(doc_root);
-
+   }
/* set the document root, this makes a more
   consistent env for php scripts */
if (env_document_root) {
@@ -756,7 +763,9 @@
int l = 
strlen(env_document_root);
int path_translated_len = 0;
char *path_translated = NULL;
-   if 

[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2003-03-29 Thread Moriyoshi Koizumi
moriyoshi   Sat Mar 29 11:18:04 2003 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
  Log:
  Fixed too optimized part
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.223 php4/sapi/cgi/cgi_main.c:1.224
--- php4/sapi/cgi/cgi_main.c:1.223  Sat Mar 29 11:13:51 2003
+++ php4/sapi/cgi/cgi_main.cSat Mar 29 11:18:04 2003
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: cgi_main.c,v 1.223 2003/03/29 16:13:51 moriyoshi Exp $ */
+/* $Id: cgi_main.c,v 1.224 2003/03/29 16:18:04 moriyoshi Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -355,9 +355,11 @@
tmp_read_bytes = FCGX_GetStr( pos, count_bytes-read_bytes, 
request-in );
pos += tmp_read_bytes;
} else {
-#endif
tmp_read_bytes = read(0, buffer+read_bytes, 
count_bytes-read_bytes);
}
+#else
+   tmp_read_bytes = read(0, buffer+read_bytes, count_bytes-read_bytes);
+#endif
 
if (tmp_read_bytes=0) {
break;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2003-03-28 Thread Moriyoshi Koizumi
moriyoshi   Fri Mar 28 12:53:36 2003 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
  Log:
  Fixed bug #22773
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.220 php4/sapi/cgi/cgi_main.c:1.221
--- php4/sapi/cgi/cgi_main.c:1.220  Thu Mar 27 12:52:33 2003
+++ php4/sapi/cgi/cgi_main.cFri Mar 28 12:53:36 2003
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: cgi_main.c,v 1.220 2003/03/27 17:52:33 shane Exp $ */
+/* $Id: cgi_main.c,v 1.221 2003/03/28 17:53:36 moriyoshi Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -808,8 +808,8 @@
} else {
/* make sure path_info/translated are empty */
script_path_translated = 
_sapi_cgibin_putenv(SCRIPT_FILENAME,script_path_translated TSRMLS_CC);
-   _sapi_cgibin_putenv(PATH_INFO,NULL TSRMLS_CC);
-   _sapi_cgibin_putenv(PATH_TRANSLATED,NULL TSRMLS_CC);
+   _sapi_cgibin_putenv(PATH_INFO,  TSRMLS_CC);
+   _sapi_cgibin_putenv(PATH_TRANSLATED,  TSRMLS_CC);
}
SG(request_info).request_uri = 
sapi_cgibin_getenv(SCRIPT_NAME,0 TSRMLS_CC);
} else {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2003-03-28 Thread Moriyoshi Koizumi
moriyoshi   Fri Mar 28 13:24:02 2003 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
  Log:
  Do the right fix..
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.221 php4/sapi/cgi/cgi_main.c:1.222
--- php4/sapi/cgi/cgi_main.c:1.221  Fri Mar 28 12:53:36 2003
+++ php4/sapi/cgi/cgi_main.cFri Mar 28 13:24:02 2003
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: cgi_main.c,v 1.221 2003/03/28 17:53:36 moriyoshi Exp $ */
+/* $Id: cgi_main.c,v 1.222 2003/03/28 18:24:02 moriyoshi Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -389,7 +389,10 @@
char *buf = NULL;
if (!name) return NULL;
len = strlen(name) + (value?strlen(value):0) + sizeof(=) + 2;
-   buf = (char *)emalloc(len);
+   buf = (char *)malloc(len);
+   if (buf == NULL) {
+   return getenv(name);
+   }
if (value) {
snprintf(buf,len-1,%s=%s, name, value);
} else {
@@ -403,7 +406,7 @@
if (!FCGX_IsCGI()) {
FCGX_Request *request = (FCGX_Request *)SG(server_context);
FCGX_PutEnv(request,buf);
-   efree(buf);
+   free(buf);
return sapi_cgibin_getenv(name,0 TSRMLS_CC);
}
 #endif
@@ -412,11 +415,7 @@
this leaks, but it's only cgi anyway, we'll fix
it for 5.0
*/
-   if (value)
-   putenv(strdup(buf));
-   else
-   putenv(buf);
-   efree(buf);
+   putenv(buf);
return getenv(name);
 }
 
@@ -808,8 +807,8 @@
} else {
/* make sure path_info/translated are empty */
script_path_translated = 
_sapi_cgibin_putenv(SCRIPT_FILENAME,script_path_translated TSRMLS_CC);
-   _sapi_cgibin_putenv(PATH_INFO,  TSRMLS_CC);
-   _sapi_cgibin_putenv(PATH_TRANSLATED,  TSRMLS_CC);
+   _sapi_cgibin_putenv(PATH_INFO, NULL TSRMLS_CC);
+   _sapi_cgibin_putenv(PATH_TRANSLATED, NULL TSRMLS_CC);
}
SG(request_info).request_uri = 
sapi_cgibin_getenv(SCRIPT_NAME,0 TSRMLS_CC);
} else {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c /sapi/isapi php4isapi.c

2003-03-27 Thread Shane Caraveo
shane   Thu Mar 27 12:52:33 2003 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
/php4/sapi/isapiphp4isapi.c 
  Log:
  handle invalid paths passed to us from iis
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.219 php4/sapi/cgi/cgi_main.c:1.220
--- php4/sapi/cgi/cgi_main.c:1.219  Tue Mar 25 03:07:13 2003
+++ php4/sapi/cgi/cgi_main.cThu Mar 27 12:52:33 2003
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: cgi_main.c,v 1.219 2003/03/25 08:07:13 sebastian Exp $ */
+/* $Id: cgi_main.c,v 1.220 2003/03/27 17:52:33 shane Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -827,7 +827,9 @@
 #endif
SG(request_info).request_method = 
sapi_cgibin_getenv(REQUEST_METHOD,0 TSRMLS_CC);
SG(request_info).query_string = sapi_cgibin_getenv(QUERY_STRING,0 
TSRMLS_CC);
-   if (script_path_translated)
+   /* some server configurations allow '..' to slip through in the
+  translated path.   We'll just refuse to handle such a path. */
+   if (script_path_translated  !strstr(script_path_translated,..))
SG(request_info).path_translated = 
estrdup(script_path_translated);
SG(request_info).content_type = (content_type ? content_type :  );
SG(request_info).content_length = 
(content_length?atoi(content_length):0);
Index: php4/sapi/isapi/php4isapi.c
diff -u php4/sapi/isapi/php4isapi.c:1.100 php4/sapi/isapi/php4isapi.c:1.101
--- php4/sapi/isapi/php4isapi.c:1.100   Mon Mar 24 06:21:15 2003
+++ php4/sapi/isapi/php4isapi.c Thu Mar 27 12:52:33 2003
@@ -818,13 +818,21 @@
 #endif
file_handle.type = ZEND_HANDLE_FILENAME;
file_handle.opened_path = NULL;
+   /* some server configurations allow '..' to slip through in the
+  translated path.   We'll just refuse to handle such a path. 
*/
+   if (strstr(SG(request_info).path_translated,..)) {
+   SG(sapi_headers).http_response_code = 404;
+   efree(SG(request_info).path_translated);
+   SG(request_info).path_translated = NULL;
+   }
 
 
php_execute_script(file_handle TSRMLS_CC);
if (SG(request_info).cookie_data) {
efree(SG(request_info).cookie_data);
}
-   efree(SG(request_info).path_translated);
+   if (SG(request_info).path_translated)
+   efree(SG(request_info).path_translated);
 #ifdef PHP_ENABLE_SEH
} __except(exceptionhandler(e, GetExceptionInformation())) {
char buf[1024];



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2003-03-24 Thread Jani Taskinen

MFH?

--Jani



On Sun, 23 Mar 2003, Shane Caraveo wrote:

shane  Sun Mar 23 15:16:41 2003 EDT

  Modified files:  
/php4/sapi/cgi cgi_main.c 
  Log:
  For fastcgi env vars, don't magic quote them
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.216 php4/sapi/cgi/cgi_main.c:1.217
--- php4/sapi/cgi/cgi_main.c:1.216 Tue Mar 18 07:06:09 2003
+++ php4/sapi/cgi/cgi_main.c   Sun Mar 23 15:16:41 2003
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: cgi_main.c,v 1.216 2003/03/18 12:06:09 ssb Exp $ */
+/* $Id: cgi_main.c,v 1.217 2003/03/23 20:16:41 shane Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -431,6 +431,9 @@
   if (!FCGX_IsCGI()) {
   FCGX_Request *request = (FCGX_Request *)SG(server_context);
   char **env, *p, *t;
+  /* turn off magic_quotes while importing environment variables */
+  int magic_quotes_gpc = PG(magic_quotes_gpc);
+  PG(magic_quotes_gpc) = 0;
 
   for (env = request-envp; env != NULL  *env != NULL; env++) {
   p = strchr(*env, '=');
@@ -441,6 +444,7 @@
   php_register_variable(t, p+1, array_ptr TSRMLS_CC);
   efree(t);
   }
+  PG(magic_quotes_gpc) = magic_quotes_gpc;
   }
   /* call php's original import as a catch-all */
   php_php_import_environment_variables(array_ptr TSRMLS_CC);





-- 
- For Sale! -


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2003-03-24 Thread Shane Caraveo
shane   Tue Mar 25 02:43:30 2003 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
  Log:
  use the correct flush on deactivate
  add some code to make debugging iis 5 cgi easier
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.217 php4/sapi/cgi/cgi_main.c:1.218
--- php4/sapi/cgi/cgi_main.c:1.217  Sun Mar 23 15:16:41 2003
+++ php4/sapi/cgi/cgi_main.cTue Mar 25 02:43:30 2003
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: cgi_main.c,v 1.217 2003/03/23 20:16:41 shane Exp $ */
+/* $Id: cgi_main.c,v 1.218 2003/03/25 07:43:30 shane Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -472,11 +472,7 @@
 
 static int sapi_cgi_deactivate(TSRMLS_D)
 {
-   fflush(stdout);
-   if(SG(request_info).argv0) {
-   free(SG(request_info).argv0);
-   SG(request_info).argv0 = NULL;
-   }
+   sapi_cgibin_flush(SG(server_context));
return SUCCESS;
 }
 
@@ -940,6 +936,18 @@
 #endif
 #endif /* PHP_FASTCGI */
 
+#if 0  defined(PHP_DEBUG)
+   /* IIS is always making things more difficult.  This allows
+  us to stop PHP and attach a debugger before much gets started */
+   {
+   char szMessage [256];
+   wsprintf (szMessage, Please attach a debugger to the process 0x%X 
[%d] (%s) and click OK,
+ GetCurrentProcessId(),GetCurrentProcessId(), argv[0]);
+   MessageBox(NULL, szMessage, CGI Debug Time!,
+ MB_OK|MB_SERVICE_NOTIFICATION);
+   }
+#endif
+
 #ifdef HAVE_SIGNAL_H
 #if defined(SIGPIPE)  defined(SIG_IGN)
signal(SIGPIPE, SIG_IGN); /* ignore SIGPIPE in standalone mode so
@@ -1013,6 +1021,7 @@
core_globals = ts_resource(core_globals_id);
sapi_globals = ts_resource(sapi_globals_id);
tsrm_ls = ts_resource(0);
+   SG(request_info).path_translated = NULL;
 #endif
 
cgi_sapi_module.executable_location = argv[0];
@@ -1056,7 +1065,13 @@
 consult the installation file that came with this distribution, or visit \n\
 a href=\http://php.net/install.windows\;the manual page/a./p\n);
 
-#ifdef ZTS
+#if defined(ZTS)  !defined(PHP_DEBUG)
+   /* XXX we're crashing here in msvc6 debug builds at
+  php_message_handler_for_zend:839 because
+  SG(request_info).path_translated is an invalid pointer.
+  It still happens even though I set it to null, so something
+  weird is going on.
+   */
tsrm_shutdown();
 #endif
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2003-03-23 Thread Shane Caraveo
shane   Sun Mar 23 15:16:41 2003 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
  Log:
  For fastcgi env vars, don't magic quote them
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.216 php4/sapi/cgi/cgi_main.c:1.217
--- php4/sapi/cgi/cgi_main.c:1.216  Tue Mar 18 07:06:09 2003
+++ php4/sapi/cgi/cgi_main.cSun Mar 23 15:16:41 2003
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: cgi_main.c,v 1.216 2003/03/18 12:06:09 ssb Exp $ */
+/* $Id: cgi_main.c,v 1.217 2003/03/23 20:16:41 shane Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -431,6 +431,9 @@
if (!FCGX_IsCGI()) {
FCGX_Request *request = (FCGX_Request *)SG(server_context);
char **env, *p, *t;
+   /* turn off magic_quotes while importing environment variables */
+   int magic_quotes_gpc = PG(magic_quotes_gpc);
+   PG(magic_quotes_gpc) = 0;
 
for (env = request-envp; env != NULL  *env != NULL; env++) {
p = strchr(*env, '=');
@@ -441,6 +444,7 @@
php_register_variable(t, p+1, array_ptr TSRMLS_CC);
efree(t);
}
+   PG(magic_quotes_gpc) = magic_quotes_gpc;
}
/* call php's original import as a catch-all */
php_php_import_environment_variables(array_ptr TSRMLS_CC);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2003-03-07 Thread Ben Mansell
joostersFri Mar  7 09:48:28 2003 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
  Log:
  Fix bug whereby a webserver closing stdout from the CGI/FastCGI binary
  would cause PHP to get caught in an infinite loop of failing write()
  syscalls.
  
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.214 php4/sapi/cgi/cgi_main.c:1.215
--- php4/sapi/cgi/cgi_main.c:1.214  Mon Feb 17 08:29:59 2003
+++ php4/sapi/cgi/cgi_main.cFri Mar  7 09:48:28 2003
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: cgi_main.c,v 1.214 2003/02/17 13:29:59 zeev Exp $ */
+/* $Id: cgi_main.c,v 1.215 2003/03/07 14:48:28 joosters Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -254,6 +254,7 @@
ret = sapi_cgibin_single_write(ptr, remaining TSRMLS_CC);
if (!ret) {
php_handle_aborted_connection();
+   return str_length - remaining;
}
ptr += ret;
remaining -= ret;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2003-02-16 Thread Shane Caraveo
shane   Sun Feb 16 22:39:58 2003 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
  Log:
  prevent possible crash if used in combo with mod_gzip
  fix command line
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.212 php4/sapi/cgi/cgi_main.c:1.213
--- php4/sapi/cgi/cgi_main.c:1.212  Sat Feb 15 20:23:11 2003
+++ php4/sapi/cgi/cgi_main.cSun Feb 16 22:39:58 2003
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: cgi_main.c,v 1.212 2003/02/16 01:23:11 helly Exp $ */
+/* $Id: cgi_main.c,v 1.213 2003/02/17 03:39:58 shane Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -715,7 +715,7 @@
 * of it by stat'ing back through the '/'
 * this fixes url's like /info.php/test
 */
-   if (stat( script_path_translated, st ) == -1 ) {
+   if (script_path_translated  stat( script_path_translated, 
+st ) == -1 ) {
char *pt = estrdup(script_path_translated);
int len = strlen(pt);
char *ptr;
@@ -1456,7 +1456,7 @@
if we are unable to open path_translated and we are not
running from shell (so fp == NULL), then fail.
*/
-   if (retval == FAILURE || file_handle.handle.fp == NULL) {
+   if (retval == FAILURE  file_handle.handle.fp == NULL) {
SG(sapi_headers).http_response_code = 404;
PUTS(No input file specified.\n);
php_request_shutdown((void *) 0);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c getopt.c php_getopt.h /sapi/cli getopt.c php.1.in php_cli.c php_getopt.h

2003-02-15 Thread Marcus Boerger
helly   Sat Feb 15 20:23:12 2003 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c getopt.c php_getopt.h 
/php4/sapi/cli  getopt.c php.1.in php_cli.c php_getopt.h 
  Log:
  - Allow long option names
  - Update CLI's manpage
  
  @Added support for long options in CLI  CGI (e.g. --version). (Marcus)
  
  # In contrast to the preliminary patch this should work now completely.
  # If all long option names are accepted we may even think about MFHing.
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.211 php4/sapi/cgi/cgi_main.c:1.212
--- php4/sapi/cgi/cgi_main.c:1.211  Fri Feb 14 09:38:20 2003
+++ php4/sapi/cgi/cgi_main.cSat Feb 15 20:23:11 2003
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: cgi_main.c,v 1.211 2003/02/14 14:38:20 sniper Exp $ */
+/* $Id: cgi_main.c,v 1.212 2003/02/16 01:23:11 helly Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -117,8 +117,31 @@
 #define PHP_MODE_LINT  4
 #define PHP_MODE_STRIP 5
 
-extern char *ap_php_optarg;
-extern int ap_php_optind;
+static char *optarg = NULL;
+static int optind = 1;
+
+static const opt_struct OPTIONS[] = {
+   {'a', 0, interactive},
+   {'C', 0, no-chdir},
+   {'c', 1, php-ini},
+   {'d', 1, define},
+   {'e', 0, profile-info},
+   {'f', 1, file},
+   {'g', 1, global},
+   {'h', 0, help},
+   {'i', 0, info},
+   {'l', 0, syntax-check},
+   {'m', 0, modules},
+   {'n', 0, no-php-ini},
+   {'q', 0, no-header},
+   {'s', 0, syntax-highlight},
+   {'s', 0, syntax-highlighting},
+   {'w', 0, strip},
+   {'?', 0, usage},/* help alias (both '?' and 'usage') */
+   {'v', 0, version},
+   {'z', 1, zend-extension},
+   {'-', 0, NULL} /* end of args */
+};
 
 #if ENABLE_PATHINFO_CHECK
 /* true global.  this is retreived once only, even for fastcgi */
@@ -138,8 +161,6 @@
 #define TRANSLATE_SLASHES(path)
 #endif
 
-#define OPTSTRING abCc:d:ef:g:hilmnqsw?vz:
-
 static int print_module_info(zend_module_entry *module, void *arg TSRMLS_DC)
 {
php_printf(%s\n, module-name);
@@ -515,7 +536,7 @@
prog = php;
}
 
-   php_printf(Usage: %s [-q] [-h] [-s [-v] [-i] [-f file] \n
+   php_printf(Usage: %s [-q] [-h] [-s] [-v] [-i] [-f file]\n
  %s file [args...]\n
 -a   Run interactively\n
 #if PHP_FASTCGI
@@ -881,8 +902,8 @@
 /* temporary locals */
int behavior=PHP_MODE_STANDARD;
int no_headers=0;
-   int orig_optind=ap_php_optind;
-   char *orig_optarg=ap_php_optarg;
+   int orig_optind=optind;
+   char *orig_optarg=optarg;
char *script_file=NULL;
zend_llist global_vars;
int interactive=0;
@@ -958,10 +979,10 @@
/* allow ini override for fastcgi */
 #endif
) {
-   while ((c=ap_php_getopt(argc, argv, OPTSTRING))!=-1) {
+   while ((c=php_getopt(argc, argv, OPTIONS, optarg, optind, 0))!=-1) {
switch (c) {
case 'c':
-   cgi_sapi_module.php_ini_path_override = 
strdup(ap_php_optarg);
+   cgi_sapi_module.php_ini_path_override = 
+strdup(optarg);
break;
case 'n':
cgi_sapi_module.php_ini_ignore = 1;
@@ -971,14 +992,14 @@
   we are being started as an 'external' fastcgi
   server by accepting a bindpath parameter. */
case 'b':
-   if (!fastcgi) bindpath= strdup(ap_php_optarg);
+   if (!fastcgi) bindpath= strdup(optarg);
break;
 #endif
}
 
}
-   ap_php_optind = orig_optind;
-   ap_php_optarg = orig_optarg;
+   optind = orig_optind;
+   optarg = orig_optarg;
}
 
 #ifdef ZTS
@@ -1172,8 +1193,9 @@
 !fastcgi
 #endif
) {
-   while ((c=ap_php_getopt(argc, argv, OPTSTRING))!=-1) {
+   while ((c=php_getopt(argc, argv, OPTIONS, optarg, optind, 
+1))!=-1) {
switch (c) {
+   case 'h':
case '?':
no_headers = 1;
php_output_startup();
@@ -1185,8 +1207,8 @@
break;
}
}
-   ap_php_optind = orig_optind;
-   

[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2003-02-14 Thread Jani Taskinen
sniper  Fri Feb 14 09:38:20 2003 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
  Log:
  MFB
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.210 php4/sapi/cgi/cgi_main.c:1.211
--- php4/sapi/cgi/cgi_main.c:1.210  Thu Feb 13 14:46:40 2003
+++ php4/sapi/cgi/cgi_main.cFri Feb 14 09:38:20 2003
@@ -20,6 +20,7 @@
+--+
 */
 
+/* $Id: cgi_main.c,v 1.211 2003/02/14 14:38:20 sniper Exp $ */
 
 #include php.h
 #include php_globals.h



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2003-02-13 Thread Shane Caraveo
shane   Thu Feb 13 13:21:14 2003 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
  Log:
  There is *absolutely no* definitive way to know if argv0 is the 
  actual php script, or if it is the beginning of a query string.  
  Additionaly, passing parameters on the command line is 
  not part of CGI spec, and is not required by either 
  Apache or IIS.  So I have removed that code altogether, 
  and done some further cleanup.  Also fix pre4.3 behaviour if fix_pathinfo=0.
  I've tested with IIS and Apache 1.3.27 on w2k and RH 7.3. 
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.208 php4/sapi/cgi/cgi_main.c:1.209
--- php4/sapi/cgi/cgi_main.c:1.208  Sat Jan 25 17:01:53 2003
+++ php4/sapi/cgi/cgi_main.cThu Feb 13 13:21:12 2003
@@ -611,11 +611,13 @@
char *env_path_translated = sapi_cgibin_getenv(PATH_TRANSLATED,0 TSRMLS_CC);
char *script_path_translated = env_script_filename;
 
+#if !DISCARD_PATH
/* some broken servers do not have script_filename or argv0
   an example, IIS configured in some ways.  then they do more
   broken stuff and set path_translated to the cgi script location */
if (!script_path_translated  env_path_translated)
script_path_translated = env_path_translated; 
+#endif
 
/* initialize the defaults */
SG(request_info).path_translated = NULL;
@@ -634,10 +636,10 @@
const char *auth;
char *content_length = sapi_cgibin_getenv(CONTENT_LENGTH,0 
TSRMLS_CC);
char *content_type = sapi_cgibin_getenv(CONTENT_TYPE,0 TSRMLS_CC);
-#if ENABLE_PATHINFO_CHECK
-   struct stat st;
char *env_path_info = sapi_cgibin_getenv(PATH_INFO,0 TSRMLS_CC);
char *env_script_name = sapi_cgibin_getenv(SCRIPT_NAME,0 TSRMLS_CC);
+#if ENABLE_PATHINFO_CHECK
+   struct stat st;
char *env_redirect_url = sapi_cgibin_getenv(REDIRECT_URL,0 
TSRMLS_CC);
char *env_document_root = sapi_cgibin_getenv(DOCUMENT_ROOT,0 
TSRMLS_CC);
 
@@ -784,12 +786,22 @@
_sapi_cgibin_putenv(PATH_INFO,NULL TSRMLS_CC);
_sapi_cgibin_putenv(PATH_TRANSLATED,NULL TSRMLS_CC);
}
+   SG(request_info).request_uri = 
+sapi_cgibin_getenv(SCRIPT_NAME,0 TSRMLS_CC);
+   } else {
+#endif
+   /* pre 4.3 behaviour, shouldn't be used but provides BC */
+   if (env_path_info)
+   SG(request_info).request_uri = env_path_info;
+   else
+   SG(request_info).request_uri = env_script_name;
+#if !DISCARD_PATH
+   script_path_translated = env_path_translated;
+#endif
+#if ENABLE_PATHINFO_CHECK
}
 #endif
-
SG(request_info).request_method = 
sapi_cgibin_getenv(REQUEST_METHOD,0 TSRMLS_CC);
SG(request_info).query_string = sapi_cgibin_getenv(QUERY_STRING,0 
TSRMLS_CC);
-   SG(request_info).request_uri = sapi_cgibin_getenv(SCRIPT_NAME,0 
TSRMLS_CC);
if (script_path_translated)
SG(request_info).path_translated = 
estrdup(script_path_translated);
SG(request_info).content_type = (content_type ? content_type :  );
@@ -870,7 +882,6 @@
int no_headers=0;
int orig_optind=ap_php_optind;
char *orig_optarg=ap_php_optarg;
-   char *argv0=NULL;
char *script_file=NULL;
zend_llist global_vars;
int interactive=0;
@@ -936,11 +947,6 @@
|| getenv(GATEWAY_INTERFACE)
|| getenv(REQUEST_METHOD)) {
cgi = 1;
-   if (argc  1) {
-   argv0 = strdup(argv[1]);
-   } else {
-   argv0 = NULL;
-   }
}
 #if PHP_FASTCGI
}
@@ -1209,8 +1215,6 @@
 
init_request_info(TSRMLS_C);
 
-   SG(request_info).argv0 = argv0;
-
zend_llist_init(global_vars, sizeof(char *), NULL, 0);
 
CG(interactive) = 0;
@@ -1388,21 +1392,27 @@
/* file is on command line, but not in -f opt */
SG(request_info).path_translated = 
estrdup(argv[ap_php_optind]);
}
-   }
+   } /* end !cgi  !fastcgi */
 
+   /* 
+   we never take stdin if we're (f)cgi, always
+   rely on the web server giving us the info
+   we need in the environment. 
+   */
+   if (cgi 
 #if PHP_FASTCGI
-   if (fastcgi) {
+   || fastcgi) 
+#endif
+   {
file_handle.type = ZEND_HANDLE_FILENAME;

[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2003-02-13 Thread Marcus Boerger
helly   Thu Feb 13 14:46:41 2003 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
  Log:
  fix non FCGI build
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.209 php4/sapi/cgi/cgi_main.c:1.210
--- php4/sapi/cgi/cgi_main.c:1.209  Thu Feb 13 13:21:12 2003
+++ php4/sapi/cgi/cgi_main.cThu Feb 13 14:46:40 2003
@@ -1401,8 +1401,9 @@
*/
if (cgi 
 #if PHP_FASTCGI
-   || fastcgi) 
+   || fastcgi
 #endif
+   )
{
file_handle.type = ZEND_HANDLE_FILENAME;
file_handle.filename = SG(request_info).path_translated;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2003-02-13 Thread Shane Caraveo
MFH?

Marcus Boerger wrote:

helly		Thu Feb 13 14:46:41 2003 EDT

  Modified files:  
/php4/sapi/cgi	cgi_main.c 
  Log:
  fix non FCGI build
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.209 php4/sapi/cgi/cgi_main.c:1.210
--- php4/sapi/cgi/cgi_main.c:1.209	Thu Feb 13 13:21:12 2003
+++ php4/sapi/cgi/cgi_main.c	Thu Feb 13 14:46:40 2003
@@ -1401,8 +1401,9 @@
 		*/
 		if (cgi 
 #if PHP_FASTCGI
-			|| fastcgi) 
+			|| fastcgi
 #endif
+		)
 		{
 			file_handle.type = ZEND_HANDLE_FILENAME;
 			file_handle.filename = SG(request_info).path_translated;






--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2003-02-13 Thread Marcus Börger
At 21:28 13.02.2003, Shane Caraveo wrote:

MFH?

Marcus Boerger wrote:

helly   Thu Feb 13 14:46:41 2003 EDT
  Modified files:
/php4/sapi/cgi  cgi_main.c   Log:
  fix non FCGI build




Sure - but i am trying to get my system fixed and reconfigured due to that 
bloody
libtool problem ... AAARGSS


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2003-01-25 Thread Shane Caraveo
shane   Sat Jan 25 17:01:54 2003 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
  Log:
  fix bug 21261
  putenv on some platforms requires we provide the memory
  cleanup env parsing logic
  fix bug 21367
  missed optargs in a previous patch
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.207 php4/sapi/cgi/cgi_main.c:1.208
--- php4/sapi/cgi/cgi_main.c:1.207  Tue Jan  7 19:41:53 2003
+++ php4/sapi/cgi/cgi_main.cSat Jan 25 17:01:53 2003
@@ -137,7 +137,7 @@
 #define TRANSLATE_SLASHES(path)
 #endif
 
-#define OPTSTRING aCc:d:ef:g:hilmnqsw?vz:
+#define OPTSTRING abCc:d:ef:g:hilmnqsw?vz:
 
 static int print_module_info(zend_module_entry *module, void *arg TSRMLS_DC)
 {
@@ -360,11 +360,11 @@
return getenv(name);
 }
 
-static int _sapi_cgibin_putenv(char *name, char *value TSRMLS_DC)
+static char *_sapi_cgibin_putenv(char *name, char *value TSRMLS_DC)
 {
int len=0;
char *buf = NULL;
-   if (!name) return -1;
+   if (!name) return NULL;
len = strlen(name) + (value?strlen(value):0) + sizeof(=) + 2;
buf = (char *)emalloc(len);
if (value) {
@@ -372,7 +372,6 @@
} else {
snprintf(buf,len-1,%s=, name);
}
-
 #if PHP_FASTCGI
/* when php is started by mod_fastcgi, no regular environment
   is provided to PHP.  It is always sent to PHP at the start
@@ -382,14 +381,20 @@
FCGX_Request *request = (FCGX_Request *)SG(server_context);
FCGX_PutEnv(request,buf);
efree(buf);
-   return 0;
+   return sapi_cgibin_getenv(name,0 TSRMLS_CC);
}
 #endif
/*  if cgi, or fastcgi and not found in fcgi env
-   check the regular environment */
-   putenv(buf);
+   check the regular environment 
+   this leaks, but it's only cgi anyway, we'll fix
+   it for 5.0
+   */
+   if (value)
+   putenv(strdup(buf));
+   else
+   putenv(buf);
efree(buf);
-   return 0;
+   return getenv(name);
 }
 
 static char *sapi_cgi_read_cookies(TSRMLS_D)
@@ -535,94 +540,159 @@
 /* }}} */
 
 /* {{{ init_request_info
+
+  initializes request_info structure
+
+  specificly in this section we handle proper translations
+  for:
+
+  PATH_INFO
+   derived from the portion of the URI path following 
+   the script name but preceding any query data
+   may be empty
+
+  PATH_TRANSLATED
+derived by taking any path-info component of the 
+   request URI and performing any virtual-to-physical 
+   translation appropriate to map it onto the server's 
+   document repository structure
+
+   empty if PATH_INFO is empty
+
+   The env var PATH_TRANSLATED **IS DIFFERENT** than the
+   request_info.path_translated variable, the latter should
+   match SCRIPT_FILENAME instead.
+
+  SCRIPT_NAME
+set to a URL path that could identify the CGI script
+   rather than the interpreter.  PHP_SELF is set to this.
+
+  REQUEST_URI
+uri section following the domain:port part of a URI
+
+  SCRIPT_FILENAME
+The virtual-to-physical translation of SCRIPT_NAME (as per 
+   PATH_TRANSLATED)
+
+  These settings are documented at
+  http://cgi-spec.golux.com/
+
+
+  Based on the following URL request:
+  
+  http://localhost/info.php/test?a=b 
+ 
+  should produce, which btw is the same as if
+  we were running under mod_cgi on apache (ie. not
+  using ScriptAlias directives):
+ 
+  PATH_INFO=/test
+  PATH_TRANSLATED=/docroot/test
+  SCRIPT_NAME=/info.php
+  REQUEST_URI=/info.php/test?a=b
+  SCRIPT_FILENAME=/docroot/info.php
+  QUERY_STRING=a=b
+ 
+  but what we get is (cgi/mod_fastcgi under apache):
+  
+  PATH_INFO=/info.php/test
+  PATH_TRANSLATED=/docroot/info.php/test
+  SCRIPT_NAME=/php/php-cgi  (from the Action setting I suppose)
+  REQUEST_URI=/info.php/test?a=b
+  SCRIPT_FILENAME=/path/to/php/bin/php-cgi  (Action setting translated)
+  QUERY_STRING=a=b
+ 
+  Comments in the code below refer to using the above URL in a request
+
  */
 static void init_request_info(TSRMLS_D)
 {
-   char *content_length = sapi_cgibin_getenv(CONTENT_LENGTH,0 TSRMLS_CC);
-   char *content_type = sapi_cgibin_getenv(CONTENT_TYPE,0 TSRMLS_CC);
-   const char *auth;
-   char *env_path_translated;
+   char *env_script_filename = sapi_cgibin_getenv(SCRIPT_FILENAME,0 TSRMLS_CC);
+   char *env_path_translated = sapi_cgibin_getenv(PATH_TRANSLATED,0 TSRMLS_CC);
+   char *script_path_translated = env_script_filename;
+
+   /* some broken servers do not have script_filename or argv0
+  an example, IIS configured in some ways.  then they do more
+  broken stuff and set path_translated to the cgi script location */
+   if (!script_path_translated  env_path_translated)
+   script_path_translated = env_path_translated; 
 
+   /* 

Re: [PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2003-01-25 Thread Andi Gutmans
Please try not to mix whitespace and functionality patches. I'm having a 
hard time looking at two of your patches because too much has changed and 
most of it is whitespace.

Thanks,
Andi

At 10:01 PM 1/25/2003 +, Shane Caraveo wrote:
shane   Sat Jan 25 17:01:54 2003 EDT

  Modified files:
/php4/sapi/cgi  cgi_main.c
  Log:
  fix bug 21261
  putenv on some platforms requires we provide the memory
  cleanup env parsing logic
  fix bug 21367
  missed optargs in a previous patch


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2003-01-25 Thread Shane Caraveo
neither of my patches contain whitespace change, it's logic change, 
which required a couple parts to be indented further.
Shane

Andi Gutmans wrote:
Please try not to mix whitespace and functionality patches. I'm having a 
hard time looking at two of your patches because too much has changed 
and most of it is whitespace.

Thanks,
Andi

At 10:01 PM 1/25/2003 +, Shane Caraveo wrote:

shane   Sat Jan 25 17:01:54 2003 EDT

  Modified files:
/php4/sapi/cgi  cgi_main.c
  Log:
  fix bug 21261
  putenv on some platforms requires we provide the memory
  cleanup env parsing logic
  fix bug 21367
  missed optargs in a previous patch


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php








--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c /sapi/cli php_cli.c

2003-01-07 Thread Ilia Alshanetsky
iliaa   Tue Jan  7 19:41:53 2003 EDT

  Modified files:  
/php4/sapi/cli  php_cli.c 
/php4/sapi/cgi  cgi_main.c 
  Log:
  Fixed bug #21297. The fix also fixes miscalculation of lines numbers by 1
  due the previously mentioned bug.
  
  
Index: php4/sapi/cli/php_cli.c
diff -u php4/sapi/cli/php_cli.c:1.60 php4/sapi/cli/php_cli.c:1.61
--- php4/sapi/cli/php_cli.c:1.60Sun Jan  5 11:10:35 2003
+++ php4/sapi/cli/php_cli.c Tue Jan  7 19:41:53 2003
@@ -695,6 +695,13 @@
while (c != 10  c != 13) {
c = fgetc(file_handle.handle.fp);   /* 
skip to end of line */
}
+   /* handle situations where line is terminated by \r\n 
+*/
+   if (c == 13) {
+   if (fgetc(file_handle.handle.fp) != 10) {
+   long pos = 
+ftell(file_handle.handle.fp);
+   fseek(file_handle.handle.fp, pos - 1, 
+SEEK_SET);
+   }
+   }
CG(start_lineno) = 2;
} else {
rewind(file_handle.handle.fp);
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.206 php4/sapi/cgi/cgi_main.c:1.207
--- php4/sapi/cgi/cgi_main.c:1.206  Tue Jan  7 11:33:28 2003
+++ php4/sapi/cgi/cgi_main.cTue Jan  7 19:41:53 2003
@@ -1413,6 +1413,13 @@
while (c != 10  c != 13) {
c = fgetc(file_handle.handle.fp);   /* 
skip to end of line */
}
+   /* handle situations where line is terminated by \r\n 
+*/
+   if (c == 13) {
+   if (fgetc(file_handle.handle.fp) != 10) {
+   long pos = 
+ftell(file_handle.handle.fp);
+   fseek(file_handle.handle.fp, pos - 1, 
+SEEK_SET);
+   }
+   }
CG(start_lineno) = 2;
} else {
rewind(file_handle.handle.fp);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2002-12-25 Thread Derick Rethans
On Wed, 25 Dec 2002, George Schlossnagle wrote:

 gschlossnagle Wed Dec 25 15:38:37 2002 EDT
 
   Modified files:  
 /php4/sapi/cgicgi_main.c 
   Log:
   fix for 21177

Please fix the whitespace...

Derick
 @@ -1379,6 +1382,10 @@
  php_module_shutdown(TSRMLS_C);
  return FAILURE;
  }
 + if (no_headers) {
 + SG(headers_sent) = 1;
 + SG(request_info).no_headers = 1;
 + }
  
  /* This actually destructs the elements of the list - ugly hack */
  zend_llist_apply(global_vars, (llist_apply_func_t) 
php_register_command_line_global_vars TSRMLS_CC);
 

-- 

-
 Derick Rethans http://derickrethans.nl/ 
 PHP Magazine - PHP Magazine for Professionals   http://php-mag.net/
-


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2002-12-24 Thread Stefan Esser
sesser  Tue Dec 24 18:46:18 2002 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
  Log:
  fix compile warning
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.200 php4/sapi/cgi/cgi_main.c:1.201
--- php4/sapi/cgi/cgi_main.c:1.200  Sun Dec  1 21:16:38 2002
+++ php4/sapi/cgi/cgi_main.cTue Dec 24 18:46:17 2002
@@ -121,7 +121,7 @@
 
 #if ENABLE_PATHINFO_CHECK
 /* true global.  this is retreived once only, even for fastcgi */
-int fix_pathinfo=1;
+long fix_pathinfo=1;
 #endif
 
 #ifdef PHP_WIN32



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2002-12-01 Thread Shane Caraveo
shane   Sun Dec  1 21:16:38 2002 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
  Log:
  fix use of Alias under apache by defaulting script_name to redirect_url
  dont lstat, stat.
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.199 php4/sapi/cgi/cgi_main.c:1.200
--- php4/sapi/cgi/cgi_main.c:1.199  Sun Dec  1 16:37:13 2002
+++ php4/sapi/cgi/cgi_main.cSun Dec  1 21:16:38 2002
@@ -369,6 +369,7 @@
} else {
snprintf(buf,len-1,%s=, name);
}
+
 #if PHP_FASTCGI
/* when php is started by mod_fastcgi, no regular environment
   is provided to PHP.  It is always sent to PHP at the start
@@ -597,8 +598,10 @@
struct stat st;
char *env_script_name = sapi_cgibin_getenv(SCRIPT_NAME,0 
TSRMLS_CC);
char *env_path_info = sapi_cgibin_getenv(PATH_INFO,0 
TSRMLS_CC);
+   char *env_redirect_url = sapi_cgibin_getenv(REDIRECT_URL,0 
+TSRMLS_CC);
if (env_path_info) env_path_info = estrdup(env_path_info);
-   if (sapi_cgibin_getenv(REDIRECT_URL,0 TSRMLS_CC) ||
+
+   if (env_redirect_url ||
(env_script_name  env_path_info 
strcmp(env_path_info,env_script_name)==0)) {
/*
@@ -611,6 +614,8 @@
 */

_sapi_cgibin_putenv(SCRIPT_FILENAME,env_path_translated TSRMLS_CC);
_sapi_cgibin_putenv(PATH_INFO,NULL TSRMLS_CC);
+   if (env_redirect_url)
+   
+_sapi_cgibin_putenv(SCRIPT_NAME,env_redirect_url TSRMLS_CC);
}
 
if (stat( env_path_translated, st ) == -1 ) {
@@ -620,7 +625,7 @@
 
while( (ptr = strrchr(pt,'/')) || (ptr = 
strrchr(pt,'\\')) ) {
*ptr = 0;
-   if ( lstat(pt, st) == 0  
S_ISREG(st.st_mode) ) {
+   if ( stat(pt, st) == 0  S_ISREG(st.st_mode) 
+) {
/*
 * okay, we found the base script!
 * work out how many chars we had to 
strip off;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2002-11-22 Thread Edin Kadribasic
edink   Fri Nov 22 08:55:27 2002 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
  Log:
  MFB: Don't send default http status (200).
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.194 php4/sapi/cgi/cgi_main.c:1.195
--- php4/sapi/cgi/cgi_main.c:1.194  Fri Nov 22 05:15:47 2002
+++ php4/sapi/cgi/cgi_main.cFri Nov 22 08:55:27 2002
@@ -238,7 +238,6 @@
 static int sapi_cgi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
 {
char buf[1024];
-   int len;
sapi_header_struct *h;
zend_llist_position pos;
long rfc2616_headers = 0;
@@ -252,13 +251,17 @@
rfc2616_headers = 0;
}
 
-   if (rfc2616_headers  SG(sapi_headers).http_status_line) {
-   len = sprintf(buf, %s\r\n, SG(sapi_headers).http_status_line);
-   } else {
-   len = sprintf(buf, Status: %d\r\n, 
SG(sapi_headers).http_response_code);
-   }
+   if (SG(sapi_headers).http_response_code != 200) {
+   int len;
+   
+   if (rfc2616_headers) {
+   len = sprintf(buf, %s\r\n, 
+SG(sapi_headers).http_status_line);
+   } else {
+   len = sprintf(buf, Status: %d\r\n, 
+SG(sapi_headers).http_response_code);
+   }
 
-   PHPWRITE_H(buf, len);
+   PHPWRITE_H(buf, len);
+   }
 
if (SG(sapi_headers).send_default_content_type) {
char *hd;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2002-11-15 Thread Andi Gutmans
Why is this needed?
Looks pretty ugly to me to check specifically for run-tests.php.

Andi

At 04:37 PM 11/12/2002 +, Hartmut Holzgraefe wrote:

hholzgraTue Nov 12 11:37:47 2002 EDT

  Modified files:
/php4/sapi/cgi  cgi_main.c
  Log:



Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.187 php4/sapi/cgi/cgi_main.c:1.188
--- php4/sapi/cgi/cgi_main.c:1.187  Tue Nov  5 17:04:10 2002
+++ php4/sapi/cgi/cgi_main.cTue Nov 12 11:37:47 2002
 -522,7 +522,7 
 int main(int argc, char *argv[])
 {
int exit_status = SUCCESS;
-   int cgi = 0, c, i, len;
+   int cgi = 0, c, i, len, testmode = 0;
zend_file_handle file_handle;
int retval = FAILURE;
char *s;
 -573,6 +573,10 
 #endif
 #endif

+#ifndef PHP_FASTCGI
+   s = getenv(USER_AGENT);
+   if(s  !strcmp(s, run-tests.php)) testmode = 1;
+#endif

 #ifdef ZTS
tsrm_startup(1, 1, 0, NULL);
 -875,11 +879,11 

zend_llist_init(global_vars, sizeof(char *), NULL, 0);

-   if (!cgi
+   if ( testmode || (!cgi
 #ifdef PHP_FASTCGI
 !fastcgi
 #endif
-   ) { /* never 
execute the arguments if you are a CGI */
+   )) { /* never execute the arguments if you are a 
CGI unless in testmode*/
if (SG(request_info).argv0) {
free(SG(request_info).argv0);
SG(request_info).argv0 = NULL;



--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2002-11-15 Thread Andi Gutmans
Forget my previous Email :)

Andi

At 04:41 PM 11/12/2002 +, Hartmut Holzgraefe wrote:

hholzgraTue Nov 12 11:41:15 2002 EDT

  Modified files:
/php4/sapi/cgi  cgi_main.c
  Log:
  reverting accidential commit


Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.188 php4/sapi/cgi/cgi_main.c:1.189
--- php4/sapi/cgi/cgi_main.c:1.188  Tue Nov 12 11:37:47 2002
+++ php4/sapi/cgi/cgi_main.cTue Nov 12 11:41:14 2002
 -522,7 +522,7 
 int main(int argc, char *argv[])
 {
int exit_status = SUCCESS;
-   int cgi = 0, c, i, len, testmode = 0;
+   int cgi = 0, c, i, len;
zend_file_handle file_handle;
int retval = FAILURE;
char *s;
 -573,10 +573,6 
 #endif
 #endif

-#ifndef PHP_FASTCGI
-   s = getenv(USER_AGENT);
-   if(s  !strcmp(s, run-tests.php)) testmode = 1;
-#endif

 #ifdef ZTS
tsrm_startup(1, 1, 0, NULL);
 -879,11 +875,11 

zend_llist_init(global_vars, sizeof(char *), NULL, 0);

-   if ( testmode || (!cgi
+   if (!cgi
 #ifdef PHP_FASTCGI
 !fastcgi
 #endif
-   )) { /* never execute the arguments if you are a 
CGI unless in testmode*/
+   ) { /* never execute the arguments if you are a 
CGI */
if (SG(request_info).argv0) {
free(SG(request_info).argv0);
SG(request_info).argv0 = NULL;



--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c /sapi/cli php_cli.c

2002-11-14 Thread Andrei Zmievski
andrei  Thu Nov 14 15:32:29 2002 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
/php4/sapi/cli  php_cli.c 
  Log:
  Sort the modules and extensions before printing them when -m switch is used.
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.190 php4/sapi/cgi/cgi_main.c:1.191
--- php4/sapi/cgi/cgi_main.c:1.190  Tue Nov 12 15:56:46 2002
+++ php4/sapi/cgi/cgi_main.cThu Nov 14 15:32:26 2002
 -117,18 +117,59 
 
 #define OPTSTRING aCc:d:ef:g:hilmnqsw?vz:
 
-static int _print_module_info(zend_module_entry *module, void *arg TSRMLS_DC)
+static int print_module_info(zend_module_entry *module, void *arg TSRMLS_DC)
 {
php_printf(%s\n, module-name);
return 0;
 }
 
-static int _print_extension_info(zend_extension *module, void *arg TSRMLS_DC)
+static int module_name_cmp(const void *a, const void *b TSRMLS_DC)
 {
-   php_printf(%s\n, module-name);
+   Bucket *f = *((Bucket **) a);
+   Bucket *s = *((Bucket **) b);
+
+   return strcmp(((zend_module_entry *)f-pData)-name,
+ ((zend_module_entry *)s-pData)-name);
+}
+
+static void print_modules(TSRMLS_D)
+{
+   HashTable sorted_registry;
+   zend_module_entry tmp;
+
+   zend_hash_init(sorted_registry, 50, NULL, NULL, 1);
+   zend_hash_copy(sorted_registry, module_registry, NULL, tmp, 
+sizeof(zend_module_entry));
+   zend_hash_sort(sorted_registry, zend_qsort, module_name_cmp, 0 TSRMLS_CC);
+   zend_hash_apply_with_argument(sorted_registry, (apply_func_arg_t) 
+print_module_info, NULL TSRMLS_CC);
+   zend_hash_destroy(sorted_registry);
+}
+
+static int print_extension_info(zend_extension *ext, void *arg TSRMLS_DC)
+{
+   php_printf(%s\n, ext-name);
return 0;
 }
 
+static int extension_name_cmp(const zend_llist_element *a,
+ const zend_llist_element *b 
+TSRMLS_DC)
+{
+   zend_llist_element *f = *((zend_llist_element **)a);
+   zend_llist_element *s = *((zend_llist_element **)b);
+
+   return strcmp(((zend_extension *)f-data)-name,
+ ((zend_extension *)s-data)-name);
+}
+
+static void print_extensions(TSRMLS_D)
+{
+   zend_llist sorted_exts;
+
+   zend_llist_copy(sorted_exts, zend_extensions);
+   zend_llist_sort(sorted_exts, extension_name_cmp TSRMLS_CC);
+   zend_llist_apply_with_argument(sorted_exts, (llist_apply_with_arg_func_t) 
+print_extension_info, NULL TSRMLS_CC);
+   zend_llist_destroy(sorted_exts);
+}
+
 #ifndef STDOUT_FILENO
 #define STDOUT_FILENO 1
 #endif
 -966,9 +1007,9 
php_output_activate(TSRMLS_C);
SG(headers_sent) = 1;
php_printf([PHP Modules]\n);
-   
zend_hash_apply_with_argument(module_registry, (apply_func_arg_t) _print_module_info, 
NULL TSRMLS_CC);
+   print_modules(TSRMLS_C);
php_printf(\n[Zend Modules]\n);
-   
zend_llist_apply_with_argument(zend_extensions, (llist_apply_with_arg_func_t) 
_print_extension_info, NULL TSRMLS_CC);
+   print_extensions(TSRMLS_C);
php_printf(\n);
php_end_ob_buffers(1 TSRMLS_CC);
exit(1);
Index: php4/sapi/cli/php_cli.c
diff -u php4/sapi/cli/php_cli.c:1.51 php4/sapi/cli/php_cli.c:1.52
--- php4/sapi/cli/php_cli.c:1.51Wed Nov 13 07:41:05 2002
+++ php4/sapi/cli/php_cli.c Thu Nov 14 15:32:28 2002
 -87,18 +87,56 
 
 #define OPTSTRING aCc:d:ef:g:hilmnqr:sw?vz:
 
-static int _print_module_info(zend_module_entry *module, void *arg TSRMLS_DC)
+static int print_module_info(zend_module_entry *module, void *arg TSRMLS_DC)
 {
php_printf(%s\n, module-name);
return 0;
 }
 
-static int _print_extension_info(zend_extension *module, void *arg TSRMLS_DC)
+static int module_name_cmp(const void *a, const void *b TSRMLS_DC)
 {
-   php_printf(%s\n, module-name);
+   Bucket *f = *((Bucket **) a);
+   Bucket *s = *((Bucket **) b);
+
+   return strcmp(((zend_module_entry *)f-pData)-name,
+ ((zend_module_entry *)s-pData)-name);
+}
+
+static void print_modules(TSRMLS_D)
+{
+   HashTable sorted_registry;
+   zend_module_entry tmp;
+
+   zend_hash_init(sorted_registry, 50, NULL, NULL, 1);
+   zend_hash_copy(sorted_registry, module_registry, NULL, tmp, 
+sizeof(zend_module_entry));
+   zend_hash_sort(sorted_registry, zend_qsort, module_name_cmp, 0 TSRMLS_CC);
+   zend_hash_apply_with_argument(sorted_registry, (apply_func_arg_t) 
+print_module_info, NULL TSRMLS_CC);
+   zend_hash_destroy(sorted_registry);
+}
+
+static int 

[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2002-11-14 Thread Andrei Zmievski
andrei  Thu Nov 14 19:31:10 2002 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
  Log:
  Fix function prototype.
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.191 php4/sapi/cgi/cgi_main.c:1.192
--- php4/sapi/cgi/cgi_main.c:1.191  Thu Nov 14 15:32:26 2002
+++ php4/sapi/cgi/cgi_main.cThu Nov 14 19:31:10 2002
 -150,12 +150,9 
return 0;
 }
 
-static int extension_name_cmp(const zend_llist_element *a,
- const zend_llist_element *b 
TSRMLS_DC)
+static int extension_name_cmp(const zend_llist_element **f,
+ const zend_llist_element **s 
+TSRMLS_DC)
 {
-   zend_llist_element *f = *((zend_llist_element **)a);
-   zend_llist_element *s = *((zend_llist_element **)b);
-
return strcmp(((zend_extension *)f-data)-name,
  ((zend_extension *)s-data)-name);
 }



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2002-11-14 Thread Andrei Zmievski
andrei  Thu Nov 14 19:32:42 2002 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
  Log:
  Oops.
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.192 php4/sapi/cgi/cgi_main.c:1.193
--- php4/sapi/cgi/cgi_main.c:1.192  Thu Nov 14 19:31:10 2002
+++ php4/sapi/cgi/cgi_main.cThu Nov 14 19:32:42 2002
 -153,8 +153,8 
 static int extension_name_cmp(const zend_llist_element **f,
  const zend_llist_element **s 
TSRMLS_DC)
 {
-   return strcmp(((zend_extension *)f-data)-name,
- ((zend_extension *)s-data)-name);
+   return strcmp(((zend_extension *)(*f)-data)-name,
+ ((zend_extension *)(*s)-data)-name);
 }
 
 static void print_extensions(TSRMLS_D)



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2002-11-12 Thread Hartmut Holzgraefe
hholzgraTue Nov 12 11:37:47 2002 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
  Log:
  
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.187 php4/sapi/cgi/cgi_main.c:1.188
--- php4/sapi/cgi/cgi_main.c:1.187  Tue Nov  5 17:04:10 2002
+++ php4/sapi/cgi/cgi_main.cTue Nov 12 11:37:47 2002
 -522,7 +522,7 
 int main(int argc, char *argv[])
 {
int exit_status = SUCCESS;
-   int cgi = 0, c, i, len;
+   int cgi = 0, c, i, len, testmode = 0;
zend_file_handle file_handle;
int retval = FAILURE;
char *s;
 -573,6 +573,10 
 #endif
 #endif
 
+#ifndef PHP_FASTCGI
+   s = getenv(USER_AGENT);
+   if(s  !strcmp(s, run-tests.php)) testmode = 1;
+#endif
 
 #ifdef ZTS
tsrm_startup(1, 1, 0, NULL);
 -875,11 +879,11 
 
zend_llist_init(global_vars, sizeof(char *), NULL, 0);
 
-   if (!cgi
+   if ( testmode || (!cgi
 #ifdef PHP_FASTCGI
 !fastcgi
 #endif
-   ) { /* never execute the 
arguments if you are a CGI */
+   )) { /* never execute the arguments if you are a CGI unless in 
+testmode*/   
if (SG(request_info).argv0) {
free(SG(request_info).argv0);
SG(request_info).argv0 = NULL;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2002-11-12 Thread Hartmut Holzgraefe
hholzgraTue Nov 12 11:41:15 2002 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
  Log:
  reverting accidential commit
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.188 php4/sapi/cgi/cgi_main.c:1.189
--- php4/sapi/cgi/cgi_main.c:1.188  Tue Nov 12 11:37:47 2002
+++ php4/sapi/cgi/cgi_main.cTue Nov 12 11:41:14 2002
 -522,7 +522,7 
 int main(int argc, char *argv[])
 {
int exit_status = SUCCESS;
-   int cgi = 0, c, i, len, testmode = 0;
+   int cgi = 0, c, i, len;
zend_file_handle file_handle;
int retval = FAILURE;
char *s;
 -573,10 +573,6 
 #endif
 #endif
 
-#ifndef PHP_FASTCGI
-   s = getenv(USER_AGENT);
-   if(s  !strcmp(s, run-tests.php)) testmode = 1;
-#endif
 
 #ifdef ZTS
tsrm_startup(1, 1, 0, NULL);
 -879,11 +875,11 
 
zend_llist_init(global_vars, sizeof(char *), NULL, 0);
 
-   if ( testmode || (!cgi
+   if (!cgi
 #ifdef PHP_FASTCGI
 !fastcgi
 #endif
-   )) { /* never execute the arguments if you are a CGI unless in 
testmode*/   
+   ) { /* never execute the arguments if you are a CGI */  
if (SG(request_info).argv0) {
free(SG(request_info).argv0);
SG(request_info).argv0 = NULL;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c /sapi/cli php_cli.c /sapi/fastcgi fastcgi.c

2002-11-05 Thread Ilia Alshanetsky
iliaa   Tue Nov  5 17:04:14 2002 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
/php4/sapi/cli  php_cli.c 
/php4/sapi/fastcgi  fastcgi.c 
  Log:
  Fixed bug #20035. ZE now allows us to pass the current line position by 
  setting zend_lineno to (current_line * -1).
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.186 php4/sapi/cgi/cgi_main.c:1.187
--- php4/sapi/cgi/cgi_main.c:1.186  Fri Oct 25 10:33:46 2002
+++ php4/sapi/cgi/cgi_main.cTue Nov  5 17:04:10 2002
 -1119,7 +1119,7 
while (c != 10  c != 13) {
c = fgetc(file_handle.handle.fp);   /* 
skip to end of line */
}
-   CG(zend_lineno)++;
+   CG(zend_lineno) = -2;
} else {
rewind(file_handle.handle.fp);
}
Index: php4/sapi/cli/php_cli.c
diff -u php4/sapi/cli/php_cli.c:1.48 php4/sapi/cli/php_cli.c:1.49
--- php4/sapi/cli/php_cli.c:1.48Tue Nov  5 10:15:51 2002
+++ php4/sapi/cli/php_cli.c Tue Nov  5 17:04:12 2002
 -652,7 +652,7 
while (c != 10  c != 13) {
c = fgetc(file_handle.handle.fp);   /* 
skip to end of line */
}
-   CG(zend_lineno)++;
+   CG(zend_lineno) = -2;
} else {
rewind(file_handle.handle.fp);
}
Index: php4/sapi/fastcgi/fastcgi.c
diff -u php4/sapi/fastcgi/fastcgi.c:1.26 php4/sapi/fastcgi/fastcgi.c:1.27
--- php4/sapi/fastcgi/fastcgi.c:1.26Wed Sep 18 17:57:33 2002
+++ php4/sapi/fastcgi/fastcgi.c Tue Nov  5 17:04:12 2002
 -237,7 +237,7 
while (c != 10  c != 13) {
c = fgetc(file_handle.handle.fp);   /* skip to end 
of line */
}
-   CG(zend_lineno)++;
+   CG(zend_lineno) = -2;
} else {
rewind(file_handle.handle.fp);
}



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2002-10-25 Thread Jan Lehnardt
jan Fri Oct 25 05:28:57 2002 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
  Log:
   - alphabetcial output for php -h (cgi) 
   - cosmetics
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.184 php4/sapi/cgi/cgi_main.c:1.185
--- php4/sapi/cgi/cgi_main.c:1.184  Thu Oct 24 09:14:48 2002
+++ php4/sapi/cgi/cgi_main.cFri Oct 25 05:28:55 2002
 -398,25 +398,27 
prog = php;
}
 
-   php_printf(Usage: %s [-q] [-h] [-s [-v] [-i] [-f file] |  {file 
[args...]}\n
--q   Quiet-mode.  Suppress HTTP Header 
output.\n
--s   Display colour syntax highlighted 
source.\n
--w   Display source with stripped comments 
and whitespace.\n
--f fileParse file.  Implies `-q'\n
--v   Version number\n
--C   Do not chdir to the script's 
directory\n
--c path|file Look for php.ini file in this 
directory\n
+   php_printf(Usage: %s [-q] [-h] [-s [-v] [-i] [-f file] \n
+ %s file [args...]\n
+-a   Run interactively\n
 #ifdef PHP_FASTCGI
 -b address:port|port Bind Path for external FASTCGI 
Server mode\n
 #endif
--a   Run interactively\n
+-C   Do not chdir to the script's 
+directory\n
+-c path|file Look for php.ini file in this 
+directory\n
 -d foo[=bar] Define INI entry foo with value 'bar'\n
 -e   Generate extended information for 
debugger/profiler\n
--z fileLoad Zend extension file.\n
+-f fileParse file.  Implies `-q'\n
+-h   This help\n,
+-i   PHP information\n
 -l   Syntax check only (lint)\n
 -m   Show compiled in modules\n
--i   PHP information\n
--h   This help\n, prog);
+-q   Quiet-mode.  Suppress HTTP Header 
+output.\n
+-s   Display colour syntax highlighted 
+source.\n
+-v   Version number\n
+-w   Display source with stripped comments 
+and whitespace.\n
+-z fileLoad Zend extension file.\n
+  prog, prog);
 }
 /* }}} */
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2002-10-25 Thread Derick Rethans
derick  Fri Oct 25 10:33:48 2002 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
  Log:
  - Fix build
  #- Jan, please TEST! before committing :-)
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.185 php4/sapi/cgi/cgi_main.c:1.186
--- php4/sapi/cgi/cgi_main.c:1.185  Fri Oct 25 05:28:55 2002
+++ php4/sapi/cgi/cgi_main.cFri Oct 25 10:33:46 2002
 -409,7 +409,7 
 -d foo[=bar] Define INI entry foo with value 'bar'\n
 -e   Generate extended information for 
debugger/profiler\n
 -f fileParse file.  Implies `-q'\n
--h   This help\n,
+-h   This help\n
 -i   PHP information\n
 -l   Syntax check only (lint)\n
 -m   Show compiled in modules\n
 -417,7 +417,7 
 -s   Display colour syntax highlighted 
source.\n
 -v   Version number\n
 -w   Display source with stripped comments 
and whitespace.\n
--z fileLoad Zend extension file.\n
+-z fileLoad Zend extension file.\n,
   prog, prog);
 }
 /* }}} */



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php