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

get_metastring_id() fails if a metastring 0 is cached (Trac #1227) #1227

Closed
elgg-gitbot opened this issue Feb 16, 2013 · 2 comments
Closed

get_metastring_id() fails if a metastring 0 is cached (Trac #1227) #1227

elgg-gitbot opened this issue Feb 16, 2013 · 2 comments
Labels
Milestone

Comments

@elgg-gitbot
Copy link

@elgg-gitbot elgg-gitbot commented Feb 16, 2013

Original ticket http://trac.elgg.org/ticket/1227 on 39685194-12-25 by cash, assigned to unknown.

Elgg version: 1.6

This is probably my most favorite bug that I've come across.

array_search($string, $METASTRINGS_CACHE); will return the index to an element in $METASTRINGS_CACHE that is zero (the number) for any $string. This causes some really interesting behavior that is difficult to debug. This happens, of course, because "string" == 0 returns true but you generally are not thinking about that when you use array_search(). The solution is to set strict to true so that the comparison is done with ===.

@elgg-gitbot
Copy link
Author

@elgg-gitbot elgg-gitbot commented Feb 16, 2013

cash wrote on 39733742-05-21

I'm upgrading the priority on this one because it can have such nasty consequences that are hard to track down.

@elgg-gitbot
Copy link
Author

@elgg-gitbot elgg-gitbot commented Feb 16, 2013

cash wrote on 39853944-06-16

(In [svn:3630]) fixes #1227 - this one has been causing nasty problems for far too long

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.