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

Fix _encodeData regexp #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix _encodeData regexp #17

wants to merge 1 commit into from

Conversation

akurth
Copy link

@akurth akurth commented Feb 9, 2025

\x was used shorthand for \x00. php v8.3.16 and v8.4.3 seem to not accept that any more. This failing example code demonstrates that:

echo preg_match('/[\x-\x20]+/', "\x00");

\x was used shorthand for \x00. php v8.3.16 and v8.4.3 seem to not
accept that any more. This failing example code demonstrates that:

  echo preg_match('/[\x-\x20]+/', "\x00");
@ktomk
Copy link
Contributor

ktomk commented Feb 9, 2025

Yes, \x was in use since 2013 and it was \x0 beforehand.. Ref: fca283a#diff-b75de153cd3132d5c0db68f7f65ab7ca328ac5c6cd626e9d3ff698cf0ddd5a6aL1030

How did you test / against which kind of system are you reporting?

IMHO it's OK to restore \x0 (or use \x00 for readability),
but I'm asking because I could not reproduce the issue on my box (8.2.27, 8.3.16, 8.4.3) and also 3v4l.org shows stable behaviour for the pattern: https://3v4l.org/FT4na

@akurth
Copy link
Author

akurth commented Feb 10, 2025

Debian unstable
libpcre2 10.45
php 8.3.16 from https://packages.sury.org/php/

I noticed the problem because the Nextcloud News app wasn’t able to pull RSS feeds any more. Error was:

preg_replace_callback(): Compilation failed: digits missing after \\x or in \\x{} or \\o{} or \\N{U+} at offset 3 at /var/www/html/nc/apps/news/vendor/pear/net_url2/Net/URL2.php#1200

@xandris
Copy link

xandris commented Feb 10, 2025

caused by a change in libpcre2 10.45:

  1. (#478, #504) Disallow \x if not followed by { or a hex digit.

PCRE2Project/pcre2#478
PCRE2Project/pcre2#504

so this depends on if your php links against 10.45

@akurth
Copy link
Author

akurth commented Feb 10, 2025

so this depends on if your php links against 10.45

... which is going to happen for many users sooner or later. So this change

  1. is future proof
  2. doesn’t hurt anyway

Or do I miss something?

@xandris
Copy link

xandris commented Feb 10, 2025

so this depends on if your php links against 10.45

... which is going to happen for many users sooner or later. So this change

  1. is future proof
  2. doesn’t hurt anyway

Or do I miss something?

no i agree with you. i was just explaining why it works on their php 8.3.16 but not ours sorry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants