View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0017967 | mantisbt | bugtracker | public | 2014-12-15 11:43 | 2015-01-25 18:17 |
Reporter | info4km | Assigned To | dregad | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 1.2.18 | ||||
Target Version | 1.2.19 | Fixed in Version | 1.2.19 | ||
Summary | 0017967: Reporting an issue gives: 'Invalid argument supplied for foreach()' in '/opt/mantisbt-1.2.18/core/gpc_api.php' line 259 | ||||
Description | When reporting an issue I get the following system warning: 'Invalid argument supplied for foreach()' in '/opt/mantisbt-1.2.18/core/gpc_api.php' line 259 | ||||
Tags | No tags attached. | ||||
Attached Files | Error_Bug Tracker_php.html (6,853 bytes)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <link rel="stylesheet" type="text/css" href="https://bugtracker.company.com/css/default.css" /> <script type="text/javascript"><!-- if(document.layers) {document.write("<style>td{padding:0px;}<\/style>")} // --></script> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Cache-Control" content="no-cache" /> <meta http-equiv="Pragma-directive" content="no-cache" /> <meta http-equiv="Cache-Directive" content="no-cache" /> <meta http-equiv="Expires" content="Wed, 17 Dec 2014 21:26:30 GMT" /> <link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon" /> <link rel="search" type="application/opensearchdescription+xml" title="MantisBT: Text Search" href="https://bugtracker.company.com/browser_search_plugin.php?type=text" /> <link rel="search" type="application/opensearchdescription+xml" title="MantisBT: Issue Id" href="https://bugtracker.company.com/browser_search_plugin.php?type=id" /> <title>Bug Tracker</title> <script type="text/javascript" src="/javascript/min/common.js"></script> <script type="text/javascript">var loading_lang = "Loading...";</script><script type="text/javascript" src="/javascript/min/ajax.js"></script> </head> <body> <div align="left"><a href="my_view_page.php"><img border="0" alt="Bug Tracker" src="/images/mantis_logo.gif" /></a></div><table class="hide"><tr><td class="login-info-left">Logged in as: <span class="italic">km</span> <span class="small">(KM - administrator)</span></td><td class="login-info-middle"><span class="italic">12-17-14 16:26 EST</span></td><td class="login-info-right"><form method="post" name="form_set_project" action="/set_project.php">Project: <select name="project_id" class="small" onchange="document.forms.form_set_project.submit();"><option value="0">All Projects</option> <option value="31">Device Integration</option> <option value="38">Our log proj</option> <option value="49">Our log proj Customer Defects</option> <option value="48">Our log proj Customer Enhancements</option> <option value="50">Our log proj Device Integration</option> <option value="42">Tools</option> <option value="19">Our Proj 4.1</option> <option value="34">Our Proj 4.1.1</option> <option value="37">Our Proj 4.1.2</option> <option value="43">Our Proj 4.1.3</option> <option value="44">Our Proj 4.1.4</option> <option value="35" selected="selected" >Our Proj 4.2</option> <option value="39">ProjTest</option> <option value="53">Our Proj 4.3</option> <option value="51">Our Proj 5.0</option> <option value="52">Our Proj 5.1</option> <option value="47">Our Proj Customer Defects</option> <option value="46">Our Proj Customer Enhancements</option> <option value="41">Our Proj Deferred</option> </select> <input type="submit" class="button-small" value="Switch" /></form><a href="https://bugtracker.company.com/issues_rss.php?username=km&key=2ef8a2cae503ad48c3120cc9ee0b61ca&project_id=35"><img src="/images/rss.png" alt="RSS" style="border-style: none; margin: 5px; vertical-align: middle;" /></a></td></tr></table><table class="width100" cellspacing="0"><tr><td class="menu"><a href="/my_view_page.php">My View</a> | <a href="/view_all_bug_page.php">View Issues</a> | <a href="/bug_report_page.php">Report Issue</a> | <a href="/changelog_page.php">Change Log</a> | <a href="/roadmap_page.php">Roadmap</a> | <a href="/summary_page.php">Summary</a> | <a href="/manage_overview_page.php">Manage</a> | <a href="/account_page.php">My Account</a> | <a href="/logout_page.php">Logout</a></td><td class="menu right nowrap"><form method="post" action="/jump_to_bug.php"><input type="text" name="bug_id" size="10" class="small" value="Issue #" onfocus="if (this.value == 'Issue #') this.value = ''" onblur="if (this.value == '') this.value = 'Issue #'" /> <input type="submit" class="button-small" value="Jump" /> </form></td></tr></table><br /><div align="center"><table class="width50" cellspacing="1"><tr><td class="form-title">SYSTEM WARNING</td></tr><tr><td><p class="center" style="color:red">'Invalid argument supplied for foreach()' in '/opt/mantisbt-1.2.18/core/gpc_api.php' line 259</p></td></tr><tr><td><p class="center">Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.</p></td></tr><tr><td> <center> <table class="width75"> <tr> <td>Full path: /opt/mantisbt-1.2.18/core/gpc_api.php</td> </tr> <tr> <td>Line: 259</td> </tr> <tr> <td> <table class="width100"><tr><th>Variable</th><th>Value</th><th>Type</th></tr><tr><td>p_var_name</td><td>custom_field_3</td><td>string</td></tr> <tr><td>p_default</td><td></td><td>NULL</td></tr> <tr><td>t_result</td><td></td><td>NULL</td></tr> <tr><td colspan="3" align="left"><br /><strong>args</strong></td></tr><tr><td colspan="3"><table class="width100"><tr><th>Variable</th><th>Value</th><th>Type</th></tr><tr><td>0</td><td>custom_field_3</td><td>string</td></tr> <tr><td>1</td><td></td><td>NULL</td></tr> </table></td></tr><tr><td colspan="3" align="left"><br /><strong>t_array</strong></td></tr><tr><td colspan="3"><table class="width100"><tr><th>Variable</th><th>Value</th><th>Type</th></tr></table></td></tr></table> </td> </tr> </table> </center> </td></tr><tr><td><center><table class="width75"><tr><th>Filename</th><th>Line</th><th></th><th></th><th>Function</th><th>Args</th></tr><tr class="row-1"><td>/opt/mantisbt-1.2.18/core/gpc_api.php</td><td>212</td><td>-</td><td>-</td><td>gpc_get_string_array</td><td>( <string>'custom_field_3', <NULL>NULL )</td></tr><tr class="row-2"><td>/opt/mantisbt-1.2.18/bug_report.php</td><td>134</td><td>-</td><td>-</td><td>gpc_get_custom_field</td><td>( <string>'custom_field_3', <string>'5', <NULL>NULL )</td></tr></table></center></td></tr></table></div> <br /> <hr size="1" /> <table border="0" width="100%" cellspacing="0" cellpadding="0"><tr valign="top"><td> <span class="timer"><a href="http://www.mantisbt.org/" title="Free Web-Based Bug Tracker">MantisBT 1.2.18</a> [<a href="http://www.mantisbt.org/" title="Free Web-Based Bug Tracker" target="_blank">^</a>]</span> <address>Copyright © 2000 - 2014 MantisBT Team</address> <address><a href="mailto:km@company.com">km@company.com</a></address> </td><td> <div align="right"><a href="http://www.mantisbt.org" title="Free Web Based Bug Tracker"><img src="/images/mantis_logo.png" width="145" height="50" alt="Powered by Mantis Bugtracker" border="0" /></a></div> </td></tr></table> </body> </html> | ||||
I just upgraded from 1.2.17 to 1.2.18 (for now I have turned off these warnings by setting: as explained in issue 0017322, but I don't like that solution. |
|
I was not able to reproduce your problem. Please provide additional information to help understanding the problem. Please follow these steps:
$g_display_errors[E_WARNING] = 'halt'; WARNING - SECURITY RISK: the 'show_detailed_errors' config can cause MantisBT to display sensitive information about your system. We recommend to restrict its activation to a Test environment, only for as long as necessary. If possible, do not turn it ON globally, instead limit it for specific user(s) using the Manage Configuration page.
|
|
OK - I followed the instructions in your note. The page I have uploaded does not look exactly as it did. When I edited the confidential stuff it got slightly messed up. All of the info that I saw is there though. See attached file Error_BugTracker_php.html. |
|
I'm still not able to reproduce. It appears the problem occurs on a custom field of type checkbox, can you detail how it is defined ? |
|
I have attached two images of the custom fields that are check boxes. It's weird because I think I had trouble with these fields when I first converted to 1.2.x in the first place. Now they are finally working, and they are giving us trouble again. Images are customfield_1.jpg and customfield_2.jpg. If its a checkbox config issue I can make it a List with a yes|no that defaults to no. |
|
I tried with a CF with same settings as you uploaded, but it works fine for me. According to the detailed error log you sent earlier, the custom field's name is 'custom_field_3' which does not match the field names in the 2 screenshots. |
|
There is no field with that name. The DB shows that custom field with an ID of 3 is "Documentation Required" which is one of the screen shots I've attached. |
|
FYI - I made that checkbox a List with no|yes - and set the debugging again. I get the same results but for custom_field_2 which is the other checkbox. Maybe If no solution is found, I will change them to lists. |
|
I can reproduce the behavior now. According to git bisect, it is a regression introduced by commit 215968fa8ff33e327f0600765a5caa24de392cbc (see 0017640). |
|
MantisBT: master-1.2.x 215968fa 2013-10-12 13:58 Paul Richards Committer: dregad Details Diff |
Strip null bytes out of GPC input strings Backporting commit fc02c46eea9d9e7cc472a7fc1801ea65d467db76 from master branch to fix issue 0017640 Signed-off-by: Damien Regad <dregad@mantisbt.org> |
Affected Issues 0017640, 0017967, 0017977 |
|
mod - core/gpc_api.php | Diff File | ||
MantisBT: master-1.2.x 99ada4de 2014-12-21 06:46 Details Diff |
Fix system warning in gpc_get_string_array() The fix for issue 0017640 did not consider that the value returned by gpc_get() is not necessarily an array - it can be the default value (e.g. null) causing PHP to throw an 'Invalid argument supplied for foreach()' warning. Fixes 0017967, regression from 215968fa8ff33e327f0600765a5caa24de392cbc |
Affected Issues 0017640, 0017967 |
|
mod - core/gpc_api.php | Diff File | ||
MantisBT: master 61c8548c 2014-12-21 06:46 Details Diff |
Fix system warning in gpc_get_string_array() The fix for issue 0017640 did not consider that the value returned by gpc_get() is not necessarily an array - it can be the default value (e.g. null) causing PHP to throw an 'Invalid argument supplied for foreach()' warning. Fixes 0017967 (ported from 1.2.x) |
Affected Issues 0017640, 0017967 |
|
mod - core/gpc_api.php | Diff File |