Skip to content

Conversation

@rvelhote
Copy link
Contributor

@rvelhote rvelhote commented Sep 5, 2018

The array_walk function accepts the array parameter as reference. That
parameter is being passed directly from the method return however only
variables can be passed as reference.

The array_walk function accepts the array parameter as reference. That
parameter is being passed directly from the method return however only
variables can be passed as reference.
@rvelhote rvelhote changed the title Fix an "only variables should be passed by reference" PHP notice Fix a "only variables should be passed by reference" PHP notice Sep 5, 2018
@rvelhote rvelhote changed the title Fix a "only variables should be passed by reference" PHP notice Fix "only variables should be passed by reference" PHP notice Sep 5, 2018
Copy link
Contributor

@andercampanha andercampanha left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution, but passing a variable to array_walk can be dangerous since it is passed by reference and it may be modified in a unpredictable way. A better way to solve this problem would be to replace array_walk with array_map.

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

Successfully merging this pull request may close these issues.

2 participants