- Issue created by @pfrenssen
- Status changed to Needs review
over 1 year ago 1:18pm 20 June 2023
The documentation of ProtectedPagesStorage::insertProtectedPage()
specifies that the method should return an integer:
/**
* Insert data into protected pages table.
*
* @param array $page_data
* An array containing all values.
*
* @return int
* The protected page id.
*/
public function insertProtectedPage(array $page_data);
However it blindly returns the query result without checking the type. The default MySQL database driver returns string results.
$ drush eval "print(gettype(\Drupal::service('protected_pages.storage')->insertProtectedPage(['password' => 'test', 'path' => '/mypath'])))"
Expected result: integer
Actual result: string
Cast the query result to an integer before returning it.
Needs review
1.0
Code