{
// 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;
*/
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) {
return -1;
}
- // @todo this should be natcasesort
- return strcasecmp($a, $b);
+ return strnatcasecmp($a, $b);
});
$ret = array();