Problem/Motivation

This is a followup from #2481103: "Undefined index" errors in system.install loading admin/reports/system.

If you install a profile without the "version" key and move into admin/reports/status page, you will see an empty dash.

Steps to reproduce

  1. Install a new instance of drupal using the "minimal" profile
  2. Inside core/profiles/minimal/minimal.info.yml file, remove the "version" key
  3. Go to admin/reports/status page and check the Installation profile section

Proposed resolution

Following the idea of #12, if a profile does not have a VERSION, the dash will be ommited.

Remaining tasks

  1. Patch
  2. Test
  3. Review
  4. Commit

User interface changes

Before:
Minimal (minimal-)
Installation profile section before applying patch

After:
Minimal (minimal)
Installation profile section after applying patch

API changes

None.

Data model changes

None.

Issue fork drupal-3270892

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

murilohp created an issue. See original summary.

murilohp’s picture

Issue summary: View changes
murilohp’s picture

Issue summary: View changes
murilohp’s picture

Component: syslog.module » system.module
murilohp’s picture

Issue summary: View changes
murilohp’s picture

This is issue was a result of the bugsmash initiave, specially the work done on #2481103: "Undefined index" errors in system.install loading admin/reports/system so adding the tag and the related issue here.

larisse made their first commit to this issue’s fork.

larisse’s picture

Status: Active » Needs review

Hi! I follow the steps to reproduce the error and was able to reproduce. With the Proposed Resolution, the error was fixed and even if the "version" key is not set in mininal.info.yml file, the page will not empty. So I opened a merge request to fix it.

yogeshmpawar made their first commit to this issue’s fork.

joachim’s picture

I'm not sure this is the right fix.

Any profile you download from d.org will have the version filled in, won't it?

So the profiles that don't have this will be custom in-house install profiles that are used to install multiple sites. In that situation, using Drupal's core version number doesn't make sense to me.

I think it might be better to show 'Undefined'.

avpaderno’s picture

Status: Needs review » Needs work

It doesn't make sense for me too. It would mean that the same profile, installed for different Drupal versions, would show a different version.

