-
Notifications
You must be signed in to change notification settings - Fork 714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using closures as registered plugins #273
Comments
Additionally, the calling syntax for closures is valid for the other types as well, so the branching structure might be removed altogether. |
You can use this patch as temporary workaround. Not perfect, but doing the job. Note: Works unmodified only with 3.1.30, since some code has been changed around. Smarty-v3.1.30.registerPlugin.closure.txt
Edit: Did not see your own solution in your first post. Sorry, seems to be equal. |
The fix is now in the master branch and will later be included in 3.1.32 |
Currently,
Smarty::registerPlguin
allows you to supply a Closure (since it is a callable) but when using it in a template it does not compile, resulting in the errorObject of class Closure could not be converted to string
.This is because (for functions, other types of plugins behave similarly), it hits the following code segment:
The first case gets executed, since a Closure is not an array. This could be solved by adding the following case:
Could this be supported? I could probably write a patch works for it. This is backwards compatible to at least PHP 5.2, as the class does not have to be loaded (or even exist) for the operator to work.
The text was updated successfully, but these errors were encountered: