------ ---------------------------------------------------------------------- 
  Line   src/Authentication/Provider/Cosign.php                                
 ------ ---------------------------------------------------------------------- 
  101    Call to deprecated function drupal_set_message():                     
         in Drupal 8.5.0 and will be removed before Drupal 9.0.0.              
         Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.  
 ------ ---------------------------------------------------------------------- 

 ------ ---------------------------------------------------------------------- 
  Line   src/Controller/CosignController.php                                   
 ------ ---------------------------------------------------------------------- 
  35     Call to deprecated function drupal_set_message():                     
         in Drupal 8.5.0 and will be removed before Drupal 9.0.0.              
         Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.  
  66     Call to deprecated function drupal_set_message():                     
         in Drupal 8.5.0 and will be removed before Drupal 9.0.0.              
         Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.  
 ------ ---------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------ 
  Line   src/CosignFunctions/CosignSharedFunctions.php                           
 ------ ------------------------------------------------------------------------ 
  26     Call to deprecated function user_load():                                
         iin Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use           
         Drupal\user\Entity\User::load().                                        
  46     Call to deprecated function user_load():                                
         iin Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use           
         Drupal\user\Entity\User::load().                                        
  61     Call to deprecated function user_load():                                
         iin Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use           
         Drupal\user\Entity\User::load().                                        
  65     Call to deprecated function user_load():                                
         iin Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use           
         Drupal\user\Entity\User::load().                                        
  75     Call to deprecated function user_load():                                
         iin Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use           
         Drupal\user\Entity\User::load().                                        
  98     Call to deprecated function user_load():                                
         iin Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use           
         Drupal\user\Entity\User::load().                                        
  109    Call to deprecated function drupal_set_message():                       
         in Drupal 8.5.0 and will be removed before Drupal 9.0.0.                
         Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.    
  112    Call to deprecated function drupal_set_message():                       
         in Drupal 8.5.0 and will be removed before Drupal 9.0.0.                
         Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.    
  205    Call to deprecated function entity_create():                            
         in Drupal 8.0.x, will be removed before Drupal 9.0.0. Use               
         The method overriding Entity::create() for the entity type, e.g.        
         \Drupal\node\Entity\Node::create() if the entity type is known. If the  
         entity type is variable, use the entity storage's create() method to    
         construct a new entity:                                                 
 ------ ------------------------------------------------------------------------ 

 ------ --------------------------------------------------------------------------- 
  Line   src/Tests/CosignSimpleTest.php                                             
 ------ --------------------------------------------------------------------------- 
  173    Call to deprecated method getUsername() of class Drupal\user\Entity\User:  
         in Drupal 8.0.0, will be removed before Drupal 9.0.0.                      
         Use \Drupal\Core\Session\AccountInterface::getAccountName() or             
         \Drupal\user\UserInterface::getDisplayName() instead.                      
  183    Call to deprecated method getUsername() of class Drupal\user\Entity\User:  
         in Drupal 8.0.0, will be removed before Drupal 9.0.0.                      
         Use \Drupal\Core\Session\AccountInterface::getAccountName() or             
         \Drupal\user\UserInterface::getDisplayName() instead.                      
  205    Call to deprecated method getUsername() of class Drupal\user\Entity\User:  
         in Drupal 8.0.0, will be removed before Drupal 9.0.0.                      
         Use \Drupal\Core\Session\AccountInterface::getAccountName() or             
         \Drupal\user\UserInterface::getDisplayName() instead.                      
  208    Call to deprecated method getUsername() of class Drupal\user\Entity\User:  
         in Drupal 8.0.0, will be removed before Drupal 9.0.0.                      
         Use \Drupal\Core\Session\AccountInterface::getAccountName() or             
         \Drupal\user\UserInterface::getDisplayName() instead.                      
  213    Call to deprecated method getUsername() of class Drupal\user\Entity\User:  
         in Drupal 8.0.0, will be removed before Drupal 9.0.0.                      
         Use \Drupal\Core\Session\AccountInterface::getAccountName() or             
         \Drupal\user\UserInterface::getDisplayName() instead.                      
  217    Call to deprecated method getUsername() of class Drupal\user\Entity\User:  
         in Drupal 8.0.0, will be removed before Drupal 9.0.0.                      
         Use \Drupal\Core\Session\AccountInterface::getAccountName() or             
         \Drupal\user\UserInterface::getDisplayName() instead.                      
  222    Call to deprecated method getUsername() of class Drupal\user\Entity\User:  
         in Drupal 8.0.0, will be removed before Drupal 9.0.0.                      
         Use \Drupal\Core\Session\AccountInterface::getAccountName() or             
         \Drupal\user\UserInterface::getDisplayName() instead.                      
  236    Call to deprecated method getUsername() of class Drupal\user\Entity\User:  
         in Drupal 8.0.0, will be removed before Drupal 9.0.0.                      
         Use \Drupal\Core\Session\AccountInterface::getAccountName() or             
         \Drupal\user\UserInterface::getDisplayName() instead.                      
  237    Call to deprecated method getUsername() of class Drupal\user\Entity\User:  
         in Drupal 8.0.0, will be removed before Drupal 9.0.0.                      
         Use \Drupal\Core\Session\AccountInterface::getAccountName() or             
         \Drupal\user\UserInterface::getDisplayName() instead.                      
  261    Call to deprecated method getUsername() of class Drupal\user\Entity\User:  
         in Drupal 8.0.0, will be removed before Drupal 9.0.0.                      
         Use \Drupal\Core\Session\AccountInterface::getAccountName() or             
         \Drupal\user\UserInterface::getDisplayName() instead.                      
 ------ --------------------------------------------------------------------------- 

                                                                                               
 [ERROR] Found 22 errors

