laravel-goto-controller
laravel-goto-controller copied to clipboard
Error: Cannot read substring of undefined exception when using app() helper inside a route file
Hello @stef-k
I just happened to stumble uppon this error when checking a route file from a project and another one that is almost the exact copy of the same file, and one works and the other doesn'nt. Going to the developer tools inside Vscode gives the error and line number to check into.
I will attach the relevant screenshots, showing the code that makes the extension stopping working and the output of the console error.
Faulty line in web.php
Log showing error in substring
Relevant line from log
Removing the faulty line makes it work again
I think that to solve this it is just a matter of the parser to skip and keep going checking the file, without throwing the exception. It would work as intended, as the app() helper do indeed use the class qualifier, but is not a controller route.
Thanks in advance and I am happy to contribute with your amazing work, as always.
@weidmaster The latest update [0.0.14 - Sep, 19 2021] should fix this.
I am closing this as fixed.
Feel free to report if the fix not working; Be sure to ping @ my name if it does not work.
It seems the fix is causing bigger issues see #26, falling back until a better solution is found.
It seems the fix is causing bigger issues see #26, falling back until a better solution is found.
Oh my! That is not good. The extension was working fine. Well, that is how technology is sometimes, we think the problem is kinda easy to solve, but fixing it causes more trouble later. I hope we can get it working soon. I would love to help tackle the issue, but I don't know Typescript and how to debug a live extension.