Skip to content

Windows Path Issue  #8

@palamccc

Description

@palamccc

Hi,

Thanks for the plugin, i tried to use it on wolf cms installed on windows and found a issue.

function substrtruncate($string, $needle) {
    return substr($string, 0, strrpos($string, $needle)+1);
}
require_once(substrtruncate($_SERVER['SCRIPT_FILENAME'], '/plugins').'../config.php'); // took out dots ../config.php
require_once(substrtruncate($_SERVER['SCRIPT_FILENAME'], '/plugins').'/Framework.php');

It failed on windows, because $_SERVER['SCRIPT_FILENAME'] value is in windows style "C:/abcd/xyz/plugins"
but the code is looking for "/plugins".
following quick workaround works, but it may not be good solution.

function substrtruncate($string, $needle) {
    $string = str_replace("\\","/",$string);
    return substr($string, 0, strrpos($string, $needle)+1);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions