Undefined array key error when specifying path in CivicTheme subtheme creation script

Created on 3 November 2023, about 1 year ago

Problem/Motivation

While attempting to create a subtheme of CivicTheme using the provided PHP script, an error is encountered when specifying the path to the new theme directory. The error message displayed is: RUNTIME ERROR: Undefined array key 7. This error prevents the successful creation of a subtheme when the path is included as an argument to the script. However, the script works as expected when the path argument is omitted and the command is run from within the themes directory.

Steps to reproduce

  1. Spin up a GovCMS 10 instance.
  2. Clone the CivicTheme repository within the themes directory using the following command: git clone git@github.com:salsadigitalauorg/civictheme.git
  3. Enter the container's CLI with ahoy cli.
  4. Run the subtheme creation script with the command php civictheme_create_subtheme.php test "Test" "Test" /app/web/themes/custom from the root directory.

Observe the RUNTIME ERROR: Undefined array key 7 that occurs upon execution.

Proposed resolution

An investigation into the script's handling of the directory path argument is needed to identify why the undefined array key error is thrown. A fix should then be implemented to allow the script to correctly parse and utilise the provided path for subtheme creation.

Remaining tasks

  • Identify the cause of the undefined array key error in the script.
  • Modify the script to handle the directory path argument without error.
  • Test the modified script to ensure the issue is resolved.

User interface changes

N/A – This issue occurs in a command-line interface and does not affect the Drupal user interface.

API changes

N/A – This issue is not related to API changes.

Data model changes

N/A – This issue does not involve changes to the data model.

🐛 Bug report
Status

Active

Version

1.5

Component

Code

Created by

🇦🇺Australia amjad1233 Brisbane

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

Comments & Activities

  • Issue created by @amjad1233
  • 🇦🇺Australia alex.skrypnyk Melbourne

    @amjad1233
    Thank you for a detailed report.

    I can confirm that this issue exists for absolute paths.

    Additionally, in your example there is no directory for a theme itself:
    php civictheme_create_subtheme.php test "Test" "Test" /app/web/themes/custom
    but should be
    php civictheme_create_subtheme.php test "Test" "Test" /app/web/themes/custom/test

    While we are working on the fix to support absolute paths, you can already use a relative path (for GovCMS you would have a sub-theme sitting as a sibling next to CivicTheme):

    php civictheme_create_subtheme.php your_theme "Your theme" "Your theme description" ./your_theme

    p.s. Please do not git-checkout from the repo as it would be a dev version - download a stable release from D.O. instead.

  • Status changed to Fixed about 1 year ago
  • 🇦🇺Australia alex.skrypnyk Melbourne

    Fixed in 1.6

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

  • Status changed to Fixed about 2 months ago
Production build 0.71.5 2024