Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

replace(…, '_') is considered as a callable #44

Open
Hywan opened this issue Nov 24, 2017 · 0 comments
Open

replace(…, '_') is considered as a callable #44

Hywan opened this issue Nov 24, 2017 · 0 comments

Comments

@Hywan
Copy link
Member

Hywan commented Nov 24, 2017

Ustring::replace supports 2 forms for the second argument: Either a string, or a callable. If it is a string, then preg_replace is used, else preg_replace_callback.

The string '_' is considered as a callable, because is_callable('_') returns true. Why? Because the function _ exists!

It is a bug. It's better to test if it is a Closure.

cc @hoaproject/hoackers, any volunteers?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

1 participant