Fix #20423: strcmp() Passing null to parameter 2 ($string2) of type string is deprecated

This commit is contained in:
Wilmer Arambula
2025-06-19 12:24:22 -04:00
committed by GitHub
parent 0a52f10ea6
commit 4c5a6c5035
3 changed files with 28 additions and 1 deletions

View File

@ -25,6 +25,7 @@ Yii Framework 2 Change Log
- Enh #20397: Add PHPStan/Psalm annotations for `ArrayHelper::merge` (samuelrajan747)
- Enh #20413: Add PHPStan/Psalm annotations for `Action`, `ActionEvent`, `Application`, `DynamicModel` and `InlineAction` (max-s-lab)
- Enh #20416: Add `PHPStan`/`PSalm` annotation for `owner` property in `Behavior` class (terabytesoftw)
- Bug #20423: `strcmp()` Passing `null` to parameter `2` ($string2) of type string is deprecated (terabytesoftw)
2.0.52 February 13, 2025

View File

@ -97,6 +97,8 @@ class UrlRule extends BaseObject implements UrlRuleInterface
* @var string|null the URL suffix used for this rule.
* For example, ".html" can be used so that the URL looks like pointing to a static HTML page.
* If not set, the value of [[UrlManager::suffix]] will be used.
* Default values should be strings. Non-string values will be automatically converted to
* strings for comparison with URL parameters.
*/
public $suffix;
/**
@ -494,7 +496,7 @@ class UrlRule extends BaseObject implements UrlRuleInterface
return false;
}
}
if (strcmp($params[$name], $value) === 0) { // strcmp will do string conversion automatically
if (strcmp($params[$name], (string) $value) === 0) {
unset($params[$name]);
if (isset($this->_paramRules[$name])) {
$tr["<$name>"] = '';