array_filter Flag will ignored when callable is null
Nobody has claimed this yet.
- Dominant language
- XML
- Stars
- 596
- Forks
- 890
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 55
Description
From manual page: https://php.net/function.array-filter
If the callback parameter is set to null, the flag is ignored. I expect array_filter to use an empty check for the mode used on key, or value, or both. But the flag is ignored and each time only the value is checked for empty.
Example:
array_filter([''=>'2',0=>'3',0,5=>3,null,'',[]], null, ARRAY_FILTER_USE_BOTH); does not filter the elements where key or value are empty. Only the elements where value is empty are filtered.
I expected all elements where key or value are empty to be filtered.
and
array_filter([''=>'2',0=>'3',0,5=>3,null,'',[]], null, ARRAY_FILTER_USE_KEY); does not filter the elements where key is empty. Only the elements where value is empty are filtered.
I had expected that all elements whose keys are empty would be filtered.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the array_filter manual page linked in the report and compare its description of a null callback with the supplied ARRAY_FILTER_USE_BOTH and ARRAY_FILTER_USE_KEY examples. Done means the documentation clearly states the flag behavior and the expected handling of empty keys and values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100