[PHP-CVS] cvs: php4(PHP_4_3) /main main.c
iliaa Fri Jun 20 13:00:16 2003 EDT Modified files: (Branch: PHP_4_3) /php4/main main.c Log: Fixed bug #24253 (missing variables when register_globals is on) Fixed a memory leak when more then 1 E|S flag is passed to gpc_order. Fixed a memory leak when variables_order is not set and gpc_order has S|s flag. Optimized out duplicate parsing of the variables order string. Index: php4/main/main.c diff -u php4/main/main.c:1.512.2.41 php4/main/main.c:1.512.2.42 --- php4/main/main.c:1.512.2.41 Tue Jun 17 13:15:16 2003 +++ php4/main/main.cFri Jun 20 13:00:16 2003 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: main.c,v 1.512.2.41 2003/06/17 17:15:16 iliaa Exp $ */ +/* $Id: main.c,v 1.512.2.42 2003/06/20 17:00:16 iliaa Exp $ */ /* {{{ includes */ @@ -134,7 +134,6 @@ #define NUM_TRACK_VARS (sizeof(short_track_vars_names_length)/sizeof(int)) - #define SAFE_FILENAME(f) ((f)?(f):-) /* {{{ PHP_INI_MH @@ -1362,7 +1361,7 @@ static int php_hash_environment(TSRMLS_D) { char *p; - unsigned char _gpc_flags[3] = {0, 0, 0}; + int _gpc_flags[5] = {0, 0, 0, 0, 0}; zend_bool have_variables_order; zval *dummy_track_vars_array = NULL; zend_bool initialized_dummy_track_vars_array=0; @@ -1409,42 +1408,48 @@ case 'P': if (!_gpc_flags[0] !SG(headers_sent) SG(request_info).request_method !strcmp(SG(request_info).request_method, POST)) { sapi_module.treat_data(PARSE_POST, NULL, NULL TSRMLS_CC); /* POST Data */ - _gpc_flags[0]=1; + _gpc_flags[0]=TRACK_VARS_POST + 1; } break; case 'c': case 'C': if (!_gpc_flags[1]) { sapi_module.treat_data(PARSE_COOKIE, NULL, NULL TSRMLS_CC); /* Cookie Data */ - _gpc_flags[1]=1; + _gpc_flags[1]=TRACK_VARS_COOKIE + 1; } break; case 'g': case 'G': if (!_gpc_flags[2]) { sapi_module.treat_data(PARSE_GET, NULL, NULL TSRMLS_CC);/* GET Data */ - _gpc_flags[2]=1; + _gpc_flags[2]=TRACK_VARS_GET + 1; } break; case 'e': case 'E': - if (have_variables_order) { - ALLOC_ZVAL(PG(http_globals)[TRACK_VARS_ENV]); - array_init(PG(http_globals)[TRACK_VARS_ENV]); - INIT_PZVAL(PG(http_globals)[TRACK_VARS_ENV]); - php_import_environment_variables(PG(http_globals)[TRACK_VARS_ENV] TSRMLS_CC); - } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, Unsupported 'e' element (environment) used in gpc_order - use variables_order instead); + if (!_gpc_flags[3]) { + if (have_variables_order) { + ALLOC_ZVAL(PG(http_globals)[TRACK_VARS_ENV]); + array_init(PG(http_globals)[TRACK_VARS_ENV]); + INIT_PZVAL(PG(http_globals)[TRACK_VARS_ENV]); + php_import_environment_variables(PG(http_globals)[TRACK_VARS_ENV] TSRMLS_CC); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Unsupported 'e' element (environment) used in gpc_order - use variables_order instead); + } + _gpc_flags[3]=TRACK_VARS_ENV + 1; } break; case 's': case 'S': - php_register_server_variables(TSRMLS_C); + if (!_gpc_flags[4]) { + php_register_server_variables(TSRMLS_C); + _gpc_flags[4]=TRACK_VARS_SERVER + 1; + } break; } } - if (!have_variables_order) { + if (!have_variables_order
[PHP-CVS] cvs: php4(PHP_4_3) /main main.c
iliaa Tue Jun 17 13:15:16 2003 EDT Modified files: (Branch: PHP_4_3) /php4/main main.c Log: MFH: Handle numeric keys passed via GPC Index: php4/main/main.c diff -u php4/main/main.c:1.512.2.40 php4/main/main.c:1.512.2.41 --- php4/main/main.c:1.512.2.40 Sat Jun 14 11:08:37 2003 +++ php4/main/main.cTue Jun 17 13:15:16 2003 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: main.c,v 1.512.2.40 2003/06/14 15:08:37 iliaa Exp $ */ +/* $Id: main.c,v 1.512.2.41 2003/06/17 17:15:16 iliaa Exp $ */ /* {{{ includes */ @@ -1500,12 +1500,14 @@ zval **data; char *string_key; uint string_key_len; + ulong num_key; zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(form_variables), pos); while (zend_hash_get_current_data_ex(Z_ARRVAL_P(form_variables), (void **)data, pos) == SUCCESS) { - zend_hash_get_current_key_ex(Z_ARRVAL_P(form_variables), string_key, string_key_len, NULL, 0, pos); - - ZEND_SET_SYMBOL_WITH_LENGTH(EG(symbol_table), string_key, string_key_len, *data, (*data)-refcount+1, 0); + /* we only register string keys, since we cannot have $1234 */ + if (zend_hash_get_current_key_ex(Z_ARRVAL_P(form_variables), string_key, string_key_len, num_key, 0, pos) == HASH_KEY_IS_STRING) { + ZEND_SET_SYMBOL_WITH_LENGTH(EG(symbol_table), string_key, string_key_len, *data, (*data)-refcount+1, 0); + } zend_hash_move_forward_ex(Z_ARRVAL_P(form_variables), pos); } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /main main.c php_variables.c
iliaa Sat Jun 14 11:08:38 2003 EDT Modified files: (Branch: PHP_4_3) /php4/main main.c php_variables.c Log: MFH: Fixed bug #24007 (Problem with register_globals arrays) Index: php4/main/main.c diff -u php4/main/main.c:1.512.2.39 php4/main/main.c:1.512.2.40 --- php4/main/main.c:1.512.2.39 Thu Jun 12 04:33:45 2003 +++ php4/main/main.cSat Jun 14 11:08:37 2003 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: main.c,v 1.512.2.39 2003/06/12 08:33:45 derick Exp $ */ +/* $Id: main.c,v 1.512.2.40 2003/06/14 15:08:37 iliaa Exp $ */ /* {{{ includes */ @@ -1495,6 +1495,20 @@ } } + if (PG(register_globals)) { + HashPosition pos; + zval **data; + char *string_key; + uint string_key_len; + + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(form_variables), pos); + while (zend_hash_get_current_data_ex(Z_ARRVAL_P(form_variables), (void **)data, pos) == SUCCESS) { + zend_hash_get_current_key_ex(Z_ARRVAL_P(form_variables), string_key, string_key_len, NULL, 0, pos); + + ZEND_SET_SYMBOL_WITH_LENGTH(EG(symbol_table), string_key, string_key_len, *data, (*data)-refcount+1, 0); + zend_hash_move_forward_ex(Z_ARRVAL_P(form_variables), pos); + } + } zend_hash_update(EG(symbol_table), _REQUEST, sizeof(_REQUEST), form_variables, sizeof(zval *), NULL); } Index: php4/main/php_variables.c diff -u php4/main/php_variables.c:1.45.2.3 php4/main/php_variables.c:1.45.2.4 --- php4/main/php_variables.c:1.45.2.3 Tue Dec 31 11:26:23 2002 +++ php4/main/php_variables.c Sat Jun 14 11:08:37 2003 @@ -16,7 +16,7 @@ | Zeev Suraski [EMAIL PROTECTED]| +--+ */ -/* $Id: php_variables.c,v 1.45.2.3 2002/12/31 16:26:23 sebastian Exp $ */ +/* $Id: php_variables.c,v 1.45.2.4 2003/06/14 15:08:37 iliaa Exp $ */ #include stdio.h #include php.h @@ -63,23 +63,15 @@ char *ip; /* index pointer */ char *index; int var_len, index_len; - zval *gpc_element, **gpc_element_p, **top_gpc_p=NULL; + zval *gpc_element, **gpc_element_p; zend_bool is_array; HashTable *symtable1=NULL; - HashTable *symtable2=NULL; assert(var != NULL); if (track_vars_array) { symtable1 = Z_ARRVAL_P(track_vars_array); } - if (PG(register_globals)) { - if (symtable1) { - symtable2 = EG(active_symbol_table); - } else { - symtable1 = EG(active_symbol_table); - } - } if (!symtable1) { /* Nothing to do */ zval_dtor(val); @@ -164,9 +156,6 @@ efree(escaped_index); } } - if (!top_gpc_p) { - top_gpc_p = gpc_element_p; - } symtable1 = Z_ARRVAL_PP(gpc_element_p); /* ip pointed to the '[' character, now obtain the key */ index = index_s; @@ -189,18 +178,8 @@ } else { zend_hash_update(symtable1, index, index_len+1, gpc_element, sizeof(zval *), (void **) gpc_element_p); } - if (!top_gpc_p) { - top_gpc_p = gpc_element_p; - } break; } - } - - if (top_gpc_p) { - if (symtable2) { - zend_hash_update(symtable2, var, var_len+1, top_gpc_p, sizeof(zval *), NULL); - (*top_gpc_p)-refcount++; - } } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /main main.c
bfrance Mon Mar 31 16:24:59 2003 EDT Modified files: (Branch: PHP_4_3) /php4/main main.c Log: Fixes the problem where argv and argc are not populated unless S is in the variables_order, even if register_argc_argv is on. Index: php4/main/main.c diff -u php4/main/main.c:1.512.2.20 php4/main/main.c:1.512.2.21 --- php4/main/main.c:1.512.2.20 Wed Mar 19 03:22:35 2003 +++ php4/main/main.cMon Mar 31 16:24:59 2003 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: main.c,v 1.512.2.20 2003/03/19 08:22:35 sniper Exp $ */ +/* $Id: main.c,v 1.512.2.21 2003/03/31 21:24:59 bfrance Exp $ */ /* {{{ includes */ @@ -110,7 +110,7 @@ static last_error_type last_error; -static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC); +static void php_build_argv(char *s TSRMLS_DC); static char *short_track_vars_names[] = { @@ -1317,11 +1317,6 @@ sapi_module.register_server_variables(array_ptr TSRMLS_CC); } - /* argv/argc support */ - if (PG(register_argc_argv)) { - php_build_argv(SG(request_info).query_string, array_ptr TSRMLS_CC); - } - /* PHP Authentication support */ if (SG(request_info).auth_user) { php_register_variable(PHP_AUTH_USER, SG(request_info).auth_user, array_ptr TSRMLS_CC); @@ -1423,6 +1418,11 @@ php_register_server_variables(TSRMLS_C); } + /* argv/argc support */ + if (PG(register_argc_argv)) { + php_build_argv(SG(request_info).query_string TSRMLS_CC); + } + for (i=0; iNUM_TRACK_VARS; i++) { if (!PG(http_globals)[i]) { if (!initialized_dummy_track_vars_array) { @@ -1474,7 +1474,7 @@ /* {{{ php_build_argv */ -static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC) +static void php_build_argv(char *s TSRMLS_DC) { pval *arr, *argc, *tmp; int count = 0; @@ -1544,8 +1544,10 @@ zend_hash_add(EG(symbol_table), argc, sizeof(argc), argc, sizeof(zval *), NULL); } - zend_hash_update(Z_ARRVAL_P(track_vars_array), argv, sizeof(argv), arr, sizeof(pval *), NULL); - zend_hash_update(Z_ARRVAL_P(track_vars_array), argc, sizeof(argc), argc, sizeof(pval *), NULL); + if ( PG(http_globals)[TRACK_VARS_SERVER] != NULL ) { + zend_hash_update(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), argv, sizeof(argv), arr, sizeof(pval *), NULL); + zend_hash_update(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), argc, sizeof(argc), argc, sizeof(pval *), NULL); + } } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4(PHP_4_3) /main main.c
Would be nice if this was fixed in HEAD too. --Jani On Mon, 31 Mar 2003, Brian France wrote: bfranceMon Mar 31 16:24:59 2003 EDT Modified files: (Branch: PHP_4_3) /php4/main main.c Log: Fixes the problem where argv and argc are not populated unless S is in the variables_order, even if register_argc_argv is on. Index: php4/main/main.c diff -u php4/main/main.c:1.512.2.20 php4/main/main.c:1.512.2.21 --- php4/main/main.c:1.512.2.20Wed Mar 19 03:22:35 2003 +++ php4/main/main.c Mon Mar 31 16:24:59 2003 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: main.c,v 1.512.2.20 2003/03/19 08:22:35 sniper Exp $ */ +/* $Id: main.c,v 1.512.2.21 2003/03/31 21:24:59 bfrance Exp $ */ /* {{{ includes */ @@ -110,7 +110,7 @@ static last_error_type last_error; -static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC); +static void php_build_argv(char *s TSRMLS_DC); static char *short_track_vars_names[] = { @@ -1317,11 +1317,6 @@ sapi_module.register_server_variables(array_ptr TSRMLS_CC); } - /* argv/argc support */ - if (PG(register_argc_argv)) { - php_build_argv(SG(request_info).query_string, array_ptr TSRMLS_CC); - } - /* PHP Authentication support */ if (SG(request_info).auth_user) { php_register_variable(PHP_AUTH_USER, SG(request_info).auth_user, array_ptr TSRMLS_CC); @@ -1423,6 +1418,11 @@ php_register_server_variables(TSRMLS_C); } + /* argv/argc support */ + if (PG(register_argc_argv)) { + php_build_argv(SG(request_info).query_string TSRMLS_CC); + } + for (i=0; iNUM_TRACK_VARS; i++) { if (!PG(http_globals)[i]) { if (!initialized_dummy_track_vars_array) { @@ -1474,7 +1474,7 @@ /* {{{ php_build_argv */ -static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC) +static void php_build_argv(char *s TSRMLS_DC) { pval *arr, *argc, *tmp; int count = 0; @@ -1544,8 +1544,10 @@ zend_hash_add(EG(symbol_table), argc, sizeof(argc), argc, sizeof(zval *), NULL); } - zend_hash_update(Z_ARRVAL_P(track_vars_array), argv, sizeof(argv), arr, sizeof(pval *), NULL); - zend_hash_update(Z_ARRVAL_P(track_vars_array), argc, sizeof(argc), argc, sizeof(pval *), NULL); + if ( PG(http_globals)[TRACK_VARS_SERVER] != NULL ) { + zend_hash_update(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), argv, sizeof(argv), arr, sizeof(pval *), NULL); + zend_hash_update(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), argc, sizeof(argc), argc, sizeof(pval *), NULL); + } } /* }}} */ -- - For Sale! - -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4(PHP_4_3) /main main.c
I have tested for this problem on HEAD, but I can't seem to make it happen. Some how the auto global code kicks in and they get registered. I haven't been able to figure out why that is since _SERVER seems to be how $_SERVER is registered and argv and argc names are not registered. I had planed on porting the patch to HEAD, but it may not be needed with auto globals. Even if the code is not needed (because of auto globals), patch the code any way so the code bases look the same (php_build_argv param change and moving things around). If that is the case I will commit the changes to branch HEAD. Let me know. Thanks, Brian On Tue, 1 Apr 2003 02:45:23 +0300 (EEST), Jani Taskinen wrote: Would be nice if this was fixed in HEAD too. --Jani On Mon, 31 Mar 2003, Brian France wrote: bfrance Mon Mar 31 16:24:59 2003 EDT Modified files: (Branch: PHP_4_3) /php4/main main.c Log: Fixes the problem where argv and argc are not populated unless S is in the variables_order, even if register_argc_argv is on. Index: php4/main/main.c diff -u php4/main/main.c:1.512.2.20 php4/main/main.c:1.512.2.21 --- php4/main/main.c:1.512.2.20 Wed Mar 19 03:22:35 2003 +++ php4/main/main.c Mon Mar 31 16:24:59 2003 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: main.c,v 1.512.2.20 2003/03/19 08:22:35 sniper Exp $ */ +/* $Id: main.c,v 1.512.2.21 2003/03/31 21:24:59 bfrance Exp $ */ /* {{{ includes */ @@ -110,7 +110,7 @@ static last_error_type last_error; -static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC); +static void php_build_argv(char *s TSRMLS_DC); static char *short_track_vars_names[] = { @@ -1317,11 +1317,6 @@ sapi_module.register_server_variables(array_ptr TSRMLS_CC); } -/* argv/argc support */ -if (PG(register_argc_argv)) { -php_build_argv(SG(request_info).query_string, array_ptr TSRMLS_CC); -} - /* PHP Authentication support */ if (SG(request_info).auth_user) { php_register_variable(PHP_AUTH_USER, SG(request_info).auth_user, array_ptr TSRMLS_CC); @@ -1423,6 +1418,11 @@ php_register_server_variables(TSRMLS_C); } +/* argv/argc support */ +if (PG(register_argc_argv)) { +php_build_argv(SG(request_info).query_string TSRMLS_CC); +} + for (i=0; iNUM_TRACK_VARS; i++) { if (!PG(http_globals)[i]) { if (!initialized_dummy_track_vars_array) { @@ -1474,7 +1474,7 @@ /* {{{ php_build_argv */ -static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC) +static void php_build_argv(char *s TSRMLS_DC) { pval *arr, *argc, *tmp; int count = 0; @@ -1544,8 +1544,10 @@ zend_hash_add(EG(symbol_table), argc, sizeof(argc), argc, sizeof(zval *), NULL); } -zend_hash_update(Z_ARRVAL_P(track_vars_array), argv, sizeof(argv), arr, sizeof(pval *), NULL); -zend_hash_update(Z_ARRVAL_P(track_vars_array), argc, sizeof(argc), argc, sizeof(pval *), NULL); +if ( PG(http_globals)[TRACK_VARS_SERVER] != NULL ) { +zend_hash_update(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), argv, sizeof(argv), arr, sizeof(pval *), NULL); +zend_hash_update(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), argc, sizeof(argc), argc, sizeof(pval *), NULL); +} } /* }}} */ -- - For Sale! - -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /main main.c
sniper Wed Mar 19 03:22:36 2003 EDT Modified files: (Branch: PHP_4_3) /php4/main main.c Log: MFH: Fixed bug #22775 (Fatal errors exit with status 0 with CGI/CLI) Index: php4/main/main.c diff -u php4/main/main.c:1.512.2.19 php4/main/main.c:1.512.2.20 --- php4/main/main.c:1.512.2.19 Tue Mar 18 17:43:00 2003 +++ php4/main/main.cWed Mar 19 03:22:35 2003 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: main.c,v 1.512.2.19 2003/03/18 22:43:00 helly Exp $ */ +/* $Id: main.c,v 1.512.2.20 2003/03/19 08:22:35 sniper Exp $ */ /* {{{ includes */ @@ -717,6 +717,7 @@ /*case E_PARSE: the parser would return 1 (failure), we can bail out nicely */ case E_COMPILE_ERROR: case E_USER_ERROR: + EG(exit_status) = 255; if (module_initialized) { zend_bailout(); efree(buffer); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /main main.c
helly Tue Mar 18 17:43:00 2003 EDT Modified files: (Branch: PHP_4_3) /php4/main main.c Log: MFH Index: php4/main/main.c diff -u php4/main/main.c:1.512.2.18 php4/main/main.c:1.512.2.19 --- php4/main/main.c:1.512.2.18 Mon Mar 17 08:50:22 2003 +++ php4/main/main.cTue Mar 18 17:43:00 2003 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: main.c,v 1.512.2.18 2003/03/17 13:50:22 wez Exp $ */ +/* $Id: main.c,v 1.512.2.19 2003/03/18 22:43:00 helly Exp $ */ /* {{{ includes */ @@ -292,7 +292,7 @@ STD_PHP_INI_BOOLEAN(display_startup_errors, 0,PHP_INI_ALL, OnUpdateBool, display_startup_errors, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN(enable_dl,1, PHP_INI_SYSTEM, OnUpdateBool, enable_dl, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN(expose_php, 1, PHP_INI_SYSTEM, OnUpdateBool, expose_php, php_core_globals, core_globals) - STD_PHP_INI_ENTRY(docref_root, http://www.php.net/;, PHP_INI_ALL, OnUpdateString, docref_root,php_core_globals, core_globals) + STD_PHP_INI_ENTRY(docref_root,, PHP_INI_ALL,OnUpdateString, docref_root, php_core_globals, core_globals) STD_PHP_INI_ENTRY(docref_ext, , PHP_INI_ALL,OnUpdateString, docref_ext, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN(html_errors, 1, PHP_INI_ALL,OnUpdateBool, html_errors, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN(xmlrpc_errors,0, PHP_INI_SYSTEM, OnUpdateBool, xmlrpc_errors, php_core_globals, core_globals) @@ -508,7 +508,10 @@ } } } - if (PG(html_errors)) { + if (!PG(html_errors) || !strlen(PG(docref_root))) { + /* no docref and no html errors - do not point to any documentation (e.g. production boxes) */ + php_error(type, %s(%s): %s, get_active_function_name(TSRMLS_C), params, buffer); + } else if (PG(html_errors)) { php_error(type, %s(%s) [a href='%s%s%s'%s/a]: %s, get_active_function_name(TSRMLS_C), params, docref_root, docref, docref_target, docref, buffer); } else { php_error(type, %s(%s) [%s%s%s]: %s, get_active_function_name(TSRMLS_C), params, docref_root, docref, docref_target, buffer); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /main main.c
sesser Wed Mar 12 07:01:04 2003 EDT Modified files: (Branch: PHP_4_3) /php4/main main.c Log: MFH Index: php4/main/main.c diff -u php4/main/main.c:1.512.2.15 php4/main/main.c:1.512.2.16 --- php4/main/main.c:1.512.2.15 Sat Mar 8 10:24:47 2003 +++ php4/main/main.cWed Mar 12 07:01:01 2003 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: main.c,v 1.512.2.15 2003/03/08 15:24:47 sesser Exp $ */ +/* $Id: main.c,v 1.512.2.16 2003/03/12 12:01:01 sesser Exp $ */ /* {{{ includes */ @@ -598,14 +598,6 @@ TSRMLS_FETCH(); buffer_len = vspprintf(buffer, PG(log_errors_max_len), format, args); - if (PG(html_errors)) { - int len; - char *replace = php_escape_html_entities(buffer, buffer_len, len, 0, ENT_COMPAT, NULL TSRMLS_CC); - efree(buffer); - buffer = replace; - buffer_len = len; - } - if (PG(ignore_repeated_errors)) { if (strncmp(last_error.buf, buffer, sizeof(last_error.buf)) || (!PG(ignore_repeated_source) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /main main.c
sesser Sat Mar 8 10:24:47 2003 EDT Modified files: (Branch: PHP_4_3) /php4/main main.c Log: MFH Index: php4/main/main.c diff -u php4/main/main.c:1.512.2.14 php4/main/main.c:1.512.2.15 --- php4/main/main.c:1.512.2.14 Thu Mar 6 15:58:18 2003 +++ php4/main/main.cSat Mar 8 10:24:47 2003 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: main.c,v 1.512.2.14 2003/03/06 20:58:18 sesser Exp $ */ +/* $Id: main.c,v 1.512.2.15 2003/03/08 15:24:47 sesser Exp $ */ /* {{{ includes */ @@ -458,6 +458,14 @@ buffer_len = vspprintf(buffer, 0, format, args); if (buffer) { + if (PG(html_errors)) { + int len; + char *replace = php_escape_html_entities(buffer, buffer_len, len, 0, ENT_COMPAT, NULL TSRMLS_CC); + efree(buffer); + buffer = replace; + buffer_len = len; + } + if (docref docref[0] == '#') { docref_target = strchr(docref, '#'); docref = NULL; @@ -590,6 +598,14 @@ TSRMLS_FETCH(); buffer_len = vspprintf(buffer, PG(log_errors_max_len), format, args); + if (PG(html_errors)) { + int len; + char *replace = php_escape_html_entities(buffer, buffer_len, len, 0, ENT_COMPAT, NULL TSRMLS_CC); + efree(buffer); + buffer = replace; + buffer_len = len; + } + if (PG(ignore_repeated_errors)) { if (strncmp(last_error.buf, buffer, sizeof(last_error.buf)) || (!PG(ignore_repeated_source) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4(PHP_4_3) /main main.c
At 02:54 03.03.2003, Harald Radi wrote: phanto Sun Mar 2 20:54:29 2003 EDT Modified files: (Branch: PHP_4_3) /php4/main main.c Log: MFH: adding disable_classes ini directive Why was this *new functionality* MFHed? -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-CVS] cvs: php4(PHP_4_3) /main main.c
because it is a rather small manageable security fix ? regards, Harald Radi -- nme - we can heal you http://www.nme.at Ortner Radi Schwenk GnbR Tumpenweg 528 5084 Grossgmain, Salzburg Austria -Original Message- From: Marcus Börger [mailto:[EMAIL PROTECTED] Sent: Monday, March 03, 2003 11:59 AM To: Harald Radi Cc: [EMAIL PROTECTED] Subject: Re: [PHP-CVS] cvs: php4(PHP_4_3) /main main.c At 02:54 03.03.2003, Harald Radi wrote: phanto Sun Mar 2 20:54:29 2003 EDT Modified files: (Branch: PHP_4_3) /php4/main main.c Log: MFH: adding disable_classes ini directive Why was this *new functionality* MFHed? -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-CVS] cvs: php4(PHP_4_3) /main main.c
At 12:13 03.03.2003, Harald Radi wrote: because it is a rather small manageable security fix ? Ah security is reason enough -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /main main.c
phanto Sun Mar 2 20:54:29 2003 EDT Modified files: (Branch: PHP_4_3) /php4/main main.c Log: MFH: adding disable_classes ini directive Index: php4/main/main.c diff -u php4/main/main.c:1.512.2.12 php4/main/main.c:1.512.2.13 --- php4/main/main.c:1.512.2.12 Wed Feb 26 17:17:35 2003 +++ php4/main/main.cSun Mar 2 20:54:29 2003 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: main.c,v 1.512.2.12 2003/02/26 22:17:35 rasmus Exp $ */ +/* $Id: main.c,v 1.512.2.13 2003/03/03 01:54:29 phanto Exp $ */ /* {{{ includes */ @@ -202,6 +202,44 @@ } /* }}} */ +/* {{{ php_disable_classes + */ +static void php_disable_classes(TSRMLS_D) +{ + char *s = NULL; + char *e = INI_STR(disable_classes); + char p; + + if (!*e) { + return; + } + + while (*e) { + switch (*e) { + case ' ': + case ',': + if (s) { + p = *e; + *e = '\0'; + zend_disable_class(s, e-s TSRMLS_CC); + *e = p; + s = NULL; + } + break; + default: + if (!s) { + s = e; + } + break; + } + e++; + } + if (s) { + zend_disable_class(s, e-s TSRMLS_CC); + } +} +/* }}} */ + /* {{{ PHP_INI_MH */ static PHP_INI_MH(OnUpdateTimeout) @@ -324,6 +362,7 @@ PHP_INI_ENTRY(sendmail_from, NULL, PHP_INI_ALL,NULL) PHP_INI_ENTRY(sendmail_path, DEFAULT_SENDMAIL_PATH, PHP_INI_SYSTEM, NULL) PHP_INI_ENTRY(disable_functions, , PHP_INI_SYSTEM, NULL) + PHP_INI_ENTRY(disable_classes,, PHP_INI_SYSTEM, NULL) STD_PHP_INI_BOOLEAN(allow_url_fopen, 1,PHP_INI_ALL, OnUpdateBool, allow_url_fopen, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN(always_populate_raw_post_data,0, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, always_populate_raw_post_data, php_core_globals, core_globals) @@ -1178,8 +1217,9 @@ */ php_ini_delayed_modules_startup(TSRMLS_C); - /* disable certain functions as requested by php.ini */ + /* disable certain classes and functions as requested by php.ini */ php_disable_functions(TSRMLS_C); + php_disable_classes(TSRMLS_C); /* start Zend extensions */ zend_startup_extensions(); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /main main.c
rasmus Wed Feb 26 17:17:35 2003 EDT Modified files: (Branch: PHP_4_3) /php4/main main.c Log: Get rid of an unnecessary syscall on non-Windows. We don't need two setitimer() calls here in order to reset the timer. Index: php4/main/main.c diff -u php4/main/main.c:1.512.2.11 php4/main/main.c:1.512.2.12 --- php4/main/main.c:1.512.2.11 Wed Feb 19 11:17:34 2003 +++ php4/main/main.cWed Feb 26 17:17:35 2003 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: main.c,v 1.512.2.11 2003/02/19 16:17:34 phanto Exp $ */ +/* $Id: main.c,v 1.512.2.12 2003/02/26 22:17:35 rasmus Exp $ */ /* {{{ includes */ @@ -1581,7 +1581,9 @@ #if defined(ZEND_MULTIBYTE) defined(HAVE_MBSTRING) php_mb_set_zend_encoding(TSRMLS_C); #endif /* ZEND_MULTIBYTE HAVE_MBSTRING */ +#ifdef PHP_WIN32 zend_unset_timeout(TSRMLS_C); +#endif zend_set_timeout(INI_INT(max_execution_time)); retval = (zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, NULL, 3, prepend_file_p, primary_file, append_file_p) == SUCCESS); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /main main.c
phanto Wed Feb 19 11:17:34 2003 EDT Modified files: (Branch: PHP_4_3) /php4/main main.c Log: MFH Index: php4/main/main.c diff -u php4/main/main.c:1.512.2.10 php4/main/main.c:1.512.2.11 --- php4/main/main.c:1.512.2.10 Sat Feb 15 15:23:12 2003 +++ php4/main/main.cWed Feb 19 11:17:34 2003 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: main.c,v 1.512.2.10 2003/02/15 20:23:12 sniper Exp $ */ +/* $Id: main.c,v 1.512.2.11 2003/02/19 16:17:34 phanto Exp $ */ /* {{{ includes */ @@ -915,6 +915,10 @@ void php_request_shutdown(void *dummy) { TSRMLS_FETCH(); + + /* EG(opline_ptr) points into nirvana and therefore cannot be safely accessed + inside zend_executor callback functions. */ + EG(opline_ptr) = NULL; zend_try { php_end_ob_buffers((zend_bool)(SG(request_info).headers_only?0:1) TSRMLS_CC); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /main main.c
sniper Sat Feb 15 15:23:13 2003 EDT Modified files: (Branch: PHP_4_3) /php4/main main.c Log: MFH: Fix for bug #0 Index: php4/main/main.c diff -u php4/main/main.c:1.512.2.9 php4/main/main.c:1.512.2.10 --- php4/main/main.c:1.512.2.9 Tue Jan 28 19:46:31 2003 +++ php4/main/main.cSat Feb 15 15:23:12 2003 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: main.c,v 1.512.2.9 2003/01/29 00:46:31 phanto Exp $ */ +/* $Id: main.c,v 1.512.2.10 2003/02/15 20:23:12 sniper Exp $ */ /* {{{ includes */ @@ -300,15 +300,15 @@ STD_PHP_INI_ENTRY(gpc_order, GPC, PHP_INI_ALL,OnUpdateStringUnempty, gpc_order, php_core_globals, core_globals) STD_PHP_INI_ENTRY(include_path, PHP_INCLUDE_PATH, PHP_INI_ALL,OnUpdateStringUnempty, include_path, php_core_globals, core_globals) PHP_INI_ENTRY(max_execution_time, 30, PHP_INI_ALL,OnUpdateTimeout) - STD_PHP_INI_ENTRY(open_basedir, NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, open_basedir, php_core_globals, core_globals) - STD_PHP_INI_ENTRY(safe_mode_exec_dir, 1, PHP_INI_SYSTEM, OnUpdateString, safe_mode_exec_dir, php_core_globals, core_globals) + STD_PHP_INI_ENTRY(open_basedir, NULL, +PHP_INI_SYSTEM, OnUpdateString, open_basedir, + php_core_globals, core_globals) + STD_PHP_INI_ENTRY(safe_mode_exec_dir, , +PHP_INI_SYSTEM, OnUpdateString, safe_mode_exec_dir, + php_core_globals, core_globals) STD_PHP_INI_BOOLEAN(file_uploads, 1, PHP_INI_SYSTEM, OnUpdateBool, file_uploads, php_core_globals, core_globals) STD_PHP_INI_ENTRY(upload_max_filesize,2M, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateInt, upload_max_filesize,php_core_globals, core_globals) STD_PHP_INI_ENTRY(post_max_size, 8M, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateInt,post_max_size, sapi_globals_struct,sapi_globals) STD_PHP_INI_ENTRY(upload_tmp_dir, NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, upload_tmp_dir, php_core_globals, core_globals) - STD_PHP_INI_ENTRY(user_dir, NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, user_dir, php_core_globals, core_globals) + STD_PHP_INI_ENTRY(user_dir, NULL, +PHP_INI_SYSTEM, OnUpdateString, user_dir, + php_core_globals, core_globals) STD_PHP_INI_ENTRY(variables_order,NULL, PHP_INI_ALL, OnUpdateStringUnempty, variables_order,php_core_globals, core_globals) STD_PHP_INI_ENTRY(error_append_string,NULL, PHP_INI_ALL, OnUpdateString, error_append_string,php_core_globals, core_globals) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /main main.c
iliaa Tue Jan 7 21:44:51 2003 EDT Modified files: (Branch: PHP_4_3) /php4/main main.c Log: MFH Index: php4/main/main.c diff -u php4/main/main.c:1.512.2.6 php4/main/main.c:1.512.2.7 --- php4/main/main.c:1.512.2.6 Tue Dec 31 11:25:15 2002 +++ php4/main/main.cTue Jan 7 21:44:50 2003 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: main.c,v 1.512.2.6 2002/12/31 16:25:15 sebastian Exp $ */ +/* $Id: main.c,v 1.512.2.7 2003/01/08 02:44:50 iliaa Exp $ */ /* {{{ includes */ @@ -751,13 +751,13 @@ case ZMSG_FAILED_INCLUDE_FOPEN: { TSRMLS_FETCH(); - php_error_docref(NULL TSRMLS_CC, E_WARNING, Failed opening '%s' for inclusion (include_path='%s'), php_strip_url_passwd((char *) data), STR_PRINT(PG(include_path))); + php_error_docref(function.include TSRMLS_CC, +E_WARNING, Failed opening '%s' for inclusion (include_path='%s'), +php_strip_url_passwd((char *) data), STR_PRINT(PG(include_path))); } break; case ZMSG_FAILED_REQUIRE_FOPEN: { TSRMLS_FETCH(); - php_error_docref(NULL TSRMLS_CC, E_COMPILE_ERROR, Failed opening required '%s' (include_path='%s'), php_strip_url_passwd((char *) data), STR_PRINT(PG(include_path))); + php_error_docref(function.require TSRMLS_CC, +E_COMPILE_ERROR, Failed opening required '%s' (include_path='%s'), +php_strip_url_passwd((char *) data), STR_PRINT(PG(include_path))); } break; case ZMSG_FAILED_HIGHLIGHT_FOPEN: { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /main main.c
iliaa Mon Dec 16 10:44:20 2002 EDT Modified files: (Branch: PHP_4_3) /php4/main main.c Log: MFH Index: php4/main/main.c diff -u php4/main/main.c:1.512.2.4 php4/main/main.c:1.512.2.5 --- php4/main/main.c:1.512.2.4 Thu Dec 5 17:15:01 2002 +++ php4/main/main.cMon Dec 16 10:44:06 2002 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: main.c,v 1.512.2.4 2002/12/05 22:15:01 helly Exp $ */ +/* $Id: main.c,v 1.512.2.5 2002/12/16 15:44:06 iliaa Exp $ */ /* {{{ includes */ @@ -168,15 +168,36 @@ */ static void php_disable_functions(TSRMLS_D) { - char *func; - char *new_value_dup = strdup(INI_STR(disable_functions)); /* This is an intentional leak, - * it's not a big deal as it's process-wide - */ - - func = strtok(new_value_dup, , ); - while (func) { - zend_disable_function(func, strlen(func) TSRMLS_CC); - func = strtok(NULL, , ); + char *s = NULL; + char *e = INI_STR(disable_functions); + char p; + + if (!*e) { + return; + } + + while (*e) { + switch (*e) { + case ' ': + case ',': + if (s) { + p = *e; + *e = '\0'; + zend_disable_function(s, e-s TSRMLS_CC); + *e = p; + s = NULL; + } + break; + default: + if (!s) { + s = e; + } + break; + } + e++; + } + if (s) { + zend_disable_function(s, e-s TSRMLS_CC); } } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /main main.c
helly Tue Nov 19 09:13:41 2002 EDT Modified files: (Branch: PHP_4_3) /php4/main main.c Log: MFH Index: php4/main/main.c diff -u php4/main/main.c:1.512.2.2 php4/main/main.c:1.512.2.3 --- php4/main/main.c:1.512.2.2 Sun Nov 17 17:53:35 2002 +++ php4/main/main.cTue Nov 19 09:13:40 2002 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: main.c,v 1.512.2.2 2002/11/17 22:53:35 iliaa Exp $ */ +/* $Id: main.c,v 1.512.2.3 2002/11/19 14:13:40 helly Exp $ */ /* {{{ includes */ @@ -290,8 +290,8 @@ STD_PHP_INI_ENTRY(user_dir, NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, user_dir, php_core_globals, core_globals) STD_PHP_INI_ENTRY(variables_order,NULL, PHP_INI_ALL, OnUpdateStringUnempty, variables_order,php_core_globals, core_globals) - STD_PHP_INI_ENTRY(error_append_string,NULL, PHP_INI_ALL, OnUpdateStringUnempty, error_append_string,php_core_globals, core_globals) - STD_PHP_INI_ENTRY(error_prepend_string, NULL, PHP_INI_ALL, OnUpdateStringUnempty, error_prepend_string, php_core_globals, core_globals) + STD_PHP_INI_ENTRY(error_append_string,NULL, PHP_INI_ALL, + OnUpdateString, error_append_string,php_core_globals, + core_globals) + STD_PHP_INI_ENTRY(error_prepend_string, NULL, PHP_INI_ALL, + OnUpdateString, error_prepend_string, php_core_globals, + core_globals) PHP_INI_ENTRY(SMTP, localhost,PHP_INI_ALL,NULL) PHP_INI_ENTRY(smtp_port, 25, PHP_INI_ALL,NULL) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /main main.c
iliaa Sun Nov 17 17:53:35 2002 EDT Modified files: (Branch: PHP_4_3) /php4/main main.c Log: MFH Index: php4/main/main.c diff -u php4/main/main.c:1.512.2.1 php4/main/main.c:1.512.2.2 --- php4/main/main.c:1.512.2.1 Sun Nov 17 08:32:43 2002 +++ php4/main/main.cSun Nov 17 17:53:35 2002 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: main.c,v 1.512.2.1 2002/11/17 13:32:43 zeev Exp $ */ +/* $Id: main.c,v 1.512.2.2 2002/11/17 22:53:35 iliaa Exp $ */ /* {{{ includes */ @@ -79,6 +79,7 @@ #include zend_highlight.h #include zend_indent.h #include zend_extensions.h +#include zend_ini.h #include php_content_types.h #include php_ticks.h @@ -1544,7 +1545,7 @@ php_mb_set_zend_encoding(TSRMLS_C); #endif /* ZEND_MULTIBYTE HAVE_MBSTRING */ zend_unset_timeout(TSRMLS_C); - zend_set_timeout(EG(timeout_seconds)); + zend_set_timeout(INI_INT(max_execution_time)); retval = (zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, NULL, 3, prepend_file_p, primary_file, append_file_p) == SUCCESS); if (old_primary_file_path) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php