civicrm / civicrm-cli-tools

Bundle of CiviCRM-specific command-line tools (for composer-based site-builders)
0 stars 1 forks source link

Uncaught TypeError: trim(): Argument #1 ($string) must be of type string, false given in phar: ... .box/src/Terminal.php:60 #1

Closed Kennedy-Robert-Charles closed 3 months ago

Kennedy-Robert-Charles commented 3 months ago

A fatal PHP error occurs during cv core:install. I provide details of the error below but first I'll provide some context.

I am exploring the possibility of using Drupal and CIVICRM to replace the donation management system currently used by a non-profit that I'm involved in.

I have PHP 8.3.3, MySQL Server 8.3 and installed on Windows 11. Drupal 10.2.3 and drush have both been installed and configured using composer.

Following the CIVICRM installation guide I first tried to get the Drupal 10 code using php ..\composer.phar require civicrm/civicrm-{core,packages,drupal-8}. However that resulted in this confusing message from composer: Pick one of these or leave empty to abort: [0] drupal/civicrm_tools I choose to abort and decided to get the CIVICRM code downloaded piece by piece in this way: 1) php composer.phar require civicrm/civicrm-core

composer's message was: Using version ^5.69 for civicrm/civicrm-core. So to keep the rest of the downloads in sync I used these restraints:

2) php composer.phar require "civicrm/civicrm-packages:^5.69" 3) php composer.phar require "civicrm/civicrm-drupal-8:^5.69" 4) php composer.phar require civicrm/cli-tools

Now when I try to do the cv core:install I get a fatal PHP error as follows: C:\drupal10\localhost>vendor\bin\cv core:install --cms-base-url="https://d10.example.org" --db="mysql://civicrm_user:civicrm_pswd@127.0.0.1:3306/civicrm_db" PHP Fatal error: Uncaught TypeError: trim(): Argument #1 ($string) must be of type string, false given in phar://C:/drupal10/localhost/vendor/civicrm/cli-tools/extern/cv.phar/.box/src/Terminal.php:60 Stack trace:

0 phar://C:/drupal10/localhost/vendor/civicrm/cli-tools/extern/cv.phar/.box/src/Terminal.php(60): trim()

1 phar://C:/drupal10/localhost/vendor/civicrm/cli-tools/extern/cv.phar/.box/src/Terminal.php(31): HumbugBox436\KevinGH\RequirementChecker\Terminal::initDimensions()

2 phar://C:/drupal10/localhost/vendor/civicrm/cli-tools/extern/cv.phar/.box/src/Printer.php(28): HumbugBox436\KevinGH\RequirementChecker\Terminal->getWidth()

3 phar://C:/drupal10/localhost/vendor/civicrm/cli-tools/extern/cv.phar/.box/src/Checker.php(17): HumbugBox436\KevinGH\RequirementChecker\Printer->__construct()

4 phar://C:/drupal10/localhost/vendor/civicrm/cli-tools/extern/cv.phar/.box/bin/check-requirements.php(22): HumbugBox436\KevinGH\RequirementChecker\Checker::checkRequirements()

5 C:\drupal10\localhost\vendor\civicrm\cli-tools\extern\cv.phar(12): require('...')

6 C:\drupal10\localhost\vendor\civicrm\cli-tools\bin\cv(7): require('...')

7 C:\drupal10\localhost\vendor\bin\cv(119): include('...')

8 {main}

thrown in phar://C:/drupal10/localhost/vendor/civicrm/cli-tools/extern/cv.phar/.box/src/Terminal.php on line 60

I have tried a number of things including: a) de-installing drush (I saw reference to a conflict on stackexchange) b) using the dev-master version of cli-tools

Now I'm stumped. I would appreciate any suggestions on what I might try next. Many thanks in advance ... Rob

totten commented 3 months ago

Thanks for reporting, @Kennedy-Robert-Charles

It smells like some kind of compatibility issue.

Kennedy-Robert-Charles commented 3 months ago

Thanks so much for your speedy and comprehensive response @totten ! I tried your first suggestion and it worked out perfectly. It was helpful to see the bash steps to understand exactly what you were suggesting. I successfully ran the cv core:install in a Windows Command Prompt which I had opened as an administrator. And now I have just opened the CiviCRM Home page on my Drupal site. Cheers ... Rob

totten commented 3 months ago

Great, I'm glad the recompiled version worked.

Started updates to make the newer version of box be the default, eg

(It's not a common change... it'll take a few additional steps after those to roll-out.)