anvc / scalar

Born-digital, open source, media-rich scholarly publishing that’s as easy as blogging.
Other
231 stars 73 forks source link

PHP 7.4 Arc library preg_match issue #148

Closed arthurian closed 3 years ago

arthurian commented 3 years ago

When I attempt to upload media using PHP 7.4, I get the following error message:

<h4>A PHP Error was encountered</h4>

<p>Severity: Warning</p>
<p>Message:  preg_match(): Compilation failed: escape sequence is invalid in character class at offset 20</p>
<p>Filename: store/ARC2_StoreLoadQueryHandler.php</p>
<p>Line Number: 329</p>

This error does not occur in PHP 7.2, which is what we are currently using.

Steps to reproduce:

  1. Navigate to the Upload Media File page (Files and Urls -> Upload media files).
  2. Choose a file to upload (in my test, it was a small jpeg image) and click Upload.

Expected behavior:

I would expect the file to be uploaded and then redirected to the media page.

Current behavior:

The upload completes, but there is no redirect to the media page and there is no indication of success or failure. In the browser developer tools, the network tab shows that the /upload request completes successfully, but then the subsequent /api/add request fails with the above PHP error message.

Other Comments:

Any thoughts on how to resolve this?

craigdietrich commented 3 years ago

Shoot, yeah, this could be a big problem. The ARC library is really complex, though, the good news is that their community is live and makes updates. But then it will require us to update ARC, which isn't trivial. I'll write up a report on their Issue tab.

craigdietrich commented 3 years ago

Looks like the line in question is removed in the recent version(s) of ARC2, so I think 'simply' updating ARC will work. Like said, it's not trivial, but I'll add it to my TODO list.

craigdietrich commented 3 years ago

This should be corrected with our new Release

https://github.com/anvc/scalar/releases/tag/2.5.15