[PHP-CVS] svn: /php/php-src/branches/PHP_5_2/ NEWS
jani Tue, 29 Dec 2009 10:27:54 + Revision: http://svn.php.net/viewvc?view=revisionrevision=292736 Log: order Changed paths: U php/php-src/branches/PHP_5_2/NEWS Modified: php/php-src/branches/PHP_5_2/NEWS === --- php/php-src/branches/PHP_5_2/NEWS 2009-12-29 09:43:03 UTC (rev 292735) +++ php/php-src/branches/PHP_5_2/NEWS 2009-12-29 10:27:54 UTC (rev 292736) @@ -1,12 +1,14 @@ PHPNEWS ||| ?? ??? 2010, PHP 5.2.13 -- Added missing host validation for HTTP urls inside FILTER_VALIDATE_URL. - (Ilia) - Removed automatic file descriptor unlocking happening on shutdown and/or stream close (on all OSes excluding Windows). (Tony, Ilia) + - Changed tidyNode class to disallow manual node creation. (Pierrick) +- Added missing host validation for HTTP urls inside FILTER_VALIDATE_URL. + (Ilia) + - Fixed build of mysqli with MySQL 5.5.0-m2. (Andrey) - Fixed bug #50575 (PDO_PGSQL LOBs are not compatible with PostgreSQL 8.5). -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/trunk/ext/tidy/ tidy.c
jani Tue, 29 Dec 2009 12:46:48 + Revision: http://svn.php.net/viewvc?view=revisionrevision=292756 Log: - WS + CS Changed paths: U php/php-src/trunk/ext/tidy/tidy.c Modified: php/php-src/trunk/ext/tidy/tidy.c === --- php/php-src/trunk/ext/tidy/tidy.c 2009-12-29 12:45:51 UTC (rev 292755) +++ php/php-src/trunk/ext/tidy/tidy.c 2009-12-29 12:46:48 UTC (rev 292756) @@ -45,7 +45,7 @@ #define FIX_BUFFER(bptr) do { if ((bptr)-size) { (bptr)-bp[(bptr)-size-1] = '\0'; } } while(0) #define TIDY_SET_CONTEXT \ -zval *object = getThis(); + zval *object = getThis(); #define TIDY_FETCH_OBJECT \ PHPTidyObj *obj; \ @@ -70,22 +70,22 @@ obj = (PHPTidyObj *) zend_object_store_get_object(object TSRMLS_CC); \ #define TIDY_APPLY_CONFIG_ZVAL(_doc, _val) \ -if(_val) { \ -if(Z_TYPE_PP(_val) == IS_ARRAY) { \ -_php_tidy_apply_config_array(_doc, HASH_OF(*_val) TSRMLS_CC); \ -} else if (Z_TYPE_PP(_val) != IS_NULL) { \ -convert_to_string_ex(_val); \ -TIDY_OPEN_BASEDIR_CHECK(Z_STRVAL_PP(_val)); \ -switch (tidyLoadConfig(_doc, Z_STRVAL_PP(_val))) { \ - case -1: \ -php_error_docref(NULL TSRMLS_CC, E_WARNING, Could not load configuration file '%s', Z_STRVAL_PP(_val)); \ -break; \ - case 1: \ -php_error_docref(NULL TSRMLS_CC, E_NOTICE, There were errors while parsing the configuration file '%s', Z_STRVAL_PP(_val)); \ -break; \ -} \ -} \ -} + if (_val) { \ + if (Z_TYPE_PP(_val) == IS_ARRAY) { \ + _php_tidy_apply_config_array(_doc, HASH_OF(*_val) TSRMLS_CC); \ + } else if (Z_TYPE_PP(_val) != IS_NULL) { \ + convert_to_string_ex(_val); \ + TIDY_OPEN_BASEDIR_CHECK(Z_STRVAL_PP(_val)); \ + switch (tidyLoadConfig(_doc, Z_STRVAL_PP(_val))) { \ +case -1: \ + php_error_docref(NULL TSRMLS_CC, E_WARNING, Could not load configuration file '%s', Z_STRVAL_PP(_val)); \ +break; \ +case 1: \ + php_error_docref(NULL TSRMLS_CC, E_NOTICE, There were errors while parsing the configuration file '%s', Z_STRVAL_PP(_val)); \ +break; \ + } \ + } \ + } #define REGISTER_TIDY_CLASS(classname, name, parent, __flags) \ { \ @@ -122,16 +122,16 @@ } #define ADD_PROPERTY_STRINGL(_conv, _table, _key, _string, _len) \ - { \ - zval *tmp; \ - MAKE_STD_ZVAL(tmp); \ - if (_string) { \ - ZVAL_U_STRINGL(_conv, tmp, (char *)_string, _len, 1); \ - } else { \ - ZVAL_EMPTY_STRING(tmp); \ - } \ - zend_ascii_hash_update(_table, #_key, sizeof(#_key), (void *)tmp, sizeof(zval *), NULL); \ - } + { \ + zval *tmp; \ + MAKE_STD_ZVAL(tmp); \ + if (_string) { \ + ZVAL_U_STRINGL(_conv, tmp, (char *)_string, _len, 1); \ + } else { \ + ZVAL_EMPTY_STRING(tmp); \ + } \ + zend_ascii_hash_update(_table, #_key, sizeof(#_key), (void *)tmp, sizeof(zval *), NULL); \ +} #define ADD_PROPERTY_LONG(_table, _key, _long) \ { \ @@ -150,11 +150,11 @@ } #define ADD_PROPERTY_BOOL(_table, _key, _bool) \ -{ \ - zval *tmp; \ - MAKE_STD_ZVAL(tmp); \ - ZVAL_BOOL(tmp, _bool); \ - zend_ascii_hash_update(_table, #_key, sizeof(#_key), (void *)tmp, sizeof(zval *), NULL); \ + { \ + zval *tmp; \ + MAKE_STD_ZVAL(tmp); \ + ZVAL_BOOL(tmp, _bool); \ + zend_ascii_hash_update(_table, #_key, sizeof(#_key), (void *)tmp, sizeof(zval *), NULL); \ } #define TIDY_OPEN_BASEDIR_CHECK(filename) \ @@ -170,7 +170,7 @@ } /* }}} */ -/* {{{ ext/tidy structs +/* {{{ ext/tidy structs */ typedef struct _PHPTidyDoc PHPTidyDoc; typedef struct _PHPTidyObj PHPTidyObj; @@ -188,22 +188,22 @@ } tidy_base_nodetypes; struct _PHPTidyDoc { - TidyDoc doc; - TidyBuffer *errbuf; - unsigned int ref_count; + TidyDoc doc; + TidyBuffer *errbuf; + unsigned int ref_count; }; typedef struct _PHPTidyConv { - UConverter *conv; - unsigned long ref_count; + UConverter *conv; + unsigned long ref_count; } PHPTidyConv; struct _PHPTidyObj { - zend_object std; - TidyNodenode; - tidy_obj_type type; - PHPTidyDoc *ptdoc; - PHPTidyConv *converter; + zend_object std; + TidyNode node; + tidy_obj_type type; + PHPTidyDoc *ptdoc; + PHPTidyConv *converter; }; /* }}} */ @@ -384,7 +384,7 @@ PHP_FE(tidy_parse_string, arginfo_tidy_parse_string) PHP_FE(tidy_parse_file, arginfo_tidy_parse_file) PHP_FE(tidy_get_output, arginfo_tidy_get_output) - PHP_FE(tidy_get_error_buffer, arginfo_tidy_get_error_buffer) + PHP_FE(tidy_get_error_buffer, arginfo_tidy_get_error_buffer) PHP_FE(tidy_clean_repair, arginfo_tidy_clean_repair) PHP_FE(tidy_repair_string, arginfo_tidy_repair_string) PHP_FE(tidy_repair_file, arginfo_tidy_repair_file) @@ -398,7 +398,7 @@ PHP_FE(tidy_error_count, arginfo_tidy_error_count)
[PHP-CVS] svn: /php/php-src/trunk/ext/tidy/ tidy.c
jani Tue, 29 Dec 2009 12:57:38 + Revision: http://svn.php.net/viewvc?view=revisionrevision=292757 Log: - Try prevent accidents Changed paths: U php/php-src/trunk/ext/tidy/tidy.c Modified: php/php-src/trunk/ext/tidy/tidy.c === --- php/php-src/trunk/ext/tidy/tidy.c 2009-12-29 12:46:48 UTC (rev 292756) +++ php/php-src/trunk/ext/tidy/tidy.c 2009-12-29 12:57:38 UTC (rev 292757) @@ -59,7 +59,7 @@ RETURN_FALSE; \ } \ } \ - obj = (PHPTidyObj *) zend_object_store_get_object(object TSRMLS_CC); \ + obj = (PHPTidyObj *) zend_object_store_get_object(object TSRMLS_CC); #define TIDY_FETCH_ONLY_OBJECT \ PHPTidyObj *obj;\ @@ -67,7 +67,7 @@ if (zend_parse_parameters_none() == FAILURE) { \ return; \ } \ - obj = (PHPTidyObj *) zend_object_store_get_object(object TSRMLS_CC); \ + obj = (PHPTidyObj *) zend_object_store_get_object(object TSRMLS_CC); #define TIDY_APPLY_CONFIG_ZVAL(_doc, _val) \ if (_val) { \ @@ -131,7 +131,7 @@ ZVAL_EMPTY_STRING(tmp); \ } \ zend_ascii_hash_update(_table, #_key, sizeof(#_key), (void *)tmp, sizeof(zval *), NULL); \ -} + } #define ADD_PROPERTY_LONG(_table, _key, _long) \ { \ @@ -158,9 +158,9 @@ } #define TIDY_OPEN_BASEDIR_CHECK(filename) \ -if (php_check_open_basedir(filename TSRMLS_CC)) { \ - RETURN_FALSE; \ -} \ + if (php_check_open_basedir(filename TSRMLS_CC)) { \ + RETURN_FALSE; \ + } #define TIDY_SET_DEFAULT_CONFIG(_doc) \ if (TG(default_config) TG(default_config)[0]) { \ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/trunk/ext/tidy/ tidy.c
jani Tue, 29 Dec 2009 13:00:09 + Revision: http://svn.php.net/viewvc?view=revisionrevision=292758 Log: - Last ws pollution, I hope. Changed paths: U php/php-src/trunk/ext/tidy/tidy.c Modified: php/php-src/trunk/ext/tidy/tidy.c === --- php/php-src/trunk/ext/tidy/tidy.c 2009-12-29 12:57:38 UTC (rev 292757) +++ php/php-src/trunk/ext/tidy/tidy.c 2009-12-29 13:00:09 UTC (rev 292758) @@ -155,7 +155,7 @@ MAKE_STD_ZVAL(tmp); \ ZVAL_BOOL(tmp, _bool); \ zend_ascii_hash_update(_table, #_key, sizeof(#_key), (void *)tmp, sizeof(zval *), NULL); \ - } + } #define TIDY_OPEN_BASEDIR_CHECK(filename) \ if (php_check_open_basedir(filename TSRMLS_CC)) { \ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_2/NEWS branches/PHP_5_2/main/rfc1867.c branches/PHP_5_3/NEWS branches/PHP_5_3/main/rfc1867.c trunk/main/rfc1867.c
iliaaTue, 29 Dec 2009 15:57:54 + Revision: http://svn.php.net/viewvc?view=revisionrevision=292762 Log: Fixed bug #48190 (Content-type parameter boundary is not case-insensitive in HTTP uploads). Bug: http://bugs.php.net/48190 (Assigned) Content-type parameter boundary is not case-insensitive in HTTP uploads Changed paths: U php/php-src/branches/PHP_5_2/NEWS U php/php-src/branches/PHP_5_2/main/rfc1867.c U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/main/rfc1867.c U php/php-src/trunk/main/rfc1867.c Modified: php/php-src/branches/PHP_5_2/NEWS === --- php/php-src/branches/PHP_5_2/NEWS 2009-12-29 15:53:35 UTC (rev 292761) +++ php/php-src/branches/PHP_5_2/NEWS 2009-12-29 15:57:54 UTC (rev 292762) @@ -20,6 +20,8 @@ (Jani) - Fixed bug #50394 (Reference argument converted to value in __call). (Stas) - Fixed bug #49851 (http wrapper breaks on 1024 char long headers). (Ilia) +- Fixed bug #48190 (Content-type parameter boundary is not case-insensitive + in HTTP uploads). (Ilia) - Fixed bug #47409 (extract() problem with array containing word this). (Ilia, chrisstocktonaz at gmail dot com) - Fixed bug #47002 (Field truncation when reading from dbase dbs with more Modified: php/php-src/branches/PHP_5_2/main/rfc1867.c === --- php/php-src/branches/PHP_5_2/main/rfc1867.c 2009-12-29 15:53:35 UTC (rev 292761) +++ php/php-src/branches/PHP_5_2/main/rfc1867.c 2009-12-29 15:57:54 UTC (rev 292762) @@ -33,6 +33,7 @@ #include php_variables.h #include rfc1867.h #include php_ini.h +#include ext/standard/php_string.h #define DEBUG_FILE_UPLOAD ZEND_DEBUG @@ -796,6 +797,8 @@ void *event_extra_data = NULL; int llen = 0; int upload_cnt = INI_INT(max_file_uploads); + + if (SG(post_max_size) 0 SG(request_info).content_length SG(post_max_size)) { sapi_module.sapi_error(E_WARNING, POST Content-Length of %ld bytes exceeds the limit of %ld bytes, SG(request_info).content_length, SG(post_max_size)); @@ -804,6 +807,18 @@ /* Get the boundary */ boundary = strstr(content_type_dup, boundary); + if (!boundary) { + int content_type_len = strlen(content_type_dup); + char *content_type_lcase = estrndup(content_type_dup, content_type_len); + + php_strtolower(content_type_lcase, content_type_len); + boundary = strstr(content_type_lcase, boundary); + if (boundary) { + boundary = content_type_dup + (boundary - content_type_lcase); + } + efree(content_type_lcase); + } + if (!boundary || !(boundary=strchr(boundary, '='))) { sapi_module.sapi_error(E_WARNING, Missing boundary in multipart/form-data POST data); return; Modified: php/php-src/branches/PHP_5_3/NEWS === --- php/php-src/branches/PHP_5_3/NEWS 2009-12-29 15:53:35 UTC (rev 292761) +++ php/php-src/branches/PHP_5_3/NEWS 2009-12-29 15:57:54 UTC (rev 292762) @@ -7,6 +7,8 @@ (Ilia) - Added stream_resolve_include_path(). (Mikko) +- Fixed bug #48190 (Content-type parameter boundary is not case-insensitive + in HTTP uploads). (Ilia) - Fixed bug #47409 (extract() problem with array containing word this). (Ilia, chrisstocktonaz at gmail dot com) Modified: php/php-src/branches/PHP_5_3/main/rfc1867.c === --- php/php-src/branches/PHP_5_3/main/rfc1867.c 2009-12-29 15:53:35 UTC (rev 292761) +++ php/php-src/branches/PHP_5_3/main/rfc1867.c 2009-12-29 15:57:54 UTC (rev 292762) @@ -32,6 +32,7 @@ #include php_globals.h #include php_variables.h #include rfc1867.h +#include ext/standard/php_string.h #define DEBUG_FILE_UPLOAD ZEND_DEBUG @@ -796,6 +797,8 @@ void *event_extra_data = NULL; int llen = 0; int upload_cnt = INI_INT(max_file_uploads); + + if (SG(post_max_size) 0 SG(request_info).content_length SG(post_max_size)) { sapi_module.sapi_error(E_WARNING, POST Content-Length of %ld bytes exceeds the limit of %ld bytes, SG(request_info).content_length, SG(post_max_size)); @@ -804,6 +807,18 @@ /* Get the boundary */ boundary = strstr(content_type_dup, boundary); + if (!boundary) { + int content_type_len = strlen(content_type_dup); + char *content_type_lcase = estrndup(content_type_dup, content_type_len); + + php_strtolower(content_type_lcase, content_type_len); + boundary = strstr(content_type_lcase, boundary); + if (boundary) { + boundary = content_type_dup + (boundary - content_type_lcase); + } +
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_2/ext/tidy/tests/035.phpt branches/PHP_5_3/ext/tidy/tests/035.phpt trunk/ext/tidy/tests/035.phpt
pierrick Tue, 29 Dec 2009 16:06:27 + Revision: http://svn.php.net/viewvc?view=revisionrevision=292765 Log: Add a test for tidyNode::__construct() Changed paths: A php/php-src/branches/PHP_5_2/ext/tidy/tests/035.phpt A php/php-src/branches/PHP_5_3/ext/tidy/tests/035.phpt A php/php-src/trunk/ext/tidy/tests/035.phpt Added: php/php-src/branches/PHP_5_2/ext/tidy/tests/035.phpt === --- php/php-src/branches/PHP_5_2/ext/tidy/tests/035.phpt (rev 0) +++ php/php-src/branches/PHP_5_2/ext/tidy/tests/035.phpt2009-12-29 16:06:27 UTC (rev 292765) @@ -0,0 +1,12 @@ +--TEST-- +tidyNode::__construct() +--SKIPIF-- +?php + if (!extension_loaded('tidy')) die ('skip tidy not present'); +? +--FILE-- +?php +new tidyNode; +? +--EXPECTF-- +Fatal error: Call to private tidyNode::__construct() from invalid context in %s on line %d Added: php/php-src/branches/PHP_5_3/ext/tidy/tests/035.phpt === --- php/php-src/branches/PHP_5_3/ext/tidy/tests/035.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/tidy/tests/035.phpt2009-12-29 16:06:27 UTC (rev 292765) @@ -0,0 +1,12 @@ +--TEST-- +tidyNode::__construct() +--SKIPIF-- +?php + if (!extension_loaded('tidy')) die ('skip tidy not present'); +? +--FILE-- +?php +new tidyNode; +? +--EXPECTF-- +Fatal error: Call to private tidyNode::__construct() from invalid context in %s on line %d Added: php/php-src/trunk/ext/tidy/tests/035.phpt === --- php/php-src/trunk/ext/tidy/tests/035.phpt (rev 0) +++ php/php-src/trunk/ext/tidy/tests/035.phpt 2009-12-29 16:06:27 UTC (rev 292765) @@ -0,0 +1,12 @@ +--TEST-- +tidyNode::__construct() +--SKIPIF-- +?php + if (!extension_loaded('tidy')) die ('skip tidy not present'); +? +--FILE-- +?php +new tidyNode; +? +--EXPECTF-- +Fatal error: Call to private tidyNode::__construct() from invalid context in %s on line %d -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/PHP_5_2/main/ rfc1867.c
jani Tue, 29 Dec 2009 18:54:08 + Revision: http://svn.php.net/viewvc?view=revisionrevision=292770 Log: MFH: clean some dead code (with static analysis help) (Approved by Ilia) Changed paths: U php/php-src/branches/PHP_5_2/main/rfc1867.c Modified: php/php-src/branches/PHP_5_2/main/rfc1867.c === --- php/php-src/branches/PHP_5_2/main/rfc1867.c 2009-12-29 17:25:12 UTC (rev 292769) +++ php/php-src/branches/PHP_5_2/main/rfc1867.c 2009-12-29 18:54:08 UTC (rev 292770) @@ -32,7 +32,6 @@ #include php_globals.h #include php_variables.h #include rfc1867.h -#include php_ini.h #include ext/standard/php_string.h #define DEBUG_FILE_UPLOAD ZEND_DEBUG @@ -205,7 +204,8 @@ index = NULL; } } - *s++='\0'; + + *s = '\0'; } @@ -612,7 +612,7 @@ } } - *resp++ = '\0'; + *resp = '\0'; return result; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/main/ rfc1867.c
jani Tue, 29 Dec 2009 18:59:58 + Revision: http://svn.php.net/viewvc?view=revisionrevision=292771 Log: - WS + CS + folding tags Changed paths: U php/php-src/branches/PHP_5_3/main/rfc1867.c Modified: php/php-src/branches/PHP_5_3/main/rfc1867.c === --- php/php-src/branches/PHP_5_3/main/rfc1867.c 2009-12-29 18:54:08 UTC (rev 292770) +++ php/php-src/branches/PHP_5_3/main/rfc1867.c 2009-12-29 18:59:58 UTC (rev 292771) @@ -13,7 +13,7 @@ | lice...@php.net so we can mail you a copy immediately. | +--+ | Authors: Rasmus Lerdorf ras...@php.net | - | Jani Taskinen sni...@php.net | + | Jani Taskinen j...@php.net| +--+ */ @@ -23,7 +23,7 @@ * This product includes software developed by the Apache Group * for use in the Apache HTTP server project (http://www.apache.org/). * - */ + */ #include stdio.h #include php.h @@ -44,7 +44,7 @@ static void safe_php_register_variable(char *var, char *strval, int val_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC); #define SAFE_RETURN { \ -php_mb_flush_gpc_variables(num_vars, val_list, len_list, array_ptr TSRMLS_CC); \ + php_mb_flush_gpc_variables(num_vars, val_list, len_list, array_ptr TSRMLS_CC); \ if (lbuf) efree(lbuf); \ if (abuf) efree(abuf); \ if (array_index) efree(array_index); \ @@ -56,7 +56,7 @@ if (mbuff) efree(mbuff); \ return; } -void php_mb_flush_gpc_variables(int num_vars, char **val_list, int *len_list, zval *array_ptr TSRMLS_DC) +void php_mb_flush_gpc_variables(int num_vars, char **val_list, int *len_list, zval *array_ptr TSRMLS_DC) /* {{{ */ { int i; if (php_mb_encoding_translation(TSRMLS_C)) { @@ -64,17 +64,18 @@ php_mb_gpc_encoding_detector(val_list, len_list, num_vars, NULL TSRMLS_CC) == SUCCESS) { php_mb_gpc_encoding_converter(val_list, len_list, num_vars, NULL, NULL TSRMLS_CC); } - for (i=0; inum_vars; i+=2){ + for (i = 0; inum_vars; i += 2) { safe_php_register_variable(val_list[i], val_list[i+1], len_list[i+1], array_ptr, 0 TSRMLS_CC); efree(val_list[i]); efree(val_list[i+1]); - } + } efree(val_list); efree(len_list); } } +/* }}} */ -void php_mb_gpc_realloc_buffer(char ***pval_list, int **plen_list, int *num_vars_max, int inc TSRMLS_DC) +void php_mb_gpc_realloc_buffer(char ***pval_list, int **plen_list, int *num_vars_max, int inc TSRMLS_DC) /* {{{ */ { /* allow only even increments */ if (inc 1) { @@ -84,15 +85,15 @@ *pval_list = (char **)erealloc(*pval_list, (*num_vars_max+2)*sizeof(char *)); *plen_list = (int *)erealloc(*plen_list, (*num_vars_max+2)*sizeof(int)); } +/* }}} */ -void php_mb_gpc_stack_variable(char *param, char *value, char ***pval_list, int **plen_list, int *num_vars, int *num_vars_max TSRMLS_DC) +void php_mb_gpc_stack_variable(char *param, char *value, char ***pval_list, int **plen_list, int *num_vars, int *num_vars_max TSRMLS_DC) /* {{{ */ { - char **val_list=*pval_list; - int *len_list=*plen_list; + char **val_list = *pval_list; + int *len_list = *plen_list; - if (*num_vars=*num_vars_max){ - php_mb_gpc_realloc_buffer(pval_list, plen_list, num_vars_max, - 16 TSRMLS_CC); + if (*num_vars = *num_vars_max) { + php_mb_gpc_realloc_buffer(pval_list, plen_list, num_vars_max, 16 TSRMLS_CC); /* in case realloc relocated the buffer */ val_list = *pval_list; len_list = *plen_list; @@ -105,6 +106,7 @@ len_list[*num_vars] = strlen(value); (*num_vars)++; } +/* }}} */ #else @@ -137,7 +139,7 @@ #define UPLOAD_ERROR_F7 /* Failed to write file to disk */ #define UPLOAD_ERROR_X8 /* File upload stopped by extension */ -void php_rfc1867_register_constants(TSRMLS_D) +void php_rfc1867_register_constants(TSRMLS_D) /* {{{ */ { REGISTER_MAIN_LONG_CONSTANT(UPLOAD_ERR_OK, UPLOAD_ERROR_OK, CONST_CS | CONST_PERSISTENT); REGISTER_MAIN_LONG_CONSTANT(UPLOAD_ERR_INI_SIZE, UPLOAD_ERROR_A, CONST_CS | CONST_PERSISTENT); @@ -148,26 +150,27 @@ REGISTER_MAIN_LONG_CONSTANT(UPLOAD_ERR_CANT_WRITE, UPLOAD_ERROR_F, CONST_CS | CONST_PERSISTENT); REGISTER_MAIN_LONG_CONSTANT(UPLOAD_ERR_EXTENSION, UPLOAD_ERROR_X, CONST_CS | CONST_PERSISTENT); } +/* }}} */ -static void normalize_protected_variable(char *varname TSRMLS_DC) +static void normalize_protected_variable(char *varname TSRMLS_DC) /* {{{ */ { - char *s=varname, *index=NULL, *indexend=NULL, *p; - + char *s = varname, *index = NULL, *indexend = NULL, *p; + /* overjump leading space */ while (*s == ' ') { s++; } - + /* and remove it */ if (s != varname) { memmove(varname, s, strlen(s)+1); } - for (p=varname; *p *p != '['; p++) { + for (p = varname; *p *p
[PHP-CVS] svn: /php/php-src/branches/PHP_5_2/main/ rfc1867.c
jani Tue, 29 Dec 2009 19:01:03 + Revision: http://svn.php.net/viewvc?view=revisionrevision=292772 Log: MF53: ws + cs + folding tags (99% sync :) Changed paths: U php/php-src/branches/PHP_5_2/main/rfc1867.c Modified: php/php-src/branches/PHP_5_2/main/rfc1867.c === --- php/php-src/branches/PHP_5_2/main/rfc1867.c 2009-12-29 18:59:58 UTC (rev 292771) +++ php/php-src/branches/PHP_5_2/main/rfc1867.c 2009-12-29 19:01:03 UTC (rev 292772) @@ -13,7 +13,7 @@ | lice...@php.net so we can mail you a copy immediately. | +--+ | Authors: Rasmus Lerdorf ras...@php.net | - | Jani Taskinen sni...@php.net | + | Jani Taskinen j...@php.net| +--+ */ @@ -23,7 +23,7 @@ * This product includes software developed by the Apache Group * for use in the Apache HTTP server project (http://www.apache.org/). * - */ + */ #include stdio.h #include php.h @@ -32,6 +32,7 @@ #include php_globals.h #include php_variables.h #include rfc1867.h +#include php_ini.h #include ext/standard/php_string.h #define DEBUG_FILE_UPLOAD ZEND_DEBUG @@ -44,7 +45,7 @@ static void safe_php_register_variable(char *var, char *strval, int val_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC); #define SAFE_RETURN { \ -php_mb_flush_gpc_variables(num_vars, val_list, len_list, array_ptr TSRMLS_CC); \ + php_mb_flush_gpc_variables(num_vars, val_list, len_list, array_ptr TSRMLS_CC); \ if (lbuf) efree(lbuf); \ if (abuf) efree(abuf); \ if (array_index) efree(array_index); \ @@ -56,7 +57,7 @@ if (mbuff) efree(mbuff); \ return; } -void php_mb_flush_gpc_variables(int num_vars, char **val_list, int *len_list, zval *array_ptr TSRMLS_DC) +void php_mb_flush_gpc_variables(int num_vars, char **val_list, int *len_list, zval *array_ptr TSRMLS_DC) /* {{{ */ { int i; if (php_mb_encoding_translation(TSRMLS_C)) { @@ -64,17 +65,18 @@ php_mb_gpc_encoding_detector(val_list, len_list, num_vars, NULL TSRMLS_CC) == SUCCESS) { php_mb_gpc_encoding_converter(val_list, len_list, num_vars, NULL, NULL TSRMLS_CC); } - for (i=0; inum_vars; i+=2){ + for (i = 0; inum_vars; i += 2) { safe_php_register_variable(val_list[i], val_list[i+1], len_list[i+1], array_ptr, 0 TSRMLS_CC); efree(val_list[i]); efree(val_list[i+1]); - } + } efree(val_list); efree(len_list); } } +/* }}} */ -void php_mb_gpc_realloc_buffer(char ***pval_list, int **plen_list, int *num_vars_max, int inc TSRMLS_DC) +void php_mb_gpc_realloc_buffer(char ***pval_list, int **plen_list, int *num_vars_max, int inc TSRMLS_DC) /* {{{ */ { /* allow only even increments */ if (inc 1) { @@ -84,15 +86,15 @@ *pval_list = (char **)erealloc(*pval_list, (*num_vars_max+2)*sizeof(char *)); *plen_list = (int *)erealloc(*plen_list, (*num_vars_max+2)*sizeof(int)); } +/* }}} */ -void php_mb_gpc_stack_variable(char *param, char *value, char ***pval_list, int **plen_list, int *num_vars, int *num_vars_max TSRMLS_DC) +void php_mb_gpc_stack_variable(char *param, char *value, char ***pval_list, int **plen_list, int *num_vars, int *num_vars_max TSRMLS_DC) /* {{{ */ { - char **val_list=*pval_list; - int *len_list=*plen_list; + char **val_list = *pval_list; + int *len_list = *plen_list; - if (*num_vars=*num_vars_max){ - php_mb_gpc_realloc_buffer(pval_list, plen_list, num_vars_max, - 16 TSRMLS_CC); + if (*num_vars = *num_vars_max) { + php_mb_gpc_realloc_buffer(pval_list, plen_list, num_vars_max, 16 TSRMLS_CC); /* in case realloc relocated the buffer */ val_list = *pval_list; len_list = *plen_list; @@ -105,6 +107,7 @@ len_list[*num_vars] = strlen(value); (*num_vars)++; } +/* }}} */ #else @@ -137,7 +140,7 @@ #define UPLOAD_ERROR_F7 /* Failed to write file to disk */ #define UPLOAD_ERROR_X8 /* File upload stopped by extension */ -void php_rfc1867_register_constants(TSRMLS_D) +void php_rfc1867_register_constants(TSRMLS_D) /* {{{ */ { REGISTER_MAIN_LONG_CONSTANT(UPLOAD_ERR_OK, UPLOAD_ERROR_OK, CONST_CS | CONST_PERSISTENT); REGISTER_MAIN_LONG_CONSTANT(UPLOAD_ERR_INI_SIZE, UPLOAD_ERROR_A, CONST_CS | CONST_PERSISTENT); @@ -148,26 +151,27 @@ REGISTER_MAIN_LONG_CONSTANT(UPLOAD_ERR_CANT_WRITE, UPLOAD_ERROR_F, CONST_CS | CONST_PERSISTENT); REGISTER_MAIN_LONG_CONSTANT(UPLOAD_ERR_EXTENSION, UPLOAD_ERROR_X, CONST_CS | CONST_PERSISTENT); } +/* }}} */ -static void normalize_protected_variable(char *varname TSRMLS_DC) +static void normalize_protected_variable(char *varname TSRMLS_DC) /* {{{ */ { - char *s=varname, *index=NULL, *indexend=NULL, *p; - + char *s = varname, *index = NULL, *indexend = NULL, *p; + /* overjump leading
[PHP-CVS] svn: /php/php-src/trunk/main/ rfc1867.c
jani Tue, 29 Dec 2009 19:23:41 + Revision: http://svn.php.net/viewvc?view=revisionrevision=292776 Log: - CS + WS + folding tags Changed paths: U php/php-src/trunk/main/rfc1867.c Modified: php/php-src/trunk/main/rfc1867.c === --- php/php-src/trunk/main/rfc1867.c 2009-12-29 19:14:39 UTC (rev 292775) +++ php/php-src/trunk/main/rfc1867.c 2009-12-29 19:23:41 UTC (rev 292776) @@ -13,7 +13,7 @@ | lice...@php.net so we can mail you a copy immediately. | +--+ | Authors: Rasmus Lerdorf ras...@php.net | - | Jani Taskinen sni...@php.net | + | Jani Taskinen j...@php.net| +--+ */ @@ -65,7 +65,7 @@ #define UPLOAD_ERROR_F7 /* Failed to write file to disk */ #define UPLOAD_ERROR_X8 /* File upload stopped by extension */ -void php_rfc1867_register_constants(TSRMLS_D) +void php_rfc1867_register_constants(TSRMLS_D) /* {{{ */ { REGISTER_MAIN_LONG_CONSTANT(UPLOAD_ERR_OK, UPLOAD_ERROR_OK, CONST_CS | CONST_PERSISTENT); REGISTER_MAIN_LONG_CONSTANT(UPLOAD_ERR_INI_SIZE, UPLOAD_ERROR_A, CONST_CS | CONST_PERSISTENT); @@ -76,24 +76,24 @@ REGISTER_MAIN_LONG_CONSTANT(UPLOAD_ERR_CANT_WRITE, UPLOAD_ERROR_F, CONST_CS | CONST_PERSISTENT); REGISTER_MAIN_LONG_CONSTANT(UPLOAD_ERR_EXTENSION, UPLOAD_ERROR_X, CONST_CS | CONST_PERSISTENT); } +/* }}} */ -static int unlink_filename(char **filename TSRMLS_DC) +static int unlink_filename(char **filename TSRMLS_DC) /* {{{ */ { VCWD_UNLINK(*filename); return 0; } +/* }}} */ -void destroy_uploaded_files_hash(TSRMLS_D) +void destroy_uploaded_files_hash(TSRMLS_D) /* {{{ */ { zend_hash_apply(SG(rfc1867_uploaded_files), (apply_func_t) unlink_filename TSRMLS_CC); zend_hash_destroy(SG(rfc1867_uploaded_files)); FREE_HASHTABLE(SG(rfc1867_uploaded_files)); } +/* }}} */ -/* - * Following code is based on apache_multipart_buffer.c from libapreq-0.33 package. - * - */ +/* {{{ Following code is based on apache_multipart_buffer.c from libapreq-0.33 package. */ #define FILLUNIT (1024 * 5) @@ -118,9 +118,9 @@ } mime_header_entry; /* - fill up the buffer with client data. - returns number of bytes added to buffer. -*/ + * Fill up the buffer with client data. + * Returns number of bytes added to buffer. + */ static int fill_buffer(multipart_buffer *self TSRMLS_DC) { int bytes_to_read, total_read = 0, actual_read = 0; @@ -195,15 +195,15 @@ } /* - gets the next CRLF terminated line from the input buffer. - if it doesn't find a CRLF, and the buffer isn't completely full, returns - NULL; otherwise, returns the beginning of the null-terminated line, - minus the CRLF. - - note that we really just look for LF terminated lines. this works - around a bug in internet explorer for the macintosh which sends mime - boundaries that are only LF terminated when you use an image submit - button in a multipart/form-data form. + * Gets the next CRLF terminated line from the input buffer. + * If it doesn't find a CRLF, and the buffer isn't completely full, returns + * NULL; otherwise, returns the beginning of the null-terminated line, + * minus the CRLF. + * + * Note that we really just look for LF terminated lines. This works + * around a bug in internet explorer for the macintosh which sends mime + * boundaries that are only LF terminated when you use an image submit + * button in a multipart/form-data form. */ static char *next_line(multipart_buffer *self) { @@ -239,7 +239,7 @@ return line; } -/* returns the next CRLF terminated line from the client */ +/* Returns the next CRLF terminated line from the client */ static char *get_line(multipart_buffer *self TSRMLS_DC) { char* ptr = next_line(self); @@ -362,7 +362,6 @@ char *res; while (*pos *pos != stop) { - if ((quote = *pos) == '' || quote == '\'') { ++pos; while (*pos *pos != quote) { @@ -376,7 +375,6 @@ ++pos; } } else ++pos; - } if (*pos == '\0') { res = estrdup(*line); @@ -467,10 +465,10 @@ } /* - search for a string in a fixed-length byte string. - if partial is true, partial matches are allowed at the end of the buffer. - returns NULL if not found, or a pointer to the start of the first match. -*/ + * Search for a string in a fixed-length byte string. + * If partial is true, partial matches are allowed at the end of the buffer. + * Returns NULL if not found, or a pointer to the start of the first match. + */ static void *php_ap_memstr(char *haystack, int haystacklen, char *needle, int needlen, int partial) { int len = haystacklen; @@ -559,13 +557,15 @@ return out; } +/* }}} */ -static void register_raw_var_ex(char *var, zval *value, HashTable *array)
[PHP-CVS] svn: /php/php-src/branches/ PHP_5_2/main/rfc1867.c PHP_5_3/main/rfc1867.c
jani Tue, 29 Dec 2009 19:25:09 + Revision: http://svn.php.net/viewvc?view=revisionrevision=292777 Log: - Sync with HEAD Changed paths: U php/php-src/branches/PHP_5_2/main/rfc1867.c U php/php-src/branches/PHP_5_3/main/rfc1867.c Modified: php/php-src/branches/PHP_5_2/main/rfc1867.c === --- php/php-src/branches/PHP_5_2/main/rfc1867.c 2009-12-29 19:23:41 UTC (rev 292776) +++ php/php-src/branches/PHP_5_2/main/rfc1867.c 2009-12-29 19:25:09 UTC (rev 292777) @@ -263,7 +263,7 @@ } /* }}} */ -static int unlink_filename(char **filename TSRMLS_DC) /* {{{ */ +static int unlink_filename(char **filename TSRMLS_DC) /* {{{ */ { VCWD_UNLINK(*filename); return 0; @@ -304,7 +304,7 @@ /* * Fill up the buffer with client data. - * returns number of bytes added to buffer. + * Returns number of bytes added to buffer. */ static int fill_buffer(multipart_buffer *self TSRMLS_DC) { @@ -417,7 +417,7 @@ return line; } -/* returns the next CRLF terminated line from the client */ +/* Returns the next CRLF terminated line from the client */ static char *get_line(multipart_buffer *self TSRMLS_DC) { char* ptr = next_line(self); @@ -665,7 +665,7 @@ * Search for a string in a fixed-length byte string. * If partial is true, partial matches are allowed at the end of the buffer. * Returns NULL if not found, or a pointer to the start of the first match. -*/ + */ static void *php_ap_memstr(char *haystack, int haystacklen, char *needle, int needlen, int partial) { int len = haystacklen; @@ -747,12 +747,14 @@ total_bytes += read_bytes; } - if (out) out[total_bytes] = '\0'; + if (out) { + out[total_bytes] = '\0'; + } *len = total_bytes; return out; } -/* }}} */ +/* }}} */ /* * The combined READER/HANDLER @@ -773,7 +775,7 @@ #endif multipart_buffer *mbuff; zval *array_ptr = (zval *) arg; - int fd=-1; + int fd = -1; zend_llist header; void *event_extra_data = NULL; int llen = 0; @@ -860,7 +862,7 @@ while (!multipart_buffer_eof(mbuff TSRMLS_CC)) { char buff[FILLUNIT]; - char *cd = NULL,*param = NULL, *filename = NULL, *tmp = NULL; + char *cd = NULL, *param = NULL, *filename = NULL, *tmp = NULL; size_t blen = 0, wlen = 0; off_t offset; @@ -1084,7 +1086,6 @@ #endif cancel_upload = UPLOAD_ERROR_B; } else if (blen 0) { - wlen = write(fd, buff, blen); if (wlen == -1) { @@ -1119,7 +1120,6 @@ cancel_upload = 5; } #endif - if (php_rfc1867_callback != NULL) { multipart_event_file_end event_file_end; @@ -1153,7 +1153,7 @@ if (array_index) { efree(array_index); } - array_index = estrndup(start_arr+1, array_len-2); + array_index = estrndup(start_arr + 1, array_len - 2); } /* Add $foo_name */ @@ -1339,6 +1339,7 @@ efree(param); } } + fileupload_done: if (php_rfc1867_callback != NULL) { multipart_event_end event_end; @@ -1349,6 +1350,7 @@ SAFE_RETURN; } +/* }}} */ /* * Local variables: Modified: php/php-src/branches/PHP_5_3/main/rfc1867.c === --- php/php-src/branches/PHP_5_3/main/rfc1867.c 2009-12-29 19:23:41 UTC (rev 292776) +++ php/php-src/branches/PHP_5_3/main/rfc1867.c 2009-12-29 19:25:09 UTC (rev 292777) @@ -262,7 +262,7 @@ } /* }}} */ -static int unlink_filename(char **filename TSRMLS_DC) /* {{{ */ +static int unlink_filename(char **filename TSRMLS_DC) /* {{{ */ { VCWD_UNLINK(*filename); return 0; @@ -303,7 +303,7 @@ /* * Fill up the buffer with client data. - * returns number of bytes added to buffer. + * Returns number of bytes added to buffer. */ static int fill_buffer(multipart_buffer *self TSRMLS_DC) { @@ -416,7 +416,7 @@ return line; } -/* returns the next CRLF terminated line from the client */ +/* Returns the next CRLF terminated line from the client */ static char *get_line(multipart_buffer *self TSRMLS_DC) { char* ptr = next_line(self); @@ -664,7 +664,7 @@ * Search for a string in a fixed-length byte string. * If partial is true, partial matches are allowed at the end of the buffer. * Returns NULL if not found, or a pointer to the start of the first match. -*/ + */