This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 271432 - Natural sorting of array indexes in variable window
Summary: Natural sorting of array indexes in variable window
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Debugger (show other bugs)
Version: 8.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: issues@php
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-05 12:51 UTC by naitsirch
Modified: 2017-09-05 12:53 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Example of sorted array indexes (8.40 KB, image/png)
2017-09-05 12:53 UTC, naitsirch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description naitsirch 2017-09-05 12:51:29 UTC
In debug mode the variables in the "variables" window can be sorted by name and even array indexes are sorted by name.

For example:

    <?php
    $var = ['b' => 1, 'a' => 2, 'c' => 3];
    ?>

would be displayed like this:

    > $var    | array[3] |
        [a]   | int      | 2
        [b]   | int      | 1
        [c]   | int      | 3
     
This is a great feature. It really helps when you are searching for variables or array indexes.

The only problem is if you have a numeric indexed array like this:

    <?php
    $var = [100 => 1, 80 => 2, 50 => 3];
    ?>

would be displayed like this:

    > $var    | array[3] |
        [100] | int      | 1
        [50]  | int      | 3
        [80]  | int      | 2

This makes it difficult to search for some indexes. Netbeans sorts the values in such cases alphabetically, although a natural sorting is desired for numeric array indexes.
Comment 1 naitsirch 2017-09-05 12:53:41 UTC
Created attachment 165088 [details]
Example of sorted array indexes