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

Nullable $replacement for ::pcre() fails #241

Closed
dakur opened this issue Nov 27, 2020 · 5 comments
Closed

Nullable $replacement for ::pcre() fails #241

dakur opened this issue Nov 27, 2020 · 5 comments

Comments

@dakur
Copy link

dakur commented Nov 27, 2020

Version: 3.1.4
PHP 8.0.0

Bug Description

Calling Strings::pcre('preg_replace', ['#\\.#', NULL, '70', -1]) fails with Fatal error: Uncaught TypeError: preg_replace(): Argument #2 ($replacement) must be of type array|string, null given

It happens when using symplify/easy-coding-standard, but it looks rather like error with PHP 8.0 compatibility in nette/utils.

image

@dakur
Copy link
Author

dakur commented Nov 27, 2020

Strange is that I have not found any mentions of preg_replace API change in 8.0.

@dg
Copy link
Member

dg commented Dec 3, 2020

Strings::replace('70', '#\\.#') - there is missing replacement

@dakur
Copy link
Author

dakur commented Dec 3, 2020

Yeah, but Strings::replace() should throw an exception in such case, shouldn't it?

@dakur
Copy link
Author

dakur commented Dec 3, 2020

Or maybe just make the argument obligatory..

@genesiscz
Copy link

Can we get a new version released so this gets fixed?

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

No branches or pull requests

3 participants