Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
253544f
PHP 8.1 deprecation notices libraries/src
frostmakk Dec 19, 2021
821fd80
Update ComponentlayoutField.php
frostmakk Dec 19, 2021
ef22f70
coding standard
frostmakk Dec 19, 2021
675417f
Adding ../Table/Module.php
frostmakk Dec 20, 2021
b5d53be
Adding 6 more.
frostmakk Dec 20, 2021
60032fc
Update PunycodeHelper.php
frostmakk Dec 22, 2021
d9d6793
Empty line
frostmakk Dec 22, 2021
264f3a6
Merge branch 'joomla:4.0-dev' into php81-lib
frostmakk Dec 22, 2021
91ca188
Update libraries/src/String/PunycodeHelper.php
frostmakk Dec 22, 2021
2ee79a5
Update libraries/src/Filter/OutputFilter.php
frostmakk Dec 22, 2021
5781220
Update libraries/src/Filesystem/Path.php
frostmakk Dec 22, 2021
bc34ce7
Update libraries/src/Date/Date.php
frostmakk Dec 23, 2021
e7db474
Requested changes
frostmakk Dec 23, 2021
d171d08
Merge branch 'php81-lib' of https://github.com/frostmakk/joomla-cms i…
frostmakk Dec 23, 2021
15a6683
Moved comment
frostmakk Dec 23, 2021
311e83a
Cleanup
wilsonge Jan 8, 2022
5bc13a1
Merge branch '4.0-dev' into php81-lib
zero-24 Jan 8, 2022
0379f58
Review updates
frostmakk Jan 8, 2022
556652e
Merge branch '4.0-dev' into php81-lib
zero-24 Jan 8, 2022
9c8c0fb
Merge branch 'joomla:4.0-dev' into php81-lib
frostmakk Jan 8, 2022
e833f4f
CleanUp some merged parts
frostmakk Jan 9, 2022
3f727c6
More cleanup
frostmakk Jan 9, 2022
199e362
Merge branch 'joomla:4.0-dev' into php81-lib
frostmakk Jan 9, 2022
afa1754
Merge branch 'joomla:4.0-dev' into php81-lib
frostmakk Jan 11, 2022
77d1cd1
Revert Path.php
frostmakk Jan 14, 2022
4eae9a8
Revert Date.php
frostmakk Jan 14, 2022
f15ac88
Merge branch '4.1-dev' into php81-lib
Jan 27, 2022
412fb02
Merge branch '4.1-dev' into php81-lib
Mar 3, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libraries/src/Language/Language.php
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,7 @@ public function getUsed()
*/
public function hasKey($string)
{
$key = strtoupper($string);
$key = strtoupper($string ?? '');
Copy link
Contributor

Choose a reason for hiding this comment

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

This is probably a bad fix - there shouldn't ever be null being passed to this function - if there is - then we should fix it to not be called first

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This notice pop up in several places.
Here is a Stack trace from creating a new Random Image module:

PHP Deprecated: strtoupper(): Passing null to parameter #1 ($string) of type string is deprecated in ..\libraries\src\Language\Language.php on line 1183
PHP Stack trace:
PHP 1. {main}() ..\administrator\index.php:0
PHP 2. require_once() ..\administrator\index.php:32
PHP 3. Joomla\CMS\Application\CMSApplication->execute() ..\administrator\includes\app.php:63
PHP 4. Joomla\CMS\Application\AdministratorApplication->doExecute() ..\libraries\src\Application\CMSApplication.php:278
PHP 5. Joomla\CMS\Application\AdministratorApplication->dispatch($component = uninitialized) ..\libraries\src\Application\AdministratorApplication.php:186
PHP 6. Joomla\CMS\Component\ComponentHelper::renderComponent($option = 'com_modules', $params = uninitialized) ..\libraries\src\Application\AdministratorApplication.php:143
PHP 7. Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch() ..\libraries\src\Component\ComponentHelper.php:389
PHP 8. Joomla\CMS\MVC\Controller\BaseController->execute($task = 'display') ..\libraries\src\Dispatcher\ComponentDispatcher.php:146
PHP 9. Joomla\Component\Modules\Administrator\Controller\DisplayController->display($cachable = uninitialized, $urlparams = uninitialized) ..\libraries\src\MVC\Controller\BaseController.php:730
PHP 10. Joomla\CMS\MVC\Controller\BaseController->display($cachable = uninitialized, $urlparams = uninitialized) ..\administrator\components\com_modules\src\Controller\DisplayController.php:122
PHP 11. Joomla\Component\Modules\Administrator\View\Module\HtmlView->display($tpl = uninitialized) ..\libraries\src\MVC\Controller\BaseController.php:692
PHP 12. Joomla\Component\Modules\Administrator\View\Module\HtmlView->addToolbar() ..\administrator\components\com_modules\src\View\Module\HtmlView.php:78
PHP 13. Joomla\CMS\Language\Language->hasKey($string = NULL) ..\administrator\components\com_modules\src\View\Module\HtmlView.php:156
PHP 14. strtoupper($string = NULL) ..\libraries\src\Language\Language.php:1183

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree, probably "early return" when it's empty?


return isset($this->strings[$key]);
}
Expand Down
5 changes: 5 additions & 0 deletions libraries/src/Language/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ public static function _($string, $jsSafe = false, $interpretBackSlashes = true,
*/
private static function passSprintf(&$string, $jsSafe = false, $interpretBackSlashes = true, $script = false)
{
if ($string === null)
{
return false;
}

// Check if string contains a comma
if (strpos($string, ',') === false)
{
Expand Down
4 changes: 2 additions & 2 deletions libraries/src/MVC/Model/ListModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ protected function populateState($ordering = null, $direction = null)
break;

case 'direction':
if (!\in_array(strtoupper($value), array('ASC', 'DESC', '')))
if (!\in_array(strtoupper($value ?? ''), array('ASC', 'DESC', '')))
{
$value = $direction;
}
Expand Down Expand Up @@ -631,7 +631,7 @@ protected function populateState($ordering = null, $direction = null)
// Check if the ordering direction is valid, otherwise use the incoming value.
$value = $app->getUserStateFromRequest($this->context . '.orderdirn', 'filter_order_Dir', $direction);

if (!\in_array(strtoupper($value), array('ASC', 'DESC', '')))
if (!\in_array(strtoupper($value ?? ''), array('ASC', 'DESC', '')))
{
$value = $direction;
$app->setUserState($this->context . '.orderdirn', $value);
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/MVC/View/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public function display($tpl = null)
*/
public function escape($var)
{
return htmlspecialchars($var, ENT_QUOTES, $this->_charset);
return htmlspecialchars($var ?? '', ENT_QUOTES, $this->_charset);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/Table/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function check()
}

// Check for a path.
if (trim($this->path) === '')
if (trim($this->path ?? '') === '')
{
$this->path = $this->alias;
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/Table/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public function check()
}

// Prevent to save too large content > 65535
if ((\strlen($this->content) > 65535) || (\strlen($this->params) > 65535))
if ((\strlen($this->content ?? '') > 65535) || (\strlen($this->params) > 65535))
Copy link
Contributor

Choose a reason for hiding this comment

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

As we're checking for "too large" we can add the check in front?

{
$this->setError(Text::_('COM_MODULES_FIELD_CONTENT_TOO_LARGE'));

Expand Down