Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Error - preg_replace_callback(): Compilation failed #3087

Open
3 tasks done
Pantos opened this issue Feb 14, 2025 · 6 comments
Open
3 tasks done

PHP Error - preg_replace_callback(): Compilation failed #3087

Pantos opened this issue Feb 14, 2025 · 6 comments
Labels

Comments

@Pantos
Copy link

Pantos commented Feb 14, 2025

IMPORTANT

Read and tick the following checkbox after you have created the issue or place an x inside the brackets ;)

  • I have read the CONTRIBUTING.md and followed the provided tips
  • I accept that the issue will be closed without comment if I do not check here
  • I accept that the issue will be closed without comment if I do not fill out all items in the issue template.

Explain the Problem

After upgrading to NC 30.0.6 i get the PHP error:
[PHP] Fehler: preg_replace_callback(): Compilation failed: digits missing after \x or in \x{} or \o{} or \N{U+} at offset 3 at /www/nextcloud/www/apps/news/vendor/pear/net_url2/Net/URL2.php#1200 von ? von -- um 14.02.2025, 22:30:07

Steps to Reproduce

The error occurs every time the cronjob updates the feeds.

System Information

  • News app version: 25.2.0
  • Nextcloud version: 30.0.6
  • Cron type: system cron
  • PHP version: 8.3.16
  • Database and version: MySQL 10.11.10
  • Browser and version: Firefox 135.0
  • OS and version: FreeBSD 14.2
Contents of nextcloud/data/nextcloud.log
{"reqId":"qhP25lmMuX7zj3Tk9Mzd","level":3,"time":"2025-02-14T21:30:07+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"preg_replace_callback(): Compilation failed: digits missing after \\x or in \\x{} or \\o{} or \\N{U+} at offset 3 at /www/nextcloud/www/apps/news/vendor/pear/net_url2/Net/URL2.php#1200","userAgent":"--","version":"30.0.6.2","data":{"app":"PHP"},"id":"67afb5dff2211"}
@Pantos Pantos added the bug label Feb 14, 2025
@Grotax Grotax added help wanted API Impact API/Backend code labels Feb 16, 2025
@Pantos
Copy link
Author

Pantos commented Feb 16, 2025

The bug still exists in version 25.2.1.

@nomoo
Copy link

nomoo commented Feb 17, 2025

also hit that.

News app version: 25.2.1
Nextcloud version: 30.0.6
Cron type: system cron
PHP version: 8.2.27
Database and version: MySQL 8.0.39
OS and version: FreeBSD 14.2

@Pantos
Copy link
Author

Pantos commented Feb 17, 2025

I had entered the OS version incorrectly in the bug report. I also use FreeBSD. With a fresh install on Linux with NC 30.0.6 and News 20.5.1 I could not reproduce the bug. Maybe the problem is OS related?

@hc42
Copy link

hc42 commented Feb 18, 2025

Hi, I can also reproduce the issue on FreeBSD. The reason is that the Net_URL2 library uses an invalid regex at the mentioned line. The single \x is invalid here.
See for example, the definition here: https://pcre.org/pcre.txt (or ask your favorite LLM).

There is an issue here at the library repository about this problem: pear/Net_URL2#17
It seems \x was used as shorthand for \x00. This however, is problematic and support was removed in PHP v8.3.16 and v8.4.3.
I wonder why that was allowed in the first place?

@hc42
Copy link

hc42 commented Feb 18, 2025

This behavior was changed in the pcre2 project, where this broken regex support was removed. PCRE2Project/pcre2@4d2bb33

It is part of version 10.45. The FreeBSD port was updated on 6 Feb 2025 https://www.freshports.org/devel/pcre2/ . This is why it probably affects our systems now (At least I updated the package to 10.45).
As a temporary hotfix, you could build an older version of this port until this issue is resolved here and see if that will work.

@Pantos
Copy link
Author

Pantos commented Feb 19, 2025

That works perfectly! Instead of building a new (old) pcre2 version, I simply added the two zeros to line 1201 in /www/nextcloud/www/apps/news/vendor/pear/net_url2/Net/URL2.php (pear/Net_URL2@2639e87):

'([\x00-\x20\x22\x3C\x3E\x7F-\xFF]+)',

@Pantos Pantos closed this as completed Feb 20, 2025
@SMillerDev SMillerDev mentioned this issue Feb 24, 2025
3 tasks
@Grotax Grotax reopened this Feb 24, 2025
@Grotax Grotax changed the title No feed update after upgrading to NC 30.0.6 - PHP Error - preg_replace_callback(): Compilation failed PHP Error - preg_replace_callback(): Compilation failed Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants