Fix PHP warnings "preg_replace(): [...] invalid range in character class"
authorEdward Chernenko <edwardspec@gmail.com>
Mon, 18 Jun 2018 22:53:52 +0000 (01:53 +0300)
committerReedy <reedy@wikimedia.org>
Tue, 19 Jun 2018 00:11:33 +0000 (00:11 +0000)
commitd88e924b6e5a7d529c471980e14f72430a94e546
tree51ada7256efb3ff03c45af827345e7b9de46e842
parenta621fad3ccf679271aa1e3bad4130f748f94ff77
Fix PHP warnings "preg_replace(): [...] invalid range in character class"

This was spotted when running tests on Travis (PHP 7.3 nighly, trusty).

Two expressions inside preg_replace() contained non-escaped "-" inside [],
where this "-" meant an actual "-" character.
The warning is because "-" has special meaning inside [] ("a-z" for range),
and things like [\w-.] are considered "invalid range".

Solution is to escape "-" like this: [\w\-.]

Change-Id: I41cc217081f00f54d957b6d8052ee209412f5ff6
includes/media/FormatMetadata.php
includes/upload/UploadStash.php