View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0009979 | mantisbt | custom fields | public | 2008-12-17 08:42 | 2009-10-13 05:17 |
Reporter | esli | Assigned To | thraxisp | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 1.1.6 | ||||
Fixed in Version | 1.1.7 | ||||
Summary | 0009979: Function gpc_isset always return false for a custom date field | ||||
Description | When reporting or updating a bug it always throw an error for a customized date field because it not filled although it was. The files bug_report.php and bug_update.php were modified at test of custom field to use the new function gpc_isset. Why this function returns false for a required date customized field? | ||||
Steps To Reproduce | Create a date customized field and define it as required when report a bug. Select report a issue and set the date custom field. Submit the report to get a error message that field wasn´t filled. | ||||
Additional Information | The problem was temporaly solved going back to implemented version 1.1.4 On file bug_report.php: v 1.1.6 is: v 1.1.4 was: On file bug_update.php: v 1.1.4 was: v 1.1.6 is: | ||||
Tags | No tags attached. | ||||
Attached Files | gpc_api.php (12,919 bytes)
<?php # Mantis - a php based bugtracking system # Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org # Copyright (C) 2002 - 2007 Mantis Team - mantisbt-dev@lists.sourceforge.net # Mantis is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # Mantis is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Mantis. If not, see <http://www.gnu.org/licenses/>. # -------------------------------------------------------- # $Id: gpc_api.php,v 1.41.2.1 2007-10-13 22:35:28 giallu Exp $ # -------------------------------------------------------- ### GET, POST, and Cookie API ### # --------------- # Retrieve a GPC variable. # If the variable is not set, the default is returned. # If magic_quotes_gpc is on, slashes will be stripped from the value before being returned. # # You may pass in any variable as a default (including null) but if # you pass in *no* default then an error will be triggered if the field # cannot be found function gpc_get( $p_var_name, $p_default = null ) { if ( isset( $_POST[$p_var_name] ) ) { $t_result = gpc_strip_slashes( $_POST[$p_var_name] ); } else if ( isset( $_GET[$p_var_name] ) ) { $t_result = gpc_strip_slashes( $_GET[$p_var_name] ); } else if ( func_num_args() > 1 ) { #check for a default passed in (allowing null) $t_result = $p_default; } else { error_parameters( $p_var_name ); trigger_error( ERROR_GPC_VAR_NOT_FOUND, ERROR ); $t_result = null; } return $t_result; } # ----------------- # test to see if a gpc is set function gpc_isset( $p_var_name ) { if ( isset( $_POST[$p_var_name] ) ) { return true; } else if ( isset( $_GET[$p_var_name] ) ) { return true; } return false; } # ----------------- # Retrieve a string GPC variable. Uses gpc_get(). # If you pass in *no* default, an error will be triggered if # the variable does not exist function gpc_get_string( $p_var_name, $p_default = null ) { # Don't pass along a default unless one was given to us # otherwise we prevent an error being triggered $args = func_get_args(); $t_result = call_user_func_array( 'gpc_get', $args ); if ( is_array( $t_result ) ) { error_parameters( $p_var_name ); trigger_error( ERROR_GPC_ARRAY_UNEXPECTED, ERROR ); } return $t_result; } # ------------------ # Retrieve an integer GPC variable. Uses gpc_get(). # If you pass in *no* default, an error will be triggered if # the variable does not exist function gpc_get_int( $p_var_name, $p_default = null ) { # Don't pass along a default unless one was given to us # otherwise we prevent an error being triggered $args = func_get_args(); $t_result = call_user_func_array( 'gpc_get', $args ); if ( is_array( $t_result ) ) { error_parameters( $p_var_name ); trigger_error( ERROR_GPC_ARRAY_UNEXPECTED, ERROR ); } $t_val = str_replace( " ", "", trim( $t_result ) ); if ( ! preg_match( "/^-?([0-9])*$/", $t_val ) ) { error_parameters( $p_var_name ); trigger_error( ERROR_GPC_NOT_NUMBER, ERROR ); } return (int)$t_val; } # ------------------ # Retrieve a boolean GPC variable. Uses gpc_get(). # If you pass in *no* default, false will be used function gpc_get_bool( $p_var_name, $p_default = false ) { $t_result = gpc_get( $p_var_name, $p_default ); if ( $t_result === $p_default ) { return $p_default; } else { if ( is_array( $t_result ) ) { error_parameters( $p_var_name ); trigger_error( ERROR_GPC_ARRAY_UNEXPECTED, ERROR ); } return gpc_string_to_bool( $t_result ); } } #=================================== # Custom Field Functions #=================================== # ------------------ # see if a custom field variable is set. Uses gpc_isset(). function gpc_isset_custom_field( $p_var_name, $p_custom_field_type ) { switch ($p_custom_field_type ) { case CUSTOM_FIELD_TYPE_DATE: // date field is three dropdowns that default to 0 // Dropdowns are always present, so check if they are set return gpc_isset( "custom_field_" . $p_var_name . "_day" ) && gpc_get_int( "custom_field_" . $p_var_name . "_day", 0 ) != 0 && gpc_isset( "custom_field_" . $p_var_name . "_month" ) && gpc_get_int( "custom_field_" . $p_var_name . "_month", 0 ) != 0 && gpc_isset( "custom_field_" . $p_var_name . "_year" ) && gpc_get_int( "custom_field_" . $p_var_name . "_year", 0 ) != 0 ; default: return gpc_isset( "custom_field_" . $p_var_name); } } # ------------------ # Retrieve a custom field variable. Uses gpc_get(). # If you pass in *no* default, an error will be triggered if # the variable does not exist function gpc_get_custom_field( $p_var_name, $p_custom_field_type, $p_default = null ) { switch ($p_custom_field_type ) { case CUSTOM_FIELD_TYPE_MULTILIST: case CUSTOM_FIELD_TYPE_CHECKBOX: // ensure that the default is an array, if it is set if ( ($p_default !== NULL) && (!is_array($p_default)) ) { $p_default = array( $p_default ); } $t_values = gpc_get_string_array( $p_var_name, $p_default ); if( is_array( $t_values ) ) { return implode( '|', $t_values ); } else { return ''; } break ; case CUSTOM_FIELD_TYPE_DATE: $t_day = gpc_get_int( $p_var_name . "_day", 0) ; $t_month = gpc_get_int( $p_var_name . "_month", 0) ; $t_year = gpc_get_int( $p_var_name . "_year", 0) ; if (($t_year == 0) || ($t_month == 0) || ($t_day == 0)) { if ($p_default == null) { return '' ; } else { return $p_default ; } } else { return strtotime($t_year . "-" . $t_month . "-" . $t_day) ; } break ; default: return gpc_get_string( $p_var_name, $p_default); } } #=================================== # Array Functions #=================================== # ------------------ # Retrieve a string array GPC variable. Uses gpc_get(). # If you pass in *no* default, an error will be triggered if # the variable does not exist function gpc_get_string_array( $p_var_name, $p_default = null ) { # Don't pass along a default unless one was given to us # otherwise we prevent an error being triggered $args = func_get_args(); $t_result = call_user_func_array( 'gpc_get', $args ); # If we the result isn't the default we were given or an array, error if ( !( ( ( 1 < func_num_args() ) && ( $t_result === $p_default ) ) || is_array( $t_result ) ) ) { error_parameters( $p_var_name ); trigger_error( ERROR_GPC_ARRAY_EXPECTED, ERROR); } return $t_result; } # ------------------ # Retrieve an integer array GPC variable. Uses gpc_get(). # If you pass in *no* default, an error will be triggered if # the variable does not exist function gpc_get_int_array( $p_var_name, $p_default = null ) { # Don't pass along a default unless one was given to us # otherwise we prevent an error being triggered $args = func_get_args(); $t_result = call_user_func_array( 'gpc_get', $args ); # If we the result isn't the default we were given or an array, error if ( !( ( ( 1 < func_num_args() ) && ( $t_result === $p_default ) ) || is_array( $t_result ) ) ) { error_parameters( $p_var_name ); trigger_error( ERROR_GPC_ARRAY_EXPECTED, ERROR); } for ( $i=0 ; $i < sizeof( $t_result ) ; $i++ ) { $t_result[$i] = (int)$t_result[$i]; } return $t_result; } # ------------------ # Retrieve a boolean array GPC variable. Uses gpc_get(). # If you pass in *no* default, an error will be triggered if # the variable does not exist function gpc_get_bool_array( $p_var_name, $p_default = null ) { # Don't pass along a default unless one was given to us # otherwise we prevent an error being triggered $args = func_get_args(); $t_result = call_user_func_array( 'gpc_get', $args ); # If we the result isn't the default we were given or an array, error if ( !( ( ( 1 < func_num_args() ) && ( $t_result === $p_default ) ) || is_array( $t_result ) ) ) { error_parameters( $p_var_name ); trigger_error( ERROR_GPC_ARRAY_EXPECTED, ERROR); } for ( $i=0 ; $i < sizeof( $t_result ) ; $i++ ) { $t_result[$i] = gpc_string_to_bool( $t_result[$i] ); } return $t_result; } #=================================== # Cookie Functions #=================================== # ------------------ # Retrieve a cookie variable # You may pass in any variable as a default (including null) but if # you pass in *no* default then an error will be triggered if the cookie # cannot be found function gpc_get_cookie( $p_var_name, $p_default = null ) { if ( isset( $_COOKIE[$p_var_name] ) ) { $t_result = gpc_strip_slashes( $_COOKIE[$p_var_name] ); } else if ( func_num_args() > 1 ) { #check for a default passed in (allowing null) $t_result = $p_default; } else { error_parameters( $p_var_name ); trigger_error(ERROR_GPC_VAR_NOT_FOUND, ERROR); } return $t_result; } # ------------------ # Set a cookie variable # If $p_expire is false instead of a number, the cookie will expire when # the browser is closed; if it is true, the default time from the config # file will be used # If $p_path or $p_domain are omitted, defaults are used # # @@@ this function is to be modified by Victor to add CRC... for now it # just passes the parameters through to setcookie() function gpc_set_cookie( $p_name, $p_value, $p_expire=false, $p_path=null, $p_domain=null ) { if ( false === $p_expire ) { $p_expire = 0; } else if (true === $p_expire ) { $t_cookie_length = config_get( 'cookie_time_length' ); $p_expire = time()+$t_cookie_length; } if ( null === $p_path ) { $p_path = config_get( 'cookie_path' ); } if ( null === $p_domain ) { $p_domain = config_get( 'cookie_domain' ); } return setcookie( $p_name, $p_value, $p_expire, $p_path, $p_domain ); } # ------------------ # Clear a cookie variable function gpc_clear_cookie( $p_name, $p_path=null, $p_domain=null ) { if ( null === $p_path ) { $p_path = config_get( 'cookie_path' ); } if ( null === $p_domain ) { $p_domain = config_get( 'cookie_domain' ); } if ( isset( $_COOKIE[$p_name] ) ) { unset( $_COOKIE[$p_name] ) ; } # dont try to send cookie if headers are send (guideweb) if ( !headers_sent() ) { return setcookie( $p_name, '', -1, $p_path, $p_domain ); } else { return false; } } #=================================== # File Functions #=================================== # ------------------ # Retrieve a file variable # You may pass in any variable as a default (including null) but if # you pass in *no* default then an error will be triggered if the file # cannot be found function gpc_get_file( $p_var_name, $p_default = null ) { if ( isset ( $_FILES[$p_var_name] ) ) { # FILES are not escaped even if magic_quotes is ON, this applies to Windows paths. $t_result = $_FILES[$p_var_name]; } else if ( func_num_args() > 1 ) { #check for a default passed in (allowing null) $t_result = $p_default; } else { error_parameters( $p_var_name ); trigger_error(ERROR_GPC_VAR_NOT_FOUND, ERROR); } return $t_result; } #=================================== # Helper Functions #=================================== # ------------------ # Convert a POST/GET parameter to an array if it is not already one. # $p_var_name - The name of the parameter # no return value. The $_POST/$_GET are updated as appropriate. function gpc_make_array( $p_var_name ) { if ( isset( $_POST[$p_var_name] ) && !is_array( $_POST[$p_var_name] ) ) { $_POST[$p_var_name] = array( $_POST[$p_var_name] ); } if ( isset( $_GET[$p_var_name] ) && !is_array( $_GET[$p_var_name] ) ) { $_GET[$p_var_name] = array( $_GET[$p_var_name] ); } } # ------------------ # Convert a string to a bool function gpc_string_to_bool( $p_string ) { if ( 0 == strcasecmp( 'off', $p_string ) || 0 == strcasecmp( 'no', $p_string ) || 0 == strcasecmp( 'false', $p_string ) || 0 == strcasecmp( '', $p_string ) || 0 == strcasecmp( '0', $p_string ) ) { return false; } else { return true; } } # ------------------ # Strip slashes if necessary (supports arrays) function gpc_strip_slashes( $p_var ) { if ( 0 == get_magic_quotes_gpc() ) { return $p_var; } else if ( !is_array( $p_var ) ){ return stripslashes( $p_var ); } else { foreach ( $p_var as $key => $value ) { $p_var[$key] = gpc_strip_slashes( $value ); } return $p_var; } } ?> bug_report.php (8,454 bytes)
<?php # Mantis - a php based bugtracking system # Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org # Copyright (C) 2002 - 2008 Mantis Team - mantisbt-dev@lists.sourceforge.net # Mantis is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # Mantis is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Mantis. If not, see <http://www.gnu.org/licenses/>. # -------------------------------------------------------- # $Id: bug_report.php,v 1.49.2.1 2007-10-13 22:32:51 giallu Exp $ # -------------------------------------------------------- # This page stores the reported bug require_once( 'core.php' ); $t_core_path = config_get( 'core_path' ); require_once( $t_core_path.'string_api.php' ); require_once( $t_core_path.'file_api.php' ); require_once( $t_core_path.'bug_api.php' ); require_once( $t_core_path.'custom_field_api.php' ); form_security_validate( 'bug_report' ); access_ensure_project_level( config_get('report_bug_threshold' ) ); $t_bug_data = new BugData; $t_bug_data->build = gpc_get_string( 'build', '' ); $t_bug_data->platform = gpc_get_string( 'platform', '' ); $t_bug_data->os = gpc_get_string( 'os', '' ); $t_bug_data->os_build = gpc_get_string( 'os_build', '' ); $t_bug_data->version = gpc_get_string( 'product_version', '' ); $t_bug_data->profile_id = gpc_get_int( 'profile_id', 0 ); $t_bug_data->handler_id = gpc_get_int( 'handler_id', 0 ); $t_bug_data->view_state = gpc_get_int( 'view_state', config_get( 'default_bug_view_status' ) ); $t_bug_data->category = gpc_get_string( 'category', config_get( 'default_bug_category' ) ); $t_bug_data->reproducibility = gpc_get_int( 'reproducibility', config_get( 'default_bug_reproducibility' ) ); $t_bug_data->severity = gpc_get_int( 'severity', config_get( 'default_bug_severity' ) ); $t_bug_data->priority = gpc_get_int( 'priority', config_get( 'default_bug_priority' ) ); $t_bug_data->summary = gpc_get_string( 'summary' ); $t_bug_data->description = gpc_get_string( 'description' ); $t_bug_data->steps_to_reproduce = gpc_get_string( 'steps_to_reproduce', config_get( 'default_bug_steps_to_reproduce' ) ); $t_bug_data->additional_information = gpc_get_string( 'additional_info', config_get ( 'default_bug_additional_info' ) ); $f_file = gpc_get_file( 'file', null ); #@@@ (thraxisp) Note that this always returns a structure # size = 0, if no file $f_report_stay = gpc_get_bool( 'report_stay', false ); $t_bug_data->project_id = gpc_get_int( 'project_id' ); $t_bug_data->reporter_id = auth_get_current_user_id(); $t_bug_data->summary = trim( $t_bug_data->summary ); $t_bug_data->target_version = access_has_project_level( config_get( 'roadmap_update_threshold' ), $t_bug_data->project_id ) ? gpc_get_string( 'target_version', '' ) : ''; # if a profile was selected then let's use that information if ( 0 != $t_bug_data->profile_id ) { if ( profile_is_global( $t_bug_data->profile_id ) ) { $row = user_get_profile_row( ALL_USERS, $t_bug_data->profile_id ); } else { $row = user_get_profile_row( $t_bug_data->reporter_id, $t_bug_data->profile_id ); } if ( is_blank( $t_bug_data->platform ) ) { $t_bug_data->platform = $row['platform']; } if ( is_blank( $t_bug_data->os ) ) { $t_bug_data->os = $row['os']; } if ( is_blank( $t_bug_data->os_build ) ) { $t_bug_data->os_build = $row['os_build']; } } helper_call_custom_function( 'issue_create_validate', array( $t_bug_data ) ); # Validate the custom fields before adding the bug. $t_related_custom_field_ids = custom_field_get_linked_ids( $t_bug_data->project_id ); foreach( $t_related_custom_field_ids as $t_id ) { $t_def = custom_field_get_definition( $t_id ); if ( $t_def['require_report'] && !gpc_isset_custom_field( $t_id, $t_def['type'] ) ) { error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) ); trigger_error( ERROR_EMPTY_FIELD, ERROR ); } if ( !custom_field_validate( $t_id, $t_cf_value ) ) { error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) ); trigger_error( ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR ); } } # Create the bug $t_bug_id = bug_create( $t_bug_data ); # Handle the file upload if ( !is_blank( $f_file['tmp_name'] ) && ( 0 < $f_file['size'] ) ) { $f_file_error = ( isset( $f_file['error'] ) ) ? $f_file['error'] : 0; file_add( $t_bug_id, $f_file['tmp_name'], $f_file['name'], $f_file['type'], 'bug', $f_file_error ); } # Handle custom field submission foreach( $t_related_custom_field_ids as $t_id ) { # Do not set custom field value if user has no write access. if( !custom_field_has_write_access( $t_id, $t_bug_id ) ) { continue; } $t_def = custom_field_get_definition( $t_id ); if( !custom_field_set_value( $t_id, $t_bug_id, gpc_get_custom_field( "custom_field_$t_id", $t_def['type'], $t_def['default_value'] ) ) ) { error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) ); trigger_error( ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR ); } } $f_master_bug_id = gpc_get_int( 'm_id', 0 ); $f_rel_type = gpc_get_int( 'rel_type', -1 ); if ( $f_master_bug_id > 0 ) { # it's a child generation... let's create the relationship and add some lines in the history # update master bug last updated bug_update_date( $f_master_bug_id ); # Add log line to record the cloning action history_log_event_special( $t_bug_id, BUG_CREATED_FROM, '', $f_master_bug_id ); history_log_event_special( $f_master_bug_id, BUG_CLONED_TO, '', $t_bug_id ); if ( $f_rel_type >= 0 ) { # Add the relationship relationship_add( $t_bug_id, $f_master_bug_id, $f_rel_type ); # Add log line to the history (both issues) history_log_event_special( $f_master_bug_id, BUG_ADD_RELATIONSHIP, relationship_get_complementary_type( $f_rel_type ), $t_bug_id ); history_log_event_special( $t_bug_id, BUG_ADD_RELATIONSHIP, $f_rel_type, $f_master_bug_id ); # Send the email notification email_relationship_added( $f_master_bug_id, $t_bug_id, relationship_get_complementary_type( $f_rel_type ) ); } } email_new_bug( $t_bug_id ); helper_call_custom_function( 'issue_create_notify', array( $t_bug_id ) ); form_security_purge( 'bug_report' ); html_page_top1(); if ( ! $f_report_stay ) { html_meta_redirect( 'view_all_bug_page.php' ); } html_page_top2(); ?> <br /> <div align="center"> <?php echo lang_get( 'operation_successful' ) . '<br />'; print_bracket_link( string_get_bug_view_url( $t_bug_id ), lang_get( 'view_submitted_bug_link' ) . " $t_bug_id" ); print_bracket_link( 'view_all_bug_page.php', lang_get( 'view_bugs_link' ) ); if ( $f_report_stay ) { ?> <p> <form method="post" action="<?php echo string_get_bug_report_url() ?>"> <input type="hidden" name="category" value="<?php echo $t_bug_data->category ?>" /> <input type="hidden" name="severity" value="<?php echo $t_bug_data->severity ?>" /> <input type="hidden" name="reproducibility" value="<?php echo $t_bug_data->reproducibility ?>" /> <input type="hidden" name="profile_id" value="<?php echo $t_bug_data->profile_id ?>" /> <input type="hidden" name="platform" value="<?php echo $t_bug_data->platform ?>" /> <input type="hidden" name="os" value="<?php echo $t_bug_data->os ?>" /> <input type="hidden" name="os_build" value="<?php echo $t_bug_data->os_build ?>" /> <input type="hidden" name="product_version" value="<?php echo $t_bug_data->version ?>" /> <input type="hidden" name="target_version" value="<?php echo $t_bug_data->target_version ?>" /> <input type="hidden" name="build" value="<?php echo $t_bug_data->build ?>" /> <input type="hidden" name="report_stay" value="1" /> <input type="hidden" name="view_state" value="<?php echo $t_bug_data->view_state ?>" /> <input type="submit" class="button" value="<?php echo lang_get( 'report_more_bugs' ) ?>" /> </form> </p> <?php } ?> </div> <?php html_page_bottom1( __FILE__ ) ?> bug_update.php (9,098 bytes)
<?php # Mantis - a php based bugtracking system # Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org # Copyright (C) 2002 - 2007 Mantis Team - mantisbt-dev@lists.sourceforge.net # Mantis is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # Mantis is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Mantis. If not, see <http://www.gnu.org/licenses/>. # -------------------------------------------------------- # $Id: bug_update.php,v 1.91.2.3 2007-10-26 08:52:18 giallu Exp $ # -------------------------------------------------------- # Update bug data then redirect to the appropriate viewing page require_once( 'core.php' ); $t_core_path = config_get( 'core_path' ); require_once( $t_core_path.'bug_api.php' ); require_once( $t_core_path.'bugnote_api.php' ); require_once( $t_core_path.'custom_field_api.php' ); form_security_validate( 'bug_update' ); $f_bug_id = gpc_get_int( 'bug_id' ); $f_update_mode = gpc_get_bool( 'update_mode', FALSE ); # set if called from generic update page $f_new_status = gpc_get_int( 'status', bug_get_field( $f_bug_id, 'status' ) ); $t_bug_data = bug_get( $f_bug_id, true ); if( $t_bug_data->project_id != helper_get_current_project() ) { # in case the current project is not the same project of the bug we are viewing... # ... override the current project. This to avoid problems with categories and handlers lists etc. $g_project_override = $t_bug_data->project_id; } if ( ! ( ( access_has_bug_level( access_get_status_threshold( $f_new_status, bug_get_field( $f_bug_id, 'project_id' ) ), $f_bug_id ) ) || ( access_has_bug_level( config_get( 'update_bug_threshold' ) , $f_bug_id ) ) || ( ( bug_get_field( $f_bug_id, 'reporter_id' ) == auth_get_current_user_id() ) && ( ( ON == config_get( 'allow_reporter_reopen' ) ) || ( ON == config_get( 'allow_reporter_close' ) ) ) ) ) ) { access_denied(); } # extract current extended information $t_old_bug_status = $t_bug_data->status; $t_bug_data->reporter_id = gpc_get_int( 'reporter_id', $t_bug_data->reporter_id ); $t_bug_data->handler_id = gpc_get_int( 'handler_id', $t_bug_data->handler_id ); $t_bug_data->duplicate_id = gpc_get_int( 'duplicate_id', $t_bug_data->duplicate_id ); $t_bug_data->priority = gpc_get_int( 'priority', $t_bug_data->priority ); $t_bug_data->severity = gpc_get_int( 'severity', $t_bug_data->severity ); $t_bug_data->reproducibility = gpc_get_int( 'reproducibility', $t_bug_data->reproducibility ); $t_bug_data->status = gpc_get_int( 'status', $t_bug_data->status ); $t_bug_data->resolution = gpc_get_int( 'resolution', $t_bug_data->resolution ); $t_bug_data->projection = gpc_get_int( 'projection', $t_bug_data->projection ); $t_bug_data->category = gpc_get_string( 'category', $t_bug_data->category ); $t_bug_data->eta = gpc_get_int( 'eta', $t_bug_data->eta ); $t_bug_data->os = gpc_get_string( 'os', $t_bug_data->os ); $t_bug_data->os_build = gpc_get_string( 'os_build', $t_bug_data->os_build ); $t_bug_data->platform = gpc_get_string( 'platform', $t_bug_data->platform ); $t_bug_data->version = gpc_get_string( 'version', $t_bug_data->version ); $t_bug_data->build = gpc_get_string( 'build', $t_bug_data->build ); $t_bug_data->fixed_in_version = gpc_get_string( 'fixed_in_version', $t_bug_data->fixed_in_version ); $t_bug_data->target_version = gpc_get_string( 'target_version', $t_bug_data->target_version ); $t_bug_data->view_state = gpc_get_int( 'view_state', $t_bug_data->view_state ); $t_bug_data->summary = gpc_get_string( 'summary', $t_bug_data->summary ); $t_bug_data->description = gpc_get_string( 'description', $t_bug_data->description ); $t_bug_data->steps_to_reproduce = gpc_get_string( 'steps_to_reproduce', $t_bug_data->steps_to_reproduce ); $t_bug_data->additional_information = gpc_get_string( 'additional_information', $t_bug_data->additional_information ); $f_private = gpc_get_bool( 'private' ); $f_bugnote_text = gpc_get_string( 'bugnote_text', '' ); $f_time_tracking = gpc_get_string( 'time_tracking', '0:00' ); $f_close_now = gpc_get_string( 'close_now', false ); # Handle auto-assigning if ( ( NEW_ == $t_bug_data->status ) && ( 0 != $t_bug_data->handler_id ) && ( ON == config_get( 'auto_set_status_to_assigned' ) ) ) { $t_bug_data->status = config_get( 'bug_assigned_status' ); } helper_call_custom_function( 'issue_update_validate', array( $f_bug_id, $t_bug_data, $f_bugnote_text ) ); $t_resolved = config_get( 'bug_resolved_status_threshold' ); $t_custom_status_label = "update"; # default info to check if ( $t_bug_data->status == $t_resolved ) { $t_custom_status_label = "resolved"; } if ( $t_bug_data->status == CLOSED ) { $t_custom_status_label = "closed"; } $t_related_custom_field_ids = custom_field_get_linked_ids( $t_bug_data->project_id ); foreach( $t_related_custom_field_ids as $t_id ) { $t_def = custom_field_get_definition( $t_id ); # Only update the field if it would have been display for editing if( !( ( ! $f_update_mode && $t_def['require_' . $t_custom_status_label] ) || ( ! $f_update_mode && $t_def['display_' . $t_custom_status_label] && in_array( $t_custom_status_label, array( "resolved", "closed" ) ) ) || ( $f_update_mode && $t_def['display_update'] ) || ( $f_update_mode && $t_def['require_update'] ) ) ) { continue; } # Do not set custom field value if user has no write access. if( !custom_field_has_write_access( $t_id, $f_bug_id ) ) { continue; } if ( $t_def['require_' . $t_custom_status_label] && !gpc_isset_custom_field( $t_id, $t_def['type'] ) ) { error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) ); trigger_error( ERROR_EMPTY_FIELD, ERROR ); } # Only update the field if it is posted if ( !gpc_isset_custom_field( $t_id, $t_def['type'] ) ) { continue; } if ( !custom_field_set_value( $t_id, $f_bug_id, $t_cf_value ) ) { error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) ); trigger_error( ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR ); } } $t_notify = true; $t_bug_note_set = false; if ( ( $t_old_bug_status != $t_bug_data->status ) && ( FALSE == $f_update_mode ) ) { # handle status transitions that come from pages other than bug_*update_page.php # this does the minimum to act on the bug and sends a specific message switch ( $t_bug_data->status ) { case $t_resolved: # bug_resolve updates the status, fixed_in_version, resolution, handler_id and bugnote and sends message bug_resolve( $f_bug_id, $t_bug_data->resolution, $t_bug_data->fixed_in_version, $f_bugnote_text, $t_bug_data->duplicate_id, $t_bug_data->handler_id, $f_private, $f_time_tracking ); $t_notify = false; $t_bug_note_set = true; if ( $f_close_now ) { bug_set_field( $f_bug_id, 'status', CLOSED ); } // update bug data with fields that may be updated inside bug_resolve(), otherwise changes will be overwritten // in bug_update() call below. $t_bug_data->handler_id = bug_get_field( $f_bug_id, 'handler_id' ); $t_bug_data->status = bug_get_field( $f_bug_id, 'status' ); break; case CLOSED: # bug_close updates the status and bugnote and sends message bug_close( $f_bug_id, $f_bugnote_text, $f_private, $f_time_tracking ); $t_notify = false; $t_bug_note_set = true; break; case config_get( 'bug_reopen_status' ): if ( $t_old_bug_status >= $t_resolved ) { bug_set_field( $f_bug_id, 'handler_id', $t_bug_data->handler_id ); # fix: update handler_id before calling bug_reopen # bug_reopen updates the status and bugnote and sends message bug_reopen( $f_bug_id, $f_bugnote_text, $f_time_tracking, $f_private ); $t_notify = false; $t_bug_note_set = true; // update bug data with fields that may be updated inside bug_resolve(), otherwise changes will be overwritten // in bug_update() call below. $t_bug_data->status = bug_get_field( $f_bug_id, 'status' ); $t_bug_data->resolution = bug_get_field( $f_bug_id, 'resolution' ); break; } # else fall through to default } } # Add a bugnote if there is one if ( !$t_bug_note_set ) { bugnote_add( $f_bug_id, $f_bugnote_text, $f_time_tracking, $f_private, 0, '', NULL, FALSE ); } # Update the bug entry, notify if we haven't done so already bug_update( $f_bug_id, $t_bug_data, true, ( false == $t_notify ) ); form_security_purge( 'bug_update' ); helper_call_custom_function( 'issue_update_notify', array( $f_bug_id ) ); print_successful_redirect_to_bug( $f_bug_id ); ?> | ||||
has duplicate | 0010065 | closed | thraxisp | Custom field "date" not saved silently |
has duplicate | 0010198 | closed | thraxisp | gpc_isset() for date custom field always return "" (empty string) |
has duplicate | 0010214 | closed | thraxisp | value of date custom fields has not updated |
related to | 0010009 | closed | thraxisp | Error when updating custom date field |
I am having this issue as well. I have a mandatory "Target Date" custom field and no one can report any bugs they all get APPLICATION ERROR #11 - A necessary field "Target Date" was empty. Please recheck your inputs. Even when the field is filled in. I worked around the issue but turning off the Mandatory flag on the custom field. If it's NOT mandatory and people fill it in it works fine, it seems to only have issues if you make the field mandatory. |
|
Possibly fixed. Thraxisp seems to think something may still be broken. see http://git.mantisbt.org/?p=mantisbt.git;a=commitdiff;h=bd435b9ef73a5745cf2fb3997697d93071b9215b for Trunk and http://git.mantisbt.org/?p=mantisbt.git;a=commitdiff;h=32c00cbac127e27706134169fe853b07d287b2d5 for 1.1.x. |
|
fixed in both 1.1.7 and 1.2.x. Enhanced gpc_isset() for custom fields. In the case of a date field, the form fields are always present, but may be populated with default values. The new check takes this into account. |
|
I´ve tested the new version of files: bug_report.php, bug_update.php reported here (master-1.1.x) and didnt work out on our system. Even using the latest version of gpc_api.php from most recently nightly build the things didnt work.. Maybe I´m doing something wrong. How can I get the fixed version 1.1.7? |
|
When I add only the two files listed below I get the following error on my apache log. Call to undefined function date_get_null() in /var/www/mantisbt-1.1.6/bug_report.php on line 61, referer: https://mantis.fmpub.net/bug_report_page.php It looks like (unless I did something wrong) that you can't just drop those two file into 1.1.6 and fix the problem. |
|
There are three files to update. Please retest using today's (08/12/31) snapshot. |
|
updated to the snapshot as recommended in 0009979:0020510 everything works fine now. |
|
I´ve retested with 09/01/02 snapshot for 1.1.x and everythings works fine. |
|
thraxisp said: "There are three files to update. Please retest using today's (08/12/31) snapshot."
Thank you |
|
The third file is core/gpc_api.php. They can be found in the git repo at http://git.mantisbt.org/?p=mantisbt.git;a=commit;h=39841669180b5dc91293c8cec0379600d0ea6eb7 . (This is the snapshot specifically for this commit). |
|
Thank you very much for your quick answer, it works like a charm now |
|
After updating 1.1.6 with the three files from 08/12/31 snapshot, the date is not getting updated and the problem still lies. After update the date becomes blank. |
|
I've uploaded the three files from the snapshot for incestigation which is applied to the 1.1.6 installation, which is not solving the problem. |
|
aniraj, You may want to update all of the files to match the snapshot. There may be other prerequisite changes that you are missing. |
|
thraxisp, I am running the current stable version 1.1.6 in production environment. So I cannot update all the files in the snapshot as that might break the whole system unless it is declared stable and 1.1.7 comes out. Otherwise I could have installed the dev v1.2x series. Any idea what are the other files apart from these three that effects this bug. |
|
MantisBT: master bd435b9e 2008-12-30 17:39 Details Diff |
Fix Bug 0009979 where fields were not required properly. |
Affected Issues 0009979 |
|
mod - bug_update.php | Diff File | ||
mod - bug_report.php | Diff File | ||
MantisBT: master-1.1.x 32c00cba 2008-12-30 17:39 Details Diff |
Fix Bug 0009979 where fields were not required properly. |
Affected Issues 0009979 |
|
mod - bug_update.php | Diff File | ||
mod - bug_report.php | Diff File |