Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

fix(filterFilter): fix matching against null/undefined #11445

Closed

Conversation

gkalpak
Copy link
Member

@gkalpak gkalpak commented Mar 27, 2015

Included fixes:

  • Do not convert null/undefined to strings for substring matching in
    non-strict comparison mode. Prevents null/undefined from being
    matched against e.g. 'u'.
  • Let null (as a top-level filter expression) match "deeply" (as do
    booleans, numbers and strings).
    E.g. let filterFilter(arr, null) match an item like {someProp: null}.

Closes #11432

1st and 3rd commits are refactorings (not important for the fix).
The 2nd commit contains the actual fix(es).
I kept them separate, for easier reviewing or eclectic merging.I can squash them if you think it is better.

@pkozlowski-opensource
Copy link
Member

@gkalpak it looks good to me after taking a quick look, but one of the commits upsets TravisCI (jsce). Could you please have a look?

@gkalpak gkalpak force-pushed the filterFilter-fix-matching-null-undefined branch from ed3b3f1 to ffd0643 Compare March 30, 2015 10:11
gkalpak added 2 commits March 30, 2015 13:32
Included fixes:

* Do not convert `null`/`undefined` to strings for substring matching in
  non-strict comparison mode. Prevents `null`/`undefined` from being
  matched against e.g. 'u'.
* Let `null` (as a top-level filter expression) match "deeply" (as do
  booleans, numbers and strings).
  E.g. let `filterFilter(arr, null)` match an item like `{someProp: null}`.

Closes angular#11432
@gkalpak gkalpak force-pushed the filterFilter-fix-matching-null-undefined branch from ffd0643 to a543eda Compare March 30, 2015 10:40
@gkalpak
Copy link
Member Author

gkalpak commented Mar 30, 2015

@pkozlowski-opensource: I fixed the error and tests are green now.
Shall I merge then (hopefully doing it the right way this time 😄) ?

@pkozlowski-opensource
Copy link
Member

@gkalpak yeh, LGTM

@Narretz
Copy link
Contributor

Narretz commented Mar 30, 2015

One question, are these regression fixes or is this something that never worked correctly before?

@gkalpak
Copy link
Member Author

gkalpak commented Mar 31, 2015

@Narretz, they are regression fixes:

Do not convert null/undefined to strings for substring matching in non-strict comparison mode.
Prevents null/undefined from being matched against e.g. 'u'.

Broken since v1.3.6 / v1.4.0-beta.1.

Let null (as a top-level filter expression) match "deeply" (as do booleans, numbers and strings).
E.g. let filterFilter(arr, null) match an item like {someProp: null}.

Broken since v1.3.15 / v1.4.0-beta.6.

@gkalpak gkalpak closed this in b5002ab Mar 31, 2015
@gkalpak
Copy link
Member Author

gkalpak commented Mar 31, 2015

@pkozlowski-opensource / @petebacondarwin, can you please take a look to make sure I got this right this time 😄

@pkozlowski-opensource
Copy link
Member

@gkalpak commits look fine and TravisCI is green so things look in order :-)

@gkalpak gkalpak deleted the filterFilter-fix-matching-null-undefined branch April 1, 2015 05:04
netman92 pushed a commit to netman92/angular.js that referenced this pull request Aug 8, 2015
Included fixes:

* Do not convert `null`/`undefined` to strings for substring matching in
  non-strict comparison mode. Prevents `null`/`undefined` from being
  matched against e.g. 'u'.
* Let `null` (as a top-level filter expression) match "deeply" (as do
  booleans, numbers and strings).
  E.g. let `filterFilter(arr, null)` match an item like `{someProp: null}`.

Closes angular#11432
Closes angular#11445
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

filter Filter will convert null and undefined to strings
4 participants