Visitar URL original
Merge pull request #19008 from MauricioFauth/template-cache-trigger-e… · phpmyadmin/phpmyadmin@c07d04a · GitHub
Skip to content

Commit c07d04a

Browse files
Merge pull request #19008 from MauricioFauth/template-cache-trigger-error-removal
Remove trigger_error from Template class
2 parents 7d8dba4 + e0d42d2 commit c07d04a

2 files changed

Lines changed: 4 additions & 25 deletions

File tree

‎phpstan-baseline.neon‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14425,11 +14425,6 @@ parameters:
1442514425
count: 1
1442614426
path: src/Table/Table.php
1442714427

14428-
-
14429-
message: "#^Dead catch \\- RuntimeException is never thrown in the try block\\.$#"
14430-
count: 1
14431-
path: src/Template.php
14432-
1443314428
-
1443414429
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
1443514430
count: 1

‎src/Template.php‎

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@
2626
use Twig\RuntimeLoader\ContainerRuntimeLoader;
2727
use Twig\TemplateWrapper;
2828

29-
use function __;
30-
use function sprintf;
31-
use function trigger_error;
32-
33-
use const E_USER_WARNING;
34-
3529
/**
3630
* Handle front end templating
3731
*/
@@ -106,23 +100,13 @@ private function load(string $templateName): TemplateWrapper
106100
}
107101

108102
try {
109-
$template = static::$twig->load($templateName . '.twig');
110-
} catch (RuntimeException $e) {
103+
return static::$twig->load($templateName . '.twig');
104+
} catch (RuntimeException) { // @phpstan-ignore-line thrown by Twig\Cache\FilesystemCache
111105
/* Retry with disabled cache */
112106
static::$twig->setCache(false);
113-
$template = static::$twig->load($templateName . '.twig');
114-
// The trigger error is intentionally after second load
115-
// to avoid triggering error when disabling cache does not solve it.
116-
trigger_error(
117-
sprintf(
118-
__('Error while working with template cache: %s'),
119-
$e->getMessage(),
120-
),
121-
E_USER_WARNING,
122-
);
123-
}
124107

125-
return $template;
108+
return static::$twig->load($templateName . '.twig');
109+
}
126110
}
127111

128112
/**

0 commit comments

Comments
 (0)