Skip to content

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

Open
mmodler wants to merge 6 commits into
predis:mainfrom
mmodler:better-prefix-fix
Open

[v3.x] Fix prefix error if prefix equals a php command#1402
mmodler wants to merge 6 commits into
predis:mainfrom
mmodler:better-prefix-fix

Conversation

@mmodler
Copy link
Copy Markdown

@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
Copy Markdown

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
Copy Markdown
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
@mmodler mmodler requested a review from tillkruss as a code owner September 18, 2023 07:24
@tillkruss tillkruss self-assigned this Sep 18, 2023
@tillkruss tillkruss added the bug label Sep 18, 2023
Comment thread src/Configuration/Option/Prefix.php Outdated
@tillkruss
Copy link
Copy Markdown
Member

See #1329.

public function filter(OptionsInterface $options, $value)
{
if (is_callable($value)) {
if (is_callable($value) && ! function_exists($value)) {
Copy link
Copy Markdown
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
Copy Markdown
Member

@vladvildanov Should we move this into v3?

@vladvildanov
Copy link
Copy Markdown
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 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
@tillkruss tillkruss changed the base branch from v2.x to main April 14, 2025 17:09
@tillkruss tillkruss removed their assignment Apr 15, 2025
@mmodler mmodler requested a review from a team as a code owner August 21, 2025 13:13
@mmodler mmodler requested a review from tillkruss August 21, 2025 13:13
@tillkruss
Copy link
Copy Markdown
Member

@vladvildanov yeah, wdyt?

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.

4 participants