API page: https://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_...
This sentence:
The return value will be NULL, regardless of whether the actual value is NULL or whether the requested key does not exist.
would normally be understood to mean that the return value will always be NULL whatever the actual value and whatever the existential state of the requested key. Re-reading it, and examining the context and the code, reveal that this is not the intended meaning.
Suggested improvement:
A return value of NULL is ambiguous, and can mean either that the requested key does not exist, or that the actual value is NULL.
Comments
Comment #1
pushpinderchauhan commentedPlease review attached patch.
Comment #2
jhodgdonThanks, looks good to me!
However, our policy is to patch Drupal 8 first, for issues that affect both. In Drupal 8, this function is NestedArray::getValue():
https://api.drupal.org/api/drupal/core!lib!Drupal!Component!Utility!Nest...
So can we make a Drupal 8 patch for that first? Thanks!
Comment #3
pushpinderchauhan commentedPatch for D8.
Comment #5
jhodgdonThanks! Committed appropriate patches to 8.0.x and 7.x.