Body: <p>I am trying to install the latest CiviCRM on a fresh Drupal 10.2.3 install. This is on Ubuntu 22.04.3 LTS.</p>
  <p>When I run the cv command (see below) to install CiviCRM, it is not installed and I receive the following error message:</p>
  <pre><code>TypeError: array_map(): Argument #2 ($array) must be of type array, bool given in /var/www/mysite/vendor/civicrm/civicrm-core/setup/src/Setup/DbUtil.php on line 13 
  
  #0 /var/www/mysite/vendor/civicrm/civicrm-core/setup/src/Setup/DbUtil.php(13): array_map()
  #1 phar:///usr/local/bin/cv/src/Util/SetupCommandTrait.php(80): Civi\Setup\DbUtil::parseDsn()
  #2 phar:///usr/local/bin/cv/src/Command/CoreInstallCommand.php(47): Civi\Cv\Command\CoreInstallCommand-&gt;bootSetupSubsystem()
  #3 phar:///usr/local/bin/cv/vendor/symfony/console/Command/Command.php(127): Civi\Cv\Command\CoreInstallCommand-&gt;execute()
  #4 phar:///usr/local/bin/cv/vendor/symfony/console/Application.php(637): Cvphar\Symfony\Component\Console\Command\Command-&gt;run()
  #5 phar:///usr/local/bin/cv/vendor/symfony/console/Application.php(190): Cvphar\Symfony\Component\Console\Application-&gt;doRunCommand()
  #6 phar:///usr/local/bin/cv/src/Application.php(67): Cvphar\Symfony\Component\Console\Application-&gt;doRun()
  #7 phar:///usr/local/bin/cv/vendor/symfony/console/Application.php(101): Civi\Cv\Application-&gt;doRun()
  #8 phar:///usr/local/bin/cv/src/Application.php(33): Cvphar\Symfony\Component\Console\Application-&gt;run()
  #9 phar:///usr/local/bin/cv/bin/cv(28): Civi\Cv\Application::main()
  #10 /usr/local/bin/cv(14): require('...')
  #11 {main}
  TypeError: array_map(): Argument #2 ($array) must be of type array, bool given in array_map() (line 13 of /var/www/mysite/vendor/civicrm/civicrm-core/setup/src/Setup/DbUtil.php).
  </code></pre>
  <p>To reproduce this error,</p>
  <ol>
  <li>Do a fresh Drupal 10.2.3 install</li>
  <li>Verify that Drupal is working</li>
  <li>Resolve any remaining errors listed in Status Report</li>
  <li>Attempt to install CiviCRM with the following:</li>
  </ol>
  <pre><code>cd /var/www/mysite.org
  composer require civicrm/civicrm-{core,packages,drupal-8}
  composer require civicrm/cli-tools
  
  cv core:install --cms-base-url=&quot;https://mysite.org&quot; --db=&quot;mysql://user:topsecretpassword@localhost:3306/mysqldatabasenameforcivicrm&quot;
  </code></pre>
  <p>Here are the commands in and around line 13 of /var/www/mysite/vendor/civicrm/civicrm-core/setup/src/Setup/DbUtil.php</p>
  <pre><code>  1 &lt;?php
    2 namespace Civi\Setup;
    3
    4 use Civi\Setup\Exception\SqlException;
    5
    6 class DbUtil {
    7
    8   /**
    9    * @param string $dsn
   10    * @return array
   11    */
   12   public static function parseDsn($dsn) {
   13     $parsed = array_map('urldecode', parse_url($dsn));
   14     // parse_url parses 'mysql://admin:secret@unix(/var/lib/mysql/mysql.sock)/otherdb' like:
   15     // [
   16     //   'host'   =&gt; 'unix(',
   17     //   'path'   =&gt; '/var/lib/mysql/mysql.sock)/otherdb',
   18     //   ...
   19     // ]
   20     if ($parsed['host'] == 'unix(') {
   21       preg_match('/(unix\(.*\))(\/(.+)?)?$/', $dsn, $matches);
   22       $server = $matches[1];
   23       $database = $matches[3] ?? NULL;
   24     }
   25     else {
   26       $server = self::encodeHostPort($parsed['host'], $parsed['port'] ?? NULL);
   27       $database = $parsed['path'] ? ltrim($parsed['path'], '/') : NULL;
   28     }
   ...
  </code></pre>
  <p>I also tried several things:</p>
  <ol>
  <li>opening write permissions to</li>
  </ol>
  <p>web/sites/default
  web/sites/default/settings.php</p>
  <p>in the event that cv required write access to these.</p>
  <ol start="2">
  <li><p>I tried running the cv command alternatively as the site administrator user and the root user.</p>
  </li>
  <li><p>I looked at the Drupal extensions list and CiviCRM Core is listed. I was confused by that because if the cv command was failing, then I would not expect that the CiviCRM Core would be available to be enabled. I tried it anyway and received a white screen with just the following message: &quot;The website encountered an unexpected error. Try again later.&quot;</p>
  </li>
  <li><p>I have scoured the internet an do not find this DbUtil.php line 13 &quot;TypeError: array_map(): Argument #2 ($array) ...&quot; error mentioned.</p>
  </li>
  </ol>
  <p>Thank you for your assistance,</p>
  <p>Joe</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-02-26T18:55:59.760Z
Comments.Text: Does your password contain characters that might be causing the command line argument to be misinterpreted? It's saying it's failing to parse your db url.
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-02-27T03:04:53.460Z
Comments.Text: Thank you Demerit!! My password contained special characters to keep it a strong password. I removed them, lowered the mysql validate_password.policy to not require special characters and tried again. The error above was replaced by another error message in white letters with a red background: "Access denied for user 'specialuser'@'localhost' to database 'mydb'"
Comments.UserDisplayName: Coventure Joe
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-02-27T19:03:47.100Z
Comments.Text: If you run `SHOW GRANTS for 'specialuser'@'localhost'` in mysql does the user actually have access to `mydb`?
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-03-01T00:15:48.907Z
Comments.Text: GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, REFERENCES, ALTER ON *.* TO `specialuser`@`localhost` WITH GRANT OPTION,  I believe the *.* indicates that has access to all databases.
Comments.UserDisplayName: Coventure Joe
Tags: <drupal><installation>
Title: CiviCRM 5.70.1 install on Drupal 10.2.3 - failure
ThreadText: # CiviCRM 5.70.1 install on Drupal 10.2.3 - failure
  
  (Asked by: username_0 on 2024-02-26)
  
  I am trying to install the latest CiviCRM on a fresh Drupal 10.2.3 install. This is on Ubuntu 22.04.3 LTS.
  
  When I run the cv command (see below) to install CiviCRM, it is not installed and I receive the following error message:
  
  ```
  TypeError: array_map(): Argument #2 ($array) must be of type array, bool given in /var/www/mysite/vendor/civicrm/civicrm-core/setup/src/Setup/DbUtil.php on line 13 
  
  #0 /var/www/mysite/vendor/civicrm/civicrm-core/setup/src/Setup/DbUtil.php(13): array_map()
  #1 phar:///usr/local/bin/cv/src/Util/SetupCommandTrait.php(80): Civi\Setup\DbUtil::parseDsn()
  #2 phar:///usr/local/bin/cv/src/Command/CoreInstallCommand.php(47): Civi\Cv\Command\CoreInstallCommand->bootSetupSubsystem()
  #3 phar:///usr/local/bin/cv/vendor/symfony/console/Command/Command.php(127): Civi\Cv\Command\CoreInstallCommand->execute()
  #4 phar:///usr/local/bin/cv/vendor/symfony/console/Application.php(637): Cvphar\Symfony\Component\Console\Command\Command->run()
  #5 phar:///usr/local/bin/cv/vendor/symfony/console/Application.php(190): Cvphar\Symfony\Component\Console\Application->doRunCommand()
  #6 phar:///usr/local/bin/cv/src/Application.php(67): Cvphar\Symfony\Component\Console\Application->doRun()
  #7 phar:///usr/local/bin/cv/vendor/symfony/console/Application.php(101): Civi\Cv\Application->doRun()
  #8 phar:///usr/local/bin/cv/src/Application.php(33): Cvphar\Symfony\Component\Console\Application->run()
  #9 phar:///usr/local/bin/cv/bin/cv(28): Civi\Cv\Application::main()
  #10 /usr/local/bin/cv(14): require('...')
  #11 {main}
  TypeError: array_map(): Argument #2 ($array) must be of type array, bool given in array_map() (line 13 of /var/www/mysite/vendor/civicrm/civicrm-core/setup/src/Setup/DbUtil.php).
  
  ```
  
  To reproduce this error,
  
  1. Do a fresh Drupal 10.2.3 install
  2. Verify that Drupal is working
  3. Resolve any remaining errors listed in Status Report
  4. Attempt to install CiviCRM with the following:
  
  ```
  cd /var/www/mysite.org
  composer require civicrm/civicrm-{core,packages,drupal-8}
  composer require civicrm/cli-tools
  
  cv core:install --cms-base-url="https://mysite.org" --db="mysql://user:topsecretpassword@localhost:3306/mysqldatabasenameforcivicrm"
  
  ```
  
  Here are the commands in and around line 13 of /var/www/mysite/vendor/civicrm/civicrm-core/setup/src/Setup/DbUtil.php
  
  ```
    1 <?php
    2 namespace Civi\Setup;
    3
    4 use Civi\Setup\Exception\SqlException;
    5
    6 class DbUtil {
    7
    8   /**
    9    * @param string $dsn
   10    * @return array
   11    */
   12   public static function parseDsn($dsn) {
   13     $parsed = array_map('urldecode', parse_url($dsn));
   14     // parse_url parses 'mysql://admin:secret@unix(/var/lib/mysql/mysql.sock)/otherdb' like:
   15     // [
   16     //   'host'   => 'unix(',
   17     //   'path'   => '/var/lib/mysql/mysql.sock)/otherdb',
   18     //   ...
   19     // ]
   20     if ($parsed['host'] == 'unix(') {
   21       preg_match('/(unix\(.*\))(\/(.+)?)?$/', $dsn, $matches);
   22       $server = $matches[1];
   23       $database = $matches[3] ?? NULL;
   24     }
   25     else {
   26       $server = self::encodeHostPort($parsed['host'], $parsed['port'] ?? NULL);
   27       $database = $parsed['path'] ? ltrim($parsed['path'], '/') : NULL;
   28     }
   ...
  
  ```
  
  I also tried several things:
  
  1. opening write permissions to
  
  web/sites/default
  web/sites/default/settings.php
  
  in the event that cv required write access to these.
  
  2. I tried running the cv command alternatively as the site administrator user and the root user.
  3. I looked at the Drupal extensions list and CiviCRM Core is listed. I was confused by that because if the cv command was failing, then I would not expect that the CiviCRM Core would be available to be enabled. I tried it anyway and received a white screen with just the following message: "The website encountered an unexpected error. Try again later."
  4. I have scoured the internet an do not find this DbUtil.php line 13 "TypeError: array\_map(): Argument #2 ($array) ..." error mentioned.
  
  Thank you for your assistance,
  
  Joe
  
  **Tags:** drupal, installation
  
  > **Comments:**
  > **username_1**: Does your password contain characters that might be causing the command line argument to be misinterpreted? It's saying it's failing to parse your db url.  
  > **username_0**: Thank you username_1!! My password contained special characters to keep it a strong password. I removed them, lowered the mysql validate_password.policy to not require special characters and tried again. The error above was replaced by another error message in white letters with a red background: "Access denied for user 'specialuser'@'localhost' to database 'mydb'"  
  > **username_1**: If you run `SHOW GRANTS for 'specialuser'@'localhost'` in mysql does the user actually have access to `mydb`?  
  > **username_0**: GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, REFERENCES, ALTER ON *.* TO `specialuser`@`localhost` WITH GRANT OPTION,  I believe the *.* indicates that has access to all databases.  
  
  ---
  
  ## 0 answers
  
  