vendredi 23 septembre 2016

loading phpbb in laravel code conflicts

I am trying to access some of the functions within PHPBB from my laravel application, this is for actions such as adding a user when a registration happens on my main site and autologins.

Phpbb is installed under /public/forums and i have updated .htaccess to allow it. I am able to access and use it just fine.

I have a helper that was originally constructed for codeigniter but should translate in to the laravel world. I am loading it as a helper by putting it under app, loading it using

use App\Helpers\phpBBHelper;

and I access the functions as such

   $ph = new phpBBHelper();
   $ph->addPhpbb3User('dave','password','dave@dave.com');

At the top of my helper I have this Construct

public function __construct() {

// Set the variables scope
        global $phpbb_root_path, $phpEx, $cache, $user, $db, $config, $template, $table_prefix;

        define('IN_PHPBB', TRUE);
        define('FORUM_ROOT_PATH', 'forum/');

        $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH :     FORUM_ROOT_PATH;
        $phpEx = substr(strrchr(__FILE__, '.'), 1);
        // Include needed files
        include($phpbb_root_path . 'common.' . $phpEx);

        // Initialize phpBB user session
        $user->session_begin();
        $auth->acl($user->data);
        $user->setup();

        // Save user data into $_user variable
        $this->_user = $user;   
    }

When i execute the code I get a server 500 error

PHP Fatal error: Call to a member function getScriptName() on null in /home/ubuntu/workspace/public/forum/phpbb/session.php on line 50

which is this line

$script_name = $request->escape($symfony_request->getScriptName(), true);

I have found a post on stack overflow that exactly refers to my issue but the resolution of that issue was never posted

http://ift.tt/2cYhqK3

In that thread it was suggested that because both PHP and Laravel both use composer it was causing a conflict when loading the classes. I am not sure if that is true.

But Laravel is certainly affecting PHPBB when I call the $user->session_begin();



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire