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.
Comment | File | Size | Author |
---|---|---|---|
#5 | 2665944-devel-empty_query_log_for_views_queries.patch | 2.99 KB | shagren |
| |||
devel-empty_query_log_for_views_queries.patch | 2.89 KB | shagren | |
|
Comments
Comment #2
shagren CreditAttribution: shagren commentedComment #3
shagren CreditAttribution: shagren commentedComment #5
shagren CreditAttribution: shagren commentedComment #6
shagren CreditAttribution: shagren commentedComment #8
shagren CreditAttribution: shagren commentedAlready fixed #2409715, in dev branch
Comment #9
salvisThanks for your effort!