We have moved to Github. Please open tickets there.

Opened 22 months ago

Closed 20 months ago

Last modified 19 months ago

#3713 closed Defect (fixed)

elgg_get_entities() not bailing when a where helper function returns false

Reported by: brettp Owned by: brettp
Priority: normal Milestone: Elgg 1.8.1b
Component: Core Version: 1.7
Severity: minor Keywords:
Cc: brett@… Difficulty:

Description

The original plan for ege() and friends was to return false if invalid options were passed (eg, 'container_guid' => 'abc'). This would be detected by if any of the helper functions returned false instead of a where clause.

There wheres are run through array_unique() first to remove duplicates. array_unique() considers false and ' ' to be the same, so instead of bailing, ege() has been letting some of the invalid calls continue if an empty string happens to be before the false.

We can't not change it because it's inconsistent, so do we implement it how I originally planned and potentially break poorly written code, or do we have invalid options silently ignored? The difference is getting false vs getting all entities.

Change History (6)

comment:1 Changed 21 months ago by brettp

  • Milestone changed from Needs Review to Elgg 1.8.1b

This is something we should have decided for 1.8.0. I'm putting it at 1.8.1b1. Feedback encouraged.

comment:2 Changed 21 months ago by cash

I would check if there are any false values in the where array before doing the array_unique call and bail if so.

comment:3 Changed 21 months ago by brettp

I'm going to make this return false on bad where clauses.

comment:4 Changed 20 months ago by brettp

  • Owner set to brettp
  • Status changed from new to assigned

comment:5 Changed 20 months ago by Brett Profitt

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

Fixes #3713. elgg_get_entities() and friends return false if passed invalid options.

Changeset: 90f5e694f6e7005f35297f9493f5caeedcf25a8c

comment:6 Changed 19 months ago by Brett Profitt

Fixes #3713. elgg_get_entities() and friends return false if passed invalid options.

Changeset: 90f5e694f6e7005f35297f9493f5caeedcf25a8c

Note: See TracTickets for help on using tickets.