Skip to content

Commit e685f1d

Browse files
committed
Simply comment out the appropriate Dockerfile lines
This way we can easily re-apply the patch if need be. Also comment the commented-out lines so it's clear why they exist.
1 parent 7965d0a commit e685f1d

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

docker/app/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ RUN chown -R www-data:www-data /var/www/html/assets /var/www/html/cache \
7676

7777
COPY --from=composer-builder /composer/vendor /var/www/html/vendor
7878

79+
# Uncomment the two lines below if you see Symfony errors like "expected Exception, got Error instead"
80+
# This will allow you to see the actual underlying error, rather than the Symfony exception that hides the underlying one
81+
# COPY docker/app/symfony-exceptions.patch /
82+
# RUN patch -p4 -i /symfony-exceptions.patch
83+
7984
RUN echo "${BUILD_VERSION}" > build-version.txt \
8085
&& sed -i "s/9.9.9/${BUILD_VERSION}/" version.php
8186

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
--- a/var/www/html/vendor/symfony/debug/ExceptionHandler.php 2019-07-23 15:39:19.000000000 +0700
2+
+++ b/var/www/html/vendor/symfony/debug/ExceptionHandler.php 2021-09-27 15:08:37.000000000 +0700
3+
@@ -103,7 +103,7 @@
4+
* The latter takes precedence and any output from the former is cancelled,
5+
* if and only if nothing bad happens in this handling path.
6+
*/
7+
- public function handle(\Exception $exception)
8+
+ public function handle(\Error $exception)
9+
{
10+
if (null === $this->handler || $exception instanceof OutOfMemoryException) {
11+
$this->sendPhpResponse($exception);
12+
@@ -144,7 +144,7 @@
13+
try {
14+
\call_user_func($this->handler, $exception);
15+
$this->caughtLength = $caughtLength;
16+
- } catch (\Exception $e) {
17+
+ } catch (\Error $e) {
18+
if (!$caughtLength) {
19+
// All handlers failed. Let PHP handle that now.
20+
throw $exception;
21+
@@ -158,7 +158,7 @@
22+
* This method uses plain PHP functions like header() and echo to output
23+
* the response.
24+
*
25+
- * @param \Exception|FlattenException $exception An \Exception or FlattenException instance
26+
+ * @param \Error|FlattenException $exception An \Error or FlattenException instance
27+
*/
28+
public function sendPhpResponse($exception)
29+
{
30+
@@ -180,7 +180,7 @@
31+
/**
32+
* Gets the full HTML content associated with the given exception.
33+
*
34+
- * @param \Exception|FlattenException $exception An \Exception or FlattenException instance
35+
+ * @param \Error|FlattenException $exception An \Error or FlattenException instance
36+
*
37+
* @return string The HTML content as a string
38+
*/
39+
@@ -250,7 +250,7 @@
40+
41+
$content .= "</tbody>\n</table>\n</div>\n";
42+
}
43+
- } catch (\Exception $e) {
44+
+ } catch (\Error $e) {
45+
// something nasty happened and we cannot throw an exception anymore
46+
if ($this->debug) {
47+
$title = sprintf('Exception thrown when handling an exception (%s: %s)', \get_class($e), $this->escapeHtml($e->getMessage()));
48+
@@ -390,7 +390,7 @@
49+
} else {
50+
try {
51+
$link = $fmt->format($path, $line);
52+
- } catch (\Exception $e) {
53+
+ } catch (\Error $e) {
54+
return sprintf('<span class="block trace-file-path">in <span title="%s%3$s"><strong>%s</strong>%s</span></span>', $this->escapeHtml($path), $file, 0 < $line ? ' line '.$line : '');
55+
}
56+
}
57+
--- a/var/www/html/vendor/symfony/debug/Exception/FlattenException.php 2019-07-23 15:39:19.000000000 +0700
58+
+++ b/var/www/html/vendor/symfony/debug/Exception/FlattenException.php 2021-09-27 15:09:06.000000000 +0700
59+
@@ -33,7 +33,7 @@
60+
private $file;
61+
private $line;
62+
63+
- public static function create(\Exception $exception, $statusCode = null, array $headers = [])
64+
+ public static function create(\Error $exception, $statusCode = null, array $headers = [])
65+
{
66+
$e = new static();
67+
$e->setMessage($exception->getMessage());
68+
@@ -59,7 +59,7 @@
69+
70+
$previous = $exception->getPrevious();
71+
72+
- if ($previous instanceof \Exception) {
73+
+ if ($previous instanceof \Error) {
74+
$e->setPrevious(static::create($previous));
75+
} elseif ($previous instanceof \Throwable) {
76+
$e->setPrevious(static::create(new FatalThrowableError($previous)));
77+
@@ -178,7 +178,7 @@
78+
return $this->trace;
79+
}
80+
81+
- public function setTraceFromException(\Exception $exception)
82+
+ public function setTraceFromException(\Error $exception)
83+
{
84+
$this->setTrace($exception->getTrace(), $exception->getFile(), $exception->getLine());
85+
}

0 commit comments

Comments
 (0)