Debugger syntax error Vanilla 2.1.b1
vrijvlinder
MVP
Parse error: syntax error, unexpected T_FUNCTION in /fumamx/foro/plugins/Debugger/views/debug.php on line 28
Am I blind ?
uasort(Gdn_Cache::$trackGet, function($a, $b){
return $b['hits'] - $a['hits'];
});
Tagged:
0
Comments
It's probably happening up above line 28 - you probably modified the file and left out a brace or bracket.
You would be blind if you just look at line 28
no I did not touch it at all that is what is so odd , here is the whole code . This version has a views folder with debug.php
<?php if (!defined('APPLICATION')) return; ?> < div id="Sql" class="DebugInfo" > < h2 >Debug Information< /h2 > <?php // Add the canonical Url. if (method_exists($Sender, 'CanonicalUrl')) { $CanonicalUrl = htmlspecialchars($Sender->CanonicalUrl(), ENT_COMPAT, 'UTF-8'); echo '< div class="CanonicalUrl ">'.T('Canonical Url')."< /b >: < a href=\"$CanonicalUrl\" accesskey=\"r\" >$CanonicalUrl< /a >< /div >"; } ?> <?php // Add some cache info. if (Gdn::Cache()->ActiveEnabled()) { echo '< h3 >Cache Information< /h3 >'; echo '< pre >'; echo '< b >Cache Revision< /b >: '.Gdn::Cache()->GetRevision()."\n"; echo '< b >Permissions Revision< /b >: '.Gdn::UserModel()->GetPermissionsIncrement()."\n"; if (property_exists('Gdn_Cache', 'GetCount')) { echo '< b >Cache Gets< /b >: '.sprintf('%s in %ss', Gdn_Cache::$GetCount, Gdn_Cache::$GetTime); } echo '< / pre >'; if (property_exists('Gdn_Cache', 'trackGet') && sizeof(Gdn_Cache::$trackGet)) { uasort(Gdn_Cache::$trackGet, function($a, $b){ return $b['hits'] - $a['hits']; } $numKeys = sizeof(Gdn_Cache::$trackGet); $duplicateGets = 0; $wastedBytes = 0; $totalBytes = 0; foreach (Gdn_Cache::$trackGet as $key => $keyData) { if ($keyData['hits'] > 1) $duplicateGets += ($keyData['hits']-1); $wastedBytes += $keyData['wasted']; $totalBytes += $keyData['transfer']; } $wastedKB = round($wastedBytes / 1024, 2); $totalKB = round($totalBytes / 1024, 2); echo "Gets\n"; echo '< pre >'; echo '< b >Trips to cache< /b >: '.sprintf('%s in %ss', Gdn_Cache::$trackGets, Gdn_Cache::$trackTime)."\n"; echo '< b >Unique Keys< /b >: '.sprintf('%s keys', $numKeys)."\n"; echo '< b >Total Transfer: '.sprintf('%skB', $totalKB)."\n"; echo '< b >Wasted Transfer< /b >: '.sprintf('%skB over %s duplicate key gets', $wastedKB, $duplicateGets)."\n"; echo '< /pre >'; foreach (Gdn_Cache::$trackGet as $key => $keyData) { echo $key; echo '< span >'.round($keyData['keysize'] / 1024, 2).'kB< /span > '; echo '< small >'.@number_format($keyData['time'], 6).'s< /small >< br/ >'; if ($keyData['hits'] > 1) { echo '< pre >'; echo '< b >Fetched< /b >: '.$keyData['hits']; if ($keyData['wasted']) { $keyWastedKB = round($keyData['wasted'] / 1024, 2); echo "\n< b >Wasted< /b >: {$keyWastedKB}kB"; } echo '< /pre >'; } } } } ?> <?php // Add the queries. $Database = Gdn::Database(); $SQL = $Database->SQL(); if(!is_null($Database)) { $String = ''; $Queries = $Database->Queries(); $String .= '< h3 >'.count($Queries).' queries in '.$Database->ExecutionTime().'s< /h3 >'; foreach ($Queries as $Key => $QueryInfo) { $Query = $QueryInfo['Sql']; // this is a bit of a kludge. I found that the regex below would mess up when there were incremented named parameters. Ie. it would replace :Param before :Param0, which ended up with some values like "'4'0". if(isset($QueryInfo['Parameters']) && is_array($QueryInfo['Parameters'])) { $tmp = $QueryInfo['Parameters']; $Query = $SQL->ApplyParameters($Query, $tmp); } $String .= $QueryInfo['Method'] .'< small >'.@number_format($QueryInfo['Time'], 6).'s< /small >' .(isset($QueryInfo['Cache']) ? '< div >< b >Cache:< /b > '.var_export($QueryInfo['Cache'], TRUE).'< /div >' : '') .'< pre >'.htmlspecialchars($Query).';< /pre >'; } echo $String; } global $Start; echo '< h3 >Page completed in '.round(Now() - $_SERVER['REQUEST_TIME'], 4).'s< /h3 >'; ?> < h3 >Controller Data< /h3 > < pre > <?php echo DebuggerPlugin::FormatData(Gdn::Controller()->Data); ?>no need to post the code (the way you posted it
. Is the debugger plugin from the 2.1b1 source? Try downloading that part again and see if you have errors.
yea the one that came with the package, ok will do
Edit: Nope it is the same , getting the same error.
this is the function singled out
if (property_exists('Gdn_Cache', 'trackGet') && sizeof(Gdn_Cache::$trackGet)) { uasort(Gdn_Cache::$trackGet, function($a, $b){ return $b['hits'] - $a['hits']; });I don't know it works for me.
you could always comment out the
//uasort(Gdn_Cache::$trackGet, function($a, $b){
//return $b['hits'] - $a['hits'];
//});
what kind of caching are you using.
I am now having another error. I disabled debugger and now getting these only after log out
Notice: Undefined offset: 0 in fumamx/foro/library/core/functions.general.php on line 146
/fumamx/foro/applications/dashboard/modules/class.menumodule.php line 164.
fumamx/foro/themes/Glass/views/default.master.php line 42.
fumamx/foro/library/core/class.controller.php line 1841.
deleted the config line Todd recommended $Configuration['Debug'] and it got fixed.
Debugger won't work unless that line is in. But if Debugger is disabled that line does not get removed .
Sound like you should re-install completely and test with default theme and no plugins enabled and work stepwise through it.
you'll be chasing errors forever otherwise.
No I think there is something going on with the config , bugsssss but will try it all to see what works....
@vrijvlinder the code you posted doesn't match with the whole file you posted. In the large post you are missing
);at the end of the callback.Yes true, I was trying to see what would work, I tried with , without, adding an extra parenthesis . That is the line that says it has an unexpected T function , I can't figure it out.