`please` cannot run app commands from app/Console/Commands on Laravel 13.36+

Đang mở
#15,808 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@lazerg đang làm issue này rồi.

Từ ngày 7/11/2026.

  • #15809 của @lazerg — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
laravel, php
Lĩnh vực
backend, cli

Hướng nghiên cứu

Start by reading src/Console/Please/Kernel.php and compare its getArtisan() command resolution with Laravel 13.36's kernel behavior described in the issue. Check the existing command tests or add a regression case for a command discovered in app/Console/Commands; done means php please app:example works and Statamic commands still run. Pull request #15809 is already open against this issue.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Bug description

Since Laravel 13.36.0, php please no longer finds commands that Laravel discovers in app/Console/Commands. php artisan runs them normally, but php please fails:

$ php artisan static:warm-links --help     # works
$ php please static:warm-links --help

   ERROR  Command "static:warm-links" is not defined.

The commands are also missing from php please list. Statamic's own commands (php please static:clear and so on) still work.

Cause

laravel/framework#61931 ("Keep the console kernel's own commands on the kernel instance", released in v13.36.0) changed Illuminate\Foundation\Console\Kernel:

  • load() and command() no longer register commands through Artisan::starting(...). They add them to a new property, $kernelCommands.
  • getArtisan() now resolves both lists:
    ->resolveCommands([...$this->kernelCommands, ...$this->commands])
    

Statamic\Console\Please\Kernel::getArtisan() overrides this method and still resolves only $this->commands:

(new Please($this->app, $this->events, Statamic::version()))
    ->resolveCommands($this->commands)

So under please, the commands in $kernelCommands are never registered. Closure commands defined with Artisan::command() in routes/console.php go through Kernel::command() too, so they are probably affected as well (not tested).

Suggested fix

In src/Console/Please/Kernel.php:

->resolveCommands([...($this->kernelCommands ?? []), ...$this->commands])

The ?? [] keeps it working on Laravel versions before 13.36, where the property does not exist. Tested locally: the app command runs under please again, and Statamic's commands still work.

How to reproduce
  1. Statamic 6.x on Laravel 13.36.0 or newer.
  2. php artisan make:command Example (signature e.g. app:example).
  3. php artisan app:example works.
  4. php please app:example fails with Command "app:example" is not defined.
  5. With Laravel 13.35 or older, step 4 works.
Logs
   ERROR  Command "app:example" is not defined.
Environment
Statamic 6.40.0 Pro
Laravel 13.40.0
PHP 8.5.12
Installation

Existing Laravel app, installed Statamic.

Additional details

Found when a deploy script that runs php please <app command> broke after an upgrade that also moved Laravel from 13.29 to 13.40. Workaround: call app commands with php artisan.

Ngôn ngữ chính
PHP
Star
4.9k
Fork
647
Merge trung bình
21 giờ 3 phút
Pull request đã merge (30 ngày)
128

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của statamic/cms

Tất cả issue của statamic/cms

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.