Jump to content
alkahest

A sane var_dump()?

Recommended Posts

Is there a way to do a var_dump() in PW without getting a massive incomprehensible array returned? The amount of data that's inside the object is so extensive that it often crashes the browser.

Is there a wrapper function that's just for debugging?

Share this post


Link to post
Share on other sites

Depends on the variable you put in var_dump :)

Can you tell what do you want to achieve, debug?

Share this post


Link to post
Share on other sites

Well, I have something as simple as a list of US states and their children (which are Schools). The US states just have a title, as do the Schools.

I have looped through all the states and split them into two arrays for display purposes. All I want to do is var_dump the array that contains the objects, but PW spits out an insane 20 page novel about the contents of the states and their children. 

Share this post


Link to post
Share on other sites

So, when I try:

$state_set = $pages->find('template=state');

echo $state_set->getArray();

I get Array(); as the output. If I try:

var_dump($state_set->getArray());

I get Proust.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By FrancisChung
      Hi there,
      I'm a newbie and I'm trying to learn more about Processwire so I've setup XDebug + PHPStorm to get some real time debugging happening. 

      I've noticed that no matter where i put a breakpoint in any of my php modules, it seems to return the following error.
      Error: __debuginfo() must return an array (line 55 of /Users/FrancisChung/site/Test/templates/head.inc) 
      This error message was shown because you are logged in as a Superuser. Error has been logged.
      I was wondering if fellow Processwire users have a similar setup, and was successful in getting debugging going.
      I've also read this forum post:
      https://processwire.com/talk/topic/1611-yes-debugging-templates-and-core-code-works/
      I'm also aware there's an issue with XDebug and Processwire:
      https://github.com/ryancramerdesign/ProcessWire/issues/1316
    • By Pierre-Luc
      I recently found while doing work on Laravel a nice tool called Var Dumpling that will convert all var_dumps to nicely formatted blocks of text with a structure, making it a lot easier do debug var_dumps.
      It's available on Chrome and Firerox, you can see what it looks like on their page http://vardumpling.com/
      Hope some of you find it interesting!
    • By Gazley
      Hi there,
      The title just about says it all! I wondered whether anyone has been able to achieve this? I've been trying all day to configure PHPStorm but no luck far
      Thanks
      --Gary
×
×
  • Create New...