Skip to content

Update for recent phpBB #1

@illwieckz

Description

@illwieckz

Current code doesn't work with phpBB 3.3.

Here is a work-in-progress patch that doesn't work (see the comment):

diff --git a/lib/Auth/Source/Auth.php b/lib/Auth/Source/Auth.php
index 7a63d99..5cdc25b 100644
--- a/lib/Auth/Source/Auth.php
+++ b/lib/Auth/Source/Auth.php
@@ -34,9 +34,25 @@ class sspmod_phpbbauth_Auth_Source_Auth extends sspmod_core_Auth_UserPassBase {
         $phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx);
         $phpbb_class_loader_ext->register();
 
+        @define('PHPBB_ENVIRONMENT', 'production');
+
         // Set up container
-        $phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx);
-        $phpbb_container = $phpbb_container_builder->get_container();
+
+        /*
+        If $phpbb_container isn't global:
+                Error: Call to a member function getParameter() on null
+        when doing:
+                $phpbb_container->get('config');
+        If $phpbb_container is global:
+                SQL ERROR [ mysqli ] Table 'phpbb3.users' doesn't exist
+        deep in phpBB code. It lacks the phpbb_ table prefix, it should be
+        phpbb3.phpbb_users. The connection may have been successful anyway.
+        */
+        // global $phpbb_container;
+
+        $phpbb_container_builder = new \phpbb\di\container_builder($phpbb_root_path, $phpEx);
+        $phpbb_container = $phpbb_container_builder->with_config($phpbb_config_php_file)->get_container();
+
         $config = $phpbb_container->get('config');
         set_config(null, null, null, $config);
         set_config_count(null, null, null, $config);

I also did an attempt by copy pasting code from phpBB's bin/phpbbcli.php and it didn't worked better. This is dark magic: the exact same code works if run by the phpbb script, not if run by the phpbbauth simplesamlphp plugin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions