Problem/Motivation

FAPI ajax callbacks can only be global functions because is_function() is used and these are called in a special way that will only work for global functions.

Proposed resolution

Use is_callable and call_user_func_array() to allow for namespaced callbacks.

Remaining tasks

RTBC

User interface changes

None

API changes

None

Data model changes

None

Comments

david_garcia created an issue. See original summary.

david_garcia’s picture

Status: Active » Needs review
StatusFileSize
new715 bytes
izaaksom’s picture

Status: Needs review » Reviewed & tested by the community

Straightforward fix. Thanks!

fabianx’s picture

Issue tags: +Modern PHP, +Pending Drupal 7 commit

Nice work, marking for commit.

fabianx’s picture

Proven this works for PHP 4.3 - 7:

https://3v4l.org/smvcH

stefan.r’s picture

Issue tags: +Needs change record
David_Rothstein’s picture

fabianx’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: -Pending Drupal 7 commit, -Needs change record
Parent issue: » #2652814: Allow the use of callbacks for element value callbacks and batch API redirect callbacks

is_callable is fine, but call_user_func_array() needs to be removed per #2652814: Allow the use of callbacks for element value callbacks and batch API redirect callbacks.

pashupathi nath gajawada’s picture

Status: Needs work » Needs review
StatusFileSize
new561 bytes

Hi Fabian Franz,

Updated the patch as suggested in #8.

Thanks,

fabianx’s picture

Status: Needs review » Reviewed & tested by the community

To RTBC, thanks for the patch

fabianx’s picture

Issue tags: +Pending Drupal 7 commit

Leaving for a moment for others to review, then will commit later, so marking for most-likely commit.

  • Fabianx committed c759414 on 7.x
    Issue #2747679 by david_garcia, pashupathi nath gajawada, izaaksom: Ajax...
fabianx’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: -Pending Drupal 7 commit +7.50 release notes

Committed and pushed to 7.x! Thanks!

David_Rothstein’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.