I created a nested array. The array contains two identical sub-arrays. When I use dsm() to display the array, the first subarray is displayed just fine. However instead of displaying the second subarray, dsm displays an infinity sign next to the word "(recursion)".

Please note I am using dsm(), not kpr().

Does anyone know why one subarray would be displayed properly, but the second (identical) subarray is not displayed?

Thank you.

UPDATE: The proposed solution in the referenced "duplicate" does not help me because (a) I am trying to dump my own array (I am not trying to dump a node), and because I am using dsm (not kpr). Perhaps the answer is "there is nothing I can do about it". I was hoping, though, that someone would have some general insight into what causes the problem, so that I could figure out a work-around. I have run into this problem before when dumping nodes, but this is the first time I have run into it when dumping my own internal structures. That is why I am scratching my head. What did I do differently this time to "break" dsm()?

FURTHER UPDATE: When I call dsm() on the subarray in question, it dumps fine. So that's my current solution: If some subarray is not getting dumped properly, then I add a dsm() statement to dump the particular subarray.

In addition, I think it would be useful if this was not marked "duplicate", because I believe it is not. Thank you.

  • 2
    This is normal. You can specify to display only the child array if you want to see the contents. See drupal.stackexchange.com/questions/12463/… – enzipher Feb 21 '13 at 0:31
  • Please note that my question was about dsm(), not kpr(). Are you saying that kpr() and dsm() are the same? – user606696 Feb 22 '13 at 5:38
  • Yes, basically the same. Check the source code. Main difference is that dpm() (and/or dsm()) is using drupal_set_message(). – enzipher Feb 22 '13 at 5:44

Browse other questions tagged or ask your own question.