Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full stack trace trace is not displayed when using the plugin #58

Closed
dmitriim opened this issue Oct 24, 2022 · 6 comments
Closed

Full stack trace trace is not displayed when using the plugin #58

dmitriim opened this issue Oct 24, 2022 · 6 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@dmitriim
Copy link
Member

dmitriim commented Oct 24, 2022

steps to replicate:

  • hack into /calendar/view.php and add something like throw new dml_exception('dbdriverproblem', 1); to line 60 (after processing all variables).
  • enabled debugging and displaying debug messages navigating to admin/settings.php?section=debugging
  • navigate to /calendar/view.php and confirm that you can see PHP stack trace
  • disable debugging
  • create an experiment with for all users, including admins with following commands ["CFG,debug,32767","CFG,debugdisplay,1","js_header,console.log('Works');"]
  • navigate to /calendar/view.php and confirm that you don't see PHP stack trace, but you still can see 'Works' in js console
@dmitriim
Copy link
Member Author

This happens because Moodle sets PHP errors earlier than calls "after_config" hook. see https://github.com/moodle/moodle/blob/master/lib/setup.php#L702

@dmitriim dmitriim added bug Something isn't working enhancement New feature or request labels Oct 24, 2022
@dmitriim
Copy link
Member Author

Not sure about the best way to fix it. We can simply hardcode setting PHP debugging in the plugin the same way as it's in core. But not sure if this is the best solution. @golenkovm @brendanheywood @Peterburnett @keevan Any ideas?

@dmitriim
Copy link
Member Author

I was able to get it working. The missing bit was forcing debugdeveloper to 1. So following config works as expected.

["CFG,debug,32767","CFG,debugdisplay,1","CFG,debugdeveloper,1","js_header,console.log('Works');"]

@brendanheywood
Copy link
Contributor

I would reopen this and turn it into a documentation task.

@dmitriim
Copy link
Member Author

@Peterburnett came up with an idea to have a specific experiment config for enabling debugging.E.g. DEBUG,1

@dmitriim
Copy link
Member Author

I have created #59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants