Skip to content

Commit beb2b9e

Browse files
authored
Merge pull request #11 from LibreSign/backport/6/stable32
[stable32] fix: scoper
2 parents 4310956 + 31e0ff4 commit beb2b9e

File tree

7 files changed

+71
-63
lines changed

7 files changed

+71
-63
lines changed

composer.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,17 @@
3636
}
3737
},
3838
"require": {
39-
"bamarni/composer-bin-plugin": "^1.8",
39+
"bamarni/composer-bin-plugin": "^1.8.2",
4040
"roave/security-advisories": "dev-latest",
41-
"endroid/qr-code": "^5.1",
42-
"jsignpdf/jsignpdf-php": "^1.3",
41+
"endroid/qr-code": "^5.1.0",
42+
"jsignpdf/jsignpdf-php": "^1.3.1",
4343
"libresign/whatosami": "^0.0.2",
44-
"mikehaertl/php-pdftk": "^0.14.0",
45-
"mpdf/mpdf": "^8.2",
46-
"pagerfanta/pagerfanta": "^4.5",
47-
"phpseclib/phpseclib": "^3.0",
48-
"smalot/pdfparser": "^2.4",
49-
"twig/twig": "^3.20",
50-
"wobeto/email-blur": "^1.0"
44+
"mikehaertl/php-pdftk": "^0.14.2",
45+
"mpdf/mpdf": "^8.2.6",
46+
"pagerfanta/pagerfanta": "^4.7.1",
47+
"phpseclib/phpseclib": "^3.0.47",
48+
"smalot/pdfparser": "^2.12.1",
49+
"twig/twig": "^3.21.1",
50+
"wobeto/email-blur": "^1.0.0"
5151
}
5252
}

composer/mpdf/mpdf/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@
5252
},
5353
"autoload": {
5454
"psr-4": {
55-
"OCA\\Libresign\\Vendor\\OCA\Libresign\Vendor\\Mpdf\\": "src\/"
55+
"OCA\\Libresign\\Vendor\\Mpdf\\": "src\/"
5656
},
5757
"files": [
5858
"src\/functions.php"
5959
]
6060
},
6161
"autoload-dev": {
6262
"psr-4": {
63-
"OCA\\Libresign\\Vendor\\OCA\Libresign\Vendor\\Mpdf\\": "tests\/Mpdf"
63+
"OCA\\Libresign\\Vendor\\Mpdf\\": "tests\/Mpdf"
6464
},
6565
"files": [
6666
"src\/functions-dev.php"

composer/twig/twig/src/Resources/core.php

Lines changed: 44 additions & 44 deletions
Large diffs are not rendered by default.

composer/twig/twig/src/Resources/debug.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*
1818
* @deprecated since Twig 3.9
1919
*/
20-
function \OCA\Libresign\Vendor\twig_var_dump(Environment $env, $context, ...$vars)
20+
function twig_var_dump(Environment $env, $context, ...$vars)
2121
{
2222
trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
2323
DebugExtension::dump($env, $context, ...$vars);

composer/twig/twig/src/Resources/escaper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*
2020
* @deprecated since Twig 3.9
2121
*/
22-
function \OCA\Libresign\Vendor\twig_raw_filter($string)
22+
function twig_raw_filter($string)
2323
{
2424
trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
2525
return $string;
@@ -29,7 +29,7 @@ function \OCA\Libresign\Vendor\twig_raw_filter($string)
2929
*
3030
* @deprecated since Twig 3.9
3131
*/
32-
function \OCA\Libresign\Vendor\twig_escape_filter(Environment $env, $string, $strategy = 'html', $charset = null, $autoescape = \false)
32+
function twig_escape_filter(Environment $env, $string, $strategy = 'html', $charset = null, $autoescape = \false)
3333
{
3434
trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
3535
return $env->getRuntime(EscaperRuntime::class)->escape($string, $strategy, $charset, $autoescape);
@@ -39,7 +39,7 @@ function \OCA\Libresign\Vendor\twig_escape_filter(Environment $env, $string, $st
3939
*
4040
* @deprecated since Twig 3.9
4141
*/
42-
function \OCA\Libresign\Vendor\twig_escape_filter_is_safe(Node $filterArgs)
42+
function twig_escape_filter_is_safe(Node $filterArgs)
4343
{
4444
trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
4545
return EscaperExtension::escapeFilterIsSafe($filterArgs);

composer/twig/twig/src/Resources/string_loader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*
1919
* @deprecated since Twig 3.9
2020
*/
21-
function \OCA\Libresign\Vendor\twig_template_from_string(Environment $env, $template, ?string $name = null) : TemplateWrapper
21+
function twig_template_from_string(Environment $env, $template, ?string $name = null) : TemplateWrapper
2222
{
2323
trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
2424
return StringLoaderExtension::templateFromString($env, $template, $name);

scoper.inc.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,19 @@
2727
'patchers' => [
2828
// patchers for twig
2929
static function (string $filePath, string $prefix, string $content): string {
30+
if (!str_contains($filePath, 'twig/twig') || !str_ends_with($filePath, '.php')) {
31+
return $content;
32+
}
3033
// correct use statements in generated templates
31-
if (preg_match('%twig/src/Node/ModuleNode\\.php$%', $filePath)) {
34+
if (str_ends_with($filePath, 'twig/src/Node/ModuleNode.php')) {
3235
return str_replace('"use Twig\\', '"use ' . str_replace('\\', '\\\\', $prefix) . '\\\\Twig\\', $content);
3336
}
3437

38+
// ignore files where functions are declared
39+
if (str_contains($filePath, 'twig/src/Resources/')) {
40+
return $content;
41+
}
42+
3543
// correctly scope function calls to twig_... globals (which will not be globals anymore) in strings
3644
if (strpos($filePath, 'twig/twig') !== false
3745
|| preg_match('/\\.php$/', $filePath)
@@ -49,7 +57,7 @@ static function (string $filePath, string $prefix, string $content): string {
4957
},
5058
// patchers for Mpdf
5159
static function (string $filePath, string $prefix, string $content): string {
52-
if (!str_contains($filePath, 'mpdf/mpdf')) {
60+
if (!str_contains($filePath, 'mpdf/mpdf') || !str_ends_with($filePath, '.php')) {
5361
return $content;
5462
}
5563
$searchReplacePairs = [

0 commit comments

Comments
 (0)