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

strict types is ignored when mapping or filtering arrays due to the usage of PHP builtin functions #194

Closed
azjezz opened this issue May 19, 2021 · 3 comments
Assignees
Labels
Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors.

Comments

@azjezz
Copy link
Owner

azjezz commented May 19, 2021

This bug was introduced in #169 by mistake, the solution would be to wrap all callbacks provided by the end user in another closure to ensure that strict types is used.

Environment (please complete the following information):

  • OS: *
  • PHP version: 7.4, 8.0
  • Version: 1.6, 1.7

Additional context

see Roave/BackwardCompatibilityCheck#306 (comment)

@azjezz azjezz added the Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors. label May 19, 2021
@azjezz azjezz self-assigned this May 19, 2021
@azjezz
Copy link
Owner Author

azjezz commented May 19, 2021

we have to benchmark which solution is better:

  1. wrap callbacks in a closure
  2. re-implement array_* functions in userland.

@Ocramius
Copy link
Contributor

re-implement array_* functions in userland.

I think we'll likely need to suck it up and keep using array_ functions here: assuming 100% type coverage on sources, we can assume that the given values are within the type boundaries of the provided callbacks.

The array_* functions are massively outperforming any iterative approach, as they can operate at zval level.

@azjezz
Copy link
Owner Author

azjezz commented May 19, 2021

fixed and released as 1.6.1 and 1.7.1

@azjezz azjezz closed this as completed May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors.
Projects
None yet
Development

No branches or pull requests

2 participants