← Back to team overview

mahara-contributors team mailing list archive

[Bug 643503] Re: styles.css path is wrong for plugins on windows

 

I've not got a Windows VM running with php at present to fully verify or
test patches against, but I see how this could well be the case.

_get_path is used by both get_path and get_url.
I believe php under windows will correctly handle use of forward slashes (/) in a path so this shouldn't cause issues for windows paths.

Since DIRECTORY_SEPARATOR expands to / on linux and I think to both \
and / on windows, it probably does make sense to just replace
DIRECTORY_SEPARATOR with / in this case -- any plugin using a trailing
backslash (\) as a directory separator in the plugindirectory would only
work under Windows and not Linux anyway. It's only get_path that could
be adversely affected by this change and only under windows.

I'll leave this to someone with a Windows dev environment to hand unless
I get a chance to get one up and running today.

-- 
styles.css path is wrong for plugins on windows
https://bugs.launchpad.net/bugs/643503
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.

Status in Mahara ePortfolio: New

Bug description:
Using Mahara 1.2.6 on Windows XP and MySQL. Debugging using Firebug

The paths returned by $THEME->get_url() include use of DIRECTORY_SEPARATOR in the middle of a URL, which doesn't work.

The line caling it is 1029 of /artefact/form/elements/filebrowser.php:

        $pluginsheets = $THEME->get_url('style/style.css', true, 'artefact/file');

And the function causing the problem is get_path() on line 697 of /ib/web.php, which can be fixed by altering line 699 to this:

        $plugindirectory = ($plugindirectory && substr($plugindirectory, -1) != '/') ? $plugindirectory . '/' : $plugindirectory;

Original line 699:

        $plugindirectory = ($plugindirectory && substr($plugindirectory, -1) != DIRECTORY_SEPARATOR) ? $plugindirectory . DIRECTORY_SEPARATOR : $plugindirectory;





References