Missing .to_s
when rendering a node (dropped possibily by accident) #1893
Description
Hey y'all,
I'm upgrading from Liquid v4 to v5 and encountered a subtle yet impactful breaking change that caused us a significant number of test failures. It seems that during a refactor, the call to .to_s
for a node output was unintentionally (?) dropped.
If we travel back in time and look at black_body.rb from commit c2ef24, we can appreciate how it'd still explicitly call .to_s
on the output of node#render
unless the result was an array.
However, while refactoring to improve rendering back in #1091 the new render_to_output_buffer
dropped this, maybe by accident (?). Instead, it started "appending" the result of render
directly to the output buffer without stringifying it.
This causes this funny case where if your output returns a number, the <<
operation ends up adding a byte instead of the stringified value.
i.e.: