1

Spend whole day trying to make working simple debugging code for Tweme theme (using D8).

function tweme_preprocess_node(&$variables) {   
   $node = $variables['elements']['#node'];
   kint($node);
   kim ($variables);
}

The only response is blank page no other info.

What's wrong with my debugging code?

  • If you got blank page, you should check the PHP error log to see any details about your problem. Maybe one of the debug functions doesn't exist, or the function is already defined. – kenorb Dec 11 '17 at 23:02
  • Have no php log access ... Just wonder if it's memory issue. Once I left the browser for longer time I was able to navigate the values. Once in a day ... – Paul Paku Dec 11 '17 at 23:24
  • Would be good if you can setup your local environment to test it, otherwise it's blind coding. Try using var_dump($variables); instead plus die() if it's test server. Maybe your $node object is too big to render and you've got out of memory error. But without access to error log it's just a guessing. You need to provide more information about the problem or at least clarify which line exactly causing the blank page. – kenorb Dec 11 '17 at 23:26
  • 2
    How are you going to debug without the error logs? You should use xdebug for this because I can tell you right off the bat that using kint or any of the functions in Devel are going to crash your browser 99% of the time, and this will wind up taking you ten times the amount of hours to deduce and work with. – Kevin Dec 11 '17 at 23:52
  • I would expect the Devel module to display variables using Kint and Ksm functions as advertised (not so strange ...). If it's not possible will look for other solution but that's all I have found for the day long. Will try xdebug. Could be will have to move locally as well. PHP memory limits on the server could be a point ... – Paul Paku Dec 12 '17 at 0:17
1

The kint() and ksm() functions output the results in the status messages block.

Make sure in /admin/structure/block the Status messages system block is set to a region.

  • Yes, it is. What's more I have got the result once I left the browser "blank" for number of minutes. The kint table was displayed but nothing else. But as I said, it was once per whole day, and browser seemed to be hanging. – Paul Paku Dec 12 '17 at 9:46
  • @PaulPaku hmm all those are symptoms of the array being too big for your server resources to handle. Try my answer here it will probably fix your issue. – No Sssweat Dec 13 '17 at 1:02
  • had the same idea. – Paul Paku Dec 14 '17 at 22:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.