New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Humhub 1.16.0 - Error with PolymorphicRelation::getPolymorphicRelation()
#6772
Comments
@martin-rueegg I think it's a code you've worked one. Maybe you know what would be the best approach to solve this problem. (allowing a null param or forcing null to become a string). Thanks! |
I've not tested; $classAttributeValue = $this->owner?->getAttribute($this->classAttribute);
if ($classAttributeValue !== null) {
$record = static::loadActiveRecord($classAttributeValue);
} else {
// Handle the case where $classAttributeValue is null
$record = null;
} |
I guess if So yes, removing the type restriction is probably the easiest option: |
Thanks, @ArchBlood, for your suggestion. According to the exception trace provided by @marc-farre it is not an issue that I'm not sure we need to account for the possibility, that for some reason the owner is set to Also, the Nullsafe operator is only available since php 8.0. And while @luke- said he wants to silantly fade out v7.4, this would simply crash it ... :-) |
I can understand that, some of @GreenMeteor modules will not function unless PHP 8.0 are used, others still need updated for PHP 8.0, but I can understand the silent method of moving away from PHP 7.4. 🤔 |
What steps will reproduce the problem?
I cannot tell, but on my Humhub instance, it occurred when viewing the notification list.
The problem is that
$this->owner->getAttribute()
can return null:humhub/protected/humhub/components/behaviors/PolymorphicRelation.php
Line 70 in 1db793d
But the first argument of
static::loadActiveRecord()
must be a string:https://github.com/humhub/humhub/blob/1db793da1f0d680053713b0654bdd5f32a5339cd/protected/humhub/components/behaviors/PolymorphicRelation.php#L177C50-L177C50
Additional info
Log:
The text was updated successfully, but these errors were encountered: