View Issue Details

IDProjectCategoryView StatusLast Update
0007118mantisbtbugtrackerpublic2014-12-08 00:33
ReporterzamanaAssigned Tograngeway 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version 
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.

Activities

grangeway

grangeway

2012-01-07 10:45

reporter   ~0030842

Fixed

Related Changesets

MantisBT: master 7ad93867

2014-09-28 18:31:46

Paul Richards

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

Issue History

Date Modified Username Field Change
2006-05-19 06:56 zamana New Issue
2012-01-07 10:45 grangeway Note Added: 0030842
2012-01-07 10:45 grangeway Status new => resolved
2012-01-07 10:45 grangeway Resolution open => fixed
2012-01-07 10:45 grangeway Assigned To => grangeway
2012-01-17 03:32 atrol Status resolved => closed
2014-09-28 18:33 Changeset attached => MantisBT master 7ad93867
2014-09-28 18:33 anonymous Fixed in Version => 1.3.0-beta.1
2014-09-29 02:14 atrol Status closed => resolved
2014-09-29 02:14 atrol Target Version => 1.3.0-beta.1
2014-12-08 00:33 vboctor Status resolved => closed