smarty-php / smarty-php/smarty

Deprecation warning in demo app, Smarty 5.8.4, PHP 8.4

Open
#1,208 1 comment 0 reactions 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

Testing with the demo page (/demo/index.php) that's included in the download. I made a slight change to it to manually include Smarty:

require_once(str_replace("\\","/",dirname(__FILE__)).'/../../basic-includes.php');

$smarty = new \Smarty\Smarty();

Here's the content of basic-includes.php:

define('SMARTY_DIR',str_replace("\\","/",dirname(__FILE__)).'/Smarty-5.8.4/libs/');

require_once(SMARTY_DIR . 'Smarty.class.php');

Here's the section of the resulting page (viewing the HTML) that contains errors:

<html>
<body>
<!--StartFragment-->
1 * John Doe
--
<br />
<b>Deprecated</b>:  Implicit conversion from float 0.5 to int loses precision in <b>[webrootdir]\includes\Smarty-5.8.4\demo\templates_c\38607186f9af3abe30d7327c890dad1b0743261a_0.file_index.tpl.cache.php</b> on line <b>68</b><br />
2 * Mary Smith
3 . James Johnson
<br />
<b>Deprecated</b>:  Implicit conversion from float 1.5 to int loses precision in <b>[webrootdir]\includes\Smarty-5.8.4\demo\templates_c\38607186f9af3abe30d7327c890dad1b0743261a_0.file_index.tpl.cache.php</b> on line <b>68</b><br />
4 . Henry Case
 

<br class="Apple-interchange-newline"><!--EndFragment-->
</body>
</html>

Note: not sure if this is due to the presence of the error, or if it's due to the conversion error itself, but in the resulting HTML, numbers 1 and 3 are more indented than numbers 2 and 4.

ETA: it's on a Windows 11 machine, IIS and FastCGI. Smarty 5.8.4, PHP 8.4

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

Reproduce the warning from demo/index.php using the shown basic-includes.php setup with Smarty 5.8.4 on PHP 8.4, then inspect the generated demo/templates_c/38607186f9af3abe30d7327c890dad1b0743261a_0.file_index.tpl.cache.php around line 68. Done means the demo no longer emits the deprecation warning and its rendered list has consistent output.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.