? ? PHP 8.x Pending

User tests: Successful: Unsuccessful:

avatar beat
beat
26 Mar 2022

Fixes Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in libraries/src/Mail/MailTemplate.php on line 297

Pull Request for Issue # none.

Summary of Changes

Obvious fix to avoid a default null (instead of empty string) passed to trim() which generates a deprecated warning in PHP 8.1.

Testing Instructions

Code review is enough imho.

To reproduce:

  • PHP 8.1 + debug ON + deprecated warnings on in php.ini
  • Make sure that you never edited the Joomla mail template
  • Make Joomla send an email in admin area (e.g. for new version available)
  • See deprecation warning displayed (or not anymore after fix)

Actual result BEFORE applying this Pull Request

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/beat/www/4.1/libraries/src/Mail/MailTemplate.php on line 297

# | Time | Memory | Function | Location
-- | -- | -- | -- | --
1 | 0.0058 | 364520 | {main}(  ) | .../index.php:0
2 | 0.0223 | 365880 | require_once( '/home/beat/www/4.1/administrator/includes/app.php ) | .../index.php:32
3 | 0.2463 | 1853712 | Joomla\CMS\Application\CMSApplication->execute(  ) | .../app.php:63
4 | 2.2751 | 6298176 | Joomla\CMS\Application\AdministratorApplication->render(  ) | .../CMSApplication.php:284
5 | 2.2752 | 6298216 | Joomla\CMS\Application\CMSApplication->render(  ) | .../AdministratorApplication.php:514
6 | 2.5000 | 8513024 | Joomla\CMS\Application\WebApplication->triggerEvent( $eventName = 'onAfterRender', $args = ??? ) | .../CMSApplication.php:1045
7 | 2.5000 | 8513120 | Joomla\Event\Dispatcher->dispatch( $name = 'onAfterRender', $event = class Joomla\Event\Event { protected $name = 'onAfterRender'; protected $arguments = []; protected $stopped = FALSE } ) | .../EventAware.php:111
8 | 2.5002 | 8513768 | Joomla\CMS\Plugin\CMSPlugin->Joomla\CMS\Plugin\{closure:/home/beat/www/4.1/libraries/src/Plugin/CMSPlugin.php:267-296}( $event = class Joomla\Event\Event { protected $name = 'onAfterRender'; protected $arguments = []; protected $stopped = FALSE } ) | .../Dispatcher.php:486
9 | 2.5002 | 8513768 | PlgSystemUpdatenotification->onAfterRender(  ) | .../CMSPlugin.php:285
10 | 3.0070 | 8978392 | Joomla\CMS\Mail\MailTemplate->send(  ) | .../updatenotification.php:271
11 | 3.0117 | 8993992 | trim( $string = NULL ) | .../MailTemplate.php:297

Expected result AFTER applying this Pull Request

No error.

Documentation Changes Required

None.

avatar beat beat - open - 26 Mar 2022
avatar beat beat - change - 26 Mar 2022
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 26 Mar 2022
Category Libraries
avatar alikon
alikon - comment - 27 Mar 2022

I have tested this item successfully on 5ffd955


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37384.

avatar alikon alikon - test_item - 27 Mar 2022 - Tested successfully
avatar laoneo
laoneo - comment - 27 Mar 2022

I have tested this item successfully on 5ffd955


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37384.

avatar laoneo laoneo - test_item - 27 Mar 2022 - Tested successfully
avatar Quy Quy - change - 27 Mar 2022
Status Pending Ready to Commit
Labels Added: ?
avatar Quy
Quy - comment - 27 Mar 2022

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37384.

avatar bembelimen bembelimen - change - 30 Mar 2022
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2022-03-30 20:23:10
Closed_By bembelimen
Labels Added: ? PHP 8.x
avatar bembelimen bembelimen - close - 30 Mar 2022
avatar bembelimen bembelimen - merge - 30 Mar 2022
avatar bembelimen
bembelimen - comment - 30 Mar 2022

Thx

Add a Comment

Login with GitHub to post a comment