pluginsGLPI / formcreator

GLPI Plugin Formcreator (DOWNLOAD : https://github.com/pluginsGLPI/formcreator/releases)
http://www.teclib-edition.com
GNU General Public License v3.0
171 stars 125 forks source link

PHP Deprecated function (8192): Implicit conversion from float to int loses precision #3435

Open ftoledo opened 7 months ago

ftoledo commented 7 months ago

Upgrade to glpi 10.0.11 PHP 8.1.18 Debian 10 Public Form with captcha enabled

(debug mode enabled)

[2023-12-18 20:45:06] glpiphplog.NOTICE:   *** PHP Deprecated function (8192): Implicit conversion from float 29.5 to int loses precision in /marketplace/formcreator/vendor/gregwar/captcha/src/Gregwar/Captcha/CaptchaBuilder.php at line 365
  Backtrace :
  ...tcha/src/Gregwar/Captcha/CaptchaBuilder.php:365 imagettftext()
  ...tcha/src/Gregwar/Captcha/CaptchaBuilder.php:459 Gregwar\Captcha\CaptchaBuilder->writePhrase()
  marketplace/formcreator/inc/common.class.php:502   Gregwar\Captcha\CaptchaBuilder->build()
  :                                                  PluginFormcreatorCommon::getCaptcha()
  src/Application/View/Extension/PhpExtension.php:91 call_user_func_array()
  ...tes/84/84a4718c7f94c147c5abd8ee1a423ea3.php:260 Glpi\Application\View\Extension\PhpExtension->call()
  vendor/twig/twig/src/Template.php:394              __TwigTemplate_4c76a3cf14df188186fd917be20fac59->doDisplay()
  vendor/twig/twig/src/Template.php:367              Twig\Template->displayWithErrorHandling()
  vendor/twig/twig/src/TemplateWrapper.php:47        Twig\Template->display()
  src/Application/View/TemplateRenderer.php:184      Twig\TemplateWrapper->display()
  marketplace/formcreator/inc/form.class.php:1071    Glpi\Application\View\TemplateRenderer->display()
  marketplace/formcreator/front/formdisplay.php:81   PluginFormcreatorForm->displayUserForm()
  public/index.php:82                                require()
ftoledo commented 7 months ago

screenshot

imagen

btry commented 6 months ago

Hi

Prepare a testing instance of GLPI where you can reproduce.

apply this patch to Formcreator

diff --git a/composer.json b/composer.json
index c9d875f6d..6578ecfb9 100644
--- a/composer.json
+++ b/composer.json
@@ -18,7 +18,7 @@
   "require": {
       "php": ">= 7.2",
       "ext-xml": "*",
-      "gregwar/captcha": "^1.1",
+      "gregwar/captcha": "^1",
       "xylemical/php-expressions": "^1.0.3",
       "laminas/laminas-eventmanager": "^3.2"
     },

next, locate in formcreator's directory, then run composer update (assuming you have composer installed, if not, go to https://getcomposer.org)

Finally, try to reproduce again and see if the warning disappeared.

ftoledo commented 6 months ago

i will check asap