[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c
janiThu Jun 4 11:53:38 2009 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c Log: MFH:- Fixed bug #48419 (non-portable STDIN fileno in cgi_main.c) # This doesn't really fix it since it's some weird Windows thing but this # does make this code slightly more portable :) http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.69r2=1.267.2.15.2.70diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.69 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.70 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.69 Mon Jan 19 18:17:59 2009 +++ php-src/sapi/cgi/cgi_main.c Thu Jun 4 11:53:38 2009 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.69 2009/01/19 18:17:59 dsp Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.70 2009/06/04 11:53:38 jani Exp $ */ #include php.h #include php_globals.h @@ -461,6 +461,9 @@ return SAPI_HEADER_SENT_SUCCESSFULLY; } +#ifndef STDIN_FILENO +# define STDIN_FILENO 0 +#endif static int sapi_cgi_read_post(char *buffer, uint count_bytes TSRMLS_DC) { @@ -473,10 +476,10 @@ fcgi_request *request = (fcgi_request*) SG(server_context); tmp_read_bytes = fcgi_read(request, buffer + read_bytes, count_bytes - read_bytes); } else { - tmp_read_bytes = read(0, buffer + read_bytes, count_bytes - read_bytes); + tmp_read_bytes = read(STDIN_FILENO, buffer + read_bytes, count_bytes - read_bytes); } #else - tmp_read_bytes = read(0, buffer + read_bytes, count_bytes - read_bytes); + tmp_read_bytes = read(STDIN_FILENO, buffer + read_bytes, count_bytes - read_bytes); #endif if (tmp_read_bytes = 0) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c
dsp Mon Jan 19 18:18:00 2009 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c Log: MFH: Fix #47149. Remove check for script_filename = path_translated, as this the actual value that we get from apache. http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.68r2=1.267.2.15.2.69diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.68 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.69 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.68 Fri Jan 9 22:14:20 2009 +++ php-src/sapi/cgi/cgi_main.c Mon Jan 19 18:17:59 2009 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.68 2009/01/09 22:14:20 dsp Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.69 2009/01/19 18:17:59 dsp Exp $ */ #include php.h #include php_globals.h @@ -961,8 +961,7 @@ } if (env_path_translated != NULL env_redirect_url != NULL - orig_script_filename != NULL script_path_translated != NULL - strcmp(orig_script_filename, script_path_translated) != 0) { + orig_script_filename != NULL script_path_translated != NULL) { /* pretty much apache specific. If we have a redirect_url then our script_filename and script_name point to the -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c
rasmus Sat Nov 8 22:45:29 2008 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c Log: Potential fix for bug #46525 http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.64r2=1.267.2.15.2.65diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.64 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.65 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.64 Mon Nov 3 23:26:23 2008 +++ php-src/sapi/cgi/cgi_main.c Sat Nov 8 22:45:29 2008 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.64 2008/11/03 23:26:23 lbarnaud Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.65 2008/11/08 22:45:29 rasmus Exp $ */ #include php.h #include php_globals.h @@ -447,6 +447,7 @@ } } else if (response_status == 304 h-header_len sizeof(Content-Type:)-1 strncasecmp(h-header, Content-Type:, sizeof(Content-Type:)-1) == 0) { + h = (sapi_header_struct*)zend_llist_get_next_ex(sapi_headers-headers, pos); continue; } else { PHPWRITE_H(h-header, h-header_len); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c
dmitry Fri Aug 15 07:30:31 2008 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c Log: Fixed double call to MSHUTDOWN in case of `php-cgi -m` http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.59r2=1.267.2.15.2.60diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.59 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.60 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.59 Wed Aug 13 01:01:29 2008 +++ php-src/sapi/cgi/cgi_main.c Fri Aug 15 07:30:31 2008 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.59 2008/08/13 01:01:29 jani Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.60 2008/08/15 07:30:31 dmitry Exp $ */ #include php.h #include php_globals.h @@ -238,6 +238,7 @@ zend_llist sorted_exts; zend_llist_copy(sorted_exts, zend_extensions); + sorted_exts.dtor = NULL; 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); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c
dmitry Wed Oct 31 18:24:42 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c Log: Added CGI SAPI -T option, to measure execution time of script repeated several times. http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.50r2=1.267.2.15.2.51diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.50 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.51 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.50 Mon Sep 24 11:40:05 2007 +++ php-src/sapi/cgi/cgi_main.c Wed Oct 31 18:24:42 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.50 2007/09/24 11:40:05 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.51 2007/10/31 18:24:42 dmitry Exp $ */ #include php.h #include php_globals.h @@ -141,6 +141,9 @@ {'?', 0, usage},/* help alias (both '?' and 'usage') */ {'v', 0, version}, {'z', 1, zend-extension}, +#if PHP_FASTCGI + {'T', 1, timing}, +#endif {'-', 0, NULL} /* end of args */ }; @@ -682,7 +685,11 @@ -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 +#if PHP_FASTCGI +-T count Measure execution time of script repeated count times.\n +#endif + , prog, prog); } /* }}} */ @@ -1199,6 +1206,13 @@ char *bindpath = NULL; int fcgi_fd = 0; fcgi_request request; + int repeats = 1; + int benchmark = 0; +#if HAVE_GETTIMEOFDAY + struct timeval start, end; +#else + time_t start, end; +#endif #ifndef PHP_WIN32 int status = 0; #endif @@ -1488,6 +1502,17 @@ zend_first_try { while ((c = php_getopt(argc, argv, OPTIONS, php_optarg, php_optind, 1)) != -1) { switch (c) { +#if PHP_FASTCGI + case 'T': + benchmark = 1; + repeats = atoi(php_optarg); +#ifdef HAVE_GETTIMEOFDAY + gettimeofday(start, NULL); +#else + time(start); +#endif + break; +#endif case 'h': case '?': #if PHP_FASTCGI @@ -1890,7 +1915,19 @@ } #if PHP_FASTCGI - if (!fastcgi) break; + if (!fastcgi) { + if (benchmark) { + repeats--; + if (repeats 0) { + script_file = NULL; + php_optind = orig_optind; + php_optarg = orig_optarg; + continue; + } + } + break; + } + /* only fastcgi will get here */ requests++; if (max_requests (requests == max_requests)) { @@ -1920,6 +1957,29 @@ } zend_end_try(); out: +#if PHP_FASTCGI + if (benchmark) { + int sec; +#ifdef HAVE_GETTIMEOFDAY + int usec; + + gettimeofday(end, NULL); + sec = (int)(end.tv_sec - start.tv_sec); + if (end.tv_usec = start.tv_usec) { + usec = (int)(end.tv_usec - start.tv_usec); + } else { + sec -= 1; + usec = (int)(end.tv_usec + 100 - start.tv_usec); + } + fprintf(stderr, \nElapsed time: %d.%06d sec\n, sec, usec); +#else + time(end); + sec = (int)(end - start); + fprintf(stderr, \nElapsed time: %d sec\n, sec); +#endif + } +#endif + SG(server_context) = NULL; php_module_shutdown(TSRMLS_C); sapi_shutdown(); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c
janiWed Aug 8 10:00:34 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c Log: MFH: fix typos in comments http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.43r2=1.267.2.15.2.44diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.43 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.44 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.43 Tue Jun 26 14:47:16 2007 +++ php-src/sapi/cgi/cgi_main.c Wed Aug 8 10:00:34 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.43 2007/06/26 14:47:16 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.44 2007/08/08 10:00:34 jani Exp $ */ #include php.h #include php_globals.h @@ -865,7 +865,7 @@ */ env_script_name = pt + l; - /* PATH_TRANSATED = DOCUMENT_ROOT + PATH_INFO */ + /* PATH_TRANSLATED = DOCUMENT_ROOT + PATH_INFO */ path_translated_len = l + (env_path_info ? strlen(env_path_info) : 0); path_translated = (char *) emalloc(path_translated_len + 1); memcpy(path_translated, env_document_root, l); @@ -881,7 +881,7 @@ } else if (env_script_name strstr(pt, env_script_name) ) { - /* PATH_TRANSATED = PATH_TRANSATED - SCRIPT_NAME + PATH_INFO */ + /* PATH_TRANSLATED = PATH_TRANSLATED - SCRIPT_NAME + PATH_INFO */ int ptlen = strlen(pt) - strlen(env_script_name); int path_translated_len = ptlen + env_path_info ? strlen(env_path_info) : 0; char *path_translated = NULL; @@ -957,7 +957,7 @@ if (real_path) { free(real_path); } - } + } } else { #endif /* pre 4.3 behaviour, shouldn't be used but provides BC */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c
stasWed Aug 8 23:51:57 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c Log: remove unneeded variables http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.45r2=1.267.2.15.2.46diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.45 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.46 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.45 Wed Aug 8 13:01:40 2007 +++ php-src/sapi/cgi/cgi_main.c Wed Aug 8 23:51:57 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.45 2007/08/08 13:01:40 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.46 2007/08/08 23:51:57 stas Exp $ */ #include php.h #include php_globals.h @@ -1161,10 +1161,6 @@ /* end of temporary locals */ #ifdef ZTS - zend_compiler_globals *compiler_globals; - zend_executor_globals *executor_globals; - php_core_globals *core_globals; - sapi_globals_struct *sapi_globals; void ***tsrm_ls; #endif @@ -1204,6 +1200,7 @@ #ifdef ZTS tsrm_startup(1, 1, 0, NULL); + tsrm_ls = ts_resource(0); #endif sapi_startup(cgi_sapi_module); @@ -1295,11 +1292,6 @@ php_optarg = orig_optarg; #ifdef ZTS - compiler_globals = ts_resource(compiler_globals_id); - executor_globals = ts_resource(executor_globals_id); - 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 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c
dmitry Thu Jun 21 08:40:43 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c Log: no need to return exit status of the last fastcgi request http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.41r2=1.267.2.15.2.42diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.41 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.42 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.41 Mon Jun 4 15:38:12 2007 +++ php-src/sapi/cgi/cgi_main.c Thu Jun 21 08:40:43 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.41 2007/06/04 15:38:12 tony2001 Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.42 2007/06/21 08:40:43 dmitry Exp $ */ #include php.h #include php_globals.h @@ -1834,6 +1834,10 @@ if (bindpath) { free(bindpath); } + if (max_requests != 1) { + /* no need to return exit_status of the last request */ + exit_status = 0; + } break; } /* end of fastcgi loop */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c
tony2001Mon Jun 4 15:38:12 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c Log: MFH: add missing open_basedir checks to CGI http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.40r2=1.267.2.15.2.41diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.40 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.41 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.40 Mon May 28 08:11:59 2007 +++ php-src/sapi/cgi/cgi_main.c Mon Jun 4 15:38:12 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.40 2007/05/28 08:11:59 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.41 2007/06/04 15:38:12 tony2001 Exp $ */ #include php.h #include php_globals.h @@ -1682,7 +1682,9 @@ */ retval = FAILURE; if (cgi || SG(request_info).path_translated) { - retval = php_fopen_primary_script(file_handle TSRMLS_CC); + if (!php_check_open_basedir(SG(request_info).path_translated TSRMLS_CC)) { + retval = php_fopen_primary_script(file_handle TSRMLS_CC); + } } /* if we are unable to open path_translated and we are not @@ -1704,9 +1706,21 @@ goto fastcgi_request_done; } #endif + + STR_FREE(SG(request_info).path_translated); + + if (free_query_string SG(request_info).query_string) { + free(SG(request_info).query_string); + SG(request_info).query_string = NULL; + } + php_request_shutdown((void *) 0); SG(server_context) = NULL; php_module_shutdown(TSRMLS_C); + sapi_shutdown(); +#ifdef ZTS + tsrm_shutdown(); +#endif return FAILURE; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c
dmitry Mon May 28 08:11:59 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c Log: Removed deprecated comment http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.39r2=1.267.2.15.2.40diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.39 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.40 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.39 Mon May 21 09:08:12 2007 +++ php-src/sapi/cgi/cgi_main.c Mon May 28 08:11:59 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.39 2007/05/21 09:08:12 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.40 2007/05/28 08:11:59 dmitry Exp $ */ #include php.h #include php_globals.h @@ -1311,8 +1311,6 @@ #endif /* FORCE_CGI_REDIRECT */ #if PHP_FASTCGI - /* for windows, socket listening is broken in the fastcgi library itself - so dissabling this feature on windows till time is available to fix it */ if (bindpath) { fcgi_fd = fcgi_listen(bindpath, 128); if (fcgi_fd 0) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c fastcgi.c fastcgi.h
dmitry Mon May 21 09:08:13 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c fastcgi.c fastcgi.h Log: Fixed crash on php -b 1234 -unknown-option http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.38r2=1.267.2.15.2.39diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.38 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.39 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.38 Sun May 20 15:56:09 2007 +++ php-src/sapi/cgi/cgi_main.c Mon May 21 09:08:12 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.38 2007/05/20 15:56:09 iliaa Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.39 2007/05/21 09:08:12 dmitry Exp $ */ #include php.h #include php_globals.h @@ -1429,6 +1429,9 @@ switch (c) { case 'h': case '?': +#if PHP_FASTCGI + fcgi_shutdown(); +#endif no_headers = 1; php_output_startup(); php_output_activate(TSRMLS_C); @@ -1823,6 +1826,7 @@ } /* end of fastcgi loop */ } + fcgi_shutdown(); #endif if (cgi_sapi_module.php_ini_path_override) { http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/fastcgi.c?r1=1.4.2.13.2.25r2=1.4.2.13.2.26diff_format=u Index: php-src/sapi/cgi/fastcgi.c diff -u php-src/sapi/cgi/fastcgi.c:1.4.2.13.2.25 php-src/sapi/cgi/fastcgi.c:1.4.2.13.2.26 --- php-src/sapi/cgi/fastcgi.c:1.4.2.13.2.25Thu May 10 15:21:02 2007 +++ php-src/sapi/cgi/fastcgi.c Mon May 21 09:08:13 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: fastcgi.c,v 1.4.2.13.2.25 2007/05/10 15:21:02 dmitry Exp $ */ +/* $Id: fastcgi.c,v 1.4.2.13.2.26 2007/05/21 09:08:13 dmitry Exp $ */ #include php.h #include fastcgi.h @@ -255,6 +255,11 @@ } } +void fcgi_shutdown(void) +{ + is_fastcgi = 0; +} + #ifdef _WIN32 /* Do some black magic with the NT security API. * We prepare a DACL (Discretionary Access Control List) so that http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/fastcgi.h?r1=1.2.2.4.2.4r2=1.2.2.4.2.5diff_format=u Index: php-src/sapi/cgi/fastcgi.h diff -u php-src/sapi/cgi/fastcgi.h:1.2.2.4.2.4 php-src/sapi/cgi/fastcgi.h:1.2.2.4.2.5 --- php-src/sapi/cgi/fastcgi.h:1.2.2.4.2.4 Wed Mar 28 15:39:22 2007 +++ php-src/sapi/cgi/fastcgi.h Mon May 21 09:08:13 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: fastcgi.h,v 1.2.2.4.2.4 2007/03/28 15:39:22 dmitry Exp $ */ +/* $Id: fastcgi.h,v 1.2.2.4.2.5 2007/05/21 09:08:13 dmitry Exp $ */ /* FastCGI protocol */ @@ -112,6 +112,7 @@ } fcgi_request; int fcgi_init(void); +void fcgi_shutdown(void); int fcgi_is_fastcgi(void); int fcgi_in_shutdown(void); int fcgi_listen(const char *path, int backlog); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c /sapi/cgi/tests 009.phpt
iliaa Sun May 20 15:56:10 2007 UTC Added files: (Branch: PHP_5_2) /php-src/sapi/cgi/tests 009.phpt Modified files: /php-src/sapi/cgi cgi_main.c Log: Fixed a possible crash when PATH_INFO is not provided but the path contains path info information http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.37r2=1.267.2.15.2.38diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.37 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.38 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.37 Tue May 15 08:17:08 2007 +++ php-src/sapi/cgi/cgi_main.c Sun May 20 15:56:09 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.37 2007/05/15 08:17:08 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.38 2007/05/20 15:56:09 iliaa Exp $ */ #include php.h #include php_globals.h @@ -825,8 +825,8 @@ * out what SCRIPT_NAME should be */ int slen = len - strlen(pt); - int pilen = strlen(env_path_info); - char *path_info = env_path_info + pilen - slen; + int pilen = env_path_info ? strlen(env_path_info) : 0; + char *path_info = env_path_info ? env_path_info + pilen - slen : NULL; if (orig_path_info != path_info) { if (orig_path_info) { @@ -866,10 +866,12 @@ env_script_name = pt + l; /* PATH_TRANSATED = DOCUMENT_ROOT + PATH_INFO */ - path_translated_len = l + strlen(env_path_info); + path_translated_len = l + (env_path_info ? strlen(env_path_info) : 0); path_translated = (char *) emalloc(path_translated_len + 1); memcpy(path_translated, env_document_root, l); - memcpy(path_translated + l, env_path_info, (path_translated_len - l)); + if (env_path_info) { + memcpy(path_translated + l, env_path_info, (path_translated_len - l)); + } path_translated[path_translated_len] = '\0'; if (orig_path_translated) { _sapi_cgibin_putenv(ORIG_PATH_TRANSLATED, orig_path_translated TSRMLS_CC); @@ -881,12 +883,14 @@ ) { /* PATH_TRANSATED = PATH_TRANSATED - SCRIPT_NAME + PATH_INFO */ int ptlen = strlen(pt) - strlen(env_script_name); - int path_translated_len = ptlen + strlen(env_path_info); + int path_translated_len = ptlen + env_path_info ? strlen(env_path_info) : 0; char *path_translated = NULL; path_translated = (char *) emalloc(path_translated_len + 1); memcpy(path_translated, pt, ptlen); - memcpy(path_translated + ptlen, env_path_info, path_translated_len - ptlen); + if (env_path_info) { + memcpy(path_translated + ptlen, env_path_info, path_translated_len - ptlen); + } path_translated[path_translated_len] = '\0'; if (orig_path_translated) { _sapi_cgibin_putenv(ORIG_PATH_TRANSLATED, orig_path_translated TSRMLS_CC); http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/tests/009.phpt?view=markuprev=1.1 Index: php-src/sapi/cgi/tests/009.phpt +++ php-src/sapi/cgi/tests/009.phpt -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit:
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c
tony2001Tue Apr 17 18:51:34 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c Log: MFH: fix leak appearing when more than one -f option specified http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.34r2=1.267.2.15.2.35diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.34 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.35 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.34 Sun Apr 15 23:06:08 2007 +++ php-src/sapi/cgi/cgi_main.c Tue Apr 17 18:51:34 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.34 2007/04/15 23:06:08 sniper Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.35 2007/04/17 18:51:34 tony2001 Exp $ */ #include php.h #include php_globals.h @@ -1478,6 +1478,9 @@ break; case 'f': /* parse file */ + if (script_file) { + efree(script_file); + } script_file = estrdup(php_optarg); no_headers = 1; /* arguments after the file are considered script args */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c
sniper Tue Apr 17 20:00:53 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c Log: - Fix a possible leak when multiple -c parameters are used http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.35r2=1.267.2.15.2.36diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.35 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.36 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.35 Tue Apr 17 18:51:34 2007 +++ php-src/sapi/cgi/cgi_main.c Tue Apr 17 20:00:53 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.35 2007/04/17 18:51:34 tony2001 Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.36 2007/04/17 20:00:53 sniper Exp $ */ #include php.h #include php_globals.h @@ -1151,6 +1151,7 @@ #endif sapi_startup(cgi_sapi_module); + cgi_sapi_module.php_ini_path_override = NULL; #ifdef PHP_WIN32 _fmode = _O_BINARY; /* sets default for file streams to binary */ @@ -1178,6 +1179,9 @@ while ((c = php_getopt(argc, argv, OPTIONS, php_optarg, php_optind, 0)) != -1) { switch (c) { case 'c': + if (cgi_sapi_module.php_ini_path_override) { + free(cgi_sapi_module.php_ini_path_override); + } cgi_sapi_module.php_ini_path_override = strdup(php_optarg); break; case 'n': -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c
sniper Sun Apr 15 22:52:07 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c Log: - Allow using syntax highlighting under FastCGI mode. http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.32r2=1.267.2.15.2.33diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.32 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.33 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.32 Thu Mar 29 18:47:04 2007 +++ php-src/sapi/cgi/cgi_main.c Sun Apr 15 22:52:07 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.32 2007/03/29 18:47:04 pollita Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.33 2007/04/15 22:52:07 sniper Exp $ */ #include php.h #include php_globals.h @@ -1224,6 +1224,10 @@ } break; #endif + case 's': /* generate highlighted HTML from source */ + behavior = PHP_MODE_HIGHLIGHT; + break; + } } @@ -1524,10 +1528,6 @@ no_headers = 1; break; - case 's': /* generate highlighted HTML from source */ - behavior = PHP_MODE_HIGHLIGHT; - break; - case 'v': /* show php version quit */ no_headers = 1; if (php_request_startup(TSRMLS_C) == FAILURE) { @@ -1737,9 +1737,17 @@ if (open_file_for_scanning(file_handle TSRMLS_CC) == SUCCESS) { php_get_highlight_struct(syntax_highlighter_ini); zend_highlight(syntax_highlighter_ini TSRMLS_CC); - fclose(file_handle.handle.fp); - php_end_ob_buffers(1 TSRMLS_CC); +#if PHP_FASTCGI + if (!fastcgi) +#endif + { + fclose(file_handle.handle.fp); + php_end_ob_buffers(1 TSRMLS_CC); + } } +#if PHP_FASTCGI + if (!fastcgi) +#endif return SUCCESS; } break; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c
sniper Sun Apr 15 23:06:08 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c Log: MFH: Simplify previous patch. http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.33r2=1.267.2.15.2.34diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.33 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.34 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.33 Sun Apr 15 22:52:07 2007 +++ php-src/sapi/cgi/cgi_main.c Sun Apr 15 23:06:08 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.33 2007/04/15 22:52:07 sniper Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.34 2007/04/15 23:06:08 sniper Exp $ */ #include php.h #include php_globals.h @@ -1738,16 +1738,13 @@ php_get_highlight_struct(syntax_highlighter_ini); zend_highlight(syntax_highlighter_ini TSRMLS_CC); #if PHP_FASTCGI - if (!fastcgi) -#endif - { - fclose(file_handle.handle.fp); - php_end_ob_buffers(1 TSRMLS_CC); + if (fastcgi) { + goto fastcgi_request_done; } - } -#if PHP_FASTCGI - if (!fastcgi) #endif + fclose(file_handle.handle.fp); + php_end_ob_buffers(1 TSRMLS_CC); + } return SUCCESS; } break; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c
pollita Thu Mar 29 18:47:04 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c Log: Add missing #if check http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.31r2=1.267.2.15.2.32diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.31 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.32 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.31 Wed Mar 28 15:39:22 2007 +++ php-src/sapi/cgi/cgi_main.c Thu Mar 29 18:47:04 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.31 2007/03/28 15:39:22 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.32 2007/03/29 18:47:04 pollita Exp $ */ #include php.h #include php_globals.h @@ -1214,6 +1214,7 @@ } break; } +#if PHP_FASTCGI /* if we're started on command line, check to see if we are being started as an 'external' fastcgi server by accepting a bindpath parameter. */ @@ -1222,6 +1223,7 @@ bindpath = strdup(php_optarg); } break; +#endif } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c
dmitry Fri Mar 9 16:46:08 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c Log: Return HTTP 403 in case of access denied. http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.29r2=1.267.2.15.2.30diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.29 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.30 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.29 Tue Feb 27 03:28:17 2007 +++ php-src/sapi/cgi/cgi_main.c Fri Mar 9 16:46:07 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.29 2007/02/27 03:28:17 iliaa Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.30 2007/03/09 16:46:07 dmitry Exp $ */ #include php.h #include php_globals.h @@ -1705,8 +1705,13 @@ running from shell (so fp == NULL), then fail. */ if (retval == FAILURE file_handle.handle.fp == NULL) { - SG(sapi_headers).http_response_code = 404; - PUTS(No input file specified.\n); + if (errno == EACCES) { + SG(sapi_headers).http_response_code = 403; + PUTS(Access denied.\n); + } else { + SG(sapi_headers).http_response_code = 404; + PUTS(No input file specified.\n); + } #if PHP_FASTCGI /* we want to serve more requests if this is fastcgi so cleanup and continue, request shutdown is -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c /sapi/cli php_cli.c
tony2001Tue Feb 20 19:20:41 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c /php-src/sapi/cli php_cli.c Log: MFH: make use of startup hooks http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.26r2=1.267.2.15.2.27diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.26 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.27 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.26 Mon Feb 19 23:52:13 2007 +++ php-src/sapi/cgi/cgi_main.c Tue Feb 20 19:20:41 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.26 2007/02/19 23:52:13 iliaa Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.27 2007/02/20 19:20:41 tony2001 Exp $ */ #include php.h #include php_globals.h @@ -119,6 +119,7 @@ static char *php_optarg = NULL; static int php_optind = 1; +static zend_module_entry cgi_module_entry; static const opt_struct OPTIONS[] = { {'a', 0, interactive}, @@ -567,7 +568,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, cgi_module_entry, 1) == FAILURE) { return FAILURE; } return SUCCESS; @@ -1262,7 +1263,7 @@ cgi_sapi_module.executable_location = argv[0]; /* startup after we get the above ini override se we get things right */ - if (php_module_startup(cgi_sapi_module, cgi_module_entry, 1) == FAILURE) { + if (cgi_sapi_module.startup(cgi_sapi_module) == FAILURE) { #ifdef ZTS tsrm_shutdown(); #endif http://cvs.php.net/viewvc.cgi/php-src/sapi/cli/php_cli.c?r1=1.129.2.13.2.13r2=1.129.2.13.2.14diff_format=u Index: php-src/sapi/cli/php_cli.c diff -u php-src/sapi/cli/php_cli.c:1.129.2.13.2.13 php-src/sapi/cli/php_cli.c:1.129.2.13.2.14 --- php-src/sapi/cli/php_cli.c:1.129.2.13.2.13 Thu Feb 8 16:55:34 2007 +++ php-src/sapi/cli/php_cli.c Tue Feb 20 19:20:41 2007 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_cli.c,v 1.129.2.13.2.13 2007/02/08 16:55:34 helly Exp $ */ +/* $Id: php_cli.c,v 1.129.2.13.2.14 2007/02/20 19:20:41 tony2001 Exp $ */ #include php.h #include php_globals.h @@ -698,7 +698,7 @@ #endif /* startup after we get the above ini override se we get things right */ - if (php_module_startup(cli_sapi_module, NULL, 0)==FAILURE) { + if (cli_sapi_module.startup(cli_sapi_module)==FAILURE) { /* there is no way to see if we must call zend_ini_deactivate() * since we cannot check if EG(ini_directives) has been initialised * because the executor's constructor does not set initialize it. -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c
dmitry Mon Feb 19 14:13:02 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c Log: Initialize retval on each request http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.24r2=1.267.2.15.2.25diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.24 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.25 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.24 Sun Feb 18 18:08:22 2007 +++ php-src/sapi/cgi/cgi_main.c Mon Feb 19 14:13:02 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.24 2007/02/18 18:08:22 iliaa Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.25 2007/02/19 14:13:02 dmitry Exp $ */ #include php.h #include php_globals.h @@ -1694,6 +1694,7 @@ 1. we are running from shell and got filename was there 2. we are running as cgi or fastcgi */ + retval = FAILURE; if (cgi || SG(request_info).path_translated) { retval = php_fopen_primary_script(file_handle TSRMLS_CC); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c
iliaa Mon Feb 19 23:52:13 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c Log: Fixed strlcat() usage. # Thanks Andi http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.25r2=1.267.2.15.2.26diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.25 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.26 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.25 Mon Feb 19 14:13:02 2007 +++ php-src/sapi/cgi/cgi_main.c Mon Feb 19 23:52:13 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.25 2007/02/19 14:13:02 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.26 2007/02/19 23:52:13 iliaa Exp $ */ #include php.h #include php_globals.h @@ -1636,7 +1636,8 @@ } } - s = malloc(++len + 1); + len += 2; + s = malloc(len); *s = '\0'; /* we are pretending it came from the environment */ for (i = php_optind; i argc; i++) { strlcat(s, argv[i], len); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c
iliaa Sun Feb 18 18:08:22 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c Log: Eliminate strcat() usage Fixed handling of argv[] for GET http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.23r2=1.267.2.15.2.24diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.23 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.24 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.23 Fri Feb 16 11:30:03 2007 +++ php-src/sapi/cgi/cgi_main.c Sun Feb 18 18:08:22 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.23 2007/02/16 11:30:03 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.24 2007/02/18 18:08:22 iliaa Exp $ */ #include php.h #include php_globals.h @@ -858,11 +858,11 @@ env_script_name = pt + l; /* PATH_TRANSATED = DOCUMENT_ROOT + PATH_INFO */ - path_translated_len = l + strlen(env_path_info) + 2; - path_translated = (char *) emalloc(path_translated_len); - *path_translated = 0; - strncat(path_translated, env_document_root, l); - strcat(path_translated, env_path_info); + path_translated_len = l + strlen(env_path_info); + path_translated = (char *) emalloc(path_translated_len + 1); + memcpy(path_translated, env_document_root, l); + memcpy(path_translated + l, env_path_info, (path_translated_len - l)); + path_translated[path_translated_len] = '\0'; if (orig_path_translated) { _sapi_cgibin_putenv(ORIG_PATH_TRANSLATED, orig_path_translated TSRMLS_CC); } @@ -873,13 +873,13 @@ ) { /* PATH_TRANSATED = PATH_TRANSATED - SCRIPT_NAME + PATH_INFO */ int ptlen = strlen(pt) - strlen(env_script_name); - int path_translated_len = ptlen + strlen(env_path_info) + 2; + int path_translated_len = ptlen + strlen(env_path_info); char *path_translated = NULL; - path_translated = (char *) emalloc(path_translated_len); - *path_translated = 0; - strncat(path_translated, pt, ptlen); - strcat(path_translated, env_path_info); + path_translated = (char *) emalloc(path_translated_len + 1); + memcpy(path_translated, pt, ptlen); + memcpy(path_translated + ptlen, env_path_info, path_translated_len - ptlen); + path_translated[path_translated_len] = '\0'; if (orig_path_translated) { _sapi_cgibin_putenv(ORIG_PATH_TRANSLATED, orig_path_translated TSRMLS_CC); } @@ -1626,17 +1626,22 @@ test.php v1=test v2=hello world! */ if (!SG(request_info).query_string argc php_optind) { + int slen = strlen(PG(arg_separator).input); len = 0; for (i = php_optind; i argc; i++) { - len += strlen(argv[i]) + 1; + if (i (argc - 1)) { + len += strlen(argv[i]) + slen; + } else { + len += strlen(argv[i]); + } } - s = malloc(len +
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c
dmitry Mon Jan 29 19:36:01 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c Log: Prevent flush of closed handle on php_module_shutdown() http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.20r2=1.267.2.15.2.21diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.20 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.21 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.20 Mon Jan 1 09:36:12 2007 +++ php-src/sapi/cgi/cgi_main.c Mon Jan 29 19:36:01 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.20 2007/01/01 09:36:12 sebastian Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.21 2007/01/29 19:36:01 dmitry Exp $ */ #include php.h #include php_globals.h @@ -1519,6 +1519,7 @@ case 'i': /* php info quit */ if (php_request_startup(TSRMLS_C) == FAILURE) { + SG(server_context) = NULL; php_module_shutdown(TSRMLS_C); return FAILURE; } @@ -1566,6 +1567,7 @@ case 'v': /* show php version quit */ no_headers = 1; if (php_request_startup(TSRMLS_C) == FAILURE) { + SG(server_context) = NULL; php_module_shutdown(TSRMLS_C); return FAILURE; } @@ -1673,6 +1675,7 @@ fcgi_finish_request(request); } #endif + SG(server_context) = NULL; php_module_shutdown(TSRMLS_C); return FAILURE; } @@ -1705,6 +1708,7 @@ } #endif php_request_shutdown((void *) 0); + SG(server_context) = NULL; php_module_shutdown(TSRMLS_C); return FAILURE; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c
tony2001Thu Dec 28 22:36:53 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c Log: MFH http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.18r2=1.267.2.15.2.19diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.18 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.19 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.18 Wed Nov 15 13:33:41 2006 +++ php-src/sapi/cgi/cgi_main.c Thu Dec 28 22:36:53 2006 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.18 2006/11/15 13:33:41 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.19 2006/12/28 22:36:53 tony2001 Exp $ */ #include php.h #include php_globals.h @@ -849,7 +849,7 @@ int path_translated_len = 0; char *path_translated = NULL; - if (env_document_root[l - 1] == '/') { + if (l env_document_root[l - 1] == '/') { --l; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c
dmitry Wed Nov 15 11:13:03 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c Log: Fixed wrong ext/filter behavior. It didn't register FastCGI environment variables and made memory leaks. http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.16r2=1.267.2.15.2.17diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.16 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.17 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.16 Tue Nov 14 10:31:47 2006 +++ php-src/sapi/cgi/cgi_main.c Wed Nov 15 11:13:02 2006 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.16 2006/11/14 10:31:47 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.17 2006/11/15 11:13:02 dmitry Exp $ */ #include php.h #include php_globals.h @@ -498,6 +498,7 @@ char *var, **val; uint var_len; ulong idx; + int filter_arg = (array_ptr == PG(http_globals)[TRACK_VARS_ENV])?PARSE_ENV:PARSE_SERVER; /* turn off magic_quotes while importing environment variables */ PG(magic_quotes_gpc) = 0; @@ -505,8 +506,8 @@ zend_hash_get_current_key_ex(request-env, var, var_len, idx, 0, pos) == HASH_KEY_IS_STRING zend_hash_get_current_data_ex(request-env, (void **) val, pos) == SUCCESS; zend_hash_move_forward_ex(request-env, pos)) { - int new_val_len; - if (sapi_module.input_filter(PARSE_SERVER, var, val, strlen(*val), new_val_len TSRMLS_CC)) { + unsigned int new_val_len; + if (sapi_module.input_filter(filter_arg, var, val, strlen(*val), new_val_len TSRMLS_CC)) { php_register_variable_safe(var, *val, new_val_len, array_ptr TSRMLS_CC); } } @@ -517,7 +518,7 @@ static void sapi_cgi_register_variables(zval *track_vars_array TSRMLS_DC) { - int new_val_len; + unsigned int new_val_len; char *val = SG(request_info).request_uri ? SG(request_info).request_uri : ; /* In CGI mode, we consider the environment to be a part of the server * variables -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c
dmitry Wed Nov 15 13:33:41 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c Log: Removed unnecessary getenv/putenv calls http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.17r2=1.267.2.15.2.18diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.17 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.18 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.17 Wed Nov 15 11:13:02 2006 +++ php-src/sapi/cgi/cgi_main.c Wed Nov 15 13:33:41 2006 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.17 2006/11/15 11:13:02 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.18 2006/11/15 13:33:41 dmitry Exp $ */ #include php.h #include php_globals.h @@ -762,33 +762,17 @@ char *env_document_root = sapi_cgibin_getenv(DOCUMENT_ROOT, sizeof(DOCUMENT_ROOT)-1 TSRMLS_CC); if (CGIG(fix_pathinfo)) { - - /* save the originals first for anything we change later */ - if (env_path_translated) { - _sapi_cgibin_putenv(ORIG_PATH_TRANSLATED, env_path_translated TSRMLS_CC); - } - if (env_path_info) { - _sapi_cgibin_putenv(ORIG_PATH_INFO, env_path_info TSRMLS_CC); - } - if (env_script_name) { - _sapi_cgibin_putenv(ORIG_SCRIPT_NAME, env_script_name TSRMLS_CC); - } - if (env_script_filename) { - _sapi_cgibin_putenv(ORIG_SCRIPT_FILENAME, env_script_filename TSRMLS_CC); - } - if (!env_document_root) { - /* ini version of 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) { - env_document_root = _sapi_cgibin_putenv(DOCUMENT_ROOT, env_document_root TSRMLS_CC); - /* fix docroot */ - TRANSLATE_SLASHES(env_document_root); - } - } + char *real_path; + char *orig_path_translated = env_path_translated; + char *orig_path_info = env_path_info; + char *orig_script_name = env_script_name; + char *orig_script_filename = env_script_filename; + + if (!env_document_root PG(doc_root)) { + env_document_root = _sapi_cgibin_putenv(DOCUMENT_ROOT, PG(doc_root) TSRMLS_CC); + /* fix docroot */ + TRANSLATE_SLASHES(env_document_root); + } if (env_path_translated != NULL env_redirect_url != NULL) { /* @@ -798,7 +782,7 @@ */ script_path_translated = env_path_translated; /* we correct SCRIPT_NAME now in case we don't have PATH_INFO */ - env_script_name = _sapi_cgibin_putenv(SCRIPT_NAME, env_redirect_url TSRMLS_CC); + env_script_name = env_redirect_url; } #ifdef __riscos__ @@ -812,7 +796,8 @@ * of it by stat'ing back through the '/' * this fixes url's like /info.php/test */ - if (script_path_translated stat(script_path_translated, st) == -1 ) { + if (script_path_translated + (real_path = tsrm_realpath(script_path_translated, NULL TSRMLS_CC)) == NULL) { char *pt = estrdup(script_path_translated); int len = strlen(pt); char *ptr; @@ -839,8 +824,19 @@ int pilen = strlen(env_path_info); char *path_info = env_path_info + pilen - slen; - env_path_info = _sapi_cgibin_putenv(PATH_INFO, path_info TSRMLS_CC); - script_path_translated = _sapi_cgibin_putenv(SCRIPT_FILENAME, pt TSRMLS_CC); + if (orig_path_info != path_info) { +
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c
pajoye Fri Nov 3 16:40:52 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c Log: - fix build (var.s is for zstr) http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.14r2=1.267.2.15.2.15diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.14 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.15 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.14 Fri Nov 3 13:51:48 2006 +++ php-src/sapi/cgi/cgi_main.c Fri Nov 3 16:40:52 2006 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.14 2006/11/03 13:51:48 iliaa Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.15 2006/11/03 16:40:52 pajoye Exp $ */ #include php.h #include php_globals.h @@ -491,8 +491,8 @@ zend_hash_get_current_data_ex(request-env, (void **) val, pos) == SUCCESS; zend_hash_move_forward_ex(request-env, pos)) { int new_val_len; - if (sapi_module.input_filter(PARSE_SERVER, var.s, val, strlen(*val), new_val_len TSRMLS_CC)) { - php_register_variable_safe(var.s, *val, new_val_len, array_ptr TSRMLS_CC); + if (sapi_module.input_filter(PARSE_SERVER, var, val, strlen(*val), new_val_len TSRMLS_CC)) { + php_register_variable_safe(var, *val, new_val_len, array_ptr TSRMLS_CC); } } PG(magic_quotes_gpc) = magic_quotes_gpc; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c
tony2001Sat Sep 23 12:27:41 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c Log: fix CGI build http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.12r2=1.267.2.15.2.13diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.12 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.13 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.12 Fri Sep 22 17:41:09 2006 +++ php-src/sapi/cgi/cgi_main.c Sat Sep 23 12:27:40 2006 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.12 2006/09/22 17:41:09 iliaa Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.13 2006/09/23 12:27:40 tony2001 Exp $ */ #include php.h #include php_globals.h @@ -1070,19 +1070,19 @@ if ((val = strchr(php_optarg, '='))) { val++; if (!isalnum(*val) *val != '' *val != '\'' *val != '\0') { - cli_sapi_module.ini_entries = realloc(cli_sapi_module.ini_entries, ini_entries_len + len + sizeof(\\\n\0)); - memcpy(cli_sapi_module.ini_entries + ini_entries_len, php_optarg, (val - php_optarg)); + cgi_sapi_module.ini_entries = realloc(cgi_sapi_module.ini_entries, ini_entries_len + len + sizeof(\\\n\0)); + memcpy(cgi_sapi_module.ini_entries + ini_entries_len, php_optarg, (val - php_optarg)); ini_entries_len += (val - php_optarg); - memcpy(cli_sapi_module.ini_entries + ini_entries_len, \, 1); + memcpy(cgi_sapi_module.ini_entries + ini_entries_len, \, 1); ini_entries_len++; - memcpy(cli_sapi_module.ini_entries + ini_entries_len, val, len - (val - php_optarg)); + memcpy(cgi_sapi_module.ini_entries + ini_entries_len, val, len - (val - php_optarg)); ini_entries_len += len - (val - php_optarg); - memcpy(cli_sapi_module.ini_entries + ini_entries_len, \\n\0, sizeof(\\n\0)); + memcpy(cgi_sapi_module.ini_entries + ini_entries_len, \\n\0, sizeof(\\n\0)); ini_entries_len += sizeof(\n\0\) - 2; } else { - cli_sapi_module.ini_entries = realloc(cli_sapi_module.ini_entries, ini_entries_len + len + sizeof(\n\0)); - memcpy(cli_sapi_module.ini_entries + ini_entries_len, php_optarg, len); - memcpy(cli_sapi_module.ini_entries + ini_entries_len + len, \n\0, sizeof(\n\0)); + cgi_sapi_module.ini_entries = realloc(cgi_sapi_module.ini_entries, ini_entries_len + len + sizeof(\n\0)); + memcpy(cgi_sapi_module.ini_entries + ini_entries_len, php_optarg, len); + memcpy(cgi_sapi_module.ini_entries + ini_entries_len + len, \n\0, sizeof(\n\0)); ini_entries_len += len + sizeof(\n\0) - 2; } } else { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c /sapi/cli php_cli.c
iliaa Fri Sep 22 17:41:09 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cli php_cli.c /php-src/sapi/cgi cgi_main.c Log: Restore support for unquoted -d options http://cvs.php.net/viewvc.cgi/php-src/sapi/cli/php_cli.c?r1=1.129.2.13.2.9r2=1.129.2.13.2.10diff_format=u Index: php-src/sapi/cli/php_cli.c diff -u php-src/sapi/cli/php_cli.c:1.129.2.13.2.9 php-src/sapi/cli/php_cli.c:1.129.2.13.2.10 --- php-src/sapi/cli/php_cli.c:1.129.2.13.2.9 Tue Sep 19 20:33:12 2006 +++ php-src/sapi/cli/php_cli.c Fri Sep 22 17:41:09 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_cli.c,v 1.129.2.13.2.9 2006/09/19 20:33:12 dmitry Exp $ */ +/* $Id: php_cli.c,v 1.129.2.13.2.10 2006/09/22 17:41:09 iliaa Exp $ */ #include php.h #include php_globals.h @@ -645,12 +645,26 @@ case 'd': { /* define ini entries on command line */ int len = strlen(php_optarg); + char *val; - if (strchr(php_optarg, '=')) { - cli_sapi_module.ini_entries = realloc(cli_sapi_module.ini_entries, ini_entries_len + len + sizeof(\n\0)); - memcpy(cli_sapi_module.ini_entries + ini_entries_len, php_optarg, len); - memcpy(cli_sapi_module.ini_entries + ini_entries_len + len, \n\0, sizeof(\n\0)); - ini_entries_len += len + sizeof(\n\0) - 2; + if ((val = strchr(php_optarg, '='))) { + val++; + if (!isalnum(*val) *val != '' *val != '\'' *val != '\0') { + cli_sapi_module.ini_entries = realloc(cli_sapi_module.ini_entries, ini_entries_len + len + sizeof(\\\n\0)); + memcpy(cli_sapi_module.ini_entries + ini_entries_len, php_optarg, (val - php_optarg)); + ini_entries_len += (val - php_optarg); + memcpy(cli_sapi_module.ini_entries + ini_entries_len, \, 1); + ini_entries_len++; + memcpy(cli_sapi_module.ini_entries + ini_entries_len, val, len - (val - php_optarg)); + ini_entries_len += len - (val - php_optarg); + memcpy(cli_sapi_module.ini_entries + ini_entries_len, \\n\0, sizeof(\\n\0)); + ini_entries_len += sizeof(\n\0\) - 2; + } else { + cli_sapi_module.ini_entries = realloc(cli_sapi_module.ini_entries, ini_entries_len + len + sizeof(\n\0)); + memcpy(cli_sapi_module.ini_entries + ini_entries_len, php_optarg, len); + memcpy(cli_sapi_module.ini_entries + ini_entries_len + len, \n\0, sizeof(\n\0)); + ini_entries_len += len + sizeof(\n\0) - 2; + } } else { cli_sapi_module.ini_entries = realloc(cli_sapi_module.ini_entries, ini_entries_len + len + sizeof(=1\n\0)); memcpy(cli_sapi_module.ini_entries + ini_entries_len, php_optarg, len); http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.11r2=1.267.2.15.2.12diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.11 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.12 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.11 Tue Sep 19 20:33:12 2006 +++ php-src/sapi/cgi/cgi_main.c Fri Sep 22 17:41:09 2006 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.11 2006/09/19 20:33:12 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.12 2006/09/22 17:41:09 iliaa Exp $ */ #include php.h #include php_globals.h @@ -1065,12 +1065,26 @@ case 'd': { /* define ini entries on command line */ int len = strlen(php_optarg); + char *val; - if (strchr(php_optarg, '=')) { - cgi_sapi_module.ini_entries = realloc(cgi_sapi_module.ini_entries, ini_entries_len + len + sizeof(\n\0)); - memcpy(cgi_sapi_module.ini_entries + ini_entries_len, php_optarg, len); -
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c
dmitry Thu Aug 31 13:11:58 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c Log: FastCGI environment variables must not be overriden by system environment variables http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.9r2=1.267.2.15.2.10diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.9 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.10 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.9 Tue Jun 27 08:27:10 2006 +++ php-src/sapi/cgi/cgi_main.c Thu Aug 31 13:11:58 2006 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.9 2006/06/27 08:27:10 tony2001 Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.10 2006/08/31 13:11:58 dmitry Exp $ */ #include php.h #include php_globals.h @@ -472,6 +472,10 @@ zval_copy_ctor(array_ptr); return; } + + /* call php's original import as a catch-all */ + php_php_import_environment_variables(array_ptr TSRMLS_CC); + if (fcgi_is_fastcgi()) { fcgi_request *request = (fcgi_request*) SG(server_context); HashPosition pos; @@ -490,8 +494,6 @@ } 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); } #endif -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c /sapi/cli php_cli.c
tony2001Tue Jun 27 08:27:10 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c /php-src/sapi/cli php_cli.c Log: MFH: fix #37920 (compilation problems on z/OS) http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.8r2=1.267.2.15.2.9diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.8 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.9 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.8 Mon Jun 19 17:49:26 2006 +++ php-src/sapi/cgi/cgi_main.c Tue Jun 27 08:27:10 2006 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.8 2006/06/19 17:49:26 tony2001 Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.9 2006/06/27 08:27:10 tony2001 Exp $ */ #include php.h #include php_globals.h @@ -1588,12 +1588,12 @@ /* #!php support */ c = fgetc(file_handle.handle.fp); if (c == '#') { - while (c != 10 c != 13) { + while (c != '\n' c != '\r') { 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) { + if (c == '\r') { + if (fgetc(file_handle.handle.fp) != '\n') { long pos = ftell(file_handle.handle.fp); fseek(file_handle.handle.fp, pos - 1, SEEK_SET); } http://cvs.php.net/viewvc.cgi/php-src/sapi/cli/php_cli.c?r1=1.129.2.13.2.5r2=1.129.2.13.2.6diff_format=u Index: php-src/sapi/cli/php_cli.c diff -u php-src/sapi/cli/php_cli.c:1.129.2.13.2.5 php-src/sapi/cli/php_cli.c:1.129.2.13.2.6 --- php-src/sapi/cli/php_cli.c:1.129.2.13.2.5 Tue Jun 20 12:55:26 2006 +++ php-src/sapi/cli/php_cli.c Tue Jun 27 08:27:10 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_cli.c,v 1.129.2.13.2.5 2006/06/20 12:55:26 tony2001 Exp $ */ +/* $Id: php_cli.c,v 1.129.2.13.2.6 2006/06/27 08:27:10 tony2001 Exp $ */ #include php.h #include php_globals.h @@ -545,12 +545,12 @@ /* #!php support */ c = fgetc(file_handle-handle.fp); if (c == '#') { - while (c != 10 c != 13) { + while (c != '\n' c != '\r') { 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) { + if (c == '\r') { + if (fgetc(file_handle-handle.fp) != '\n') { long pos = ftell(file_handle-handle.fp); fseek(file_handle-handle.fp, pos - 1, SEEK_SET); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c
tony2001Mon Jun 19 11:39:02 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c Log: MFH: add missing ifdef and avoid unused variable warning http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.6r2=1.267.2.15.2.7diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.6 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.7 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.6 Sat Jun 17 11:08:05 2006 +++ php-src/sapi/cgi/cgi_main.c Mon Jun 19 11:39:02 2006 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.6 2006/06/17 11:08:05 nlopess Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.7 2006/06/19 11:39:02 tony2001 Exp $ */ #include php.h #include php_globals.h @@ -387,9 +387,11 @@ static char *_sapi_cgibin_putenv(char *name, char *value TSRMLS_DC) { int name_len; +#if !HAVE_SETENV || !HAVE_UNSETENV int len; char *buf; - +#endif + if (!name) { return NULL; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c
tony2001Mon Jun 19 17:49:26 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c Log: MFH: plug leak in CGI SAPI when running scripts with query string in console http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.7r2=1.267.2.15.2.8diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.7 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.8 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.7 Mon Jun 19 11:39:02 2006 +++ php-src/sapi/cgi/cgi_main.c Mon Jun 19 17:49:26 2006 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.7 2006/06/19 11:39:02 tony2001 Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.8 2006/06/19 17:49:26 tony2001 Exp $ */ #include php.h #include php_globals.h @@ -973,6 +973,7 @@ */ int main(int argc, char *argv[]) { + int free_query_string = 0; int exit_status = SUCCESS; int cgi = 0, c, i, len; zend_file_handle file_handle; @@ -1503,7 +1504,7 @@ len += strlen(argv[i]) + 1; } - s = malloc(len + 1);/* leak - but only for command line version, so ok */ + s = malloc(len + 1); *s = '\0'; /* we are pretending it came from the environment */ for (i = php_optind, len = 0; i argc; i++) { strcat(s, argv[i]); @@ -1512,6 +1513,7 @@ } } SG(request_info).query_string = s; + free_query_string = 1; } } /* end !cgi !fastcgi */ @@ -1671,6 +1673,11 @@ free(SG(request_info).path_translated); SG(request_info).path_translated = NULL; } + if (free_query_string SG(request_info).query_string) { + free(SG(request_info).query_string); + SG(request_info).query_string = NULL; + } + } #if PHP_FASTCGI -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c /sapi/cli php_cli.c
johannesSat Jun 3 22:02:02 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cli php_cli.c /php-src/sapi/cgi cgi_main.c Log: MFH http://cvs.php.net/viewcvs.cgi/php-src/sapi/cli/php_cli.c?r1=1.129.2.13.2.2r2=1.129.2.13.2.3diff_format=u Index: php-src/sapi/cli/php_cli.c diff -u php-src/sapi/cli/php_cli.c:1.129.2.13.2.2 php-src/sapi/cli/php_cli.c:1.129.2.13.2.3 --- php-src/sapi/cli/php_cli.c:1.129.2.13.2.2 Thu May 11 22:10:31 2006 +++ php-src/sapi/cli/php_cli.c Sat Jun 3 22:02:02 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_cli.c,v 1.129.2.13.2.2 2006/05/11 22:10:31 dmitry Exp $ */ +/* $Id: php_cli.c,v 1.129.2.13.2.3 2006/06/03 22:02:02 johannes Exp $ */ #include php.h #include php_globals.h @@ -122,7 +122,6 @@ {'e', 0, profile-info}, {'F', 1, process-file}, {'f', 1, file}, - {'g', 1, global}, {'h', 0, help}, {'i', 0, info}, {'l', 0, syntax-check}, @@ -415,7 +414,7 @@ -n No php.ini file will be used\n -d foo[=bar] Define INI entry foo with value 'bar'\n -e Generate extended information for debugger/profiler\n - -f fileParse file.\n + -f fileParse and execute file.\n -h This help\n -i PHP information\n -l Syntax check only (lint)\n @@ -467,21 +466,6 @@ } -static void php_register_command_line_global_vars(char **arg TSRMLS_DC) -{ - char *var, *val; - - var = *arg; - val = strchr(var, '='); - if (!val) { - printf(No value specified for variable '%s'\n, var); - } else { - *val++ = '\0'; - php_register_variable(var, val, NULL TSRMLS_CC); - } - efree(*arg); -} - static php_stream *s_in_process = NULL; static void cli_register_file_handles(TSRMLS_D) @@ -591,7 +575,6 @@ char *orig_optarg=php_optarg; char *arg_free=NULL, **arg_excp=arg_free; char *script_file=NULL; - zend_llist global_vars; int interactive=0; int module_started = 0; int lineno = 0; @@ -690,8 +673,6 @@ module_started = 1; zend_first_try { - zend_llist_init(global_vars, sizeof(char *), NULL, 0); - zend_uv.html_errors = 0; /* tell the engine we're in non-html mode */ CG(in_compilation) = 0; /* not initialized but needed for several options */ EG(uninitialized_zval_ptr) = NULL; @@ -786,12 +767,11 @@ case 'a': /* interactive mode */ if (!interactive) { -#if (HAVE_LIBREADLINE || HAVE_LIBEDIT) !defined(COMPILE_DL_READLINE) - printf(Interactive shell\n\n); -#else - printf(Interactive mode enabled\n\n); -#endif - fflush(stdout); + if (behavior != PHP_MODE_STANDARD) { + param_error = param_mode_conflict; + break; + } + interactive=1; } break; @@ -829,14 +809,6 @@ script_file = php_optarg; break; - case 'g': /* define global variables on command line */ - { - char *arg = estrdup(php_optarg); - - zend_llist_add_element(global_vars, arg); - } - break; - case 'l': /* syntax check mode */ if (behavior != PHP_MODE_STANDARD) { break; @@ -864,7 +836,7 @@ param_error = You can use -r only once.\n; break; } - } else if (behavior != PHP_MODE_STANDARD) { + } else if (behavior != PHP_MODE_STANDARD || interactive) { param_error = param_mode_conflict; break; } @@ -892,7 +864,7 @@ param_error = You can use -B only once.\n;
Re: [PHP-CVS] cvs: php-src(PHP_5_2) /sapi/cgi cgi_main.c /sapi/cli php_cli.c
Hey, I must have missed the discussion around this one. Why is it useless? How long has this feature existed? Thx. Andi At 03:02 PM 6/3/2006, Johannes Schlüter wrote: johannesSat Jun 3 22:02:02 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cli php_cli.c /php-src/sapi/cgi cgi_main.c Log: MFH -- 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: php-src(PHP_5_2) /sapi/cgi cgi_main.c fastcgi.c fastcgi.h
dmitry Mon May 15 14:30:32 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c fastcgi.c fastcgi.h Log: - Removed source compatibility with libfcgi - Optimized access to FastCGI environment using HashTable instead of linear search - Allowed PHP_FCGI_MAX_REQUESTS=0 to disable PHP die - Allowed PHP_FCGI_CHILDREN=0 to disable PHP spawn workers http://cvs.php.net/viewcvs.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15r2=1.267.2.15.2.1diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.1 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15 Wed May 3 19:40:58 2006 +++ php-src/sapi/cgi/cgi_main.c Mon May 15 14:30:31 2006 @@ -17,10 +17,11 @@ | Zeev Suraski [EMAIL PROTECTED]| | FastCGI: Ben Mansell [EMAIL PROTECTED] | | Shane Caraveo [EMAIL PROTECTED] | + | Dmitry Stogov [EMAIL PROTECTED] | +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15 2006/05/03 19:40:58 tony2001 Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.1 2006/05/15 14:30:31 dmitry Exp $ */ #include php.h #include php_globals.h @@ -81,9 +82,8 @@ #if PHP_FASTCGI #include fastcgi.h -#ifdef PHP_WIN32 -extern int OS_SetImpersonate(void); -#else + +#ifndef PHP_WIN32 /* XXX this will need to change later when threaded fastcgi is implemented. shane */ struct sigaction act, old_term, old_quit, old_int; @@ -234,9 +234,9 @@ #endif #if PHP_FASTCGI - if (!FCGX_IsCGI()) { - FCGX_Request *request = (FCGX_Request *) SG(server_context); - long ret = FCGX_PutStr(str, str_length, request-out); + if (fcgi_is_fastcgi()) { + fcgi_request *request = (fcgi_request*) SG(server_context); + long ret = fcgi_write(request, FCGI_STDOUT, str, str_length); if (ret = 0) { return 0; } @@ -276,13 +276,13 @@ static void sapi_cgibin_flush(void *server_context) { #if PHP_FASTCGI - if (!FCGX_IsCGI()) { - FCGX_Request *request = (FCGX_Request *) server_context; + if (fcgi_is_fastcgi()) { + fcgi_request *request = (fcgi_request*) server_context; if ( #ifndef PHP_WIN32 !parent #endif - request FCGX_FFlush(request-out) == -1) { + request fcgi_flush(request, 0) == -1) { php_handle_aborted_connection(); } return; @@ -349,9 +349,9 @@ count_bytes = MIN(count_bytes, (uint) SG(request_info).content_length - SG(read_post_bytes)); while (read_bytes count_bytes) { #if PHP_FASTCGI - if (!FCGX_IsCGI()) { - FCGX_Request *request = (FCGX_Request *) SG(server_context); - tmp_read_bytes = FCGX_GetStr(pos, count_bytes - read_bytes, request-in); + if (fcgi_is_fastcgi()) { + fcgi_request *request = (fcgi_request*) SG(server_context); + tmp_read_bytes = fcgi_read(request, pos, count_bytes - read_bytes); pos += tmp_read_bytes; } else { tmp_read_bytes = read(0, buffer + read_bytes, count_bytes - read_bytes); @@ -375,9 +375,9 @@ is provided to PHP. It is always sent to PHP at the start of a request. So we have to do our own lookup to get env vars. This could probably be faster somehow. */ - if (!FCGX_IsCGI()) { - FCGX_Request *request = (FCGX_Request *) SG(server_context); - return FCGX_GetParam(name,request-envp); + if (fcgi_is_fastcgi()) { + fcgi_request *request = (fcgi_request*) SG(server_context); + return fcgi_getenv(request, name, name_len); } #endif /* if cgi, or fastcgi and not found in fcgi env @@ -387,31 +387,23 @@ static char *_sapi_cgibin_putenv(char *name, char *value TSRMLS_DC) { - int len = 0; - char *buf = NULL; + int name_len; + int len; + char *buf; + if (!name) { return NULL; } - len = strlen(name) + (value ? strlen(value) : 0) + sizeof(=) + 2; - buf = (char *) malloc(len); - if (buf == NULL) { - return getenv(name); - } - if (value) { - snprintf(buf, len - 1, %s=%s, name, value); - } else { - snprintf(buf, len - 1, %s=, name); - } + name_len = strlen(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 of a request. So we have to do