View Issue Details

IDProjectCategoryView StatusLast Update
0007118mantisbtbugtrackerpublic2020-11-22 05:13
Reporterzamana Assigned Tograngeway  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Target Version1.3.0-beta.1Fixed in Version1.3.0-beta.1 
Summary0007118: Report Issue: attaching an oversized file raises wrong error message in bug_report.php/gpc_get (gpc_api.php)
Description

In "Report Issue" option, if you try to attach an oversized file, you'll get an error message about the missing of "reproducibility" field. This is misleading and is regarding the fact that, when the total size of a post is oversized, the $_POST and the $_GET (and the $_REQUEST) global arrays are emptied.

Regarding to PHP, this is not a bug, but a feature:
http://www.php.net/manual/en/ini.core.php#ini.post-max-size

Additional Information

In order to get the correct error message I changed the function "gpc_get" in "core/gpc_api.php" to look like this (look for "// By Zamana"):

function gpc_get( $p_var_name, $p_default = null ) {

simulate auto-globals from PHP v4.1.0 (see also code in php_api.php)

  if ( !php_version_at_least( '4.1.0' ) ) {
     global $_POST, $_GET;
  }

  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 if (count($_POST) == 0 || count($_GET) == 0) { // By Zamana
     trigger_error( ERROR_FILE_TOO_BIG, ERROR );        // By Zamana
     $t_result = null;                                  // By Zamana
  } else {
     error_parameters( $p_var_name );
     trigger_error( ERROR_GPC_VAR_NOT_FOUND, ERROR );
     $t_result = null;
  }

  return $t_result;

}

I suggest that this change be put on the official Mantis code. You can change it if needed, of course.

TagsNo tags attached.

Relationships

related to 0027575 closeddregad Remove obsolete 'posted' form param when reporting new issue 

Activities

grangeway

grangeway

2012-01-07 10:45

reporter   ~0030842

Fixed

Related Changesets

MantisBT: master 7ad93867

2014-09-28 14:31

Paul Richards


Details Diff
Fix 0007118 Attaching an oversized file raises wrong error message Affected Issues
0007118
mod - bug_report.php Diff File
mod - bug_report_page.php Diff File