User tests: Successful: Unsuccessful:
Pull Request for Issue ##44872 .
fix PHP Deprecated: trim(): Passing null to parameter
Set Error Reporting to Maximum.
Edit a banner.
Type in a new category.
Select Save & Close button.
See PHP error log:
Deprecated
no more Deprecated
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Hmm, I'm not sure if this PR is right. Currently without the PR, the trim is applied on the alias before the check if it is empty:
$this->alias = trim($this->alias);
if (empty($this->alias)) {
$this->alias = $this->title;
}
So if someone enters spaces as alias in the form, that will not be used, and the title will be used.
Now with the PR you move trim to after the check, so if someone enters spaces as alias in the form, it will be used and not the title because the empty check for a string with spaces will return false:
if (empty($this->alias)) {
$this->alias = $this->title;
}
$this->alias = trim($this->alias);
Maybe the following code would be better?
$this->alias = trim($this->alias ?? '');
if (empty($this->alias)) {
$this->alias = $this->title;
}
I.e. leave order of processing like it is without this PR and use the null coalescing operator inside the trim call to not let it operate on a null value.
Labels |
Added:
PR-5.2-dev
|
done
I have tested this item ✅ successfully on 3ac3c7c
Status | Pending | ⇒ | Ready to Commit |
RTC
Labels |
Added:
RTC
bug
|
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2025-02-20 18:24:41 |
Closed_By | ⇒ | pe7er |
I have tested this item ✅ successfully on 0059c80
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44876.