Page MenuHomePhabricator

Skin::getSkinName not overridden in subclasses
Closed, ResolvedPublic

Description

Author: wiki

Description:
Most skins use SkinTemplate as a base. In here, $this->skinname
is marked private. However, some skins are based on Skin. In
Skin, there's no such 'property'.

Skin has a member function getSkinName(). This function returns
the name of the skin, which defaults to 'standard'. This
function should be overwritten by derived classes.

SkinTemplate is based on Skin. It does NOT overwrite the
getSkinName() function, thus returning an incorrect skinname (i.
e., 'standard', instead of 'amethyst')

To ensure correct working of the code, there should be an $this-

skinname in Skin.

Proposed fix:

In Skin::Skin(), add "$this->skinname = 'standard';"
Replace "return 'standard';" in Skin::getSkinName() with "return
$this->skinname;"

After this, developers can use $skin->getSkinName() and it will
return the correct skinname, regardless of its parentclass
(SkinTemplate, Skin ).

Skins based on Skin have overwritten the getSkinName function.
So those won't be affected.


Version: 1.6.x
Severity: minor
OS: Windows 2000
Platform: PC

Details

Reference
bz3366

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 8:49 PM
bzimport set Reference to bz3366.
bzimport added a subscriber: Unknown Object (MLST).

I applied your patch and marked Skin::skinname protected.