Skip to content

Fixed --force not skipping the PHP version prompt in ldap:troubleshoot - #19514

Merged
snipe merged 1 commit into
grokability:developfrom
kratos0718:fix/ldap-troubleshoot-force-php-version-prompt
Aug 19, 2026
Merged

snipe merged 1 commit into
grokability:developfrom
kratos0718:fix/ldap-troubleshoot-force-php-version-prompt

Conversation

@kratos0718

Copy link
Copy Markdown
Contributor

Reported in #19513.

Problem

ldap:troubleshoot declares --force as "Skip the interactive yes/no prompt for confirmation" and guards two of its three confirmations with it:

// ~149
if (! $this->option('force')) {
    $confirmation = $this->confirm('WARNING: This command will display your LDAP password on your terminal. ...');

// ~207
if (! $this->option('force')) {
    $confirmation = $this->confirm('WARNING: This command will make several attempts to connect to your LDAP server. ...');

The PHP-version confirmation isn't guarded, so it prompts even with --force:

// ~200
$this->warn("PHP Version: $php_version WARNING - Versions before 8.3.21 or 8.4.7 will return INCONSISTENT results!");
if (! $this->confirm('Are you sure you wish to continue?')) {
    $this->warn('ABORTING');
    exit(-1);
}

The practical effect, from the report:

$ docker run --rm snipe/snipe-it:v8.7.1 php artisan ldap:troubleshoot --force
PHP Version: 8.3.6 WARNING - Versions before 8.3.21 or 8.4.7 will return INCONSISTENT results!
 Are you sure you wish to continue? (yes/no) [no]:
 > ABORTING

--no-interaction isn't a way out either — Laravel's confirm($question, $default = false) returns the default under -n, which lands on the same ABORTING branch.

This isn't an edge case for the official image: the Dockerfile is FROM ubuntu:24.04 installing distro php8.3-* packages, and Ubuntu ships the 8.3.6 line with fixes backported rather than the version string advanced. So the check compares an upstream version number against a distro-patched build and fires on every run of that image, making the command unusable unattended there.

Fix

Guard that confirmation the same way as the other two, in the same shape the file already uses. The warn() is deliberately left outside the guard so the caveat still appears in unattended logs — --force suppresses the prompt, not the warning.

Testing

php -l clean.

The behavioural change, with confirm() stubbed to what a non-interactive run returns:

--force=false   old: ABORTED    new: ABORTED
--force=true    old: ABORTED    new: CONTINUED

So the un-forced path is untouched and only --force changes, which is the documented contract. I don't have an LDAP directory to exercise the rest of the command against, so this is scoped strictly to the guard.

The reporter also raised whether the image should ship a newer PHP (they mentioned trying the Ondřej PPA) — that's a separate packaging decision, so I've left it out of this PR.

The command declares --force as "Skip the interactive yes/no prompt for
confirmation" and guards two of its three confirmations with it, but the
PHP version warning prompts unconditionally. A run with --force still
stops at "Are you sure you wish to continue?" and aborts, so the command
cannot be run unattended on any PHP build whose version string is below
8.3.21 or 8.4.7 - which includes the official Docker image, since it
installs Ubuntu 24.04's distro php8.3 packages.

--no-interaction does not help either: Laravel's confirm() defaults to
false, so it returns the default and lands on the same ABORTING branch.

Guard that confirmation the same way as the other two. The warning
itself still prints under --force, so the caveat stays visible in
unattended logs.
@kratos0718
kratos0718 requested a review from snipe as a code owner August 18, 2026 10:55
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@snipe

snipe commented Aug 19, 2026

Copy link
Copy Markdown
Member

This looks great, thank you!

@snipe
snipe merged commit 4992d7c into grokability:develop Aug 19, 2026
5 of 10 checks passed
kratos0718 added a commit to kratos0718/portfolio that referenced this pull request Sep 20, 2026
Merged-PR stat was showing 17 while the actual count is 22 - the
OpenSource.tsx list was missing mercari/pipeline#122, apache/maven-
help-plugin#424, grokability/snipe-it#19514, phasespace-labs/
palinode#132, and the newly-merged apache/maven-shared-jar#165.
Added all five with real quotes/stars pulled from each PR, and
updated the Landing and OpenSource stat badges and bio/tagline
text in portfolioData.ts to match.
kratos0718 added a commit to kratos0718/portfolio that referenced this pull request Nov 12, 2026
Merged-PR stat was showing 17 while the actual count is 22 - the
OpenSource.tsx list was missing mercari/pipeline#122, apache/maven-
help-plugin#424, grokability/snipe-it#19514, phasespace-labs/
palinode#132, and the newly-merged apache/maven-shared-jar#165.
Added all five with real quotes/stars pulled from each PR, and
updated the Landing and OpenSource stat badges and bio/tagline
text in portfolioData.ts to match.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants