-
Notifications
You must be signed in to change notification settings - Fork 201
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
fix(EntityLoad): Return NULL on NULL entity IDs when composing entity load #1174
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to me this makes perfect sense
Hey! Great that you found this. I think for the test it would suffice with just adding a new test checking out for NULLs. See
At the same time, I am not completely sure but I think I got the same problem with LoadMultiple? In that case we would need to do some kind of checking if there're NULL presents in the resolver in
What do you think? Would we need more test covering some kind of composing. |
Thanks, yes I think that test case would be enough for EntityLoad. Can you make a new pull request so that we can see the tests run? EntityLoadMultiple: right, would make sense to run the default array_filter() on the passed IDs to remove any NULL or falsy values. Your test for that makes sense! |
Added a test case and merged this, thanks! |
* 8.x-4.x: test(dataprovider): Rename dataprovider functions to not be accidentally tested (drupal-graphql#1266) fix(EntityLoad): Return NULL on NULL entity IDs when composing entity load (drupal-graphql#1174) fix(entity_reference): Return emtpy arrays instead of NULL (drupal-graphql#1265) chore(voyager): JS dependency updates with yarn audit chore(explorer): JS dependency updates with yarn audit test(coder): Update Coder to 8.3.14 (drupal-graphql#1264) test(phpstan): Enable PHPStan on PHP 8 by disabling PHP opcache (drupal-graphql#1262) feat(server): Log unsafe server errors for better error tracing (drupal-graphql#1258) test(phpstan): Ignore PHPStan warning directly in code with a comment (drupal-graphql#1263) test(phpstan): Ignore a false unreachable statement error (drupal-graphql#1261) test(phpstan): Update PHPStan and dependencies (drupal-graphql#1257) test(php): Add PHP 8.1 for testing (drupal-graphql#1256) test(core): Update Drupal core to 9.3 for testing (drupal-graphql#1255)
We saw the error
array_flip(): Can only flip STRING and INTEGER values! in Drupal\Core\Entity\EntityStorageBase->loadMultiple()
, this happens when a NULL ID is passed into the EntityLoad dataproducer (for example when composing data producers)Make this more robust by checking for NULL.