Skip to content

Fix _encodeData regexp #17

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

Closed
wants to merge 1 commit into from
Closed

Fix _encodeData regexp #17

wants to merge 1 commit into from

Conversation

akurth
Copy link
Contributor

@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
Contributor 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
Contributor 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

@reedy
Copy link
Contributor

reedy commented Mar 9, 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

Debian unstable is currently using 10.45 (testing is on 10.44), so will indeed start causing wider pain down the line

https://tracker.debian.org/pkg/pcre2

Would definitely be useful for this to be merged, and a release tagged for other reasons (#14 which is https://pear.php.net/bugs/bug.php?id=28649)

I have already created https://pear.php.net/bugs/bug.php?id=29032 specifically requesting a new release too...

@gessel
Copy link

gessel commented Mar 9, 2025

This seems to impact MediaWiki as well. FreeBSD ports updated devel/pcre2 to 10.45 on
06 Feb 2025 09:40:08. The manifestation of the error in MediaWiki may appear as in this bug: https://phabricator.wikimedia.org/T388285#10616477

@reedy
Copy link
Contributor

reedy commented Mar 9, 2025

It'll impact many things - https://packagist.org/packages/pear/net_url2/dependents?order_by=downloads (never mind direct pear installs etc)

@MatthewVernon
Copy link

Debian "trixie" will ship with 10.45 (as that's what's in testing since 2025-02-24).

ktomk added a commit to ktomk/Net_URL2 that referenced this pull request Mar 12, 2025
Resolves: https://pear.php.net/bugs/bug.php?id=29032 "Request #29032: Release with PHP 8.4 support (Sam Reed, 2025-03-07)"
Resolves: pear#20 "MSGH Pear Net_URL2 pear#20: URL2.php remove executable bit (Sam Reed, 2025-02-28)"
Resolves: pear#18 "MSGH Pear Net_URL2 pear#18: Restore Phpunit Tests (Tom Klingenberg, 2025-02-12)"
Resolves: pear#17 "MSGH Pear Net_URL2 pear#17: Fix _encodeData regexp (Andreas Kurth, 2025-02-09)"
Resolves: https://pear.php.net/bugs/bug.php?id=28662 "Request #28662: Minimum supported PHP version? (Sam Reed, 2024-11-25)"
Resolves: pear#15 "MSGH Pear Net_URL2 pear#15: Update CI to GitHub Actions (Sam Reed, 2024-11-25)"
Resolves: pear#14 "MSGH Pear Net_URL2 pear#14: URL2: Fix implicit null declaration (Sam Reed, 2024-11-25)"
Resolves: https://pear.php.net/bugs/bug.php?id=28649 "Bug #28649: PHP 8.4 compatybility bug" (Aleksander Machniak, 2024-08-30)
Resolves: pear#13 "MSGH Pear Net_URL2 pear#13: Add .gitattributes to exclude dev files from Composer package (Timo Tijhof, 2020-02-15)"
ktomk added a commit to ktomk/Net_URL2 that referenced this pull request Mar 12, 2025
Resolves: https://pear.php.net/bugs/bug.php?id=29032 "Request #29032: Release with PHP 8.4 support (Sam Reed, 2025-03-07)"
Resolves: pear#20 "MSGH Pear Net_URL2 pear#20: URL2.php remove executable bit (Sam Reed, 2025-02-28)"
Resolves: pear#18 "MSGH Pear Net_URL2 pear#18: Restore Phpunit Tests (Tom Klingenberg, 2025-02-12)"
Resolves: pear#17 "MSGH Pear Net_URL2 pear#17: Fix _encodeData regexp (Andreas Kurth, 2025-02-09)"
Resolves: https://pear.php.net/bugs/bug.php?id=28662 "Request #28662: Minimum supported PHP version? (Sam Reed, 2024-11-25)"
Resolves: pear#15 "MSGH Pear Net_URL2 pear#15: Update CI to GitHub Actions (Sam Reed, 2024-11-25)"
Resolves: pear#14 "MSGH Pear Net_URL2 pear#14: URL2: Fix implicit null declaration (Sam Reed, 2024-11-25)"
Resolves: https://pear.php.net/bugs/bug.php?id=28649 "Bug #28649: PHP 8.4 compatybility bug" (Aleksander Machniak, 2024-08-30)
Resolves: pear#13 "MSGH Pear Net_URL2 pear#13: Add .gitattributes to exclude dev files from Composer package (Timo Tijhof, 2020-02-15)"
ktomk added a commit to ktomk/Net_URL2 that referenced this pull request Mar 24, 2025
Resolves: https://pear.php.net/bugs/bug.php?id=29032 "Request #29032: Release with PHP 8.4 support (Sam Reed, 2025-03-07)"
Resolves: pear#20 "MSGH Pear Net_URL2 pear#20: URL2.php remove executable bit (Sam Reed, 2025-02-28)"
Resolves: pear#18 "MSGH Pear Net_URL2 pear#18: Restore Phpunit Tests (Tom Klingenberg, 2025-02-12)"
Resolves: pear#17 "MSGH Pear Net_URL2 pear#17: Fix _encodeData regexp (Andreas Kurth, 2025-02-09)"
Resolves: https://pear.php.net/bugs/bug.php?id=28662 "Request #28662: Minimum supported PHP version? (Sam Reed, 2024-11-25)"
Resolves: pear#15 "MSGH Pear Net_URL2 pear#15: Update CI to GitHub Actions (Sam Reed, 2024-11-25)"
Resolves: pear#14 "MSGH Pear Net_URL2 pear#14: URL2: Fix implicit null declaration (Sam Reed, 2024-11-25)"
Resolves: https://pear.php.net/bugs/bug.php?id=28649 "Bug #28649: PHP 8.4 compatybility bug" (Aleksander Machniak, 2024-08-30)
Resolves: pear#13 "MSGH Pear Net_URL2 pear#13: Add .gitattributes to exclude dev files from Composer package (Timo Tijhof, 2020-02-15)"
@ktomk
Copy link
Contributor

ktomk commented Mar 24, 2025

Version 2.2.3 of Net_URL2 has been successfully released, and its promotion cycle has started. https://pear.php.net/package/Net_URL2/

Version 2.2.3 of Net_URL2 has been tagged in the upstream repository. https://github.com/ktomk/Net_URL2/releases/tag/v2.2.3

PACKAGIST ORG now has the Version 2.2.3 tag.
https://packagist.org/packages/pear/net_url2

@reedy
Copy link
Contributor

reedy commented Mar 25, 2025

Do we have a rough timeline as to when the official release will be/how long that promotion cycle is?

@ktomk
Copy link
Contributor

ktomk commented Mar 25, 2025

@reedy I guess you ask because of the Packagist downstream (Composer)? Because that was just the standard message and related to uploading the package on the Pear website and as written it's unrelated.

Unfortunately right now I can't merge here so I mailed the list, but I can't predict when someone joins in with a helping hand. Maybe @cweiske can help and can reinstate my Github account for the Net_URL2 repo?

@reedy Merged and Packagist has the new tag.

@ktomk ktomk closed this in c1f2b31 Mar 26, 2025
@reedy
Copy link
Contributor

reedy commented Mar 27, 2025

Thanks!

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.

6 participants