Skip to content
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

presseddigital\linkit\base\ElementLink::getUrl(): Return value must be of type string, null returned #107

Closed
Troops994 opened this issue Oct 7, 2022 · 4 comments
Assignees

Comments

@Troops994
Copy link

Getting the following errors for Linkit.

Strill seeing an issue where the type string is referenced.

in /var/www/craft/vendor/presseddigital/linkit/src/base/ElementLink.phpat line 71
62636465666768697071727374757677787980 if (!is_null($this->customSelectionLabel) && $this->customSelectionLabel != '') {
return $this->customSelectionLabel;
}
return $this->defaultSelectionLabel();
}

public function getUrl(): string
{
    $element = $this->getElement();
    return $element ? $element->getUrl() : '';
}

public function getText(): string
{
    return $this->getCustomOrDefaultText() ?? ($this->getElement() ? $this->getElement()->title : null) ?? $this->getUrl() ?? '';
}

public function getElement()
{
  1. in /var/www/craft/vendor/yiisoft/yii2/base/Component.php at line 139– presseddigital\linkit\base\ElementLink::getUrl()

  2. in /var/www/craft/vendor/craftcms/cms/src/helpers/Template.php at line 90– yii\base\Component::__get('url')
    84858687888990919293949596
    if (
    $type !== TwigTemplate::METHOD_CALL &&
    $object instanceof BaseObject &&
    $object->canGetProperty($item)
    ) {
    return $isDefinedTest ? true : $object->$item;
    }

     // Convert any \Twig\Markup arguments back to strings (unless the class *extends* \Twig\Markup)
     foreach ($arguments as $key => $value) {
         if (is_object($value) && get_class($value) === Markup::class) {
             $arguments[$key] = (string)$value;
    
@Troops994
Copy link
Author

This issue seems to be only with Entries, I think it is the one you might be already investigating.

@Troops994
Copy link
Author

Morning, any idea when the fix will be out, this is effecting our live environments so we are keen to get this resolved asap.

@andrewfairlie
Copy link

Any update on this?

@ben-callaway
Copy link
Collaborator

Fixed in 3.0.3 / 4.0.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants