Support » Plugins and Hacks » [Plugin: Custom Permalinks] PHP Error Undefined variable 'path'

[Plugin: Custom Permalinks] PHP Error Undefined variable 'path'

Viewing 4 replies - 1 through 4 (of 4 total)
  • I ran into this issue today. It looks like the issue is with the output of the parse_URL path.

    Here’s the modified code I used to fix the errors:

    Lines 96 & 97 become:

    $url = parse_url(get_bloginfo('wpurl'), PHP_URL_PATH);
    $request = ltrim(substr($_SERVER['REQUEST_URI'], strlen($url)),'/');

    Lines 154 & 155:

    $url = parse_url(get_bloginfo('url'), PHP_URL_PATH);
    $request = ltrim(substr($_SERVER['REQUEST_URI'], strlen($url)),'/');

    Lines 260 & 261:

    $url = parse_url(get_bloginfo('url'), PHP_URL_PATH);
    $request = ltrim(substr($string, strlen($url)),'/');

    Line 266:
    return ($string{0} == '/' ? '/' : '') . trailingslashit($url) . $_CPRegisteredURL;

    The changes are just in syntax, parsing just the path with PHP_URL_PATH rather than parsing the whole path, and calling $url[‘path’], which wasn’t getting defined.

    – Jonathan

    Just installed the plugin today, also seeing the same issue with these Notices.

    Thanks for the fix Jonathan. Hoping the plugin gets an update soon.

    Yep, those “undefined index” messages are annoying when debugging is turned on BUT I would like to point out that this one needs more urgent attention:

    Notice: has_cap was called with an argument that is deprecated since version 2.0! Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead.

    I actually fixed this bug to use the plugin for a client. You can find my “fixed” version on GitHub: https://github.com/ericmann/custom-permalinks/tree/dev

    I’ve also sent the changes back to the original developer via email but have yet to hear back. I’ll pull in the latest release (that fixed a minor compatibility issue elsewhere) when I get the chance to the GitHub version is up to date.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Custom Permalinks] PHP Error Undefined variable 'path'’ is closed to new replies.