You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug ExceptionResponse.php creates an instance of the thrown exception object (see line 73) so it can do stuff with it. Occasionally, these exception objects require an argument, such as MissingTemplateException. When this required argument is not present, the application crashes.
To Reproduce
Steps to reproduce the behavior: I'm really not sure but I will post the stack trace.
Expected behavior
I should probably not be getting the MTE in the first place, but since I am and it requires an argument, I'd expect Swagger Bake to know how to give it what it needs so the framework doesn't crash.
Attachments
Was going to bin/cake swagger bake and post an updated swagger.json but actually the CLI crashes with the same error...which is super odd I think given that there's no template for the CLI...
Version and Platform (please complete the following information):
OS/Platform: macOS Monterey 12.5.1
CakePHP: 4.4.14
SwaggerBake Version: 2.5.6
Additional context
I'm trying to get PHP8 attributes to work for setting up flexible routes and making sure they also show up in Swagger.
The text was updated successfully, but these errors were encountered:
By reading the stack trace closer I think I have uncovered the problem.
When the OpenApiPathGenerator scans the controller docblock for my PagesController it picks up the several @throws annotations that are put there by default:
/** * Displays a view * * @param string ...$path Path segments. * * @return \Cake\Http\Response|null * @throws \Cake\Http\Exception\ForbiddenException When a directory traversal attempt. * @throws \Cake\View\Exception\MissingTemplateException When the view file could not * be found and in debug mode. * @throws \Cake\Http\Exception\NotFoundException When the view file could not * be found and not in debug mode. * @throws \Cake\View\Exception\MissingTemplateException In debug mode. */
#[Route('/pages/*', 'pages:display', resource: false)]
publicfunctiondisplay(string ...$path): ?Response
{ ... }
I'm guessing the path scanner tries to instantiate these exceptions as objects, which it cannot do for the MissingTemplateException because it doesn't have the required parameter, thus the crash.
Indeed, if I comment out the @throws lines (there are two) for the MTE the crash disappears.
Describe the bug
ExceptionResponse.php
creates an instance of the thrown exception object (see line 73) so it can do stuff with it. Occasionally, these exception objects require an argument, such asMissingTemplateException
. When this required argument is not present, the application crashes.To Reproduce
Steps to reproduce the behavior: I'm really not sure but I will post the stack trace.
Expected behavior
I should probably not be getting the MTE in the first place, but since I am and it requires an argument, I'd expect Swagger Bake to know how to give it what it needs so the framework doesn't crash.
Attachments
Was going to
bin/cake swagger bake
and post an updated swagger.json but actually the CLI crashes with the same error...which is super odd I think given that there's no template for the CLI...Version and Platform (please complete the following information):
Additional context
I'm trying to get PHP8 attributes to work for setting up flexible routes and making sure they also show up in Swagger.
The text was updated successfully, but these errors were encountered: