We have moved to Github. Please open tickets there.

Opened 4 years ago

Closed 4 years ago

#1227 closed Defect (fixed)

get_metastring_id() fails if a metastring 0 is cached

Reported by: cash Owned by:
Priority: critical Milestone: Elgg 1.7
Component: Core Version: 1.6
Severity: critical Keywords:
Cc: marcus, brettp, Difficulty:

Description

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 ===.

Change History (2)

comment:1 Changed 4 years ago by cash

  • Priority changed from major to critical

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

comment:2 Changed 4 years ago by cash

  • Resolution set to fixed
  • Status changed from new to closed

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

Note: See TracTickets for help on using tickets.