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

@ -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>"] = '';