Page MenuHomePhabricator

Split mkdir and symlink off in includes/media/SVG.php
Open, LowPublic

Description

Line 207 of includes/media/SVG.php has:

$ok = mkdir( $tmpDir, 0771 ) && symlink( $srcPath, $lnPath );

But it makes things very confusing, not being explicitly what is the problem. I installed Mediawiki in a PHP hardened installation (Suhosin) with symlink() disabled and took hours to discover the problem. Please, make something like:

$ok = mkdir(...);
if (!$ok) {
  hey user! no way creating that directory!
}
$ok = symlink(...);
if (!$ok) {
  hey user! problem creating symlink. check your php configuration.
}

Thanks!

Event Timeline

Silasdb1 created this task.Feb 2 2016, 10:47 PM
Silasdb1 raised the priority of this task from to Needs Triage.
Silasdb1 updated the task description. (Show Details)
Silasdb1 added a subscriber: Silasdb1.
Restricted Application added subscribers: StudiesWorld, Aklapper. · View Herald TranscriptFeb 2 2016, 10:47 PM
Silasdb1 updated the task description. (Show Details)Feb 2 2016, 10:48 PM
Silasdb1 set Security to None.
Aklapper renamed this task from Please, split mkdir and symlink off in includes/media/SVG.php to Split mkdir and symlink off in includes/media/SVG.php.Feb 3 2016, 12:36 PM
Aklapper triaged this task as Low priority.
Aklapper added a project: good first bug.

Hi @Silasdb1, thanks for taking the time to report this and for taking a look at the code!

You are very welcome to use developer access to submit your proposed changes as a Git branch directly into Gerrit which makes it easier to review it quickly.
If you don't want to set up Git/Gerrit, you can also use the Gerrit Patch Uploader. Thanks again!

Change 268350 had a related patch set uploaded (by PlasmaPower):
Added a seperate error message for mkdir failures

https://gerrit.wikimedia.org/r/268350

Change 268350 merged by jenkins-bot:
[mediawiki/core@master] Added a separate error message for mkdir failures

https://gerrit.wikimedia.org/r/268350

Restricted Application added a subscriber: TerraCodes. · View Herald TranscriptAug 9 2017, 11:24 PM

Should this be resolved or is there something left to do?

Framawiki moved this task from Backlog to Doing on the good first bug board.Dec 2 2017, 1:35 PM