-
Bug
-
Resolution: Duplicate
-
Minor
-
None
-
3.3.1
-
None
-
MOODLE_33_STABLE
I believe there is a bug on this line https://github.com/moodle/moodle/blob/v3.3.1/lib/classes/lock/lock.php#L114 as the condition defined('PHPUNIT_TEST') always evaluates to true. As a result, if there is a thrown exception and we get to this destructor, the details of the original exception are swallowed and replaced with this new exception thrown here.
This actually happened to me when there was an exception thrown by the locking subsystem which was not caught - whole story at https://github.com/catalyst/moodle-tool_lockstats/issues/19
Was it intended to throw this exception only in unit tests? So that badly written code that does not release the lock, would be identified without affecting the functionality in production?
Or was it intended to throw the exception everywhere but in unit tests?
Maybe it would be better to simply call debugging()?
- duplicates
-
MDL-47546 Unreleased lock throws exception outside of phpunit
- Closed