Skip to content

fix(template): register sprintf as a Smarty modifier - #264

Merged
mambax7 merged 1 commit into
XOOPS:masterfrom
mambax7:fix/template-sprintf-modifier
Oct 9, 2026
Merged

mambax7 merged 1 commit into
XOOPS:masterfrom
mambax7:fix/template-sprintf-modifier

Conversation

@mambax7

@mambax7 mambax7 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Smarty 4 deprecates PHP functions used as modifiers unless they are registered. XoopsTpl already registers strstr, trim and file_exists; add sprintf so module templates using |sprintf render without a deprecation notice.

Summary by Sourcery

Register sprintf as a Smarty modifier for compatibility with Smarty 4 template rendering.

Bug Fixes:

  • Register the sprintf PHP function as a Smarty modifier to prevent deprecation notices when rendering module templates with |sprintf.

Documentation:

  • Add the change to the project changelog.

Smarty 4 deprecates PHP functions used as modifiers unless they are
registered. XoopsTpl already registers strstr, trim and file_exists;
add sprintf so module templates using |sprintf render without a
deprecation notice.
Copilot AI balanced review requested due to automatic review settings October 9, 2026 05:29
@sourcery-ai

sourcery-ai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Registers sprintf as an explicit Smarty modifier in XoopsTpl, preventing Smarty 4 deprecation notices for templates that use the |sprintf filter, with a corresponding changelog entry.

Sequence diagram for registered sprintf template modifier

sequenceDiagram
    participant Template as XoopsTpl
    participant Smarty
    participant TemplateFile
    Template->>Smarty: registerPlugin(modifier, sprintf, sprintf)
    TemplateFile->>Smarty: render template with |sprintf
    Smarty->>Smarty: sprintf()
    Smarty-->>TemplateFile: rendered output without deprecation notice
Loading

File-Level Changes

Change Details Files
Register the native sprintf function as a Smarty modifier to maintain compatibility with Smarty 4 template validation.
  • Add sprintf to XoopsTpl's constructor alongside existing registered PHP modifiers.
  • Document the fix in the changelog.
htdocs/class/template.php
docs/changelog.270.txt

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Oct 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository: XOOPS/XoopsCore27/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: 5ea8010e-0ce9-45ab-bbe2-4e646925ba00

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@gitar-bot

gitar-bot Bot commented Oct 9, 2026

Copy link
Copy Markdown

Important

You are using the Gitar free plan. Upgrade to unlock code review, CI analysis, auto-apply, custom automations, and more.

Gitar

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The registration is valid, narrowly scoped, and documented correctly.

0 open findings

What changed in this PR

Registers sprintf as a Smarty modifier to prevent Smarty 4 deprecation notices.

Changes:

  • Registers the native sprintf modifier in XoopsTpl.
  • Documents the compatibility fix.
File Description
htdocs/​class/​template.php Registers the sprintf modifier.
docs/​changelog.270.txt Records the template compatibility fix.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov

codecov Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 22.54%. Comparing base (64e098e) to head (d8d932c).
⚠️ Report is 13 commits behind head on master.

Files with missing lines Patch % Lines
htdocs/class/template.php 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #264      +/-   ##
============================================
- Coverage     22.54%   22.54%   -0.01%     
  Complexity     8666     8666              
============================================
  Files           685      685              
  Lines         46315    46316       +1     
============================================
  Hits          10444    10444              
- Misses        35871    35872       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mambax7
mambax7 merged commit 883e919 into XOOPS:master Oct 9, 2026
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants