Skip to content

COLDBOX-1463 Check implicitViews before the missing-handler view lookup - #723

Open
homestar9 wants to merge 1 commit into
ColdBox:developmentfrom
homestar9:fix/implicitviews-missing-handler
Open

homestar9 wants to merge 1 commit into
ColdBox:developmentfrom
homestar9:fix/implicitviews-missing-handler

Conversation

@homestar9

Copy link
Copy Markdown
Contributor

Description

With implicitViews set to false (the default since 8.3.0), an event with no matching handler should go through invalid event handling. HandlerService.getHandlerBean() still checks for a view with the same name, though. When it finds one, it flags the event as a view dispatch. The renderer then has no view to render, because implicit views are off, and the request fails with Renderer.ViewNotSetException instead of reaching the invalidEventHandler or returning a 404.

getHandler() already checks the setting before it calls isViewDispatch() for a missing action. This PR adds the same check to getHandlerBean():

if ( variables.implicitViews AND isViewDispatch( arguments.event, oHandlerBean ) ) {

Apps with implicitViews turned on behave as before.

Two existing HandlerServiceTest specs expected simpleview to dispatch while the test harness has implicitViews off. They only passed because of this bug. They now turn the setting on for their duration, with prepareMock().$property() because the service caches the setting, and restore it afterwards. They also remove the simpleview bean they cache, so it doesn't carry over into later specs.

Jira Issues

Type of change

  • Bug Fix

Checklist

  • My code follows the style guidelines of this project (cfformat run on touched files: no changes beyond the fix)
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective (HandlerServiceTest: with implicit views off, getHandlerBean( "simpleview" ) isn't a view dispatch and returns the invalid event handler's bean; EventExecutionsSpec: requesting simpleview with implicit views off returns the invalid event handler's 404. Both fail without the fix, the second with Renderer.ViewNotSetException)
  • New and existing unit tests pass locally with my changes (runner.cfm and runner-integration.cfm, compared with a run of development without the change: no new failures, and the new specs pass, on Lucee 5.4, Adobe 2023, Adobe 2025, BoxLang 1 and BoxLang 1 with CFML compat. Integration runner 98/98 on each engine. MySQL wasn't available locally, so ORM was turned off and the DB log appender removed for these runs. The specs that need the database fail the same way with and without the change.)

@homestar9
homestar9 marked this pull request as ready for review October 16, 2026 16:43
Copilot AI balanced review requested due to automatic review settings October 16, 2026 16:43
@homestar9

Copy link
Copy Markdown
Contributor Author

@lmajano I don't think the ACF test error is related to the PR.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused guard matches existing behavior and has regression coverage, with no identified blocking issues; tests were not run during this review.

0 open findings

What changed in this PR

Fixes missing-handler resolution so view-only events reach invalid event handling when implicitViews is disabled.

Changes:

  • Guards view dispatch with the cached implicitViews setting.
  • Adds service and request-level regression coverage.
  • Updates existing view-dispatch tests to enable implicit views temporarily and clean up cached beans.
File Description
tests/​specs/​web/​services/​HandlerServiceTest.cfc Tests disabled implicit views and isolates enabled-view tests.
tests/​specs/​integration/​EventExecutionsSpec.cfc Verifies view-only requests return the invalid-handler 404.
system/​web/​services/​HandlerService.cfc Checks implicitViews before missing-handler view lookup.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@homestar9
homestar9 force-pushed the fix/implicitviews-missing-handler branch from 4fc5fc8 to c927789 Compare October 16, 2026 19:22
…view lookup

getHandlerBean() called isViewDispatch() for every event without a handler, even with implicitViews off. An event matching a view name was then flagged as a view dispatch and failed with Renderer.ViewNotSetException instead of reaching invalid event handling. It now checks the setting first, like getHandler() does for a missing action.
@homestar9
homestar9 force-pushed the fix/implicitviews-missing-handler branch from c927789 to 76b8343 Compare October 16, 2026 19:30
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