[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /sapi/cgi cgi_main.c
dsp Tue Jun 9 13:29:40 2009 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c /php-srcNEWS Log: Fix bug #47042 (cgi sapi is incorrectly removing the SCRIPT_FILENAME for non apache). The fix was provided by Sriram Natarajan. http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.70&r2=1.267.2.15.2.71&diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u 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.71 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.70 Thu Jun 4 11:53:38 2009 +++ php-src/sapi/cgi/cgi_main.c Tue Jun 9 13:29:39 2009 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.70 2009/06/04 11:53:38 jani Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.71 2009/06/09 13:29:39 dsp Exp $ */ #include "php.h" #include "php_globals.h" @@ -964,7 +964,8 @@ } if (env_path_translated != NULL && env_redirect_url != NULL && - orig_script_filename != NULL && script_path_translated != NULL) { + env_path_translated != script_path_translated && + strcmp(env_path_translated, script_path_translated) != 0) { /* pretty much apache specific. If we have a redirect_url then our script_filename and script_name point to the http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1548&r2=1.2027.2.547.2.1549&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.1548 php-src/NEWS:1.2027.2.547.2.1549 --- php-src/NEWS:1.2027.2.547.2.1548Tue Jun 9 12:16:31 2009 +++ php-src/NEWSTue Jun 9 13:29:39 2009 @@ -34,6 +34,8 @@ (Nuno, Scott) - Fixed bug #42143 (The constant NAN is reported as 0 on Windows) (Kanwaljeet Singla, Venkat Raman Don) +- Fixed bug #47042 (cgi sapi is incorrectly removing SCRIPT_FILENAME). + (Sriram Natarajan, David Soria Parra) 27 May 2009, PHP 5.2.10RC1 -- 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) / NEWS /sapi/cgi cgi_main.c
dsp Fri Jan 9 22:14:20 2009 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/sapi/cgi cgi_main.c Log: MFH: Fixed bug #47042 (PHP cgi sapi is removing SCRIPT_FILENAME for non apache). http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1386&r2=1.2027.2.547.2.1387&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.1386 php-src/NEWS:1.2027.2.547.2.1387 --- php-src/NEWS:1.2027.2.547.2.1386Fri Jan 9 07:17:57 2009 +++ php-src/NEWSFri Jan 9 22:14:20 2009 @@ -15,6 +15,8 @@ APA Laboratory (Fixes CVE-2008-5498). (Scott) - Fixed a segfault when malformed string is passed to json_decode(). (Scott) +- Fixed bug #47042 (PHP cgi sapi is removing SCRIPT_FILENAME for non apache). + (Sriram Natarajan) - Fixed bug #47037 (No error when using fopen with empty string). (Cristian Rodriguez R., Felipe) - Fixed bug #47035 (dns_get_record returns a garbage byte at the end of a TXT http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.67&r2=1.267.2.15.2.68&diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.67 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.67 Wed Dec 31 11:17:48 2008 +++ php-src/sapi/cgi/cgi_main.c Fri Jan 9 22:14:20 2009 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.67 2008/12/31 11:17:48 sebastian Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.68 2009/01/09 22:14:20 dsp Exp $ */ #include "php.h" #include "php_globals.h" @@ -960,7 +960,9 @@ TRANSLATE_SLASHES(env_document_root); } - if (env_path_translated != NULL && env_redirect_url != NULL) { + 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) { /* 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) / NEWS /sapi/cgi cgi_main.c
dmitry Fri Nov 28 11:56:50 2008 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/sapi/cgi cgi_main.c Log: Fixed bug #46366 (bad cwd with / as pathinfo) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1339&r2=1.2027.2.547.2.1340&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.1339 php-src/NEWS:1.2027.2.547.2.1340 --- php-src/NEWS:1.2027.2.547.2.1339Thu Nov 27 23:51:45 2008 +++ php-src/NEWSFri Nov 28 11:56:50 2008 @@ -1,6 +1,7 @@ PHPNEWS ||| ?? Dec 2008, PHP 5.2.7 +- Fixed bug #46366 (bad cwd with / as pathinfo). (Dmitry) 27 Nov 2008, PHP 5.2.7RC5 - Upgraded PCRE to version 7.8 (Fixes CVE-2008-2371) (Ilia) http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.65&r2=1.267.2.15.2.66&diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u 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.66 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.65 Sat Nov 8 22:45:29 2008 +++ php-src/sapi/cgi/cgi_main.c Fri Nov 28 11:56:50 2008 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.65 2008/11/08 22:45:29 rasmus Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.66 2008/11/28 11:56:50 dmitry Exp $ */ #include "php.h" #include "php_globals.h" @@ -985,6 +985,9 @@ if (script_path_translated && (script_path_translated_len = strlen(script_path_translated)) > 0 && (script_path_translated[script_path_translated_len-1] == '/' || +#ifdef PHP_WIN32 + script_path_translated[script_path_translated_len-1] == '\\' || +#endif (real_path = tsrm_realpath(script_path_translated, NULL TSRMLS_CC)) == NULL)) { char *pt = estrndup(script_path_translated, script_path_translated_len); int len = script_path_translated_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) / NEWS /sapi/cgi cgi_main.c /sapi/cli php_cli.c
lbarnaudMon Nov 3 23:26:24 2008 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/sapi/cgi cgi_main.c /php-src/sapi/cli php_cli.c Log: Fixed bug #46379 (Infinite loop when parsing '#' in one line file) # PHP_5_2 only http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1298&r2=1.2027.2.547.2.1299&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.1298 php-src/NEWS:1.2027.2.547.2.1299 --- php-src/NEWS:1.2027.2.547.2.1298Mon Nov 3 20:55:01 2008 +++ php-src/NEWSMon Nov 3 23:26:23 2008 @@ -11,6 +11,7 @@ - Fixed bug #46406 (Unregistering nodeclass throws E_FATAL). (Rob) - Fixed bug #46389 (NetWare needs small patch for _timezone). (patch by [EMAIL PROTECTED]) +- Fixed bug #46379 (Infinite loop when parsing '#' in one line file). (Arnaud) - Fixed bug #46388 (stream_notification_callback inside of object destroys object variables). (Felipe) - Fixed bug #46381 (wrong $this passed to internal methods causes segfault). http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.63&r2=1.267.2.15.2.64&diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.63 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.63 Tue Oct 21 16:43:59 2008 +++ php-src/sapi/cgi/cgi_main.c Mon Nov 3 23:26:23 2008 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.63 2008/10/21 16:43:59 lbarnaud Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.64 2008/11/03 23:26:23 lbarnaud Exp $ */ #include "php.h" #include "php_globals.h" @@ -1964,7 +1964,7 @@ /* #!php support */ c = fgetc(file_handle.handle.fp); if (c == '#') { - while (c != '\n' && c != '\r') { + while (c != '\n' && c != '\r' && c != EOF) { c = fgetc(file_handle.handle.fp); /* skip to end of line */ } /* handle situations where line is terminated by \r\n */ http://cvs.php.net/viewvc.cgi/php-src/sapi/cli/php_cli.c?r1=1.129.2.13.2.27&r2=1.129.2.13.2.28&diff_format=u Index: php-src/sapi/cli/php_cli.c diff -u php-src/sapi/cli/php_cli.c:1.129.2.13.2.27 php-src/sapi/cli/php_cli.c:1.129.2.13.2.28 --- php-src/sapi/cli/php_cli.c:1.129.2.13.2.27 Wed Aug 13 01:01:29 2008 +++ php-src/sapi/cli/php_cli.c Mon Nov 3 23:26:24 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_cli.c,v 1.129.2.13.2.27 2008/08/13 01:01:29 jani Exp $ */ +/* $Id: php_cli.c,v 1.129.2.13.2.28 2008/11/03 23:26:24 lbarnaud Exp $ */ #include "php.h" #include "php_globals.h" @@ -562,7 +562,7 @@ /* #!php support */ c = fgetc(file_handle->handle.fp); if (c == '#') { - while (c != '\n' && c != '\r') { + while (c != '\n' && c != '\r' && c != EOF) { c = fgetc(file_handle->handle.fp); /* skip to end of line */ } /* handle situations where line is terminated by \r\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) / NEWS /sapi/cgi cgi_main.c fastcgi.c fastcgi.h
lbarnaudTue Oct 21 16:44:00 2008 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/sapi/cgi cgi_main.c fastcgi.c fastcgi.h Log: MFH: Fixed FCGI_GET_VALUES requests (fixes #45522) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1268&r2=1.2027.2.547.2.1269&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.1268 php-src/NEWS:1.2027.2.547.2.1269 --- php-src/NEWS:1.2027.2.547.2.1268Mon Oct 20 23:23:45 2008 +++ php-src/NEWSTue Oct 21 16:43:59 2008 @@ -24,7 +24,9 @@ (chsc at peytz dot dk, Felipe) - Fixed bug #46026 (bzip2.decompress/zlib.inflate filter tries to decompress after end of stream). (Keisial at gmail dot com, Greg) -- Fixed buf #45722 (mb_check_encoding() crashes). (Moriyoshi) +- Fixed bug #45722 (mb_check_encoding() crashes). (Moriyoshi) +- Fixed bug #45522 (FCGI_GET_VALUES request does not return supplied values). + (Arnaud) - Fixed bug #44251, #41125 (PDO + quote() + prepare() can result in segfault). (tsteiner at nerdclub dot net) - Fixed bug #43723 (SOAP not sent properly from client for ). (Dmitry) http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.62&r2=1.267.2.15.2.63&diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.62 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.63 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.62 Fri Oct 17 01:32:59 2008 +++ php-src/sapi/cgi/cgi_main.c Tue Oct 21 16:43:59 2008 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.62 2008/10/17 01:32:59 iliaa Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.63 2008/10/21 16:43:59 lbarnaud Exp $ */ #include "php.h" #include "php_globals.h" @@ -1545,11 +1545,18 @@ #ifndef PHP_WIN32 /* Pre-fork, if required */ if (getenv("PHP_FCGI_CHILDREN")) { - children = atoi(getenv("PHP_FCGI_CHILDREN")); + char * children_str = getenv("PHP_FCGI_CHILDREN"); + children = atoi(children_str); if (children < 0) { fprintf(stderr, "PHP_FCGI_CHILDREN is not valid\n"); return FAILURE; } + fcgi_set_mgmt_var("FCGI_MAX_CONNS", sizeof("FCGI_MAX_CONNS")-1, children_str, strlen(children_str)); + /* This is the number of concurrent requests, equals FCGI_MAX_CONNS */ + fcgi_set_mgmt_var("FCGI_MAX_REQS", sizeof("FCGI_MAX_REQS")-1, children_str, strlen(children_str)); + } else { + fcgi_set_mgmt_var("FCGI_MAX_CONNS", sizeof("FCGI_MAX_CONNS")-1, "1", sizeof("1")-1); + fcgi_set_mgmt_var("FCGI_MAX_REQS", sizeof("FCGI_MAX_REQS")-1, "1", sizeof("1")-1); } if (children) { http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/fastcgi.c?r1=1.4.2.13.2.31&r2=1.4.2.13.2.32&diff_format=u Index: php-src/sapi/cgi/fastcgi.c diff -u php-src/sapi/cgi/fastcgi.c:1.4.2.13.2.31 php-src/sapi/cgi/fastcgi.c:1.4.2.13.2.32 --- php-src/sapi/cgi/fastcgi.c:1.4.2.13.2.31Tue Jul 15 13:10:07 2008 +++ php-src/sapi/cgi/fastcgi.c Tue Oct 21 16:43:59 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: fastcgi.c,v 1.4.2.13.2.31 2008/07/15 13:10:07 dmitry Exp $ */ +/* $Id: fastcgi.c,v 1.4.2.13.2.32 2008/10/21 16:43:59 lbarnaud Exp $ */ #include "php.h" #include "fastcgi.h" @@ -133,18 +133,7 @@ struct sockaddr_in sa_inet; } sa_t; -typedef struct _fcgi_mgmt_rec { - char* name; - char name_len; - char val; -} fcgi_mgmt_rec; - -static const fcgi_mgmt_rec fcgi_mgmt_vars[] = { - {"FCGI_MAX_CONNS", sizeof("FCGI_MAX_CONNS")-1, 1}, - {"FCGI_MAX_REQS", sizeof("FCGI_MAX_REQS")-1, 1}, - {"FCGI_MPXS_CONNS", sizeof("FCGI_MPXS_CONNS")-1, 0} -}; - +static HashTable fcgi_mgmt_vars; static int is_initialized = 0; static int is_fastcgi = 0; @@ -194,6 +183,8 @@ int fcgi_init(void) { if (!is_initialized) { + zend_hash_init(&fcgi_mgmt_vars, 0, NULL, fcgi_free_mgmt_var_cb, 1); + fcgi_set_mgmt_var("FCGI_MPXS_CONNS", sizeof("FCGI_MPXS_CONNS")-1, "0", sizeof("0")-1); #ifdef _WIN32 # if 0 /* TODO: Support for TCP sockets */ @@ -260,6 +251,9 @@ void fcgi_shutdown(void) { + if (is_initialized) { + zend_hash_destroy(&fcgi_mgmt_vars); + } is_fastcgi = 0; } @@ -748,8 +742,13 @@ padding = hdr.paddingLength; } } else if (hdr.type == FCGI_GET_VALUES) { - int j; unsigned char *p = buf + sizeof(fcgi_header); + HashPosition pos; + char * str_index; + uint str_length; + ulong num_index; + int key_type; + zval ** value; if (safe_read
[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /sapi/cgi cgi_main.c
iliaa Fri Oct 17 01:32:59 2008 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c /php-srcNEWS Log: MFB: Fixed bug #46319 (PHP sets default Content-Type header for HTTP 304 response code, in cgi sapi) http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.61&r2=1.267.2.15.2.62&diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.61 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.62 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.61 Tue Sep 2 13:22:00 2008 +++ php-src/sapi/cgi/cgi_main.c Fri Oct 17 01:32:59 2008 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.61 2008/09/02 13:22:00 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.62 2008/10/17 01:32:59 iliaa Exp $ */ #include "php.h" #include "php_globals.h" @@ -370,6 +370,7 @@ sapi_header_struct *h; zend_llist_position pos; zend_bool ignore_status = 0; + int response_status = SG(sapi_headers).http_response_code; if (SG(request_info).no_headers == 1) { return SAPI_HEADER_SENT_SUCCESSFULLY; @@ -381,8 +382,11 @@ zend_bool has_status = 0; if (CGIG(rfc2616_headers) && SG(sapi_headers).http_status_line) { - len = slprintf(buf, SAPI_CGI_MAX_HEADER_LENGTH, - "%s\r\n", SG(sapi_headers).http_status_line); + char *s; + len = slprintf(buf, SAPI_CGI_MAX_HEADER_LENGTH, "%s\r\n", SG(sapi_headers).http_status_line); + if ((s = strchr(SG(sapi_headers).http_status_line, ' '))) { + response_status = atoi((s + 1)); + } if (len > SAPI_CGI_MAX_HEADER_LENGTH) { len = SAPI_CGI_MAX_HEADER_LENGTH; @@ -396,6 +400,7 @@ (s - SG(sapi_headers).http_status_line) >= 5 && strncasecmp(SG(sapi_headers).http_status_line, "HTTP/", 5) == 0) { len = slprintf(buf, sizeof(buf), "Status:%s\r\n", s); + response_status = atoi((s + 1)); } else { h = (sapi_header_struct*)zend_llist_get_first_ex(&sapi_headers->headers, &pos); while (h) { @@ -440,6 +445,9 @@ PHPWRITE_H(h->header, h->header_len); PHPWRITE_H("\r\n", 2); } + } else if (response_status == 304 && h->header_len > sizeof("Content-Type:")-1 && + strncasecmp(h->header, "Content-Type:", sizeof("Content-Type:")-1) == 0) { + continue; } else { PHPWRITE_H(h->header, h->header_len); PHPWRITE_H("\r\n", 2); http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1261&r2=1.2027.2.547.2.1262&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.1261 php-src/NEWS:1.2027.2.547.2.1262 --- php-src/NEWS:1.2027.2.547.2.1261Thu Oct 16 16:20:52 2008 +++ php-src/NEWSFri Oct 17 01:32:59 2008 @@ -1,6 +1,8 @@ PHPNEWS ||| ?? Oct 2008, PHP 5.2.7RC2 +- Fixed bug #46319 (PHP sets default Content-Type header for HTTP 304 + response code, in cgi sapi). (Ilia) - Fixed bug #46292 (PDO::setFetchMode() shouldn't requires the 2nd arg when using FETCH_CLASSTYPE). (Felipe) - Fixed bug #46274, #46249 (pdo_pgsql always fill in NULL for empty BLOB and -- 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) / NEWS /sapi/cgi cgi_main.c /sapi/cgi/tests 010.phpt
dmitry Tue Sep 2 13:22:00 2008 UTC Added files: (Branch: PHP_5_2) /php-src/sapi/cgi/tests 010.phpt Modified files: /php-srcNEWS /php-src/sapi/cgi cgi_main.c Log: Fixed bug #45860 (header() function fails to correctly replace all Status lines) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1211&r2=1.2027.2.547.2.1212&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.1211 php-src/NEWS:1.2027.2.547.2.1212 --- php-src/NEWS:1.2027.2.547.2.1211Tue Sep 2 09:45:36 2008 +++ php-src/NEWSTue Sep 2 13:21:59 2008 @@ -23,6 +23,8 @@ in parsed file). (Jani) - Fixed bug #45862 (get_class_vars is inconsistent with 'protected' and 'private' variables). (ilewis at uk dot ibm dot com, Felipe) +- Fixed bug #45860 (header() function fails to correctly replace all Status + lines). (Dmitry) - Fixed bug #45805 (Crash on throwing exception from error handler). (Dmitry) - Fixed bug #45765 (ReflectionObject with default parameters of self::xxx cause an error). (Felipe) http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.60&r2=1.267.2.15.2.61&diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u 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.61 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.60 Fri Aug 15 07:30:31 2008 +++ php-src/sapi/cgi/cgi_main.c Tue Sep 2 13:22:00 2008 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.60 2008/08/15 07:30:31 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.61 2008/09/02 13:22:00 dmitry Exp $ */ #include "php.h" #include "php_globals.h" @@ -369,6 +369,7 @@ char buf[SAPI_CGI_MAX_HEADER_LENGTH]; sapi_header_struct *h; zend_llist_position pos; + zend_bool ignore_status = 0; if (SG(request_info).no_headers == 1) { return SAPI_HEADER_SENT_SUCCESSFULLY; @@ -424,6 +425,7 @@ } if (!has_status) { PHPWRITE_H(buf, len); + ignore_status = 1; } } @@ -431,8 +433,17 @@ while (h) { /* prevent CRLFCRLF */ if (h->header_len) { - PHPWRITE_H(h->header, h->header_len); - PHPWRITE_H("\r\n", 2); + if (h->header_len > sizeof("Status:")-1 && + strncasecmp(h->header, "Status:", sizeof("Status:")-1) == 0) { + if (!ignore_status) { + ignore_status = 1; + PHPWRITE_H(h->header, h->header_len); + PHPWRITE_H("\r\n", 2); + } + } else { + PHPWRITE_H(h->header, h->header_len); + PHPWRITE_H("\r\n", 2); + } } h = (sapi_header_struct*)zend_llist_get_next_ex(&sapi_headers->headers, &pos); } http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/tests/010.phpt?view=markup&rev=1.1 Index: php-src/sapi/cgi/tests/010.phpt +++ php-src/sapi/cgi/tests/010.phpt -- 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) / NEWS /sapi/cgi cgi_main.c
dmitry Tue Jul 15 13:38:29 2008 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/sapi/cgi cgi_main.c Log: Fixed bug #45151 (Crash with URI/file..php (filename contains 2 dots)) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1173&r2=1.2027.2.547.2.1174&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.1173 php-src/NEWS:1.2027.2.547.2.1174 --- php-src/NEWS:1.2027.2.547.2.1173Tue Jul 15 13:16:25 2008 +++ php-src/NEWSTue Jul 15 13:38:29 2008 @@ -26,6 +26,8 @@ - Fixed bug #45251 (double free or corruption with setAttributeNode()). (Rob) - Fixed bug #45220 (curl_read callback returns -1 when needs to return size_t (unsigned)). (Felipe) +- Fixed bug #45151 (Crash with URI/file..php (filename contains 2 dots)). + (Dmitry) - Fixed bug #45139 (ReflectionProperty returns incorrect declaring class). (Felipe) - Fixed bug #45004 (pg_insert() does not accept 4 digit timezone format). http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.57&r2=1.267.2.15.2.58&diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.57 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.58 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.57 Tue Jul 15 13:10:07 2008 +++ php-src/sapi/cgi/cgi_main.c Tue Jul 15 13:38:29 2008 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.57 2008/07/15 13:10:07 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.58 2008/07/15 13:38:29 dmitry Exp $ */ #include "php.h" #include "php_globals.h" @@ -771,6 +771,39 @@ } /* }}} */ +/* {{{ is_valid_path + * + * some server configurations allow '..' to slip through in the + * translated path. We'll just refuse to handle such a path. + */ +static int is_valid_path(const char *path) +{ + const char *p; + + if (!path) { + return 0; + } + p = strstr(path, ".."); + if (p) { + if ((p == path || IS_SLASH(*(p-1))) && + (*(p+2) == 0 || IS_SLASH(*(p+2 { + return 0; + } + while (1) { + p = strstr(p+1, ".."); + if (!p) { + break; + } + if (IS_SLASH(*(p-1)) && + (*(p+2) == 0 || IS_SLASH(*(p+2 { + return 0; + } + } + } + return 1; +} +/* }}} */ + /* {{{ init_request_info initializes request_info structure @@ -1067,9 +1100,7 @@ if (pt) { efree(pt); } - /* 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, "..")) { + if (is_valid_path(script_path_translated)) { SG(request_info).path_translated = estrdup(script_path_translated); } } else { @@ -1100,9 +1131,7 @@ } else { SG(request_info).request_uri = env_script_name; } - /* 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, "..")) { + if (is_valid_path(script_path_translated)) { SG(request_info).path_translated = estrdup(script_path_translated); } free(real_path); @@ -1120,9 +1149,7 @@ script_path_translated = env_path_translated; } #endif - /* 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, "..")) { + if (is_valid_path(script_path_translated)) { SG(request_info).path_translated = estrdup(script_path_translated); } #if ENABLE_PATHINFO_CHECK -- 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) / NEWS /sapi/cgi cgi_main.c fastcgi.c
dmitry Tue Jul 15 13:10:07 2008 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/sapi/cgi cgi_main.c fastcgi.c Log: Fixed bug #45423 (fastcgi parent process doesn't invoke php_module_shutdown before shutdown) (basant dot kukreja at sun dot com) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1171&r2=1.2027.2.547.2.1172&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.1171 php-src/NEWS:1.2027.2.547.2.1172 --- php-src/NEWS:1.2027.2.547.2.1171Sat Jul 12 21:14:57 2008 +++ php-src/NEWSTue Jul 15 13:10:07 2008 @@ -13,6 +13,8 @@ accept lengths of 1024). (Felipe, andrew at lifescale dot com) - Fixed bug #45449 (filesize() regression using ftp wrapper). (crrodriguez at suse dot de) +- Fixed bug #45423 (fastcgi parent process doesn't invoke php_module_shutdown + before shutdown) (basant dot kukreja at sun dot com) - Fixed bug #45352 (Segmentation fault because of tick function on second request). (Dmitry) - Fixed bug #45312 (Segmentation fault on second request for array functions). http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.56&r2=1.267.2.15.2.57&diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.56 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.57 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.56 Wed Apr 9 09:16:40 2008 +++ php-src/sapi/cgi/cgi_main.c Tue Jul 15 13:10:07 2008 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.56 2008/04/09 09:16:40 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.57 2008/07/15 13:10:07 dmitry Exp $ */ #include "php.h" #include "php_globals.h" @@ -103,6 +103,12 @@ */ static int parent = 1; +/* Did parent received exit signals SIG_TERM/SIG_INT/SIG_QUIT */ +static int exit_signal = 0; + +/* Is Parent waiting for children to exit */ +static int parent_waiting = 0; + /** * Process group */ @@ -1135,7 +1141,7 @@ } /* }}} */ -#if PHP_FASTCGI +#if PHP_FASTCGI && !defined(PHP_WIN32) /** * Clean up child processes upon exit */ @@ -1145,15 +1151,16 @@ fprintf(stderr, "FastCGI shutdown, pid %d\n", getpid()); #endif -#ifndef PHP_WIN32 sigaction(SIGTERM, &old_term, 0); /* Kill all the processes in our process group */ kill(-pgroup, SIGTERM); -#endif - /* We should exit at this point, but MacOSX doesn't seem to */ - exit(0); + if (parent && parent_waiting) { + exit_signal = 1; + } else { + exit(0); + } } #endif @@ -1520,7 +1527,7 @@ } if (fcgi_in_shutdown()) { - exit(0); + goto parent_out; } while (parent) { @@ -1557,9 +1564,25 @@ #ifdef DEBUG_FASTCGI fprintf(stderr, "Wait for kids, pid %d\n", getpid()); #endif - while (wait(&status) < 0) { + parent_waiting = 1; + while (1) { + if (wait(&status) >= 0) { + running--; + break; + } else if (exit_signal) { + break; + } + } + if (exit_signal) { +#if 0 + while (running > 0) { + while (wait(&status) < 0) { + } + running--; + } +#endif + goto parent_out; } - running--; } } } else { @@ -2061,6 +2084,10 @@ } #endif +#ifndef PHP_WIN32 +parent_out: +#endif + SG(server_context) = NULL; php_module_shutdown(TSRMLS_C); sapi_shutdown(); http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/fastcgi.c?r1=1.4.2.13.2.30&r2=1.4.2.13.2.31&diff_format=u Index: php-src/sapi/cgi/fastcgi.c diff -u php-src/sapi/cgi/fastcgi.c:1.4.2.13.2.30 php-src/sapi/cgi/fastcgi.c:1.4.2.13.2.31 --- php-src/sapi/cgi/fastcgi.c:1.4.2.13.2.30Thu Apr 3 10:24:44 2008 +++ php-src/sapi/cgi/fastcgi.c Tue Jul 15 13:10:07 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: fastcgi.c,v 1.4.2.13.2.30 2008/04/03 10:24:44 dmitry Exp $ */ +/* $Id: fastcgi.c,v 1.4.2.13.2.31 2008/07/15 13:10:07 dmitry Exp $ */ #include "php.h" #include "fastcgi.h" @@ -170,6 +170,20 @@
[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /sapi/cgi cgi_main.c
dmitry Wed Apr 9 09:16:40 2008 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/sapi/cgi cgi_main.c Log: Fixed bug #44673 (With CGI argv/argc starts from arguments, not from script) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1137&r2=1.2027.2.547.2.1138&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.1137 php-src/NEWS:1.2027.2.547.2.1138 --- php-src/NEWS:1.2027.2.547.2.1137Tue Apr 8 17:17:07 2008 +++ php-src/NEWSWed Apr 9 09:16:39 2008 @@ -1,6 +1,8 @@ PHPNEWS ||| ?? Apr 2008, PHP 5.2.6 +- Fixed bug #44673 (With CGI argv/argc starts from arguments, not from script) + (Dmitry) - Fixed bug #44667 (proc_open() does not handle pipes with the mode 'wb' correctly). (Jani) - Fixed bug #44650 (escaepshellscmd() does not check arg count). (Ilia) http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.55&r2=1.267.2.15.2.56&diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.55 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.56 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.55 Thu Feb 28 00:29:29 2008 +++ php-src/sapi/cgi/cgi_main.c Wed Apr 9 09:16:40 2008 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.55 2008/02/28 00:29:29 iliaa Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.56 2008/04/09 09:16:40 dmitry Exp $ */ #include "php.h" #include "php_globals.h" @@ -1760,7 +1760,7 @@ } else if (argc > php_optind) { /* file is on command line, but not in -f opt */ STR_FREE(SG(request_info).path_translated); - SG(request_info).path_translated = estrdup(argv[php_optind++]); + SG(request_info).path_translated = estrdup(argv[php_optind]); /* arguments after the file are considered script args */ SG(request_info).argc = argc - php_optind; SG(request_info).argv = &argv[php_optind]; -- 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) / NEWS /sapi/cgi cgi_main.c
iliaa Thu Feb 28 00:29:30 2008 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c /php-srcNEWS Log: Fixed security issue detailed in CVE-2008-0599 http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.54&r2=1.267.2.15.2.55&diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.54 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.55 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.54 Mon Dec 31 07:20:16 2007 +++ php-src/sapi/cgi/cgi_main.c Thu Feb 28 00:29:29 2008 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.54 2007/12/31 07:20:16 sebastian Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.55 2008/02/28 00:29:29 iliaa Exp $ */ #include "php.h" #include "php_globals.h" @@ -1017,7 +1017,7 @@ ) { /* 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; + 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); http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1100&r2=1.2027.2.547.2.1101&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.1100 php-src/NEWS:1.2027.2.547.2.1101 --- php-src/NEWS:1.2027.2.547.2.1100Wed Feb 27 02:04:09 2008 +++ php-src/NEWSThu Feb 28 00:29:29 2008 @@ -1,6 +1,7 @@ PHPNEWS ||| -?? ??? 2008, PHP 5.2.6 +27 Feb 2008, PHP 5.2.6RC1 +- Fixed security issue detailed in CVE-2008-0599. (Rasmus) - Fixed potential memleak in stream filter parameter for zlib filter (Greg) - Added Reflection API metadata for the methods of the DOM classes. (Sebastian) - Fixed weired behavior in CGI parameter parsing. (Dmitry, Hannes Magnusson) -- 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) / NEWS /sapi/cgi cgi_main.c
dmitry Mon Dec 3 15:08:02 2007 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/sapi/cgi cgi_main.c Log: Fixed weired behavior in CGI parameter parsing http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1023&r2=1.2027.2.547.2.1024&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.1023 php-src/NEWS:1.2027.2.547.2.1024 --- php-src/NEWS:1.2027.2.547.2.1023Mon Dec 3 14:11:09 2007 +++ php-src/NEWSMon Dec 3 15:08:01 2007 @@ -1,6 +1,8 @@ PHPNEWS ||| ?? ??? 2008, PHP 5.2.6 +- Fixed weired behavior in CGI parameter parsing. (Dmitry, Hannes Magnusson) + - Fixed bug #43482 (array_pad() does not warn on very small pad numbers). (Ilia) - Fixed bug #43457 (Prepared statement with incorrect parms doens't http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.52&r2=1.267.2.15.2.53&diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.52 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.53 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.52 Thu Nov 1 15:23:14 2007 +++ php-src/sapi/cgi/cgi_main.c Mon Dec 3 15:08:01 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.52 2007/11/01 15:23:14 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.53 2007/12/03 15:08:01 dmitry Exp $ */ #include "php.h" #include "php_globals.h" @@ -1661,12 +1661,12 @@ } script_file = estrdup(php_optarg); no_headers = 1; - /* arguments after the file are considered script args */ - SG(request_info).argc = argc - (php_optind - 1); - SG(request_info).argv = &argv[php_optind - 1]; break; case 'i': /* php info & quit */ + if (script_file) { + efree(script_file); + } if (php_request_startup(TSRMLS_C) == FAILURE) { SG(server_context) = NULL; php_module_shutdown(TSRMLS_C); @@ -1687,6 +1687,9 @@ break; case 'm': /* list compiled in modules */ + if (script_file) { + efree(script_file); + } php_output_startup(); php_output_activate(TSRMLS_C); SG(headers_sent) = 1; @@ -1710,6 +1713,9 @@ break; case 'v': /* show php version & quit */ + if (script_file) { + efree(script_file); + } no_headers = 1; if (php_request_startup(TSRMLS_C) == FAILURE) { SG(server_context) = NULL; @@ -1746,6 +1752,18 @@ /* override path_translated if -f on command line */ STR_FREE(SG(request_info).path_translated); SG(request_info).path_translated = script_file; + /* before registering argv to module exchange the *new* argv[0] */ + /* we can achieve this without allocating more memory */ + SG(request_info).argc = argc - (php_optind - 1); + SG(request_info).argv = &argv[php_optind - 1]; + SG(request_info).argv[0] = script_file; + } else if (argc > php_optind) { + /* file is on command line, but not in -f opt */ + STR_FREE(SG(request_info).path_translated); + SG(request_info).path_translated = estrdup(argv[php_optind++]); + /* arguments after the file are considered script args */ + SG(request_info).argc = argc - php_opti
[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /sapi/cgi cgi_main.c /sapi/cgi/tests 003.phpt 008.phpt
dmitry Thu Nov 1 15:23:15 2007 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/sapi/cgi cgi_main.c /php-src/sapi/cgi/tests 003.phpt 008.phpt Log: Fixed bug #42848 (Status: header incorrect under FastCGI) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.994&r2=1.2027.2.547.2.995&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.994 php-src/NEWS:1.2027.2.547.2.995 --- php-src/NEWS:1.2027.2.547.2.994 Thu Nov 1 14:10:18 2007 +++ php-src/NEWSThu Nov 1 15:23:14 2007 @@ -195,6 +195,7 @@ - Fixed PECL bug #11216 (crash in ZipArchive::addEmptyDir when a directory already exists). (Pierre) +- Fixed bug #42848 (Status: header incorrect under FastCGI). (Dmitry) - Fixed bug #42368 (Incorrect error message displayed by pg_escape_string). (Ilia) - Fixed bug #42365 (glob() crashes and/or accepts way too many flags). http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.51&r2=1.267.2.15.2.52&diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u 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.52 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.51 Wed Oct 31 18:24:42 2007 +++ php-src/sapi/cgi/cgi_main.c Thu Nov 1 15:23:14 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.51 2007/10/31 18:24:42 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.52 2007/11/01 15:23:14 dmitry Exp $ */ #include "php.h" #include "php_globals.h" @@ -311,6 +311,52 @@ #define SAPI_CGI_MAX_HEADER_LENGTH 1024 +typedef struct _http_error { + int code; + const char* msg; +} http_error; + +static const http_error http_error_codes[] = { + {100, "Continue"}, + {101, "Switching Protocols"}, + {200, "OK"}, + {201, "Created"}, + {202, "Accepted"}, + {203, "Non-Authoritative Information"}, + {204, "No Content"}, + {205, "Reset Content"}, + {206, "Partial Content"}, + {300, "Multiple Choices"}, + {301, "Moved Permanently"}, + {302, "Moved Temporarily"}, + {303, "See Other"}, + {304, "Not Modified"}, + {305, "Use Proxy"}, + {400, "Bad Request"}, + {401, "Unauthorized"}, + {402, "Payment Required"}, + {403, "Forbidden"}, + {404, "Not Found"}, + {405, "Method Not Allowed"}, + {406, "Not Acceptable"}, + {407, "Proxy Authentication Required"}, + {408, "Request Time-out"}, + {409, "Conflict"}, + {410, "Gone"}, + {411, "Length Required"}, + {412, "Precondition Failed"}, + {413, "Request Entity Too Large"}, + {414, "Request-URI Too Large"}, + {415, "Unsupported Media Type"}, + {500, "Internal Server Error"}, + {501, "Not Implemented"}, + {502, "Bad Gateway"}, + {503, "Service Unavailable"}, + {504, "Gateway Time-out"}, + {505, "HTTP Version not supported"}, + {0, NULL} +}; + static int sapi_cgi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) { char buf[SAPI_CGI_MAX_HEADER_LENGTH]; @@ -324,6 +370,7 @@ if (CGIG(nph) || SG(sapi_headers).http_response_code != 200) { int len; + zend_bool has_status = 0; if (CGIG(rfc2616_headers) && SG(sapi_headers).http_status_line) { len = slprintf(buf, SAPI_CGI_MAX_HEADER_LENGTH, @@ -342,11 +389,35 @@ strncasecmp(SG(sapi_headers).http_status_line, "HTTP/", 5) == 0) { len = slprintf(buf, sizeof(buf), "Status:%s\r\n", s); } else { - len = slprintf(buf, sizeof(buf), "Status: %d\r\n", SG(sapi_headers).http_response_code); + h = (sapi_header_struct*)zend_llist_get_first_ex(&sapi_headers->headers, &pos); + while (h) { + if (h->header_len > sizeof("Status:")-1 && + strncasecmp(h->header, "Status:", sizeof("Status:")-1) == 0) { + has_status = 1; + break; + } + h = (sapi_header_struct*)zend_llist_get_next_ex(&sapi_headers->headers, &pos); + } + if (!has_status) { + http_error *err = (http_error*)http_error_codes; + + while (err->code != 0) { + if (err->code == SG(sapi_headers).http_response_code) { + break; + } +
[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /sapi/cgi cgi_main.c
dmitry Mon Sep 24 11:40:06 2007 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/sapi/cgi cgi_main.c Log: Fixed bug #42699 (PHP_SELF duplicates path) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.961&r2=1.2027.2.547.2.962&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.961 php-src/NEWS:1.2027.2.547.2.962 --- php-src/NEWS:1.2027.2.547.2.961 Sun Sep 23 15:19:21 2007 +++ php-src/NEWSMon Sep 24 11:40:05 2007 @@ -32,6 +32,7 @@ - Fixed bug #42739 (mkdir() doesnt like a trailing slash when safe_mode is enabled). (Ilia) +- Fixed bug #42699 (PHP_SELF duplicates path). (Dmitry) - Fixed bug #42643 (CLI segfaults if using ATTR_PERSISTENT). (Ilia) - Fixed bug #42629 (Dynamically loaded PHP extensions need symbols exported on MacOSX). (jdolecek at NetBSD dot org) http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.49&r2=1.267.2.15.2.50&diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.49 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.49 Mon Sep 10 10:55:26 2007 +++ php-src/sapi/cgi/cgi_main.c Mon Sep 24 11:40:05 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.49 2007/09/10 10:55:26 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.50 2007/09/24 11:40:05 dmitry Exp $ */ #include "php.h" #include "php_globals.h" @@ -522,29 +522,44 @@ static void sapi_cgi_register_variables(zval *track_vars_array TSRMLS_DC) { - char *script_name = SG(request_info).request_uri; - unsigned int script_name_len = script_name ? strlen(script_name) : 0; - char *path_info = sapi_cgibin_getenv("PATH_INFO", sizeof("PATH_INFO")-1 TSRMLS_CC); - unsigned int path_info_len = path_info ? strlen(path_info) : 0; - unsigned int php_self_len = script_name_len + path_info_len; - char *php_self = emalloc(php_self_len + 1); - - if (script_name) { - memcpy(php_self, script_name, script_name_len + 1); - } - if (path_info) { - memcpy(php_self + script_name_len, path_info, path_info_len + 1); - } + unsigned int php_self_len; + char *php_self; /* In CGI mode, we consider the environment to be a part of the server * variables */ php_import_environment_variables(track_vars_array TSRMLS_CC); - /* Build the special-case PHP_SELF variable for the CGI version */ + +#if ENABLE_PATHINFO_CHECK + if (CGIG(fix_pathinfo)) { + char *script_name = SG(request_info).request_uri; + unsigned int script_name_len = script_name ? strlen(script_name) : 0; + char *path_info = sapi_cgibin_getenv("PATH_INFO", sizeof("PATH_INFO")-1 TSRMLS_CC); + unsigned int path_info_len = path_info ? strlen(path_info) : 0; + + php_self_len = script_name_len + path_info_len; + php_self = emalloc(php_self_len + 1); + if (script_name) { + memcpy(php_self, script_name, script_name_len + 1); + } + if (path_info) { + memcpy(php_self + script_name_len, path_info, path_info_len + 1); + } + + /* Build the special-case PHP_SELF variable for the CGI version */ + if (sapi_module.input_filter(PARSE_SERVER, "PHP_SELF", &php_self, php_self_len, &php_self_len TSRMLS_CC)) { + php_register_variable_safe("PHP_SELF", php_self, php_self_len, track_vars_array TSRMLS_CC); + } + efree(php_self); + return; + } +#endif + + php_self = SG(request_info).request_uri ? SG(request_info).request_uri : ""; + php_self_len = strlen(php_self); if (sapi_module.input_filter(PARSE_SERVER, "PHP_SELF", &php_self, php_self_len, &php_self_len TSRMLS_CC)) { php_register_variable_safe("PHP_SELF", php_self, php_self_len, track_vars_array TSRMLS_CC); } - efree(php_self); } static void sapi_cgi_log_message(char *message) -- 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) / NEWS /sapi/cgi cgi_main.c
dmitry Mon Sep 10 10:55:27 2007 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/sapi/cgi cgi_main.c Log: Fixed bug #42587 (behaviour change regarding symlinked .php files) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.938&r2=1.2027.2.547.2.939&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.938 php-src/NEWS:1.2027.2.547.2.939 --- php-src/NEWS:1.2027.2.547.2.938 Sun Sep 9 16:34:05 2007 +++ php-src/NEWSMon Sep 10 10:55:26 2007 @@ -14,6 +14,7 @@ - Fixed bug #42590 (Make the engine recornize \v and \f escape sequences). (Ilia) +- Fixed bug #42587 (behaviour change regarding symlinked .php files). (Dmitry) - Fixed bug #42579 (apache_reset_timeout() does not exist). (Jani) - Fixed bug #42549 (ext/mysql failed to compile with libmysql 3.23). (Scott) - Fixed bug #42523 (PHP_SELF duplicates path). (Dmitry) http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.48&r2=1.267.2.15.2.49&diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.48 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.49 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.48 Wed Sep 5 08:26:32 2007 +++ php-src/sapi/cgi/cgi_main.c Mon Sep 10 10:55:26 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.48 2007/09/05 08:26:32 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.49 2007/09/10 10:55:26 dmitry Exp $ */ #include "php.h" #include "php_globals.h" @@ -777,6 +777,7 @@ struct stat st; char *env_redirect_url = sapi_cgibin_getenv("REDIRECT_URL", sizeof("REDIRECT_URL")-1 TSRMLS_CC); char *env_document_root = sapi_cgibin_getenv("DOCUMENT_ROOT", sizeof("DOCUMENT_ROOT")-1 TSRMLS_CC); + int script_path_translated_len; /* Hack for buggy IIS that sets incorrect PATH_INFO */ char *env_server_software = sapi_cgibin_getenv("SERVER_SOFTWARE", sizeof("SERVER_SOFTWARE")-1 TSRMLS_CC); @@ -829,9 +830,11 @@ * this fixes url's like /info.php/test */ 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); + (script_path_translated_len = strlen(script_path_translated)) > 0 && + (script_path_translated[script_path_translated_len-1] == '/' || +(real_path = tsrm_realpath(script_path_translated, NULL TSRMLS_CC)) == NULL)) { + char *pt = estrndup(script_path_translated, script_path_translated_len); + int len = script_path_translated_len; char *ptr; while ((ptr = strrchr(pt, '/')) || (ptr = strrchr(pt, '\\'))) { @@ -971,9 +974,6 @@ SG(request_info).path_translated = estrdup(script_path_translated); } } else { - if (real_path) { - script_path_translated = real_path; - } /* make sure path_info/translated are empty */ if (!orig_script_filename || (script_path_translated != orig_script_filename && @@ -1006,9 +1006,7 @@ if (script_path_translated && !strstr(script_path_translated, "..")) { SG(request_info).path_translated = estrdup(script_path_translated); } - if (real_path) { - free(real_path); - } + free(real_path); } } else { #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) / NEWS /sapi/cgi cgi_main.c
dmitry Wed Sep 5 08:26:32 2007 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/sapi/cgi cgi_main.c Log: Fixed bug #42523 (PHP_SELF duplicates path) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.927&r2=1.2027.2.547.2.928&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.927 php-src/NEWS:1.2027.2.547.2.928 --- php-src/NEWS:1.2027.2.547.2.927 Tue Sep 4 18:51:48 2007 +++ php-src/NEWSWed Sep 5 08:26:31 2007 @@ -9,6 +9,7 @@ - Upgraded PCRE to version 7.3 (Nuno) - Added optional parameter $provide_object to debug_backtrace(). (Sebastian) +- Fixed bug #42523 (PHP_SELF duplicates path). (Dmitry) - Fixed bug #42512 (ip2long('255.255.255.255') should return 4294967295 on 64-bit PHP). (Derick) - Fixed bug #42506 (php_pgsql_convert() timezone parse bug) (nonunnet at http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.47&r2=1.267.2.15.2.48&diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.47 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.48 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.47 Fri Aug 31 12:17:52 2007 +++ php-src/sapi/cgi/cgi_main.c Wed Sep 5 08:26:32 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.47 2007/08/31 12:17:52 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.48 2007/09/05 08:26:32 dmitry Exp $ */ #include "php.h" #include "php_globals.h" @@ -778,6 +778,21 @@ char *env_redirect_url = sapi_cgibin_getenv("REDIRECT_URL", sizeof("REDIRECT_URL")-1 TSRMLS_CC); char *env_document_root = sapi_cgibin_getenv("DOCUMENT_ROOT", sizeof("DOCUMENT_ROOT")-1 TSRMLS_CC); + /* Hack for buggy IIS that sets incorrect PATH_INFO */ + char *env_server_software = sapi_cgibin_getenv("SERVER_SOFTWARE", sizeof("SERVER_SOFTWARE")-1 TSRMLS_CC); + if (env_server_software && + env_script_name && + env_path_info && + strncmp(env_server_software, "Microsoft-IIS", sizeof("Microsoft-IIS")-1) == 0 && + strncmp(env_path_info, env_script_name, strlen(env_script_name)) == 0) { + env_path_info = _sapi_cgibin_putenv("ORIG_PATH_INFO", env_path_info TSRMLS_CC); + env_path_info += strlen(env_script_name); + if (*env_path_info == 0) { + env_path_info = NULL; + } + env_path_info = _sapi_cgibin_putenv("PATH_INFO", env_path_info TSRMLS_CC); + } + if (CGIG(fix_pathinfo)) { char *real_path = NULL; char *orig_path_translated = env_path_translated; -- 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) / NEWS /sapi/cgi cgi_main.c
dmitry Fri Aug 31 12:17:52 2007 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/sapi/cgi cgi_main.c Log: Fixed bug #42453 (CGI SAPI does not shut down cleanly with -i/-m/-v cmdline options) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.920&r2=1.2027.2.547.2.921&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.920 php-src/NEWS:1.2027.2.547.2.921 --- php-src/NEWS:1.2027.2.547.2.920 Fri Aug 31 10:48:45 2007 +++ php-src/NEWSFri Aug 31 12:17:52 2007 @@ -5,6 +5,8 @@ - Fixed bug #42462 (Segmentation when trying to set an attribute in a DOMElement). (Rob) +- Fixed bug #42453 (CGI SAPI does not shut down cleanly with -i/-m/-v cmdline + options). (Dmitry) - Fixed bug #42452 (PDO classes do not expose Reflection API information). (Hannes) - Fixed bug #42359 (xsd:list type not parsed). (Dmitry) http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.46&r2=1.267.2.15.2.47&diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u 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.47 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.46 Wed Aug 8 23:51:57 2007 +++ php-src/sapi/cgi/cgi_main.c Fri Aug 31 12:17:52 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.46 2007/08/08 23:51:57 stas Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.47 2007/08/31 12:17:52 dmitry Exp $ */ #include "php.h" #include "php_globals.h" @@ -1471,8 +1471,8 @@ SG(headers_sent) = 1; php_cgi_usage(argv[0]); php_end_ob_buffers(1 TSRMLS_CC); - exit(1); - break; + exit_status = 0; + goto out; } } php_optind = orig_optind; @@ -1511,7 +1511,8 @@ SG(headers_sent) = 1; php_printf("You cannot use both -n and -c switch. Use -h for help.\n"); php_end_ob_buffers(1 TSRMLS_CC); - exit(1); + exit_status = 1; + goto out; } while ((c = php_getopt(argc, argv, OPTIONS, &php_optarg, &php_optind, 0)) != -1) { @@ -1552,9 +1553,9 @@ SG(request_info).no_headers = 1; } php_print_info(0x TSRMLS_CC); - php_end_ob_buffers(1 TSRMLS_CC); - exit(0); - break; + php_request_shutdown((void *) 0); + exit_status = 0; + goto out; case 'l': /* syntax check mode */ no_headers = 1; @@ -1571,8 +1572,8 @@ print_extensions(TSRMLS_C); php_printf("\n"); php_end_ob_buffers(1 TSRMLS_CC); - exit(0); - break; + exit_status = 0; + goto out; #if 0 /* not yet operational, see also below ... */ case '': /* generate indented source mode*/ @@ -1600,9 +1601,9 @@ #else php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2007 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); #endif - php_end_ob_buffers(1 TSRMLS_CC); - exit(0); - break; + php_request_shutdown((void *) 0); + exit_status = 0; + goto out; case 'w': behavior = PHP_MODE_STRIP; @@ -1890,6 +1891,7 @@ exit_status = 255; } zend_end_try(); +out: 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) / NEWS /sapi/cgi cgi_main.c
dmitry Wed Aug 8 13:01:40 2007 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/sapi/cgi cgi_main.c Log: - Fixed bug #42198 (SCRIPT_NAME and PHP_SELF truncated when inside a userdir and using PATH_INFO). - Fixed bug #31892 (PHP_SELF incorrect without cgi.fix_pathinfo, but turning on screws up PATH_INFO). http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.885&r2=1.2027.2.547.2.886&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.885 php-src/NEWS:1.2027.2.547.2.886 --- php-src/NEWS:1.2027.2.547.2.885 Wed Aug 8 11:37:44 2007 +++ php-src/NEWSWed Aug 8 13:01:39 2007 @@ -7,11 +7,15 @@ - Fixed bug #4 (possible buffer overflow in php_openssl_make_REQ). (Pierre) - Fixed bug #42208 (substr_replace() crashes when the same array is passed more than once). (crrodriguez at suse dot de, Ilia) +- Fixed bug #42198 (SCRIPT_NAME and PHP_SELF truncated when inside a userdir + and using PATH_INFO). (Dmitry) - Fixed bug #42195 (C++ compiler required always). (Jani) - Fixed bug #42082 (NodeList length zero should be empty). (Hannes) - Fixed bug #41973 (./configure --with-ldap=shared fails with LDFLAGS="-Wl,--as-needed"). (Nuno) - Fixed bug #36492 (Userfilters can leak buckets). (Sara) +- Fixed bug #31892 (PHP_SELF incorrect without cgi.fix_pathinfo, but turning + on screws up PATH_INFO). (Dmitry) 02 Aug 2007, PHP 5.2.4RC1 - Removed --enable-versioning configure option. (Jani) http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.44&r2=1.267.2.15.2.45&diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u 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.45 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.44 Wed Aug 8 10:00:34 2007 +++ php-src/sapi/cgi/cgi_main.c Wed Aug 8 13:01:40 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.44 2007/08/08 10:00:34 jani Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.45 2007/08/08 13:01:40 dmitry Exp $ */ #include "php.h" #include "php_globals.h" @@ -522,16 +522,29 @@ static void sapi_cgi_register_variables(zval *track_vars_array TSRMLS_DC) { - unsigned int new_val_len; - char *val = SG(request_info).request_uri ? SG(request_info).request_uri : ""; + char *script_name = SG(request_info).request_uri; + unsigned int script_name_len = script_name ? strlen(script_name) : 0; + char *path_info = sapi_cgibin_getenv("PATH_INFO", sizeof("PATH_INFO")-1 TSRMLS_CC); + unsigned int path_info_len = path_info ? strlen(path_info) : 0; + unsigned int php_self_len = script_name_len + path_info_len; + char *php_self = emalloc(php_self_len + 1); + + if (script_name) { + memcpy(php_self, script_name, script_name_len + 1); + } + if (path_info) { + memcpy(php_self + script_name_len, path_info, path_info_len + 1); + } + /* In CGI mode, we consider the environment to be a part of the server * variables */ php_import_environment_variables(track_vars_array TSRMLS_CC); /* Build the special-case PHP_SELF variable for the CGI version */ - if (sapi_module.input_filter(PARSE_SERVER, "PHP_SELF", &val, strlen(val), &new_val_len TSRMLS_CC)) { - php_register_variable_safe("PHP_SELF", val, new_val_len, track_vars_array TSRMLS_CC); + if (sapi_module.input_filter(PARSE_SERVER, "PHP_SELF", &php_self, php_self_len, &php_self_len TSRMLS_CC)) { + php_register_variable_safe("PHP_SELF", php_self, php_self_len, track_vars_array TSRMLS_CC); } + efree(php_self); } static void sapi_cgi_log_message(char *message) @@ -830,7 +843,21 @@ if (orig_path_info != path_info) { if (orig_path_info) { + char old; + _sapi_cgibin_putenv("ORIG_PATH_INFO", orig_path_info TSRMLS_CC); + old = path_info[0]; + path_info[0] = 0; + if (!orig_script_name || + strcmp(orig_script_name, env_path_info) != 0) { + if (orig_script_name) { + _sapi_cgibin_putenv("ORIG_SCRIPT_NAME", orig_script_name TSRMLS_CC); + } +
[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /sapi/cgi cgi_main.c
dmitry Tue Jun 26 14:47:16 2007 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/sapi/cgi cgi_main.c Log: Fixed bug #40419 (Trailing Slash in CGI request don't work) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.802&r2=1.2027.2.547.2.803&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.802 php-src/NEWS:1.2027.2.547.2.803 --- php-src/NEWS:1.2027.2.547.2.802 Tue Jun 26 12:10:08 2007 +++ php-src/NEWSTue Jun 26 14:47:15 2007 @@ -88,6 +88,7 @@ integer as sections). (Tony) - Fixed bug #41350 (my_thread_global_end() error during request shutdown on Windows). (Scott, Andrey) +- Fixed bug #40419 (Trailing Slash in CGI request don't work). (Dmitry) - Fixed bug #39330 (apache2handler does not call shutdown actions before apache child die). (isk at ecommerce dot com, Gopal, Tony) http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.42&r2=1.267.2.15.2.43&diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u 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.43 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.42 Thu Jun 21 08:40:43 2007 +++ php-src/sapi/cgi/cgi_main.c Tue Jun 26 14:47:16 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.42 2007/06/21 08:40:43 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.43 2007/06/26 14:47:16 dmitry Exp $ */ #include "php.h" #include "php_globals.h" @@ -766,7 +766,7 @@ char *env_document_root = sapi_cgibin_getenv("DOCUMENT_ROOT", sizeof("DOCUMENT_ROOT")-1 TSRMLS_CC); if (CGIG(fix_pathinfo)) { - char *real_path; + char *real_path = NULL; char *orig_path_translated = env_path_translated; char *orig_path_info = env_path_info; char *orig_script_name = env_script_name; @@ -926,6 +926,9 @@ efree(pt); } } else { + if (real_path) { + script_path_translated = real_path; + } /* make sure path_info/translated are empty */ if (!orig_script_filename || (script_path_translated != orig_script_filename) || @@ -951,8 +954,10 @@ } else { SG(request_info).request_uri = env_script_name; } + if (real_path) { + free(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) / NEWS /sapi/cgi cgi_main.c
dmitry Tue May 15 08:17:08 2007 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/sapi/cgi cgi_main.c Log: Fixed bug #41378 (fastcgi protocol lacks support for Reason-Phrase in "Status:" header) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.703&r2=1.2027.2.547.2.704&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.703 php-src/NEWS:1.2027.2.547.2.704 --- php-src/NEWS:1.2027.2.547.2.703 Mon May 14 18:54:05 2007 +++ php-src/NEWSTue May 15 08:17:08 2007 @@ -10,6 +10,8 @@ - Fixed altering $this via argument named "this". (Dmitry) - Fixed PHP CLI to use the php.ini from the binary location. (Hannes) - Fixed segfault in strripos(). (Tony, Joxean Koret) +- Fixed bug #41378 (fastcgi protocol lacks support for Reason-Phrase in + "Status:" header). (Dmitry) - Fixed bug #41374 (wholetext concats values of wrong nodes). (Rob) - Fixed bug #41353 (crash in openssl_pkcs12_read() on invalid input). (Ilia) - Fixed bug #41351 (Invalid opcode with foreach ($a[] as $b)). (Dmitry, Tony) http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.36&r2=1.267.2.15.2.37&diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u 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.37 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.36 Tue Apr 17 20:00:53 2007 +++ php-src/sapi/cgi/cgi_main.c Tue May 15 08:17:08 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.36 2007/04/17 20:00:53 sniper Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.37 2007/05/15 08:17:08 dmitry Exp $ */ #include "php.h" #include "php_globals.h" @@ -331,7 +331,16 @@ } } else { - len = slprintf(buf, sizeof(buf), "Status: %d\r\n", SG(sapi_headers).http_response_code); + char *s; + + if (SG(sapi_headers).http_status_line && + (s = strchr(SG(sapi_headers).http_status_line, ' ')) != 0 && + (s - SG(sapi_headers).http_status_line) >= 5 && + strncasecmp(SG(sapi_headers).http_status_line, "HTTP/", 5) == 0) { + len = slprintf(buf, sizeof(buf), "Status:%s\r\n", s); + } else { + len = slprintf(buf, sizeof(buf), "Status: %d\r\n", SG(sapi_headers).http_response_code); + } } PHPWRITE_H(buf, 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) / NEWS /sapi/cgi cgi_main.c fastcgi.c fastcgi.h
dmitry Wed Mar 28 15:39:23 2007 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/sapi/cgi cgi_main.c fastcgi.c fastcgi.h Log: Improved FastCGI SAPI to support external pipe and socket servers on win32 http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.615&r2=1.2027.2.547.2.616&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.615 php-src/NEWS:1.2027.2.547.2.616 --- php-src/NEWS:1.2027.2.547.2.615 Wed Mar 28 10:08:31 2007 +++ php-src/NEWSWed Mar 28 15:39:22 2007 @@ -9,6 +9,8 @@ - Upgraded SQLite 3 to version 3.3.13 (Ilia) - Upgraded PCRE to version 7.0 (Nuno) - Updated timezone database to version 2007.3. (Derick) +- Improved FastCGI SAPI to support external pipe and socket servers on win32. + (Dmitry) - Improved Zend Memory Manager . guarantee of reasonable time for worst cases of best-fit free block searching algorithm. (Dmitry) @@ -58,6 +60,7 @@ - Fixed bug #40770 (Apache child exits when PHP memory limit reached). (Dmitry) - Fixed bug #40764 (line thickness not respected for horizontal and vertical lines). (Pierre) +- Fixed bug #40758 (Test fcgi_is_fastcgi() is wrong on windows). (Dmitry) - Fixed bug #40754 (added substr() & substr_replace() overflow checks). (Ilia) - Fixed bug #40752 (parse_ini_file() segfaults when a scalar setting is redeclared as an array). (Tony) http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.30&r2=1.267.2.15.2.31&diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u 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.31 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.30 Fri Mar 9 16:46:07 2007 +++ php-src/sapi/cgi/cgi_main.c Wed Mar 28 15:39:22 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.30 2007/03/09 16:46:07 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.31 2007/03/28 15:39:22 dmitry Exp $ */ #include "php.h" #include "php_globals.h" @@ -123,9 +123,7 @@ static const opt_struct OPTIONS[] = { {'a', 0, "interactive"}, -#ifndef PHP_WIN32 {'b', 1, "bindpath"}, -#endif {'C', 0, "no-chdir"}, {'c', 1, "php-ini"}, {'d', 1, "define"}, @@ -630,7 +628,7 @@ php_printf("Usage: %s [-q] [-h] [-s] [-v] [-i] [-f ]\n" " %s [args...]\n" " -a Run interactively\n" -#if PHP_FASTCGI && !defined(PHP_WIN32) +#if PHP_FASTCGI " -b | Bind Path for external FASTCGI Server mode\n" #endif " -C Do not chdir to the script's directory\n" @@ -997,21 +995,6 @@ } #endif -#if PHP_FASTCGI -#ifndef PHP_WIN32 -static int is_port_number(const char *bindpath) -{ - while (*bindpath) { - if (*bindpath < '0' || *bindpath > '9') { - return 0; - } - bindpath++; - } - return 1; -} -#endif -#endif - PHP_INI_BEGIN() STD_PHP_INI_ENTRY("cgi.rfc2616_headers", "0", PHP_INI_ALL, OnUpdateBool, rfc2616_headers, php_cgi_globals_struct, php_cgi_globals) STD_PHP_INI_ENTRY("cgi.nph", "0", PHP_INI_ALL, OnUpdateBool, nph, php_cgi_globals_struct, php_cgi_globals) @@ -1133,9 +1116,7 @@ int max_requests = 500; int requests = 0; int fastcgi = fcgi_is_fastcgi(); -#ifndef PHP_WIN32 char *bindpath = NULL; -#endif int fcgi_fd = 0; fcgi_request request; #ifndef PHP_WIN32 @@ -1233,8 +1214,6 @@ } break; } -#if PHP_FASTCGI -#ifndef PHP_WIN32 /* 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. */ @@ -1243,8 +1222,6 @@ bindpath = strdup(php_optarg); } break; -#endif -#endif } } @@ -1311,26 +1288,10 @@ #endif /* FORCE_CGI_REDIRECT */ #if PHP_FASTCGI -#ifndef PHP_WIN32 /* 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) { - /* Pass on the arg to the FastCGI library, with one exception. -* If just a port is specified, then we prepend a ':' onto the -* path (it's what the fastcgi library expects) -*/ - if (strchr(bindpath, ':') == NULL && is_port_number(bindpath)) { - char *tmp; - - tmp = malloc(strlen(bindpath) + 2); - tmp[
[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /sapi/cgi cgi_main.c
dmitry Fri Feb 16 11:30:03 2007 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/sapi/cgi cgi_main.c Log: Fixed bug #40286 (PHP fastcgi with PHP_FCGI_CHILDREN don't kill children when parent is killed) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.544&r2=1.2027.2.547.2.545&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.544 php-src/NEWS:1.2027.2.547.2.545 --- php-src/NEWS:1.2027.2.547.2.544 Fri Feb 16 08:33:28 2007 +++ php-src/NEWSFri Feb 16 11:30:03 2007 @@ -22,6 +22,8 @@ (Dmitry) - Fixed bug #40410 (ext/posix does not compile on MacOS 10.3.9). (Tony) - Fixed Bug #40352 (FCGI_WEB_SERVER_ADDRS function get lost). (Dmitry) +- Fixed bug #40286 (PHP fastcgi with PHP_FCGI_CHILDREN don't kill children when + parent is killed). (Dmitry) - Fixed bug #40236 (php -a function allocation eats memory). (Dmitry) - Fixed bug #40109 (iptcembed fails on non-jfif jpegs). (Tony) - Fixed bug #39836 (SplObjectStorage empty after unserialize). (Marcus) http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.22&r2=1.267.2.15.2.23&diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.22 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.22 Thu Feb 15 12:33:16 2007 +++ php-src/sapi/cgi/cgi_main.c Fri Feb 16 11:30:03 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.22 2007/02/15 12:33:16 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.23 2007/02/16 11:30:03 dmitry Exp $ */ #include "php.h" #include "php_globals.h" @@ -355,18 +355,14 @@ static int sapi_cgi_read_post(char *buffer, uint count_bytes TSRMLS_DC) { - uint read_bytes=0, tmp_read_bytes; -#if PHP_FASTCGI - char *pos = buffer; -#endif + int read_bytes=0, tmp_read_bytes; count_bytes = MIN(count_bytes, (uint) SG(request_info).content_length - SG(read_post_bytes)); while (read_bytes < count_bytes) { #if PHP_FASTCGI 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; + 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); } -- 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) / NEWS /sapi/cgi cgi_main.c fastcgi.c fastcgi.h
dmitry Thu Feb 15 12:33:16 2007 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/sapi/cgi cgi_main.c fastcgi.c fastcgi.h Log: Fixed bug #40414 (possivle endless fork() loop when running fastcgi) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.540&r2=1.2027.2.547.2.541&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.540 php-src/NEWS:1.2027.2.547.2.541 --- php-src/NEWS:1.2027.2.547.2.540 Thu Feb 15 12:04:59 2007 +++ php-src/NEWSThu Feb 15 12:33:16 2007 @@ -13,6 +13,8 @@ - Fixed bug #40451 (addAttribute() may crash when used with non-existent child node). (Tony) - Fixed bug #40428 (imagepstext() doesn't accept optional parameter). (Pierre) +- Fixed bug #40414 (possible endless fork() loop when running fastcgi). + (Dmitry) - Fixed bug #40410 (ext/posix does not compile on MacOS 10.3.9). (Tony) - Fixed Bug #40352 (FCGI_WEB_SERVER_ADDRS function get lost). (Dmitry) - Fixed bug #40236 (php -a function allocation eats memory). (Dmitry) http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.21&r2=1.267.2.15.2.22&diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u 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.22 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.21 Mon Jan 29 19:36:01 2007 +++ php-src/sapi/cgi/cgi_main.c Thu Feb 15 12:33:16 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.21 2007/01/29 19:36:01 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.22 2007/02/15 12:33:16 dmitry Exp $ */ #include "php.h" #include "php_globals.h" @@ -1392,6 +1392,10 @@ exit(1); } + if (fcgi_in_shutdown()) { + exit(0); + } + while (parent) { do { #ifdef DEBUG_FASTCGI http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/fastcgi.c?r1=1.4.2.13.2.15&r2=1.4.2.13.2.16&diff_format=u Index: php-src/sapi/cgi/fastcgi.c diff -u php-src/sapi/cgi/fastcgi.c:1.4.2.13.2.15 php-src/sapi/cgi/fastcgi.c:1.4.2.13.2.16 --- php-src/sapi/cgi/fastcgi.c:1.4.2.13.2.15Thu Feb 15 12:04:59 2007 +++ php-src/sapi/cgi/fastcgi.c Thu Feb 15 12:33:16 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: fastcgi.c,v 1.4.2.13.2.15 2007/02/15 12:04:59 dmitry Exp $ */ +/* $Id: fastcgi.c,v 1.4.2.13.2.16 2007/02/15 12:33:16 dmitry Exp $ */ #include "php.h" #include "fastcgi.h" @@ -164,6 +164,11 @@ #endif +int fcgi_in_shutdown(void) +{ + return in_shutdown; +} + int fcgi_init(void) { if (!is_initialized) { http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/fastcgi.h?r1=1.2.2.4.2.2&r2=1.2.2.4.2.3&diff_format=u Index: php-src/sapi/cgi/fastcgi.h diff -u php-src/sapi/cgi/fastcgi.h:1.2.2.4.2.2 php-src/sapi/cgi/fastcgi.h:1.2.2.4.2.3 --- php-src/sapi/cgi/fastcgi.h:1.2.2.4.2.2 Mon Jan 1 09:36:12 2007 +++ php-src/sapi/cgi/fastcgi.h Thu Feb 15 12:33:16 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: fastcgi.h,v 1.2.2.4.2.2 2007/01/01 09:36:12 sebastian Exp $ */ +/* $Id: fastcgi.h,v 1.2.2.4.2.3 2007/02/15 12:33:16 dmitry Exp $ */ /* FastCGI protocol */ @@ -110,6 +110,7 @@ int fcgi_init(void); int fcgi_is_fastcgi(void); +int fcgi_in_shutdown(void); int fcgi_listen(const char *path, int backlog); void fcgi_init_request(fcgi_request *req, int listen_socket); int fcgi_accept_request(fcgi_request *req); -- 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) / NEWS /sapi/cgi cgi_main.c
dmitry Tue Nov 14 10:31:47 2006 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/sapi/cgi cgi_main.c Log: cgi.* and fastcgi.* directives are moved to INI subsystem. The new directive cgi.check_shebang_line can be used to ommiting checnk for "#! /usr/bin/php" line. http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.360&r2=1.2027.2.547.2.361&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.360 php-src/NEWS:1.2027.2.547.2.361 --- php-src/NEWS:1.2027.2.547.2.360 Mon Nov 13 22:10:37 2006 +++ php-src/NEWSTue Nov 14 10:31:47 2006 @@ -1,6 +1,9 @@ PHPNEWS ||| ?? ??? 2007, PHP 5.2.1 +- cgi.* and fastcgi.* directives are moved to INI subsystem. + The new directive cgi.check_shebang_line can be used to ommiting checnk + for "#! /usr/bin/php" line. (Dmitry). - Windows related optimizations (Dmitry, Stas) . removed unnecessary checks for ISREG file and corresponding stat() calls . opendir() is reimplemented using GetFistFile/GetNextFile those are faster http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.15&r2=1.267.2.15.2.16&diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u 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.16 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.15 Fri Nov 3 16:40:52 2006 +++ php-src/sapi/cgi/cgi_main.c Tue Nov 14 10:31:47 2006 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.15 2006/11/03 16:40:52 pajoye Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.16 2006/11/14 10:31:47 dmitry Exp $ */ #include "php.h" #include "php_globals.h" @@ -145,17 +145,32 @@ {'-', 0, NULL} /* end of args */ }; +typedef struct _php_cgi_globals_struct { + zend_bool rfc2616_headers; + zend_bool nph; + zend_bool check_shebang_line; #if ENABLE_PATHINFO_CHECK -/* true global. this is retreived once only, even for fastcgi */ -long fix_pathinfo = 1; + zend_bool fix_pathinfo; +#endif +#if FORCE_CGI_REDIRECT + zend_bool force_redirect; + char *redirect_status_env; #endif - #if PHP_FASTCGI -long fcgi_logging = 1; + zend_bool fcgi_logging; +# ifdef PHP_WIN32 + zend_bool impersonate; +# endif #endif +} php_cgi_globals_struct; -static long rfc2616_headers = 0; -static long cgi_nph = 0; +#ifdef ZTS +static int php_cgi_globals_id; +#define CGIG(v) TSRMG(php_cgi_globals_id, php_cgi_globals_struct *, v) +#else +static php_cgi_globals_struct php_cgi_globals; +#define CGIG(v) (php_cgi_globals.v) +#endif #ifdef PHP_WIN32 #define TRANSLATE_SLASHES(path) \ @@ -304,11 +319,11 @@ return SAPI_HEADER_SENT_SUCCESSFULLY; } - if (cgi_nph || SG(sapi_headers).http_response_code != 200) + if (CGIG(nph) || SG(sapi_headers).http_response_code != 200) { int len; - if (rfc2616_headers && SG(sapi_headers).http_status_line) { + if (CGIG(rfc2616_headers) && SG(sapi_headers).http_status_line) { len = snprintf(buf, SAPI_CGI_MAX_HEADER_LENGTH, "%s\r\n", SG(sapi_headers).http_status_line); @@ -517,9 +532,10 @@ static void sapi_cgi_log_message(char *message) { #if PHP_FASTCGI - if (fcgi_is_fastcgi() && fcgi_logging) { + TSRMLS_FETCH(); + + if (fcgi_is_fastcgi() && CGIG(fcgi_logging)) { fcgi_request *request; - TSRMLS_FETCH(); request = (fcgi_request*) SG(server_context); if (request) { @@ -744,7 +760,7 @@ char *env_redirect_url = sapi_cgibin_getenv("REDIRECT_URL", sizeof("REDIRECT_URL")-1 TSRMLS_CC); char *env_document_root = sapi_cgibin_getenv("DOCUMENT_ROOT", sizeof("DOCUMENT_ROOT")-1 TSRMLS_CC); - if (fix_pathinfo) { + if (CGIG(fix_pathinfo)) { /* save the originals first for anything we change later */ if (env_path_translated) { @@ -963,6 +979,96 @@ #endif #endif +PHP_INI_BEGIN() + STD_PHP_INI_ENTRY("cgi.rfc2616_headers", "0", PHP_INI_ALL, OnUpdateBool, rfc2616_headers, php_cgi_globals_struct, php_cgi_globals) + STD_PHP_INI_ENTRY("cgi.nph", "0", PHP_INI_ALL, OnUpdateBool, nph, php_cgi_globals_struct, php_cgi_globals) + STD_PHP_INI_ENTRY("cgi.check_shebang_line", "1", PHP_INI_SYSTEM, OnUpdateBool, check_shebang_line, php_cgi_globals_struct, php_cgi_globals) +#if FORCE_CGI_REDIRECT + STD_PHP_INI_ENTRY("cgi.force_redirect", "1", PHP_INI_SYSTEM, OnUpdateBool, force_redirect, php_cgi_globals_struct, php_cgi_gl
[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /sapi/cgi cgi_main.c
dmitry Wed May 24 09:42:21 2006 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/sapi/cgi cgi_main.c Log: Fixed bug #37256 (php-fastcgi dosen't handle connection abort) http://cvs.php.net/viewcvs.cgi/php-src/NEWS?r1=1.2027.2.547.2.42&r2=1.2027.2.547.2.43&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.42 php-src/NEWS:1.2027.2.547.2.43 --- php-src/NEWS:1.2027.2.547.2.42 Wed May 24 07:55:18 2006 +++ php-src/NEWSWed May 24 09:42:21 2006 @@ -72,6 +72,7 @@ - Fixed bug #37313 (sigemptyset() used without including ). (jdolecek) - Fixed bug #37306 (max_execution_time = max_input_time). (Dmitry) +- Fixed bug #37256 (php-fastcgi dosen't handle connection abort). (Dmitry) - Fixed bug #37244 (Added strict flag to base64_decode() that enforces RFC3548 compliance). (Ilia) - Fixed bug #36630 (umask not reset at the end of the request). (Ilia) http://cvs.php.net/viewcvs.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.2&r2=1.267.2.15.2.3&diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.2 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.3 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.2 Wed May 24 07:55:19 2006 +++ php-src/sapi/cgi/cgi_main.c Wed May 24 09:42:21 2006 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.2 2006/05/24 07:55:19 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.3 2006/05/24 09:42:21 dmitry Exp $ */ #include "php.h" #include "php_globals.h" @@ -282,7 +282,7 @@ #ifndef PHP_WIN32 !parent && #endif - request && fcgi_flush(request, 0) == -1) { + request && !fcgi_flush(request, 0)) { php_handle_aborted_connection(); } return; -- 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) / NEWS /sapi/cgi cgi_main.c
dmitry Wed May 24 07:55:19 2006 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/sapi/cgi cgi_main.c Log: Fixed bug #37341 ($_SERVER in included file is shortened to two entries, if $_ENV gets used). http://cvs.php.net/viewcvs.cgi/php-src/NEWS?r1=1.2027.2.547.2.41&r2=1.2027.2.547.2.42&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.41 php-src/NEWS:1.2027.2.547.2.42 --- php-src/NEWS:1.2027.2.547.2.41 Tue May 23 23:22:04 2006 +++ php-src/NEWSWed May 24 07:55:18 2006 @@ -67,6 +67,8 @@ - Fixed bug #37376 (fastcgi.c compile fail with gcc 2.95.4). (Ilia) - Fixed bug #37368 (Incorrect timestamp returned for strtotime()). (Derick) - Fixed bug #37348 (make PEAR install ignore open_basedir). (Ilia) +- Fixed bug #37341 ($_SERVER in included file is shortened to two entries, + if $_ENV gets used). (Dmitry) - Fixed bug #37313 (sigemptyset() used without including ). (jdolecek) - Fixed bug #37306 (max_execution_time = max_input_time). (Dmitry) http://cvs.php.net/viewcvs.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.1&r2=1.267.2.15.2.2&diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.1 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.2 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.1 Mon May 15 14:30:31 2006 +++ php-src/sapi/cgi/cgi_main.c Wed May 24 07:55:19 2006 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.1 2006/05/15 14:30:31 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.2 2006/05/24 07:55:19 dmitry Exp $ */ #include "php.h" #include "php_globals.h" @@ -434,14 +434,18 @@ void cgi_php_import_environment_variables(zval *array_ptr TSRMLS_DC) { if (PG(http_globals)[TRACK_VARS_ENV] && - array_ptr != PG(http_globals)[TRACK_VARS_ENV]) { + array_ptr != PG(http_globals)[TRACK_VARS_ENV] && + Z_TYPE_P(PG(http_globals)[TRACK_VARS_ENV]) == IS_ARRAY && + zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_ENV])) > 0) { zval_dtor(array_ptr); *array_ptr = *PG(http_globals)[TRACK_VARS_ENV]; INIT_PZVAL(array_ptr); zval_copy_ctor(array_ptr); return; } else if (PG(http_globals)[TRACK_VARS_SERVER] && - array_ptr != PG(http_globals)[TRACK_VARS_SERVER]) { + array_ptr != PG(http_globals)[TRACK_VARS_SERVER] && + Z_TYPE_P(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY && + zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER])) > 0) { zval_dtor(array_ptr); *array_ptr = *PG(http_globals)[TRACK_VARS_SERVER]; INIT_PZVAL(array_ptr); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php