presseddigital / linkit

Linkit Plugin for Craft 4
Other
28 stars 18 forks source link

Error while fetching an empty phone field value with GQL #111

Open codename-niels opened 1 year ago

codename-niels commented 1 year ago

An error occurred while I added a Linkit field with the phone number type selected and left the field empty.

Craft: 4.4.17 Linkit: 4.0.4.1

To reproduce, add a linkit field and enable the phone type. Set the field in an entry to phone and leave the value empty. Save the entry and fetch the value via GQL.

Error:

{
      "debugMessage": "craft\\helpers\\StringHelper::stripWhitespace(): Argument #1 ($str) must be of type string, null given, called in /app/vendor/presseddigital/linkit/src/models/Phone.php on line 35",
      "message": "Internal server error",
      "extensions": {
        "category": "internal"
      },
      "file": "/app/vendor/craftcms/cms/src/helpers/StringHelper.php",
      "line": 1455,
      "trace": [
        {
          "file": "/app/vendor/presseddigital/linkit/src/models/Phone.php",
          "line": 35,
          "call": "craft\\helpers\\StringHelper::stripWhitespace(null)"
        },
        {
          "file": "/app/vendor/yiisoft/yii2/base/Component.php",
          "line": 231,
          "call": "presseddigital\\linkit\\models\\Phone::getUrl()"
        },
        {
          "file": "/app/vendor/yiisoft/yii2/base/Model.php",
          "line": 1021,
          "call": "yii\\base\\Component::__isset('url')"
        },
        {
          "file": "/app/vendor/webonyx/graphql-php/src/Executor/Executor.php",
          "line": 177,
          "call": "yii\\base\\Model::offsetExists('url')"
        },