soflyy / oxygen-bugs-and-features

Bug Reports & Feature Requests for Oxygen
https://oxygenbuilder.com/
315 stars 29 forks source link

Naming a variable "options" in a code block breaks Oxygen. #3500

Closed shoelaced closed 8 months ago

shoelaced commented 8 months ago

Describe the bug A clear and concise description of what the bug is.

This is a very bizarre issue but using $options in a code block either causes a fatal error or removes the closing </div> of the code block and messes up the layout. Meanwhile, any other variable name does not cause this issue.

A link to a Sandbox site where the bug has been reproduced https://oxygenbuilder.com/try? (REQUIRED) Provide the link to a Sandbox install where the issue is present. If the issue only exists on a specific post or template, provide a direct link to that post or template.

Sandbox link below. View the code block at the top of the MAIN template. https://oxygen-qtdk2zlnrfaxl.oxygen-demo.qsandbox.org/product-tour/

IF YOU CAN'T PROVIDE A SANDBOX REPRODUCTION: Steps required to reproduce the bug: Steps to reproduce the behavior:

  1. Put $options = ''; in any code block.
  2. Observe the frontend.
Spellhammer commented 8 months ago

This is helpful to have documented for other users, but it's not a bug in Oxygen.

The problem here is that the code gets eval'd within the Code Block class where we are expecting the $options variable to be something else.

I would recommend using very unique variable names within Code Blocks since they can't be narrowly scoped (like within a class, etc...)