We have moved to Github. Please open tickets there.

#4084 closed Defect (fixed)

Update elgg_query_runner() to support closures

Reported by: janlb Owned by: janlb
Priority: normal Milestone: Elgg 1.9.0
Component: Core Version: Github Master
Severity: minor Keywords:
Cc: brett@… Difficulty:

Description (last modified by ewinslow)

While closures generally work throughout Elgg, there are some cases where their usage could cause potential problems.

Some elgg functions take a callback parameter, but they expect this parameter to be of type string.

Functions such as get_data will work if a closure is passed instead of a string, however it will also raise a PHP Notice when attempting to cast the closure to a string (and in turn generate an inaccurate "cache key")

Change History (5)

comment:1 Changed 18 months ago by cash

  • Summary changed from More thorough PHP closure support to Update elgg_query_runner() to support closures

I'm going to change this ticket to focus on elgg_query_runner(). If there are other areas of Elgg that need to be updated for anonymous functions, please open additional tickets.

As for elgg_query_runner(), if we cannot create some sort of signature from the anonymous function, we'll have to rewrite the caching code to operate before the callback is applied.

comment:2 Changed 15 months ago by janlb

  • Owner set to janlb

Opened up a pull request https://github.com/Elgg/Elgg/pull/175

comment:3 Changed 15 months ago by janlb

  • Version changed from 1.8 to Github Master

comment:4 Changed 13 months ago by ewinslow

  • Description modified (diff)
  • Milestone changed from Needs Review to Elgg 1.9.0

comment:5 Changed 11 months ago by Cash Costello

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

Fixes #4084 support anonymous functions for db callbacks - from Janek Lasocki-Biczysko

Changeset: 2584535842eeafd8afc1b8ad40e2239fb62d015b

Note: See TracTickets for help on using tickets.