Fix 500 on client detail page: undefined constant generalComment#3423
Merged
marcelfolaron merged 1 commit intoMay 30, 2026
Merged
Conversation
showClient.blade.php used count($submodules.generalComment); the dot makes PHP 8 read generalComment as an undefined constant (fatal Error), and $submodules is not passed to the view. Use array access with a null guard: count($submodules['generalComment'] ?? []). Fixes Leantime#3407
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Fixes a Blade template syntax error where $submodules.generalComment (invalid PHP) was used instead of proper array access.
Changes:
- Replace invalid dot notation with array key access on
$submodules - Add null-coalescing fallback to an empty array to avoid
count()errors when the key is missing
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
yonas
pushed a commit
to yonasBSD/leantime
that referenced
this pull request
May 30, 2026
Follow-up to Leantime#3423. That PR stopped the fatal on /clients/showClient/{id} by guarding the never-passed $submodules variable with `?? []`, but as a result the Discussion tab always rendered "(0)". The Clients controller (ShowClient::getClientPageData) already assigns $comments via CommentService::getComments('client', $id). Count that instead, so the tab shows the real number and no longer depends on the $submodules variable that the Blade migration (Leantime#3362) dropped. Matches how Tickets/Wiki compute their tab counts. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Opening a client's detail page (
/clients/showClient/{id}) returns a 500 on PHP 8. The client record saves fine; rendering its detail view fatals. Same symptom as #3407.Root cause
app/Domain/Clients/Templates/showClient.blade.php(line 28):count($submodules.generalComment)
$submodules.generalCommentuses.(concatenation) instead of array access. On PHP 8 the barewordgeneralCommentis read as an undefined constant → fatal Error.$submodulesis also not passed to this view (regressed in the Blade migration,refactor: migrate all .tpl.php/.sub.php/.inc.php templates to Blade #3362), so array access alone still throwsUndefined variable $submodules.Stack trace (PHP 8.3 — paths redacted)
Before the fix: production.ERROR: Undefined constant "generalComment" (View: app/Domain/Clients/Templates/showClient.blade.php) at /storage/framework/views/.php:28 After correcting the `.` to array access, the unpassed variable surfaces: production.ERROR: Undefined variable $submodules (View: app/Domain/Clients/Templates/showClient.blade.php) at /storage/framework/views/.php:28 Both originate at showClient.blade.php line 28.