PHP 5.2 does not support anonymous functions.
Instead, try using a named function, represented by a string:
function my_function($kclass) {
$parts = explode('\\', $klass);
if ($parts[0] == 'QueryPath') {
$path = __DIR__ . '/' . implode('/', $parts) . '.php';
if (file_exists($path)) {
require $path;
}
}
}
spl_autoload_register('my_function');