Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291614

Inconsistent check between \Drupal\Core\Render\Element::children() and \Drupal\Core\Render\Element::child()

$
0
0

It strikes me odd that both functions are performing supposedly identical operation, however both are doing it differently when it comes to identifying whether a form element has a valid child name.

function element_child($key) {
  return !isset($key[0]) || $key[0] != '#';
}

function element_children...
if ($key === '' || $key[0] !== '#')
...

mainly !isset($key[0]) versus ($key === '') and $key[0] != '#' versus $key[0] !== '#'.

Unfortunately i fail to grasp the subtle differences between the two versions, hence the post. Thanks in advance.


Viewing all articles
Browse latest Browse all 291614

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>