Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Just updated a Drupal 8.7.3 to 8.7.4 with simple_sitemap
enabled.
This exception is raised when editing a node :
TypeError: Argument 1 passed to Drupal\simple_sitemap\EntityHelper::getEntityInstanceBundleName() must implement interface Drupal\Core\Entity\EntityInterface, null given, called in /app/web/modules/contrib/simple_sitemap/src/Simplesitemap.php on line 727 in Drupal\simple_sitemap\EntityHelper->getEntityInstanceBundleName() (line 80 of modules/contrib/simple_sitemap/src/EntityHelper.php).
Comment | File | Size | Author |
---|---|---|---|
#11 | 3066138_D8_11.patch | 1.67 KB | idimopoulos |
| |||
#11 | 3066138_test_only.patch | 1.04 KB | idimopoulos |
#10 | simple_sitemap-null_argument-3066138-10.patch | 852 bytes | manuel.adan |
Comments
Comment #2
matthieuscarset CreditAttribution: matthieuscarset as a volunteer and commentedComment #3
matthieuscarset CreditAttribution: matthieuscarset as a volunteer and commentedNevermind, false alert. Sorry about that.
It was an issue with the Node (actually deleted).
Comment #4
matthieuscarset CreditAttribution: matthieuscarset as a volunteer and commentedComment #5
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commentedNo worries, there is an issue about throwing more sensible exceptions, see #3027987: Throw and Catch exceptions in API.
Comment #6
dhanya_girish CreditAttribution: dhanya_girish commentedI am getting the same error while editing a node after Drupal upgrade to 8.7.5 from 8.6.7.
Comment #7
mjt772 CreditAttribution: mjt772 commentedMy apologies for reopening this issue (I'll create a new one if you want).
I'm also getting this exception when attempting to create a new version of a legal document (entity_legal):
TypeError: Argument 1 passed to Drupal\simple_sitemap\EntityHelper::getEntityInstanceBundleName() must implement interface Drupal\Core\Entity\EntityInterface, null given, called in /docroot/modules/contrib/simple_sitemap/src/Simplesitemap.php on line 727 in Drupal\simple_sitemap\EntityHelper->getEntityInstanceBundleName() (line 81 of /docroot/modules/contrib/simple_sitemap/src/EntityHelper.php)
I don't think this was happening with our old 8.x-2.x version of simple_sitemap; we updated to 8.x-3.3 last week.
Comment #8
mjt772 CreditAttribution: mjt772 commentedComment #9
manuel.adanI'm also getting what is described in #7, simple_sitemap version 3.3 and the latest -dev of the entity_legal module.
Comment #10
manuel.adanThis is a simple workaround, it doesn't actually fix the issue but prevents from the exception working with entity legal revisions.
Comment #11
idimopoulos CreditAttribution: idimopoulos commentedI have had exactly the same issue with
entity_legal
.The issue however is generic. The issue derives from the fact that simple_sitemap assumes that an entity object that has an id is also saved in the database. However, there is no restriction in Drupal that an entity cannot have an ID before it is saved.
I am providing a small test and some patch about it. The solution from #10 is correct but I placed the solution a bit earlier in code.
Comment #12
idimopoulos CreditAttribution: idimopoulos commentedComment #14
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commented@idimopoulos, @manuel.adan, @mjt772
The issue you describe has nothing to do with op's issue. I have created a new issue here: https://www.drupal.org/project/simple_sitemap/issues/3079897
Comment #17
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commentedDon't mind the above commit, now ya'll got credited twice, sorry for that. :P
Comment #18
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commentedRegarding op's issue, there is no method that requires Drupal\Core\Entity\Entity object as its parameter. They all require
\Drupal\Core\Entity\EntityInterface
which is also the interface for \Drupal\Core\Entity\EntityBase. So please provide a way to reproduce this issue; until then I am going to close it as non-reproducible.Comment #19
johnpicozziI was getting the error here, however the patch here https://www.drupal.org/project/simple_sitemap/issues/3027987#comment-132... resolves the error.
Comment #20
patrick.thurmond@gmail.comI'm having this exact same problem when upgrading just Drupal core from 8.6.15 to 8.7.7. But ONLY after upgrading core without any other module changes.
At this initial point of seeing the error, I updated core and ran "drush updb -y". That generates that error when I try to edit a node. I also notice a separate error (this might be two separate issues) where I get "This branch of Entity Browser is not compatible with the version of Media Entity installed" in the command line when running that Drush command.