Problem/Motivation
In the project this type error is appearing in several processes:
In ProcessBase.php line 171:
Unable to decode output into JSON: Syntax error
TypeError: Cannot assign null to property Drupal\geofield\Plugin\Field\FieldType\GeofieldItem::$geometry of type G
eometry in Drupal\geofield\Plugin\Field\FieldType\GeofieldItem->isEmpty() (line 206 of /var/www/web/modul
es/contrib/geofield/src/Plugin/Field/FieldType/GeofieldItem.php).
has context menu
The problem occurs in this line of code. WHen the geometry is being loaded, it may return null, but the geometry property is not nullable so in case of returning NULL it will throw the error.
Steps to reproduce
Upgrade to 1.58. Run the method isEmpty over a geofield that has value but it returns null when it is being loaded.
Proposed resolution
Make the geometry property nullable, and check it is instance of Geometry class before calling isEmpty method.
Comments
Comment #3
sarwan_verma commentedHi @omarlopesino,
I have fixed this issue "TypeError: Cannot assign null to property Drupal\geofield\Plugin\Field\FieldType\GeofieldItem::$geometry" and also attached patch ,
please review and verify .
Comment #4
sarwan_verma commentedComment #5
omarlopesinoSorry I have uploaded just 10 minutes ago the MR with the solution. However, let's see the feedback from the maintainers. Thanks for the help.
Comment #8
itamair commentedThanks! New 8.x-1.59 release deployed with this fix!