View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0008238 | mantisbt | filters | public | 2007-08-06 14:10 | 2007-12-21 23:16 |
Reporter | Martin Fuchs | Assigned To | MartinFuchs | ||
Priority | normal | Severity | minor | Reproducibility | sometimes |
Status | closed | Resolution | fixed | ||
Product Version | 1.1.0a4 | ||||
Target Version | 1.1.0 | Fixed in Version | 1.1.0rc3 | ||
Summary | 0008238: urldecode() error on creating PermaLink | ||||
Description | When trying to create a peramenant link using the "PermaLink" feature some times the following error message is display on the opened page: SYSTEM WARNING: urldecode() expects parameter 1 to be string, array given I can't yet say on which condition this happens exactly. But it is reproducable at least with one of the stored filters in my local Mantis installation. | ||||
Tags | patch | ||||
Attached Files | string_api.php.patch (1,449 bytes)
Index: core/string_api.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/string_api.php,v retrieving revision 1.92 diff -u -r1.92 string_api.php --- core/string_api.php 8 Sep 2007 23:21:01 -0000 1.92 +++ core/string_api.php 23 Oct 2007 13:09:30 -0000 @@ -199,7 +199,6 @@ # -------------------- # validate the url as part of this site before continuing function string_sanitize_url( $p_url ) { - $t_url = strip_tags( urldecode( $p_url ) ); if ( preg_match( '?http(s)*://?', $t_url ) > 0 ) { // no embedded addresses @@ -217,13 +216,20 @@ list( $t_path, $t_param ) = split( '\?', $t_url, 2 ); if ( $t_param !== "" ) { $t_vals = array(); - parse_str( $t_param, $t_vals ); + parse_str( html_entity_decode( $t_param ), $t_vals ); $t_param = ''; foreach($t_vals as $k => $v) { if ($t_param != '') { - $t_param .= '&'; + $t_param .= '&'; + } + if ( is_array( $v ) ) { + for ( $i = 0, $size = sizeof( $v ); $i < $size; $i++ ) { + $t_param .= $k . urlencode('[]') . '=' . urlencode( strip_tags( urldecode( $v[$i] ) ) ); + $t_param .= ( $i != $size - 1 ) ? '&' : ''; + } + } else { + $t_param .= "$k=" . urlencode( strip_tags( urldecode( $v ) ) ); } - $t_param .= "$k=" . urlencode( strip_tags( urldecode( $v ) ) ); } return $t_path . '?' . $t_param; } else { | ||||
Try using advanced filters and set each of the fields to multiple values, then try. See which field would introduce the problem. The other option is to check the filter that causes the problem and figure out the fields set in it. This will narrow down the issue. |
|
I can now reproduce the problem with the following steps: 1.) Reset the query filter to default settings. |
|
Same problem here.
|
|
I've attached patch. |
|
Martin, can you please validate the patch. |
|
Yes, I can confirm the error messages don't appear any more after applying the patch. |
|
Assigned to Martin to apply to both 1.1.x branch and trunk. Some minor comments:
|
|
Seiji, thanks for the patch. I just committed it to SVN with Victors proposed changes. |
|
I believe we are ready to resolve this as fixed in 1.1.0rc3, right? |
|
Sure, you can go on and set the status to resolved. |
|