Skip to content

Commit 5eb14c5

Browse files
authored
Merge pull request #2375 from acelaya-forks/feature/deprecation-error-reporting
Disable deprecation warnings when running in production envs
2 parents af2d676 + a18360a commit 5eb14c5

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

CHANGELOG.md

+19
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org).
66

7+
## [Unreleased]
8+
### Added
9+
* *Nothing*
10+
11+
### Changed
12+
* *Nothing*
13+
14+
### Deprecated
15+
* *Nothing*
16+
17+
### Removed
18+
* *Nothing*
19+
20+
### Fixed
21+
* [#2373](https://github.com/shlinkio/shlink/issues/2373) Ensure deprecation warnings do not end up escalated to `ErrorException`s by `ProblemDetailsMiddleware`.
22+
23+
In order to do this, Shlink will entirely ignore deprecation warnings when running in production, as those do not mean something is not working, but only that something will break in future versions.
24+
25+
726
## [4.4.4] - 2025-02-19
827
### Added
928
* *Nothing*

config/container.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
use const Shlinkio\Shlink\LOCAL_LOCK_FACTORY;
1313

14+
// Set current directory to the project's root directory
1415
chdir(dirname(__DIR__));
1516

1617
require 'vendor/autoload.php';
@@ -21,7 +22,11 @@
2122
enumValues(EnvVars::class),
2223
);
2324

24-
// This is one of the first files loaded. Configure the timezone and memory limit here
25+
// This is one of the first files loaded. Set global configuration here
26+
error_reporting(
27+
// Set a less strict error reporting for prod, where deprecation warnings should be ignored
28+
EnvVars::isProdEnv() ? E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED : E_ALL,
29+
);
2530
ini_set('memory_limit', EnvVars::MEMORY_LIMIT->loadFromEnv());
2631
date_default_timezone_set(EnvVars::TIMEZONE->loadFromEnv());
2732

data/infra/php.ini

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
display_errors=On
2-
error_reporting=-1
32
log_errors_max_len=0
43
zend.assertions=1
54
assert.exception=1

0 commit comments

Comments
 (0)