Security update for Core, with self-updated composer
[yaffs-website] / vendor / psy / psysh / src / Psy / Command / ListCommand / VariableEnumerator.php
index ba16e79642740988e149234d3d07cab484e4de4d..55b5afcd44db47fe8e9c076c8c6676d569a68185 100644 (file)
@@ -22,7 +22,7 @@ class VariableEnumerator extends Enumerator
 {
     // n.b. this array is the order in which special variables will be listed
     private static $specialNames = array(
-        '_', '_e', '__function', '__method', '__class', '__namespace', '__file', '__line', '__dir',
+        '_', '_e', '__out', '__function', '__method', '__class', '__namespace', '__file', '__line', '__dir',
     );
 
     private $context;
@@ -78,10 +78,13 @@ class VariableEnumerator extends Enumerator
      */
     protected function getVariables($showAll)
     {
+        // self:: doesn't work inside closures in PHP 5.3 :-/
+        $specialNames = self::$specialNames;
+
         $scopeVars = $this->context->getAll();
-        uksort($scopeVars, function ($a, $b) {
-            $aIndex = array_search($a, self::$specialNames);
-            $bIndex = array_search($b, self::$specialNames);
+        uksort($scopeVars, function ($a, $b) use ($specialNames) {
+            $aIndex = array_search($a, $specialNames);
+            $bIndex = array_search($b, $specialNames);
 
             if ($aIndex !== false) {
                 if ($bIndex !== false) {
@@ -95,8 +98,7 @@ class VariableEnumerator extends Enumerator
                 return -1;
             }
 
-            // @todo this should be natcasesort
-            return strcasecmp($a, $b);
+            return strnatcasecmp($a, $b);
         });
 
         $ret = array();