saveUserPicture file_validate TypeError

Created on 29 October 2021, over 2 years ago
Updated 3 October 2023, 9 months ago

Problem/Motivation

When Drupal is unable to save the user picture a TypeError is thrown. If performed during login, the user is unable to login.

Steps to reproduce

Misconfigure the 'file_public_path' setting, or revoke write access. Then attempt to login via LDAP.

Proposed resolution

Check if the file was saved before validating it.

Error

The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to file_validate() must implement interface Drupal\file\FileInterface, bool given, called in \modules\contrib\ldap\ldap_user\src\Processor\DrupalUserProcessor.php on line 577 in file_validate() (line 278 of core\modules\file\file.module).
file_validate() (Line: 577)
Drupal\ldap_user\Processor\DrupalUserProcessor->saveUserPicture() (Line: 536)
Drupal\ldap_user\Processor\DrupalUserProcessor->userPictureFromLdapEntry() (Line: 731)
Drupal\ldap_user\Processor\DrupalUserProcessor->setLdapBaseFields() (Line: 607)
Drupal\ldap_user\Processor\DrupalUserProcessor->applyAttributesToAccount() (Line: 680)
Drupal\ldap_user\Processor\DrupalUserProcessor->syncToDrupalAccount() (Line: 440)
Drupal\ldap_user\Processor\DrupalUserProcessor->drupalUserLogsIn() (Line: 96)
ldap_user_user_login()
call_user_func_array() (Line: 403)
Drupal\Core\Extension\ModuleHandler->invokeAll() (Line: 466)
user_login_finalize() (Line: 138)
Drupal\ldap_sso_auth\LdapSsoAuthAuthentication->authenticate() (Line: 52)
Drupal\ldap_sso_auth\Authentication\Provider\LdapSsoAuthAuthenticationProvider->authenticate() (Line: 52)
Drupal\Core\Authentication\AuthenticationManager->authenticate() (Line: 77)
Drupal\Core\EventSubscriber\AuthenticationSubscriber->onKernelRequestAuthenticate()
call_user_func() (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 134)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 57)
Drupal\Core\StackMiddleware\Session->handle() (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 23)
Stack\StackedHttpKernel->handle() (Line: 717)
Drupal\Core\DrupalKernel->handle() (Line: 19)

πŸ› Bug report
Status

Fixed

Version

4.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States bluegeek9

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024