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?

Command icon 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

aaronrus created an issue. See original summary.

aaronrus’s picture

Issue summary: View changes
megakeegman’s picture

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

megakeegman’s picture

I 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.

aaronrus changed the visibility of the branch 3562094-socialapidatahandlersessionprefix-must-not to hidden.

aaronrus changed the visibility of the branch 3562094-socialapidatahandlersessionprefix-must-not to active.

aaronrus’s picture

Status: Closed (duplicate) » Needs review

Fix 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/...

aaronrus’s picture

Opened 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

aaronrus’s picture

Category: Support request » Bug report
Priority: Normal » Critical

Keegan @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

megakeegman’s picture

Status: Needs review » Fixed

Wow I can't believe I never caught that. Thank you so much!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.