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

[v3.x] Fix prefix error if prefix equals a php command #1402

Open
wants to merge 5 commits into
base: v2.x
Choose a base branch
from

Conversation

mmodler
Copy link

@mmodler mmodler commented Sep 18, 2023

Fix php error if prefix equals a php command like "chr" for example.

Replaced is_callable with instanceof Closure, which should preserve the desired behavior.

Hopefully better fix for #1339

@coveralls
Copy link

coveralls commented Sep 18, 2023

Coverage Status

coverage: 80.208%. remained the same when pulling cf469fc on mmodler:better-prefix-fix into 577bd39 on predis:v2.x.

@mmodler
Copy link
Author

mmodler commented Sep 18, 2023

@tillkruss Now tests are passing, only code style test failing but has nothing to do with my change?

@mmodler mmodler marked this pull request as ready for review September 18, 2023 07:24
@tillkruss tillkruss self-assigned this Sep 18, 2023
@tillkruss tillkruss added the bug label Sep 18, 2023
@tillkruss
Copy link
Member

See #1329.

@@ -28,7 +29,7 @@ class Prefix implements OptionInterface
*/
public function filter(OptionsInterface $options, $value)
{
if (is_callable($value)) {
if (is_callable($value) && ! function_exists($value)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mmodler Great, let's add a new test case that "chr" won't be called as a function and we can merge it.

@tillkruss
Copy link
Member

@vladvildanov Should we move this into v3?

@vladvildanov
Copy link
Contributor

@tillkruss +

@tillkruss tillkruss changed the base branch from v2.x to main January 22, 2024 17:43
@tillkruss tillkruss requested a review from a team as a code owner January 22, 2024 17:43
@tillkruss tillkruss changed the base branch from main to v2.x January 22, 2024 17:43
@tillkruss tillkruss changed the title Fix prefix error if prefix equals a php command [v3.x] Fix prefix error if prefix equals a php command Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

4 participants