Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for recent phpBB #1

Open
illwieckz opened this issue Aug 26, 2022 · 0 comments
Open

Update for recent phpBB #1

illwieckz opened this issue Aug 26, 2022 · 0 comments

Comments

@illwieckz
Copy link
Member

illwieckz commented Aug 26, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant