fix syntax error crash with PHP version < 5.3

getAttrValuesSorted was using PHP closure.
Now it uses the new function customKsort.