Comments

rpc5102 created an issue. See original summary.

sergiu stici’s picture

Status: Active » Needs review
StatusFileSize
new14.79 KB

Here is the patch, please review.

rpc5102’s picture

Thanks for the patch @sergiu-stici! The messaging side of things seems to be fine but I'm getting an SQLSTATE exception with the auto-create users function turned on. The method in https://www.drupal.org/forum/support/module-development-and-code-questions/2015-03-04/how-to-programmatically-create-a-user#comment-11051637 works for me.

Error:

Drupal\Core\Database\IntegrityConstraintViolationException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'name' cannot be null: INSERT INTO {users_field_data} (uid, langcode, preferred_langcode, preferred_admin_langcode, name, pass, mail, timezone, status, created, changed, access, login, init, default_langcode) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13, :db_insert_placeholder_14); Array ( [:db_insert_placeholder_0] => 171 [:db_insert_placeholder_1] => en [:db_insert_placeholder_2] => en [:db_insert_placeholder_3] => [:db_insert_placeholder_4] => [:db_insert_placeholder_5] => [:db_insert_placeholder_6] => [:db_insert_placeholder_7] => America/New_York [:db_insert_placeholder_8] => 0 [:db_insert_placeholder_9] => 1568726695 [:db_insert_placeholder_10] => 1568726695 [:db_insert_placeholder_11] => 0 [:db_insert_placeholder_12] => 0 [:db_insert_placeholder_13] => [:db_insert_placeholder_14] => 1 ) in Drupal\Core\Database\Connection->handleQueryException() (line 689 of /web/core/lib/Drupal/Core/Database/Connection.php).
superfluousapostrophe’s picture

StatusFileSize
new62.86 KB

Hi rpc5102,
Here's a patch I put together which addresses the deprecated function and updates the module to use the recommended dependency injections. It also includes a new function which allows the cosign module to play nicely with the Masquerade module.

Edit: This does not make any changes to the unit tests.

superfluousapostrophe’s picture

Assigned: Unassigned » superfluousapostrophe

I have rolled my patch into a new branch, 8.x-1.1. rpc5102 and I have been collaborating on it and we think that it is working. An extra set or two of eyes on it would be useful.

superfluousapostrophe’s picture

Status: Needs review » Fixed

The codebase has been updated in 8.x-1.1-alpha1. Thanks for your input.

Status: Fixed » Closed (fixed)

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