[GH-ISSUE #1040] Many invalid files due to 'preg_match(): Compilation failed' #619

Closed
opened 2026-02-26 02:33:43 +03:00 by kerem · 6 comments
Owner

Originally created by @svalo on GitHub (Aug 6, 2019).
Original GitHub issue: https://github.com/koel/koel/issues/1040

Hey, thanks for contributing to Koel! To save time for both of us, please make sure these checkboxes are checked before submitting the issue:

  • You have read and followed closely the Wiki, Upgrade Guide, as well as Troubleshooting
  • The issue has not been reported before
  • This is not a "how to install on Windows" or "why is my npm messed up" question
  • You're a cool person - hope so :)

All checked? Now also make sure your issue

  • Is associated with a version. Or better yet, a commit.
  • Is as detailed as possible (ahem... OS, browser, steps to reproduce, maybe?)
  • Includes the error output if it's a bug/error report ("Whoops!" is not very helpful, you know)
  • Is in English, 因为我不说中文。

OS

Archlinux, latest release
PHP: 7.3.8 (FPM)
Nginx: 1.16.0
DB: MariaDB 10.4.7
Browser: not involved

Koel Version: latest master rev fe9653e

Error

Hello, I receive many error while importing my library, on a desktop player it works fine with the same track giving error in koel.

This happens only on a subset of the songs, output of php artisan koel:sync
is

Syncing media from /***/AUDIO

 12932/12932 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

Completed! 0 new or updated song(s), 2970 unchanged song(s), and 9962 invalid file(s).

One example error message is '07 One Rode To Asa Bay.mp3' is not a valid media file: Caught exception: preg_match(): Compilation failed: escape sequence is invalid in character class at offset 16

I think this is due to the change from PHP 7.2 to PHP 7.3 where the Regexp engine version changed, here I found a brief but clear explanation.

I tried to search for the line calling preg_match to propose a fix but i'm not familiar with the codebase and didn't manage to find it.

Originally created by @svalo on GitHub (Aug 6, 2019). Original GitHub issue: https://github.com/koel/koel/issues/1040 Hey, thanks for contributing to Koel! To save time for both of us, please make sure these checkboxes are checked before submitting the issue: - [x] You have read and followed closely the [Wiki](https://koel.phanan.net/docs), [Upgrade Guide](https://github.com/phanan/koel/releases), as well as [Troubleshooting](https://koel.phanan.net/docs/#/troubleshooting) - [x] The issue has not been reported before - [x] This is not a "how to install on Windows" or "why is my npm messed up" question - [x] You're a cool person - hope so :) All checked? Now also make sure your issue - [ ] Is associated with a version. Or better yet, a commit. - [x] Is as detailed as possible (ahem... OS, browser, steps to reproduce, maybe?) - [x] Includes the error output if it's a bug/error report ("Whoops!" is not very helpful, you know) - [x] Is in English, 因为我不说中文。 ### OS Archlinux, latest release PHP: 7.3.8 (FPM) Nginx: 1.16.0 DB: MariaDB 10.4.7 Browser: not involved Koel Version: latest master rev fe9653e ### Error Hello, I receive many error while importing my library, on a desktop player it works fine with the same track giving error in koel. This happens only on a subset of the songs, output of `php artisan koel:sync` is ``` Syncing media from /***/AUDIO 12932/12932 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100% Completed! 0 new or updated song(s), 2970 unchanged song(s), and 9962 invalid file(s). ``` One example error message is `'07 One Rode To Asa Bay.mp3' is not a valid media file: Caught exception: preg_match(): Compilation failed: escape sequence is invalid in character class at offset 16` I think this is due to the change from PHP 7.2 to PHP 7.3 where the Regexp engine version changed, [here](https://ayesh.me/Upgrade-PHP-7.3#pcre2) I found a brief but clear explanation. I tried to search for the line calling preg_match to propose a fix but i'm not familiar with the codebase and didn't manage to find it.
kerem closed this issue 2026-02-26 02:33:43 +03:00
Author
Owner

@svalo commented on GitHub (Aug 6, 2019):

This issue is solved if i introduce the changes present in this commit github.com/JamesHeinrich/getID3@68ef47e5bd of the the getID3 library

<!-- gh-comment-id:518569511 --> @svalo commented on GitHub (Aug 6, 2019): This issue is solved if i introduce the changes present in this commit https://github.com/JamesHeinrich/getID3/commit/68ef47e5bdebf927a7577961a419525b5e1bdb40 of the the getID3 library
Author
Owner

@phanan commented on GitHub (Aug 7, 2019):

Thanks for reporting the issue! I've upgraded GetID3 to the latest beta and pushed some changes. Can you confirm if everything is fine?

<!-- gh-comment-id:518993424 --> @phanan commented on GitHub (Aug 7, 2019): Thanks for reporting the issue! I've upgraded GetID3 to the latest beta and pushed some changes. Can you confirm if everything is fine?
Author
Owner

@svalo commented on GitHub (Aug 7, 2019):

Hi, thank you for the fix :)

I stil get some errors mentioning preg_match() but way less than before. (Maybe it's because my library didn't change)

I think the issue is that the library version v2.0.0-beta1 gets built from the v2.0.0-beta1 tag which doesn't contain the fix to the regexp pattern.

While the tag v2.0.0-beta1 doesn't contain the fix the 2.0 branch does

As I reintroduce the fix to the regexp I don't receive any more error regarding preg_match.

Maybe this should be addressed upstream tagging a new release for the 2.0.0... tag, I'm not sure

<!-- gh-comment-id:519078122 --> @svalo commented on GitHub (Aug 7, 2019): Hi, thank you for the fix :) I stil get some errors mentioning `preg_match()` but way less than before. (Maybe it's because my library didn't change) I think the issue is that the library version `v2.0.0-beta1` gets built from the `v2.0.0-beta1` tag which doesn't contain the fix to the regexp pattern. While the tag `v2.0.0-beta1` doesn't contain the fix the `2.0` branch does As I reintroduce the fix to the regexp I don't receive any more error regarding preg_match. Maybe this should be addressed upstream tagging a new release for the `2.0.0...` tag, I'm not sure
Author
Owner

@phanan commented on GitHub (Aug 8, 2019):

OK, I think we'll have to wait for @JamesHeinrich to release a newer version of GetID3 with the fix then.

<!-- gh-comment-id:519554669 --> @phanan commented on GitHub (Aug 8, 2019): OK, I think we'll have to wait for @JamesHeinrich to release a newer version of GetID3 with the fix then.
Author
Owner

@BrookeDot commented on GitHub (Apr 15, 2020):

Is this still an issue now that getID3 was bumped to v1.9.19 in 2de16f1ed9?

<!-- gh-comment-id:613838858 --> @BrookeDot commented on GitHub (Apr 15, 2020): Is this still an issue now that getID3 was bumped to v1.9.19 in 2de16f1ed92c4c197fb040dd395dcd5b19580dc5?
Author
Owner

@BrookeDot commented on GitHub (Apr 15, 2020):

I'm going to close this since I haven't been able to replicate in 4.2.2 and this should be fixed by v1.9.19 in 2de16f1? as mentioned above.

<!-- gh-comment-id:614269030 --> @BrookeDot commented on GitHub (Apr 15, 2020): I'm going to close this since I haven't been able to replicate in 4.2.2 and this should be fixed by v1.9.19 in 2de16f1? as mentioned above.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/koel-koel#619
No description provided.