stakx-io / stakx

An opinionated, powerful, and simple static website generator built in PHP
https://stakx.io/
MIT License
14 stars 3 forks source link

dump() crashes on possible recursion problem #84

Closed allejo closed 5 years ago

allejo commented 5 years ago
{% set functions = collections.bzfs_api_functions | group('category') %}

{{ dump(functions) }}

Given a collection of content items and using the group filter, stakx crashes for a reason that requires further investigation.

allejo commented 5 years ago

This was happening because Content Items have a reference to the parent Dynamic PageView that it belongs to. The Dynamic PageViews had a reference to all its children and this lead to recursion for dump().

Implementing the __debugInfo() magic method allows us to output far more useful information and it'll avoid the recursion. Now, jailed documents will output the result of jailed functions and Front Matter which is all that's accessible through Twig anyways.