Skip to content
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

"Too many shorthand attributes" error message after migrated to smarty 5 #949

Closed
rodriguezny opened this issue Mar 13, 2024 · 4 comments · Fixed by #953
Closed

"Too many shorthand attributes" error message after migrated to smarty 5 #949

rodriguezny opened this issue Mar 13, 2024 · 4 comments · Fixed by #953
Milestone

Comments

@rodriguezny
Copy link

After migrated our project(Tiki Wiki CMS Groupware => https://tiki.org/HomePage to smarty 5, I have the following error thrown in the template https://gitlab.com/tikiwiki/tiki/-/blob/master/templates/examples/search/related_tracker_items.tpl on line 5.

Error: Syntax error in template "file:examples/search/related_tracker_items.tpl" on line 5 "{if preg_match_all('/(.+?)\:([^\v]+)$/mis', $relationValue, $matches, 2)}" too many shorthand attributes

Any idea of the mistake in my code ?
I explored some issues reported in previous years about the same error message "too many shorthand attribute" but none of them helped me, they are not similar to mine expect that they are both related to the use of the {if}{/if} block.

Below is the entire content of my template
image

@rodriguezny rodriguezny changed the title Too many shorthand attributes after migrated to smarty 5 "Too many shorthand attributes" error message after migrated to smarty 5 Mar 13, 2024
@wisskid
Copy link
Contributor

wisskid commented Mar 14, 2024

The problem is caused by this call having 4 parameters... Somewhere while refactoring, I set protected $shorttag_order = ['var1', 'var2', 'var3']; to temporarily fix a bunch of problems, but I forgot to fix this properly. This went undetected as all unit tests use less than 4 parameters for function calls. This definitely needs a fix.

Also, Smarty5 does not seem to support passing parameters by reference anymore, as this code fragment does (the $matches parameter).

@wisskid wisskid added this to the 5.0 milestone Mar 14, 2024
wisskid added a commit that referenced this issue Mar 15, 2024
…nction with more than 3 parameters in an expression

Fixes #949
@wisskid
Copy link
Contributor

wisskid commented Mar 15, 2024

@rodriguezny #953 should have fixed the 'too many shorthand attributes' error. Can you verify against smarty dev-master?

@rodriguezny
Copy link
Author

Ok, let me verify against smarty dev-master. Thanks!

@rodriguezny
Copy link
Author

Thanks @wisskid for the fix, I installed smarty dev-master, it works fine, the issue no longer exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants