[Galette-discussion] Events plugin

[ Thread Index | Date Index | More lists.galette.eu/users Archives ]


Hi

I think I have found a bug in the Events plugin.

Test Environment :
Galette core v0.9.6.1
Galette-events V1.5.0
PHP 8.1
OS : Ubuntu Linux 20.04.4
Kernel : 5.15.0-58-generic on x86_64

When attempting to add a reservation for an event, the page displays "Erreur de l’application".

In the error log I get this :

Galette error:\nType: ErrorException\nMessage: DateTime::__construct(): Passing null to parameter #1 ($datetime) of type string is deprecated\nFile: /var/www/html/galette/plugins/galette-plugin-events-1.5.0/lib/GaletteEvents/Booking.php\nLine: 636\nTrace: #0 [internal function]: {closure}()\n#1 /var/www/html/galette/plugins/galette-plugin-events-1.5.0/lib/GaletteEvents/Booking.php(636): DateTime->__construct()\n#2 /var/www/html/galette/data/templates_c/49a528800285ad55ec259b18973b5b2367c5c25c_0.file.booking.tpl.php(69): GaletteEvents\\Booking->getDate()\n#3 /var/www/html/galette/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php(248): Block_161316356163e4c6b401cb21_94665065->callBlock()\n#4 /var/www/html/galette/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php(184): Smarty_Internal_Runtime_Inheritance->callBlock()\n#5 /var/www/html/galette/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php(186): Smarty_Internal_Runtime_Inheritance->process()\n#6 /var/www/html/galette/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php(156): Smarty_Internal_Runtime_Inheritance->process()\n#7 /var/www/html/galette/data/templates_c/e2704d303129881d1dd29c509fdbf703eb43e6d8_0.file.page.tpl.php(342): Smarty_Internal_Runtime_Inheritance->instanceBlock()\n#8 /var/www/html/galette/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_639332a5628a54_29940910()\n#9 /var/www/html/galette/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode()\n#10 /var/www/html/galette/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(216): Smarty_Template_Compiled->render()\n#11 /var/www/html/galette/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(385): Smarty_Internal_Template->render()\n#12 /var/www/html/galette/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php(116): Smarty_Internal_Template->_subTemplateRender()\n#13 /var/www/html/galette/data/templates_c/49a528800285ad55ec259b18973b5b2367c5c25c_0.file.booking.tpl.php(41): Smarty_Internal_Runtime_Inheritance->endChild()\n#14 /var/www/html/galette/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_63e4c6b4039259_09254577()\n#15 /var/www/html/galette/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode()\n#16 /var/www/html/galette/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(216): Smarty_Template_Compiled->render()\n#17 /var/www/html/galette/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(232): Smarty_Internal_Template->render()\n#18 /var/www/html/galette/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(116): Smarty_Internal_TemplateBase->_execute()\n#19 /var/www/html/galette/vendor/mathmarques/smarty-view/src/Smarty.php(113): Smarty_Internal_TemplateBase->fetch()\n#20 /var/www/html/galette/vendor/mathmarques/smarty-view/src/Smarty.php(126): Slim\\Views\\Smarty->fetch()\n#21 /var/www/html/galette/plugins/galette-plugin-events-1.5.0/lib/GaletteEvents/Controllers/Crud/BookingsController.php(462): Slim\\Views\\Smarty->render()\n#22 /var/www/html/galette/plugins/galette-plugin-events-1.5.0/lib/GaletteEvents/Controllers/Crud/BookingsController.php(85): GaletteEvents\\Controllers\\Crud\\BookingsController->edit()\n#23 [internal function]: GaletteEvents\\Controllers\\Crud\\BookingsController->add()\n#24 /var/www/html/galette/vendor/php-di/invoker/src/Invoker.php(74): call_user_func_array()\n#25 /var/www/html/galette/vendor/php-di/slim-bridge/src/ControllerInvoker.php(50): Invoker\\Invoker->call()\n#26 /var/www/html/galette/vendor/slim/slim/Slim/Route.php(281): DI\\Bridge\\Slim\\ControllerInvoker->__invoke()\n#27 /var/www/html/galette/lib/Galette/Middleware/Authenticate.php(173): Slim\\Route->__invoke()\n#28 [internal function]: Galette\\Middleware\\Authenticate->__invoke()\n#29 /var/www/html/galette/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array()\n#30 [internal function]: Slim\\DeferredCallable->__invoke()\n#31 /var/www/html/galette/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func()\n#32 /var/www/html/galette/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\\Route->Slim\\{closure}()\n#33 /var/www/html/galette/vendor/slim/slim/Slim/Route.php(268): Slim\\Route->callMiddlewareStack()\n#34 /var/www/html/galette/vendor/slim/slim/Slim/App.php(503): Slim\\Route->run()\n#35 /var/www/html/galette/vendor/akrabat/rka-slim-session-middleware/RKA/SessionMiddleware.php(47): Slim\\App->__invoke()\n#36 [internal function]: RKA\\SessionMiddleware->__invoke()\n#37 /var/www/html/galette/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array()\n#38 [internal function]: Slim\\DeferredCallable->__invoke()\n#39 /var/www/html/galette/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func()\n#40 /var/www/html/galette/lib/Galette/Middleware/SmartyCsrf.php(94): Slim\\App->Slim\\{closure}()\n#41 [internal function]: Galette\\Middleware\\SmartyCsrf->__invoke()\n#42 /var/www/html/galette/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array()\n#43 [internal function]: Slim\\DeferredCallable->__invoke()\n#44 /var/www/html/galette/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func()\n#45 /var/www/html/galette/vendor/slim/csrf/src/Guard.php(171): Slim\\App->Slim\\{closure}()\n#46 [internal function]: Slim\\Csrf\\Guard->__invoke()\n#47 /var/www/html/galette/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array()\n#48 [internal function]: Slim\\DeferredCallable->__invoke()\n#49 /var/www/html/galette/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func()\n#50 /var/www/html/galette/lib/Galette/Middleware/TrailingSlash.php(81): Slim\\App->Slim\\{closure}()\n#51 [internal function]: Galette\\Middleware\\TrailingSlash->__invoke()\n#52 /var/www/html/galette/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array()\n#53 [internal function]: Slim\\DeferredCallable->__invoke()\n#54 /var/www/html/galette/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func()\n#55 /var/www/html/galette/lib/Galette/Middleware/Language.php(104): Slim\\App->Slim\\{closure}()\n#56 [internal function]: Galette\\Middleware\\Language->__invoke()\n#57 /var/www/html/galette/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array()\n#58 [internal function]: Slim\\DeferredCallable->__invoke()\n#59 /var/www/html/galette/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func()\n#60 /var/www/html/galette/lib/Galette/Middleware/Telemetry.php(146): Slim\\App->Slim\\{closure}()\n#61 [internal function]: Galette\\Middleware\\Telemetry->__invoke()\n#62 /var/www/html/galette/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array()\n#63 [internal function]: Slim\\DeferredCallable->__invoke()\n#64 /var/www/html/galette/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func()\n#65 /var/www/html/galette/lib/Galette/Middleware/CheckAcls.php(144): Slim\\App->Slim\\{closure}()\n#66 [internal function]: Galette\\Middleware\\CheckAcls->__invoke()\n#67 /var/www/html/galette/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array()\n#68 [internal function]: Slim\\DeferredCallable->__invoke()\n#69 /var/www/html/galette/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func()\n#70 /var/www/html/galette/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\\App->Slim\\{closure}()\n#71 /var/www/html/galette/vendor/slim/slim/Slim/App.php(392): Slim\\App->callMiddlewareStack()\n#72 /var/www/html/galette/vendor/slim/slim/Slim/App.php(297): Slim\\App->process()\n#73 /var/www/html/galette/includes/main.inc.php(159): Slim\\App->run()\n#74 /var/www/html/galette/webroot/index.php(57): require_once('...')\n#75 {main}, referer: https://galette.dnsalias.org/plugins


This presumably has to do with PHP 8 compatibility. I am also getting error log messages for one other script :

Galette error:\nType: ErrorException\nMessage: round(): Passing null to parameter #1 ($num) of type int|float is deprecated\nFile: /var/www/html/galette/lib/Galette/Repository/Contributions.php\nLine: 277\nTrace.......


When I add the null coalescing operator in line 636 of script "Booking.php" .....

changing line 636
from
$date = new \DateTime($this->date);
to
$date = new \DateTime($this->date ?? "");

.....the "add reservation" operation functions correctly again.

In the current version in production on our site (Galette 0.9.3.1 and Events 1.2.0) we do not encounter this error. (production is running on a VPS where PHP 8.1 is available, but older 7 versions also)

Are you able to address this problem in a mini version update of the plugin ? 

--

Cordialement

Jim Cluchey




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/