ActiveState Powered by ActiveState

ActiveState Community


PHP debug variable sorting (fixed in Komodo 4.4)

Posted by cheesegrits on 2007-04-11 12:53
OS: All / Any

Having said my life would be complete with a working "go to definition" and no default breakpoint, I did forget one (for me) big issue which burns up a lot of PHP debug time, which is the unsorted variable list.

During Perl debugging, the variable list is sorted alphabetically by Name. But in PHP debugging, there doesn't seem to be any logic to the sort order.

As you know, I'm doing a lot of vBulletin work, and vB is HUGE. Which means I'm dealing with many hundreds, sometimes thousands, of variables in scope at any time.

The "type the first few letters" trick helps some ... but because I'm a Good Boy and use a very structured naming convention, I tend to have a lot of variables that are prefixed with things like product_class_ (like blog_session_sid). Which makes the completion technique a pain. And of course I can add a Watch by hand, but that means (*gasp*) extra mouse clicks and typing and pushing buttons.

As a result, when I first start debugging a given PHP scenario, it can take 5 minutes or more to locate and add everything I need to the Watch list. Versus about 10 seconds in Perl.

So for my life to be complete, PHP variables would have to be sorted during debugging. :)

-- hugh

jeffg | Thu, 2007-04-12 10:13

http://bugs.activestate.com/show_bug.cgi?id=68879

Thanks for the report, I'm hoping we will get some time too look at this for 4.1.

--
JeffG

cheesegrits | Thu, 2007-04-12 12:15

No rush, thanks for submitting the bug report.

Looking forward to 4.1 ...

-- hugh

mmcaulay | Fri, 2007-04-27 11:32

I'm a new Komodo user, still evaluating the PHP debugging capabilities. I signed up for an account and came on the forums specifically to post about this issue. Glad to see it's going to get some love. As things stand, it's a big PITA to find the variable you're looking for when there are a lot of them in scope.

While I'm at it, a really nice feature would be to show the most recently changed local variable somehow. Either by giving it its own field in the gui somewhere, or by autoscrolling the Locals window to it (as an option at least - not everyone would want this behavior). As you're stepping through code it's nice to be able to see at a glance what a variable got set to without having to move the mouse.

Thanks!

cheesegrits | Tue, 2007-09-18 18:37

Sorry to be nagging about this again, but I'd kind of hoped this would be resolved in 4.2, as the bug JeffG entered for me:

http://bugs.activestate.com/show_bug.cgi?id=68879

... had been marked closed. But I guess that's because it was declared a duplicate of another bug which I don't have permissions to view.

The unsorted PHP variables really are an every day frustration, and I'd be EVER so grateful if y'all could fix it!

Then you could issue it as one of the first auto-updated features in 4.2. :)

-- hugh

jeffg | Tue, 2007-09-18 20:09

That bug didn't make it in to 4.2.0, sorry about that. I did just make the other public public though, and upped the priority of it. Please feel free to add your email to the cc list, and we'll see what we can do for 4.2.x or 4.3.

--
JeffG

Peter Mott | Fri, 2007-11-02 13:25

The unsorted variable list in PHP debugging (locals) is driving me to distraction. I'm having to work with an LMS called Moodle and it carries everything including the kitchen around with it all the time. I just the variable name into the watch window at the moment. Real pain.

cheesegrits | Sat, 2007-11-03 08:26

I got all excited when I got the email notification of this thread being updated, I was hoping to see "This bug has been resolved".

I'm now working on both Joomla and vBulletin projects, which as Peter put it, carry everything and the kitchen sink around with them. The lack of variable sorting makes the main variable list essentially unusable.

-- hugh

cheesegrits | Wed, 2008-01-02 22:08

This is an automated reminder from the hughbot (and on behalf of the mottbot). Hugh is still waiting for PHP variable sorting so his life can once again be complete.

As per my bugzilla comment today, the offer has now gone up to a family sized bag of Peanut M&M's and an Import beer.

Seriously guys, if you can do this for 4.2.2, I'll buy the dev/support team a round ... as long as you can find a bar in Vancouver that either does PayPal, or will take my CC over the phone!

