Problem/Motivation
Error: Typed property Drupal\social_api\SocialApiDataHandler::$sessionPrefix must not be accessed before initialization in Drupal\social_api\SocialApiDataHandler->getSessionPrefix() (line 47 of modules/contrib/social_api/src/SocialApiDataHandler.php).
Steps to reproduce
Installed social_api 4.0.2, social_post 3.0.2 and social_post_facebook 3.0.x-dev created a facebook app, published and configured settings at admin/config/social-api/social-post/facebook
Social Social API 4.0.2
Social Social Post 3.0.2
Social Social Post Facebook
When going to admin/config/social-api/social-post/facebook/users
When going to user/social-post/facebook/auth
When going to user/social-post/facebook/auth/sitewide
I get the following Error:
The website encountered an unexpected error. Try again later.
Error: Typed property Drupal\social_api\SocialApiDataHandler::$sessionPrefix must not be accessed before initialization in Drupal\social_api\SocialApiDataHandler->getSessionPrefix() (line 47 of modules/contrib/social_api/src/SocialApiDataHandler.php).
Drupal\social_post_facebook\Controller\FacebookPostController->__construct() (Line: 125)
Drupal\social_post_facebook\Controller\FacebookPostController::create() (Line: 41)
Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition() (Line: 100)
Drupal\Core\Utility\CallableResolver->getCallableFromDefinition() (Line: 50)
Drupal\Core\Controller\ControllerResolver->getControllerFromDefinition() (Line: 65)
Drupal\Core\Controller\ControllerResolver->getController() (Line: 164)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741)
Drupal\Core\DrupalKernel->handle() (Line: 19)
Am I missing something?
Am I missing something? Any ideas on how to resolve this error?
Issue fork social_post_facebook-3562094
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
aaronrus commentedComment #3
megakeegman commentedThere is an issue fork for this in the social api module, which I have tested and it works: https://www.drupal.org/project/social_api/issues/3501411 (MR 15)
Comment #5
megakeegman commentedI went ahead and added this link to the project page. Thank for reporting and reminding me that there is a pending patch for social api. Hopefully we can get that change merged in soon! If you try it out please do share your results in the social_api issue.
Comment #8
aaronrus commentedFix initialization error for SocialApiDataHandler::$sessionPrefix
Corrected access-before-initialization issue 3562094 in social_post_facebook module.
The upstream patch suggested in https://www.drupal.org/project/social_api/issues/3501411 is not needed — fixed directly here
See issue fork social_post_facebook-3562094 https://git.drupalcode.org/issue/social_post_facebook-3562094/-/compare/...
Comment #10
aaronrus commentedOpened Merge Request !17 with the fix applied directly in social_post_facebook. Tested locally and the error is gone.
https://git.drupalcode.org/project/social_post_facebook/-/merge_requests/17
Comment #11
aaronrus commentedKeegan @megakeegman
Not sure if you have see this yet. Thought I would tag you in case you have not. I have tested it locally and it resolves the error SocialApiDataHandler::$sessionPrefix without the need for the upstream patch. See https://git.drupalcode.org/project/social_post_facebook/-/merge_requests/17
Thanks
Aaron
Comment #12
megakeegman commentedWow I can't believe I never caught that. Thank you so much!