Fix #20548: Fix PHP 8.5 null array offset deprecation warnings

This commit is contained in:
Wilmer Arambula
2025-09-29 19:31:21 -03:00
committed by GitHub
parent d8ba4c0468
commit 33ed3218bf
3 changed files with 9 additions and 2 deletions

View File

@ -37,6 +37,7 @@ Yii Framework 2 Change Log
- Bug #19655: Fix `LinkPager::getPageRange` when `maxButtons` is 2 (max-s-lab)
- Enh #20539: Update minimum PHP version requirement from `7.3` to `7.4` (terabytesoftw)
- Bug #20541: Remove deprecated caching components: `XCache` and `ZendDataCache`, and update related tests and documentation (terabytesoftw)
- Bug #20548: Fix PHP `8.5` `null` array offset deprecation warnings (terabytesoftw)
- Enh #19526: Add the `convertIniSizeToBytes` method to `BaseStringHelper` (max-s-lab)

View File

@ -835,7 +835,8 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
throw new StaleObjectException('The object being updated is outdated.');
}
if (isset($values[$lock])) {
// using null as an array offset is deprecated in PHP `8.5`
if ($lock !== null && isset($values[$lock])) {
$this->$lock = $values[$lock];
}

View File

@ -112,7 +112,12 @@ class PhpManager extends BaseManager
*/
public function getAssignments($userId)
{
return isset($this->assignments[$userId]) ? $this->assignments[$userId] : [];
// using null as an array offset is deprecated in PHP `8.5`
if ($userId !== null && isset($this->assignments[$userId])) {
return $this->assignments[$userId];
}
return [];
}
/**