smarty-php / smarty-php/smarty

Smarty Debug triggers undefined array key warnings

Open
#1,139 0 comments 1 reaction 0 assignees View on GitHub

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"

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.