Problem/Motivation

#3143096: [DX]: throw an exception if #lazy_builder callback does not return a (renderable) array introduced some nice, debuggable error handling when lazy builder callbacks fail to return renderable arrays. However, it doesn't cover all cases -- lazy builders can be instance methods of objects (e.g., [$this, 'lazyBuilder']), and the code will choke on that and produce a fatal error, rather than the helpful exception we'd like it to.

Steps to reproduce

Not really needed; these are API-level edge(-ish) cases.

Proposed resolution

Renderer::renderRoot() should handle object callables when building the exception.

Remaining tasks

Write a failing test, then fix the problem.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

None needed.

Issue fork drupal-3212049

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

phenaproxima created an issue. See original summary.

phenaproxima’s picture

Issue summary: View changes

phenaproxima’s picture

Status: Active » Needs review
alexpott’s picture

Status: Needs review » Closed (duplicate)

I've reviewed this code and it's made me realise the @phenaproxima was correct I should revert #3143096: [DX]: throw an exception if #lazy_builder callback does not return a (renderable) array - I think we should use an assert and move the callable to string stuff to \Drupal\Component\Utility\Variable.