View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0035525 | mantisbt | bugtracker | public | 2025-03-01 16:39 | 2025-03-03 11:53 |
Reporter | dregad | Assigned To | dregad | ||
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | resolved | Resolution | fixed | ||
Target Version | 2.28.0 | Fixed in Version | 2.28.0 | ||
Summary | 0035525: gpc_get_int() should not remove spaces in the middle of the string | ||||
Description | The fix for issue 0005092 introduced validation in gpc_get_int(), to ensure the value given is actually an integer. The logic relies on Removing spaces in the middle of the string does not make sense, as it could lead to wrongly interpreting a string like | ||||
Additional Information | Initially reported by @atrol in https://github.com/mantisbt/mantisbt/pull/2105#discussion_r1975991667 | ||||
Tags | No tags attached. | ||||
I initially thought about using filter_var() for this, but it validates integers in a very PHP-centric way, e.g. So it's probably best to stick to regex-based validation and just remove the str_replace() call, to avoid regressions. |
|
MantisBT: master b9172717 2025-03-01 18:00 Details Diff |
gpc_get_int() don't remove spaces in middle of string Keep using preg_match() instead of calling filter_var() as the latter's interpretation of what an integer is is too strict for our purposes (e.g. `01` is not considered as an integer). Code cleanup: remove unnecessary capturing group in the number validation regex. Fixes 0035525 |
Affected Issues 0035525 |
|
mod - core/gpc_api.php | Diff File |