smarty-php / smarty-php/smarty
Smarty Debug triggers undefined array key warnings
Open
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 2.3k
- Forks
- 709
- PR merge metrics
- No merged PRs in 30d
Description
Smarty v5.5.2 triggers the following warnings:
vendor/smarty/smarty/src/Debug.php:107
Undefined array key "compile_time"
vendor/smarty/smarty/src/Debug.php:130
Undefined array key "render_time"
- https://github.com/smarty-php/smarty/blob/v5.5.2/src/Debug.php#L107
- https://github.com/smarty-php/smarty/blob/v5.5.2/src/Debug.php#L130
The fix is to predefine the keys in $template_data array, e.g.
if(!array_key_exists('render_time', $this->template_data[ $this->index ][ $key ])) {
$this->template_data[ $this->index ][ $key ][ 'render_time' ] = 0;
}
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
Start in src/Debug.php at lines 107 and 130, where the issue reports undefined array key warnings for compile_time and render_time. Reproduce the Smarty Debug behavior and inspect how template_data is populated. Done means those warnings no longer occur when the debug data lacks either key.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100