Support » Fixing WordPress » Update 5.5.1 stripping URL parameters

  • jlreichelt

    (@jlreichelt)


    I have updated my site to 5.5.1 and after the update my url calls or getting stripped. For instance on the previous version of WordPress I have a menu item that has a custom URL that looks like this:
    http://ctp-web2.adu.dcn/index.php/Applications/?page=Applications this would load the Applications page and use the ?page parameter to make a function call to a database to display the page. On version 5.5.1 the menu still calls the same page:
    http://ctp-web2.adu.dcn/index.php/Applications/?page=Applications

    but when the page gets displayed the /?page=Applications is no longer in the URL which then makes the page display incorrectly.

    I have disabled all plug-ins and tried a different theme with the same results.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Yes! I am having the same issue since updating to 5.5.1. Has anyone found why this is happening? It seems like it is isolated to when the parameter is ?page=something but I really don’t want to go into my code and change all my parameter names. I had to downgrade back to WP 5.4 for the time being until I can figure out why it is doing this.

    Thread Starter jlreichelt

    (@jlreichelt)

    I was able to delete the ?page=Applications parameter and wrote code to just pick up Applications from the URL using this:

    $thepage = $_SERVER[“PHP_SELF”];
    $thepage = cut_string_using_last(‘/’, $thepage, ‘right’, false);
    $catelogid = $thepage;
    $pageid = $thepage;
    $calpage = $pageid;
    $pageid = str_replace(‘-‘,’ ‘,$catelogid);
    $website = ‘http://ctp-web2.adu.dcn/’;
    $subject_set = find_all_links($pageid);

    This code works on my text site but does not work on the production site and the page will not load. Any idea’s on why this would be the case?

    Production Server is Windows Server 2012 R2 standard and the test server is Windows Server 2012 Standard. The both appear to be configured the same way otherwise.

    Got to admit this is quite frustrating and may not allow me to ever update Eordpress on the production server.

    Thread Starter jlreichelt

    (@jlreichelt)

    Joy, thanks I did not and I have now. Nice to know I am not the only one who has found this. I did solve the problem for myself though. My code as explained above does work I just forgot to add the cut_string_using_last function to my functions code. Code below:
    function cut_string_using_last($character, $string, $side, $keep_character=true) {
    $offset = ($keep_character ? 1 : 0);
    $whole_length = strlen($string);
    $right_length = (strlen(strrchr($string, $character)) – 1);
    $left_length = ($whole_length – $right_length – 1);
    switch($side) {
    case ‘left’:
    $piece = substr($string, 0, ($left_length + $offset));
    break;
    case ‘right’:
    $start = (0 – ($right_length + $offset));
    $piece = substr($string, $start);
    break;
    default:
    $piece = false;
    break;
    }
    return($piece);
    }

    Your code doesn’t look very secure. You might want to take the advice from that ticket and don’t use a reserved variable. You can read the More Information section of this function: https://developer.wordpress.org/reference/functions/get_query_var/
    which tells you how to use WP’s parsing to get your variable the WP way.

    Thread Starter jlreichelt

    (@jlreichelt)

    So as it turns out from reading the problem others were having the easiest fix for me was instead of calling the url by http://ctp-web2.adu.dcn/index.php/Applications/?page=Applications I called it by http://ctp-web2.adu.dcn/index.php/Applications/?thepage=Applications. Since I did not have a lot of calls this was quite easy to fix. If you have a lot of links using the ?page= you could make the change in the wp_postmeta
    using this SQL
    SELECT * FROM wordpress.wp_postmeta where meta_value like ‘%?page%’; or change this SQL to change any value of ?page to ?thepage. You would then need to change what coding you have that looks for the value of page to look for the value thepage.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Update 5.5.1 stripping URL parameters’ is closed to new replies.