ctf0 / Laravel-Media-Manager

A "Vuejs & Laravel" Media Manager With Tons of Features
MIT License
829 stars 179 forks source link

[BUG] PCRE2 backward incompatible for regex patterns #127

Closed vasishth80987 closed 4 years ago

vasishth80987 commented 4 years ago

What version of Laravel are you using? (nothing lower than v5.4).

6.x

is it an issue related to installation or usage ?

Yes

what is the error you are getting ?

exception: "ErrorException" file: "/vendor/ctf0/media-manager/src/App/Controllers/Modules/Utils.php" line: 50 message: "preg_replace(): Compilation failed: invalid range in character class at offset 27"

Do You Know A Solution For this Issue ?

This is an issue specific to PHP 7.3 and newer. PHP PCRE engine has migrated to PCRE2. So the regex pattern used for compilation needs to be compatible with the new regex syntax. In my case the pattern generated was

(script.*?\/script)|[^(-\s)a-zA-Z0-9]+_

The -\s has to be -\s as per the new syntax(please cross check this https://wiki.php.net/rfc/pcre2-migration#backward_incompatible_changes)

ctf0 commented 4 years ago

The -\s has to be -\s as

???

vasishth80987 commented 4 years ago

Aplogies for the typo,

It should be _\-\s, the hyphen has to escaped.

vasishth80987 commented 4 years ago

Resolved it, by changing it in the config variable 'allowed_folderNames_chars' and 'allowed_fileNames_chars'.

antlusher commented 4 years ago

Hello all, still having regex issues for file creation, for now, I've changed to empty strings in LMM config.. Not sure how to fix this, will have a look when I get the opportunity

Cheers