Problem/Motivation

Sometimes, i.e. when page contain views, query log file has zero size. I was debug and found that problem cause recursion in queries received from Database::getLog(). Function json_encode() which used for for serializing queries return empty and register error JSON_ERROR_RECURSION. Like us you know about this error because json_encode() shielded by @ now.

Proposed resolution

I propose patch wich add new function/wrapper devel_safe_json_encode($value, $options = 0, $depth = 512) which can be used instead json_encode(). Proposed function first try to call json_encode() and if it fails remove recursion and too deep childrens from array/object.
Maybe you can use $depth = 3 for decreasing query log file size too.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

shagren created an issue. See original summary.

shagren’s picture

Issue tags: -views recursion +views, +recursion
shagren’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, devel-empty_query_log_for_views_queries.patch, failed testing.

shagren’s picture

shagren’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 5: 2665944-devel-empty_query_log_for_views_queries.patch, failed testing.

shagren’s picture

Status: Needs work » Closed (fixed)
Related issues: +#2409715: Query log : arguments and explain do not work

Already fixed #2409715, in dev branch

salvis’s picture

Status: Closed (fixed) » Closed (outdated)

Thanks for your effort!