shivammathur / setup-php

GitHub action to set up PHP with extensions, php.ini configuration, coverage drivers, and various tools.
https://setup-php.com
MIT License
2.89k stars 337 forks source link

PHP 8.3 nightly missing Unicode PCRE properties #779

Closed curry684 closed 10 months ago

curry684 commented 10 months ago

The following code does not work in PHP 8.3 nightly:

var_dump(preg_match('#\\p{cyrillic}#u', 'Пример')); # Should be 1
var_dump(preg_match('#\\p{cyrillic}#u', 'Latin'));  # Should be 0

Even though it should: https://3v4l.org/4sRgY#v8.2.11

You can see it fail in https://github.com/omines/antispam-bundle/actions/runs/6769796730/job/18396922196:

1) /home/runner/work/antispam-bundle/antispam-bundle/src/Validator/Constraints/BannedScriptsValidator.php:34
preg_match(): Compilation failed: unknown property name after \P or \p at offset 13

8.1 and 8.2 are passing the same test suite. My local 8.3 install passes it as well.

As far as I can see this error results from the PCRE extension being built without --enable-unicode-properties flag. It's pretty much impossible to validate that hypothesis though as the switch is not exposed through PHP.

curry684 commented 10 months ago

I've set up a dedicated test case, turns out the code successfully runs on 7.3 to 8.2 only.

PHP 5.6 to 7.2 and the nightlies of 8.3 and 8.4 fail.

https://github.com/curry684/regexp-actions/actions/runs/6771604589

shivammathur commented 10 months ago

Thanks for reporting this.

Fixed in https://github.com/shivammathur/php-builder/commit/bf0252650611d2f2ad37660da62d4613066bca48

Please restart your workflow, it should work correctly now for PHP 7.3 to 8.4

curry684 commented 10 months ago

Yessss, thank you!

https://github.com/curry684/regexp-actions/actions/runs/6771604589

curry684 commented 9 months ago

@shivammathur the problem returned now that 8.3 is stable 😉

https://github.com/omines/antispam-bundle/actions/runs/7020097667/job/19099047187

edit: better testcase at https://github.com/omines/antispam-bundle/actions/runs/7026796018

shivammathur commented 9 months ago

@curry684

FIxed in https://github.com/shivammathur/php-ubuntu/commit/c05854720bc765dee8fdaef650cc485b994b8cef

curry684 commented 9 months ago

Thank you, confirmed @ https://github.com/omines/antispam-bundle/actions/runs/7026796018