(I've tried flattery and outright begging, so I think the time for bribery has arrived)

-- hughbot

cheesegrits | Sat, 2008-02-09 12:52

The lack of PHP variable sorting is almost becoming a deal breaker for me and Komodo. I found myself looking at Eclipse yesterday, wondering if I might use that until this issue gets resolved in Komodo.

If you guys could spend a day in my shoes, working on large PHP projects involving things like Joomla and vBulletin, I think you'd understand why this is such a huge problem. Doesn't matter how tight I code my stuff, because the surrounding apps have been built by committe in PHP4, my stuff just gets lost amongst the zillions of global variables in scope at any one time.

However, instead of switching to Eclipse, as an act of peaceful civil unrest I made myself ill by eating the entire economy sized bag of M&M's I had reserved for y'all.

Please please please please please can we get this fixed? As someone on another thread said about this ... sorting a list isn't rocket science. And I should know, I live in Huntsville, AL, "Rocket City - we put 12 men on the moon".

-- hugh

ToddW | Sun, 2008-02-10 15:12

Hi Hugh,

I've added an initial patch on the Komodo bug to address variable sorting for PHP:
http://bugs.activestate.com/show_bug.cgi?id=65295#c7

Try it out and see if this works for you.

Cheers,
Todd

cheesegrits | Sun, 2008-02-10 20:50

Thank you Todd, you rule. And on a Sunday, too. Looks like both of us need to get lives.

Just one small, itsy-bitsy little issue, it shows the "...Next Page..." at the top of the list instead of the bottom. Which is sub-optimal.

-- hugh

ToddW | Sun, 2008-02-10 22:10

Yes, I also noticed the sorting moved "...Next Page..." to the top of the list. Something worse (at least on my machine) was that clicking on the "...Next Page..." did not do anything, do you also get this problem? I had to increase the "number of children" shown per page in Komodo's preferences ("Debugger->Advanced" category) to ensure I was receiving all of the variables.

cheesegrits | Mon, 2008-02-11 16:07

Well, I think you may have run across that bug I reported a few weeks ago, where sometimes "Next Page" just doesn't do anything:

http://community.activestate.com/forum-topic/next-page-flakiness

On my newly sorted lists, Next Page is working "normally" for me, which means about 8 out of 10 debug sessions it will work.

-- hugh

cheesegrits | Mon, 2008-02-11 18:48

OK, another problem ...

If I have an array already open in the list when the debugger breaks, the elements from that array will get sorted into the main list, rather than under the array.

So instead of ...

aaa
bbb
  -abb
  -bbb
  -cbb
  -dbb
  -ebb
ccc
ddd

... it looks like ...

aaa
  -abb
bbb
  -bbb
  -cbb
ccc
  -dbb
ddd
  -ebb

Or something like that. If I could attach a picture, I could save a thousand words.

-- hugh

cheesegrits | Wed, 2008-02-13 09:09

After looking at the code in variableOutlinerView.js to see if I could fix the problem I reported above, I unreservedly take back my comment about sorting a list not being rocket science. Not only is this rocket science, it's rocket science done in JavaScript. JavaScience.

Needless to say I didn't fix it.

-- hugh

peter2108 | Wed, 2008-02-13 13:24

The variables are in order at last! Thanks ever so much.
BTW is there any help on applying a patch. I'm on Windows so copied the .jar archive to a Linux machine and unpacked there intending to run 'patch'. I did but it did not work - none of the 'hunks' were applied. I had to fix it by hand. My command was 'patch ' Is that the right one?

ToddW | Wed, 2008-02-13 13:38

I've updated the variable sorting patch to hopefully fix the following problems:
* ensure "...Next Page..." is the last item instead of the first.
* ensure variable depth is maintained correctly when refreshing a variable that has previously been toggled open.

The patch command described in the bug should work the same on Windows / Linux (copying across from windows and linux to do the patching should also work in the same way).

The hunks should not fail as long as the "variableOutlinerView.js" file extracted from the komodo.jar file was from the Komodo 4.2.1 build and that you correctly renamed the "variableOutlinerView.unprocessed.js" string in the patch file to be "variableOutlinerView.js".

Cheers,
Todd

cheesegrits | Wed, 2008-02-13 15:13

Just FYI, you can do the patching on Windows, but you'll need to grab UnxUtils from:

http://sourceforge.net/projects/unxutils

... which gives you 'patch' (amongst other indispensible UNIX command line apps), and you can grab a commandline zip / unzip from:

ftp://tug.ctan.org/tex-archive/tools/zip/info-zip/

If you are on x86, you need zip232xN.zip and unz552xN.exe. Any other platform you'll have to check the README for which files are which.

IMPORTANT NOTE - to get the patching to work on winders, you'll also have to open the patch file in something like WordPad and save it as "Text - DOS", otherwise your hunks will fail due to line ending problems. Bad DOS, No Donut.

-- hugh

peter2108 | Fri, 2008-02-15 12:21

Thanks a lot Hugh - I had no success with patching on my Linux machine despite thrashing about with line endings my hunks FAILED (but only some, three succeeded, two with fuzz factor 1, one needing no fuzz at all). But everything worked like a charm following your suggestions. I almost couldn't believe it! BTW the v2 patch seems to work for 4.3 alpha as well. The patch is great too - if somewhat tardy ;-)

-- Peter

cheesegrits | Wed, 2008-02-13 15:21

Todd, you rule.

Your M&M's will be in the mail.

-- hugh

cheesegrits | Fri, 2008-04-04 13:21

One last favor - can we get this patch rolled into 4.3.x? It's a bit of a pain having to re-apply it every time a minor update rolls out ... :(

IMHO, it's ready for prime time - still a few little glitches, but a darn site better than no sorting!

-- hugh

ToddW | Sat, 2008-04-05 09:28

No, sorry Hugh, but the bug has been moved to Komodo 4.4.

You'll need to patch again next week...

Cheers,
Todd

cheesegrits | Sat, 2008-04-05 12:40

Cool ... as long as it's on a roadmap somewhere, I can live with that. Just wanted to make sure it hadn't slipped through the cracks. I can't tell you what a huge help that patch has been for me.

Thanks,

-- hugh

peter2108 | Wed, 2008-05-07 12:53

PHP variable sorting has made it into 4.4a1 -- (along with some other stuff I think) hooray!!!!, close topic!

cheesegrits | Wed, 2008-05-07 14:08

The Fat Lady hasn't sung yet!

-- hugh

-->