You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This behavior can cause fatal errors on site front-ends.
Expected behavior
It would be useful if the PHP Validator's check for duplicate identifiers would keep an index of other defined functions in other snippets, and if someone attempts to redeclare an existing function name, prompt the user to change it.
Alternately, if the function names declared in each snippet could be stored in meta for the snippet, with function_exists() checks for each before it is eval'd, to avoid fataling a site?
Steps to reproduce
To reproduce, activate these two (simple) test snippets and view the front-end of the site.
Current behavior
This behavior can cause fatal errors on site front-ends.
Expected behavior
It would be useful if the PHP Validator's check for duplicate identifiers would keep an index of other defined functions in other snippets, and if someone attempts to redeclare an existing function name, prompt the user to change it.
code-snippets/src/php/class-validator.php
Lines 95 to 129 in 04baf35
Alternately, if the function names declared in each snippet could be stored in meta for the snippet, with
function_exists()
checks for each before it is eval'd, to avoid fataling a site?Steps to reproduce
To reproduce, activate these two (simple) test snippets and view the front-end of the site.
test-fn-1.code-snippets.json
test-fn-2.code-snippets.json
WordPress version
6.7.2
Code Snippets version
3.6.8
Code Snippets license
Core (free)
Anything else?
No response
The text was updated successfully, but these errors were encountered: