Attribute code error: null value – how to find which attribute code?

We ran into this exact error: Certain Magento Pages returning HTTP Error 500 after a payment was done with PayPal Express Checkout (PayPal redirects to our website after the transaction is completed, then the error 500 occurs).

But checking the error log didn’t provide any information (see below for details). In the end, our developer used a workaround to resolve this issue, but he has to move on to more pressing matters, so I’m trying to get to the bottom of it instead.

The workaround is simply to return an empty value instead of a null value when Magento retrieves attribute codes. He changed this file:

vendor\magento\module-eav\Model\Validator\Attribute\Data.php

And changed this section of it:

    /**  * Validate EAV model attributes with data models  *  * @param \Magento\Framework\Model\AbstractModel $  entity  * @return bool  */ public function isValid($  entity) {     /** @var $  attributes Attribute[] */     $  attributes = $  this->_getAttributes($  entity);      $  data = [];     if ($  this->_data) {         $  data = $  this->_data;     } elseif ($  entity instanceof \Magento\Framework\DataObject) {         $  data = $  entity->getData();     }      foreach ($  attributes as $  attribute) {         $  attributeCode = $  attribute->getAttributeCode();         if (!$  attribute->getDataModel() && !$  attribute->getFrontendInput()) {             continue;         }         $  dataModel = $  this->_attrDataFactory->create($  attribute, $  entity);         $  dataModel->setExtractedData($  data);         if (!isset($  data[$  attributeCode])) {             $  data[$  attributeCode] = null;         }         if($  data[$  attributeCode] == null){             $  data[$  attributeCode] = "";         }         $  result = $  dataModel->validateValue($  data[$  attributeCode]);         if (true !== $  result) {             $  this->_addErrorMessages($  attributeCode, (array)$  result);         }     }     return count($  this->_messages) == 0; } 

Any idea how we could identify the missing/faulty attribute code? There are no exception returned and Magento’s debug log looked like this:

[2019-07-11 23:06:44] main.DEBUG: array (   'ipn' =>  [PayPal API information]   ),   'postback_to' => 'https://ipnpb.paypal.com/cgi-bin/webscr',   'exception' => 'The "order" authorizations aren\'t implemented.', ) [] [] [2019-07-11 23:06:44] main.CRITICAL: The "order" authorizations aren't implemented. {"exception":"[object] (Exception(code: 0): The \"order\" authorizations aren't implemented. at [root]/vendor/magento/module-paypal/Model/Ipn.php:363)"} []     

I can only conclude that the source of the error really isn’t in ipn.php…

Error log:

[ N 2019-07-11 04:27:36.5293 26283/T5 age/Cor/SecurityUpdateChecker.h:517 ]: Security update check: no update found (next check in 24 hours)

That was the only line for the day.