IMO, it doesn't make sense to show, for example, Minimal (minimal-9.3-12-dev) nor Minimal (minimal-undefined). I would just show the profile name and the version, when it has been set (Minimal (9.3-12-dev) or Minimal). At least, it would be consistent with the versions shown for modules, which aren't prefixed by the module machine name. (It doesn't show node-9.3.18-dev, for the Node module.)

murilohp’s picture

Issue tags: -Needs tests
StatusFileSize
new2.35 KB

Thanks for applying the suggestion @larisse, and also thanks @yogeshmpawar for the rebase!

Regarding #11 and #12:
At the first moment I thought your suggestion a good one @joachim, but after reading the comment from @apaderno(#12), I got to say that I agree with him, I think it's better to keep things consistent, it means, if the profile does not have a version it will show just the profile name and machine name, something like:

Before:
Minimal (minimal-)

After:
Minimal (minimal)

I've update the PR with this logic and I've added a new test to validate this scenario. It would be nice to have your thoughts here, since it's a bug I've upload a TEST-ONLY patch, so it's supposed to fail here.

Moving back to NR.

murilohp’s picture

Issue summary: View changes
Status: Needs work » Needs review
murilohp’s picture

Issue summary: View changes
murilohp’s picture

Issue summary: View changes

Status: Needs review » Needs work

The last submitted patch, 13: 3270892-test-only.patch, failed testing. View results

murilohp’s picture

Status: Needs work » Needs review

Moving back to NR, the failing test seems unrelated.

hmendes’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new11.46 KB

Applied the MR and it fixed the problem following the Proposed resolution.
Changing this to RTBC.
Following a screenshot with the changes applied.

avpaderno’s picture

The patch in #13, which was supposed to fail, failed because Your XML configuration validates against a deprecated schema. which isn't the expected failure.

murilohp’s picture

Hey @apaderno, I think the "Your XML configuration validates against a deprecated schema" is a warning message and AFAIK every time a patch fails, this message is displayed, the error is actually:

1) Drupal\FunctionalTests\Installer\InstallerMissingVersionTest::testProfileOnStatusPage
Behat\Mink\Exception\ResponseTextException: The text "Testing install missing version (testing_install_profile_missing_version)" was not found anywhere in the text of the current page.
avpaderno’s picture

I was referring to this sentence in that comment.

since it's a bug I've upload a TEST-ONLY patch, so it's supposed to fail here.

I take you are expecting that patch fails, but I take you aren't talking about the Your XML configuration validates against a deprecated schema. failure. What failure should that test patch show, then?

murilohp’s picture

My bad @apaderno, the patch should actually fail the new test that was added to validate the "empty dash", the core/tests/Drupal/FunctionalTests/Installer/InstallerMissingVersionTest.php file

murilohp’s picture

@hmendes, it's good to know that you've tested the MR, could you update the summary and add the Before and After screenshots?

hmendes’s picture

Issue summary: View changes

Sure

avpaderno’s picture

Status: Reviewed & tested by the community » Needs work

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

bkosborne’s picture

@alexverb - Can you create an MR with your change in this issue? I agree just using a string output here makes sense.

ameymudras made their first commit to this issue’s fork.

ameymudras’s picture

Status: Needs work » Needs review
avpaderno’s picture

Status: Needs review » Needs work
+
+      $profile_value = $info['version'] ? '%profile_name (%profile-%version)' : '%profile_name (%profile)';
       $requirements['install_profile'] = [
         'title' => t('Installation profile'),
-        'value' => t('%profile_name (%profile-%version)', [
-          '%profile_name' => $info['name'],
-          '%profile' => $profile,
-          '%version' => $info['version'],
-        ]),
+        'value' => $info['name'] . ' (' . $profile . ($info['version'] ? '-' . $info['version'] : '') . ')',
         'severity' => REQUIREMENT_INFO,
         'weight' => -9,

$profile_value is set but never used. That's why core/scripts/dev/commit-code-check.sh --drupalci fails.

ravi.shankar made their first commit to this issue’s fork.

ravi.shankar’s picture

Status: Needs work » Needs review

I don't think if we need $profile_value variable anymore so I've removed it. Please review.

murilohp’s picture

Status: Needs review » Needs work

Just a minor nitpick, moving back to NW

aarti zikre made their first commit to this issue’s fork.

aarti zikre’s picture

Status: Needs work » Needs review

Addressed #34 concern
Please review this

claudiu.cristea’s picture

Priority: Normal » Major
Issue tags: +PHP 8.1

In PHP 8.1 this shows an error, at least when running ./vendor/bin/drush core:requirements:

Deprecated function: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\Component\Utility\Html::escape() (line 424 of web/core/lib/Drupal/Component/Utility/Html.php)
#0 web/core/includes/bootstrap.inc(347): _drupal_error_handler_real(8192, 'htmlspecialchar...', '...', 424)
#1 [internal function]: _drupal_error_handler(8192, 'htmlspecialchar...', '...', 424)
#2 web/core/lib/Drupal/Component/Utility/Html.php(424): htmlspecialchars(NULL, 11, 'UTF-8')
#3 web/core/lib/Drupal/Component/Render/FormattableMarkup.php(262): Drupal\Component\Utility\Html::escape(NULL)
#4 web/core/lib/Drupal/Component/Render/FormattableMarkup.php(232): Drupal\Component\Render\FormattableMarkup::placeholderEscape(NULL)
#5 web/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php(195): Drupal\Component\Render\FormattableMarkup::placeholderFormat('%profile_name (...', Array)
#6 web/core/lib/Drupal/Component/Utility/ToStringTrait.php(15): Drupal\Core\StringTranslation\TranslatableMarkup->render()
#7 vendor/drush/drush/src/Drupal/DrupalUtil.php(23): Drupal\Core\StringTranslation\TranslatableMarkup->__toString()
#8 vendor/drush/drush/src/Drupal/Commands/core/DrupalCommands.php(132): Drush\Drupal\DrupalUtil::drushRender(Object(Drupal\Core\StringTranslation\TranslatableMarkup))
#9 [internal function]: Drush\Drupal\Commands\core\DrupalCommands->requirements(Array)
...
claudiu.cristea’s picture

Status: Needs review » Needs work

I've left a short review in the MR that needs some work

ravi.shankar’s picture

Status: Needs work » Needs review

Tried to address #38, changing status to needs review.

murilohp’s picture

Status: Needs review » Needs work

The tests are failing, maybe because of the change on the testing_install_profile_missing_version.info.yml file, I've also added a new comment. Moving back to NW

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

claudiu.cristea’s picture

Issue tags: -PHP 8.1

We are so close, I still have 2 comments in the MR. Also, @larisse, could you, please, change the base branch of the MR to `11.x`? Thanks

shalini_jha made their first commit to this issue’s fork.

shalini_jha’s picture

I've updated the existing (MR) with the changes suggested #43. However, I don't have the necessary permissions to edit this MR and change the branch to 11.x. Would it be okay if I create a new MR against the 11.x branch?

claudiu.cristea’s picture

Please try to find @larisse and ask her to change. If you don't have a reply in a reasonable amount of time, yes, create a new MR

cyberwolf’s picture

I removed the unused FormattableMarkup import again.

murilohp changed the visibility of the branch 3270892-if-you-dont to hidden.

murilohp’s picture

Status: Needs work » Needs review

I wasn't able to get in touch with the person who opened the first MR, so I've created a new branch and pointed to D11. Moving back to NR to see what you guys think.

murilohp’s picture

Some tests were failing yesterday, nothing related to the code, but right now it's all green

smustgrave’s picture

Status: Needs review » Needs work

Left a comment around the test.

murilohp’s picture

Status: Needs work » Needs review

Just answered the MR comment, moving back to NR

smustgrave’s picture

Status: Needs review » Needs work

To move test, rest seems good to me.

rodrigoaguilera made their first commit to this issue’s fork.

rodrigoaguilera’s picture

StatusFileSize
new1.17 KB

Rebased the branch and moved the tests. Not sure why tests are failing.

Attached also you can fin the patch for Drupal 11.2.2 for composer

mstrelan’s picture

Status: Needs work » Postponed (maintainer needs more info)

Pretty sure this was fixed in #3511868: A profile without a version causes a fatal error on status report page, can anyone confirm? If that's the case a core maintainer can assigned credit and we can close as a duplicate.

rodrigoaguilera’s picture

Status: Postponed (maintainer needs more info) » Reviewed & tested by the community
Related issues: +#3511868: A profile without a version causes a fatal error on status report page

Yes, totally a duplicate. Adding it as related issue.

I think RTBC might get more attention from a core maintainer to assign credit

catch’s picture

Status: Reviewed & tested by the community » Closed (duplicate)

Thanks for figuring out this was a duplicate. Did my best with issue credit and closing out.