Skip to content

Commit

Permalink
Add support for uopz extension handling
Browse files Browse the repository at this point in the history
Introduces handling for the uopz extension to ensure the application does not break due to disabled exit calls by uopz. This change checks for the presence of the uopz extension and its settings, attempting to enable exit calls where possible to maintain application stability.
  • Loading branch information
endelwar committed Mar 22, 2024
1 parent f558812 commit a16f6c2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog

## Unreleased
### Added
- Support for handling the `uopz` extension to prevent the application from breaking due to disabled `exit` calls by `uopz`.

## 1.2.22
### Fixes
Expand Down
9 changes: 9 additions & 0 deletions mailscanner/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@
error_reporting(E_ALL ^ E_DEPRECATED ^ E_STRICT);
}

if (extension_loaded('uopz') && !(ini_get('uopz.disable') || ini_get('uopz.exit'))) {
// uopz works at opcode level and disables exit calls
if (function_exists('uopz_allow_exit')) {
@uopz_allow_exit(true);
} else {
throw new \RuntimeException('The uopz extension ignores exit calls and breaks this application. Disable the extension or set "uopz.exit" to TRUE');
}
}

// Read in MailWatch configuration file
if (!is_readable(__DIR__ . '/conf.php')) {
exit(__('cannot_read_conf'));
Expand Down

0 comments on commit a16f6c2

Please sign in to comment.