Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Fixed unsetting from loosely equal keys OrderedHashMap#24566
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
maryo commentedOct 15, 2017
| Q | A |
|---|---|
| Branch? | 2.7 |
| Bug fix? | yes |
| New feature? | no |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | #24558 |
| License | MIT |
fabpot commentedOct 16, 2017
Thank you@maryo. |
…ryo)This PR was merged into the 2.7 branch.Discussion----------Fixed unsetting from loosely equal keys OrderedHashMap| Q | A| ------------- | ---| Branch? | 2.7| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#24558| License | MITCommits-------ba37cba Fixed unsetting from loosely equal keys OrderedHashMap
| publicfunctionoffsetUnset($key) | ||
| { | ||
| if (false !== ($position =array_search($key,$this->orderedKeys))) { | ||
| if (false !== ($position =array_search((string)$key,$this->orderedKeys))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Wouldn't it have been enough to passtrue as the third argument here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@xabbuhhttps://3v4l.org/vBboa
When unsetting a numeric string offset likeunset($map['1']),$key equals to integer1. So it's needed to treat these numeric strings the same way as integers. Hence the cast. And since$this->orderedKeys are all strings (the new cast inoffsetSet), passingtrue would result in the same.