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

Summary: Natural sorting of array indexes in variable window
Product: php Reporter: naitsirch <naitsirch>
Component: DebuggerAssignee: issues@php <issues>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.2   
Hardware: PC   
OS: Linux   
Issue Type: ENHANCEMENT Exception Reporter:
Attachments: Example of sorted array indexes

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