smarty-php / smarty-php/smarty
Deprecated warning for implode
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 2.3k
- Forks
- 709
- PR merge metrics
- No merged PRs in 30d
Description
Using implode in Smarty templates throws a deprecation warning, even when used with the correct argument order.
For example: {implode(',', $array)}
Despite being valid syntax, this still triggers a warning. Replacing implode() with join() and reversed argument order resolves the issue, but this requires changes to existing templates, which may not be ideal.
I believe, the deprecation warning should only be triggered if the arguments are provided in the incorrect order. If the syntax is correct, no warning should be raised.
I suggest trigger_errow should only be called if incorrect order of arguments is provided.
https://github.com/smarty-php/smarty/blob/5d1ea5806a10071fdb6af0fa945c8e3f58e033c4/src/Extension/DefaultExtension.php#L562
Or would like clarification: Is implode officially deprecated in Smarty in favour of join (which actually an alias in php), or is this an unintended side effect? Is so, then overriding the default extensions could be a viable workaround: https://github.com/smarty-php/smarty/issues/1048
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Inspect src/Extension/DefaultExtension.php around line 562 and reproduce the warning with implode(',', $array) in a Smarty template. Determine whether the warning is intended for all implode calls or only the incorrect argument order. Done means the documented argument order no longer warns while the incorrect order still does, with the project’s relevant behavior covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 57/100