Laravel 5加载phpBB 3.1

时间:2016-12-10 16:53:32

标签: php laravel phpbb

我试图将phpBB 3.1集成到我的Laravel 5应用程序中。这是如此phpBB可以处理我的用户会话,所以我可以更轻松地做一些事情,如抓住帖子并通过bbcode解析器运行它们在外部页面上呈现(在论坛外部)。

我将phpBB样板添加到我的网络路径中:

Route::get('/', function ()
{
    define('IN_PHPBB', true);
    $phpbb_root_path = '../../forum/';
    $phpEx           = substr(strrchr(__FILE__, '.'), 1);
    include($phpbb_root_path . 'common.' . $phpEx);
    include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

    // Start session management
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup('viewforum');

    return view('home',
    [
        'active_tab' => 'home'
    ]);
});

它抛出的错误是

Fatal error: Call to a member function getParameter() on null

Laravel堆栈跟踪的相关部分是

in file.php line 37
at file->__construct()
at ReflectionClass->newInstanceArgs(array()) in ContainerBuilder.php line 927
at ContainerBuilder->createService(object(Definition), 'cache.driver') in ContainerBuilder.php line 475
at ContainerBuilder->get('cache.driver') in common.php line 131
at include('P:\wamp\www\site\forum\common.php') in web.php line 19

所以,在forum / common.php中它有

$phpbb_class_loader->set_cache($phpbb_container->get('cache.driver'));

那 - > get()最终在forum / phpbb / cache / driver / file.php中运行构造函数

function __construct($cache_dir = null)
{
    global $phpbb_container;

    $this->cache_dir = !is_null($cache_dir) ? $cache_dir : $phpbb_container->getParameter('core.cache_dir');
    $this->filesystem = new \phpbb\filesystem\filesystem();

    if (!is_dir($this->cache_dir))
    {
            @mkdir($this->cache_dir, 0777, true);
    }
}

$ phpbb_container现在在该构造函数中为null。它在common.php中不为null,并且看起来设置正确。

另一个线程中的一个建议是将phpbb和laravel放在根目录中的自己的文件夹中以避免自动加载冲突。我已经完成了这个(/ site / laravel /和/ site / forum /),但它并没有改变这个问题。

我还注意到该错误最初是从phpbb的缓存加载一些缓存文件。所以我清除了phpbb缓存,但它现在从未缓存的文件中抛出错误。

Laravel是否正在做一些搞乱全局变量的事情,还是有更深层次的事情发生?

0 个答案:

没有答案