Last active
June 18, 2025 10:14
-
-
Save sokai/db8dbea4bb47576037a5263b1fd426bb to your computer and use it in GitHub Desktop.
LibreSign: Issue Helper Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php declare(strict_types=1); | |
/** | |
* Some CHECKs and TESTS for https://github.com/LibreSign/libresign/issues/4872 | |
* FYI: this code is very hacky …! | |
* | |
* SETUP | |
* 1. Put this script/file on your server, so it is available by your PHP CLI user and in the browser | |
* * Example (= $SCRIPTPATH): $NCROOTPATH/4872.php | |
* 2. Change the CONFIG part in this script: | |
* * Set "$sLocale" to a locale you want | |
* * Set "$sNcPath" to the root of your NC installation ($NCROOTPATH) | |
* * Set "$aRedact" if needed (to redact this at output) | |
* RUN | |
* 1. Run this script with your NC PHP user ($redactUser) by `php -f $SCRIPTPATH` | |
* 2. Open this script in your browser | |
* 3. → Compare both outputs … | |
*/ | |
// CONFIG | |
$sLocale = 'en_GB.UTF-8'; // ???: 'en_GB.utf8' | |
$sNcPath = '/var/www/PATH/cloud'; | |
$aRedact = [ | |
// Put PATH before single strings/words | |
'/var/www', | |
]; | |
/** DO NOT change from here … **/ | |
// Debug + Header | |
ini_set('display_errors', '1'); | |
ini_set('display_startup_errors', '1'); | |
error_reporting(E_ALL); | |
header('Content-Type: text/plain'); | |
//opcache_invalidate($_SERVER['SCRIPT_FILENAME']); | |
// Lil helpers | |
function out($mPre, $mOutput = '', $bEncl = null) { | |
global $iCountOut, $sHeaderOut; | |
if ($mOutput === true || $mOutput === false) { | |
$mOutput = $mOutput ? 'true' : 'false'; | |
$bEncl = false; | |
} | |
if (is_int($mOutput)) { | |
$bEncl = false; | |
} | |
$bEncl = ($bEncl || $bEncl === null) && $mOutput !== '' ? '"' : ''; | |
$iCounter = !empty($mPre) && !str_starts_with($mPre, PHP_EOL) && !str_starts_with($mPre, '#') && !str_starts_with($mPre, '*') ? $iCountOut++ . '. ' : ''; | |
$sOut = $iCounter . $mPre . ($mOutput !== '' ? ': ' . $bEncl . redact($mOutput) . $bEncl : '') . PHP_EOL; | |
if (str_starts_with($sOut, '#')) { | |
$sOut = (trim($sOut) !== $sHeaderOut ? PHP_EOL : '') . $sOut . PHP_EOL; | |
} | |
echo $sOut; | |
} | |
function redact($mOutput) { | |
if (is_array($mOutput) || is_string($mOutput)) { | |
global $aRedact, $sNcPath; | |
array_unshift($aRedact, dirname(__FILE__), $sNcPath, get_current_user()); | |
foreach ($aRedact as $sRedact) { | |
$mOutput = str_replace($sRedact, '[redacted]', $mOutput); | |
} | |
} | |
return $mOutput; | |
} | |
// Init | |
$iCountOut = 0; | |
$sHeaderOut = '# LibreSign: Issue Helper Script'; | |
out($sHeaderOut); | |
out('* See @GH → https://github.com/LibreSign/libresign/issues/4872'); | |
// SETUP | |
out('## SETUP'); | |
out('PHP > phpversion()', phpversion()); | |
out('PHP > php_sapi_name()', php_sapi_name()); | |
out('Script > $sLocale', $sLocale); | |
$javaPath = trim(`$sNcPath/occ config:app:get libresign java_path`); | |
out('Script > $javaPath', $javaPath); | |
// CHECKS | |
out('## CHECKS'); | |
// CHECKS: PHP locales | |
out('locale_get_default()', locale_get_default()); | |
out('setlocale(LC_ALL, 0)', setlocale(LC_ALL, 0)); | |
// CHECKS: NC functions, adopted … | |
// 20250522: https://github.com/nextcloud/server/blob/e143921896b12f1c4e76b321550eeca02db79952/lib/private/legacy/OC_Util.php#L697 | |
/** | |
* Check if current locale is non-UTF8 | |
* | |
* @return bool | |
*/ | |
function isNonUTF8Locale() { | |
if (function_exists('escapeshellcmd')) { | |
return escapeshellcmd('§') === ''; | |
} elseif (function_exists('escapeshellarg')) { | |
return escapeshellarg('§') === '\'\''; | |
} else { | |
return preg_match('/utf-?8/i', setlocale(LC_CTYPE, 0)) === 0; | |
} | |
} | |
out('isNonUTF8Locale()', isNonUTF8Locale()); | |
/** | |
* Check if the setlocale call does not work. This can happen if the right | |
* local packages are not available on the server. | |
* | |
* @internal | |
*/ | |
function isSetLocaleWorking(): bool { | |
if (isNonUTF8Locale()) { | |
// Borrowed from \Patchwork\Utf8\Bootup::initLocale | |
setlocale(LC_ALL, 'C.UTF-8', 'C'); | |
setlocale(LC_CTYPE, 'en_US.UTF-8', 'fr_FR.UTF-8', 'es_ES.UTF-8', 'de_DE.UTF-8', 'ru_RU.UTF-8', 'pt_BR.UTF-8', 'it_IT.UTF-8', 'ja_JP.UTF-8', 'zh_CN.UTF-8', '0'); | |
// Check again | |
if (isNonUTF8Locale()) { | |
return false; | |
} | |
} | |
return true; | |
} | |
out('isSetLocaleWorking()', isSetLocaleWorking()); | |
// CHECKS: \exec | |
out('\exec("whoami"', \exec('whoami')); | |
\exec('echo $LC_CTYPE', $out, $resp); | |
out('echo $LC_CTYPE', $out[0]); | |
\exec('echo $LANG', $out, $resp); | |
out('echo $LANG', $out[0]); | |
\exec('locale -a', $output, $result_code); | |
out('"locale -a" (implode: ";")', implode(';', $output)); | |
out('\exec("locale charmap")', \exec('locale charmap')); | |
// CHECKS: LibreSign check funtion, adopted … | |
// 20250614: https://github.com/LibreSign/libresign/blob/60ea31950ee8e4c97ec2917f0f82408b6a45f2f8/lib/Service/Install/InstallService.php#L47 | |
const JAVA_VERSION = 'openjdk version "21.0.7" 2025-04-15 LTS'; | |
// 202506114: https://github.com/LibreSign/libresign/blob/60ea31950ee8e4c97ec2917f0f82408b6a45f2f8/lib/Service/Install/ConfigureCheckService.php#L381 | |
if (file_exists($javaPath)) { | |
out('Java binary', $javaPath); | |
\exec($javaPath . ' -version 2>&1', $javaVersion, $resultCode); | |
if (empty($javaVersion)) { | |
out('Java ERROR', 'Failed to execute Java. Sounds that your operational system is blocking the JVM.'); | |
} | |
if ($resultCode !== 0) { | |
out('Java ERROR', 'Failure to check Java version.'); | |
} | |
$javaVersion = current($javaVersion); | |
if ($javaVersion !== JAVA_VERSION) { | |
out('Java ERROR', sprintf('Invalid java version. Found: %s expected: %s', $javaVersion, JAVA_VERSION)); | |
} | |
out('Java version', $javaVersion); | |
\exec($javaPath . ' -XshowSettings:properties -version 2>&1', $output, $resultCode); | |
preg_match('/native.encoding = (?<encoding>.*)\n/', implode("\n", $output), $matches); | |
if (!isset($matches['encoding'])) { | |
out('Java ERROR', 'Java encoding not found.'); | |
} | |
if (!str_contains($matches['encoding'], 'UTF-8')) { | |
out('Java INFO', 'Non-UTF-8 encoding detected. This may cause issues with accented or special characters'); | |
} | |
out('Java encoding', $matches['encoding']); | |
} | |
// TESTS | |
out('## TESTS'); | |
// TESTS: putenv | |
putenv('LC_ALL=' . $sLocale); | |
out('putenv(LC_ALL=' . $sLocale . ') + \exec("locale charmap")', \exec('locale charmap')); | |
// Use the putenv from above | |
if (file_exists($javaPath)) { | |
\exec($javaPath . ' -XshowSettings:properties -version 2>&1', $output, $resultCode); | |
preg_match('/native.encoding = (?<encoding>.*)\n/', implode("\n", $output), $matches); | |
if (!isset($matches['encoding'])) { | |
out('Java ERROR', 'Java encoding not found.'); | |
} | |
if (!str_contains($matches['encoding'], 'UTF-8')) { | |
out('Java INFO', 'Non-UTF-8 encoding detected. This may cause issues with accented or special characters'); | |
} | |
out('Java encoding', $matches['encoding']); | |
} | |
// FYI: same output with "putenv()" + vars: LANG, LANGUAGE | |
// Use putenv() from above + setlocale() | |
setlocale(LC_ALL, $sLocale); | |
if (file_exists($javaPath)) { | |
\exec($javaPath . ' -XshowSettings:properties -version 2>&1', $output, $resultCode); | |
preg_match('/native.encoding = (?<encoding>.*)\n/', implode("\n", $output), $matches); | |
if (!isset($matches['encoding'])) { | |
out('Java ERROR', 'Java encoding not found.'); | |
} | |
if (!str_contains($matches['encoding'], 'UTF-8')) { | |
out('Java INFO', 'Non-UTF-8 encoding detected. This may cause issues with accented or special characters'); | |
} | |
out('Java encoding', $matches['encoding']); | |
} | |
// FYI: same output with "putenv()", "setlocale()" + vars: LANG, LANGUAGE | |
// Why I have multiple "native.encoding" props, but only the ANSI-one is curr. selcted/detected, somehow …!? | |
// → Cause: multiple "Property settings:" at Java settings sets = 3x "Property settings:" with different encoding properties/values | |
out('## INVESTIGATION: Multi Java Settings Sets'); | |
if (file_exists($javaPath)) { | |
// 1. get Java props | |
\exec($javaPath . ' -XshowSettings:properties --version 2>&1', $output, $resultCode); | |
// 2. Separate all "Property settings:" = create instance (array) | |
$aProps = []; | |
$iCountProps = 0; | |
foreach ($output as $prop) { | |
$prop = trim($prop); | |
if ($prop === 'Property settings:') { | |
$iCountProps++; | |
} elseif ($prop !== '') { | |
$aProp = $pieces = explode(' = ', $prop); | |
$sKey = redact(trim($aProp[0])); | |
$sVal = isset($aProp[1]) ? redact(trim($aProp[1])) : ''; | |
$aProps[$iCountProps][$sKey] = $sVal; | |
} | |
} | |
// 3. Output lines count + count of "Property settings:" sets | |
// !!! "$iCountProps-1": "$aProps[0] is no set, it has some general locale settings(??) | |
out('\exec(java -XshowSettings:properties --version 2>&1)', count($output) . ' lines | ' . $iCountProps-1 . ' sets', false); | |
// 4. Output encoding keys from all/3 "Property settings:" instances | |
for ($i = 1; $i < $iCountProps; $i++) { | |
foreach ($aProps[$i] as $sKey => $sVal) { | |
if (str_contains($sKey, 'encoding')) { | |
out($i . ' => ' . $sKey, $sVal); | |
} | |
} | |
} | |
out('### Array Diffs'); | |
out('##### "array_diff_assoc($aProps[1], $aProps[2])"'); | |
print_r(array_diff_assoc($aProps[1], $aProps[2])); | |
out('#### "array_diff_assoc($aProps[1], $aProps[3])"'); | |
print_r(array_diff_assoc($aProps[1], $aProps[3])); | |
out('#### "array_diff_assoc($aProps[2], $aProps[3])"'); | |
print_r(array_diff_assoc($aProps[2], $aProps[3])); | |
out('### All Sets with "print_r()"'); | |
for ($i = 1; $i < $iCountProps; $i++) { | |
print_r($aProps[$i]); | |
} | |
} | |
out(PHP_EOL . date('c')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# LibreSign: Issue Helper Script | |
* See @GH → https://github.com/LibreSign/libresign/issues/4872 | |
## SETUP | |
0. PHP > phpversion(): "8.4.8" | |
1. PHP > php_sapi_name(): "fpm-fcgi" | |
2. Script > $sLocale: "en_GB.UTF-8" | |
3. Script > $javaPath: "[redacted]_data/appdata_och7ky5vropk/libresign/x86_64/linux/java/jdk-21.0.7+6-jre/bin/java" | |
## CHECKS | |
4. locale_get_default(): "en_GB.UTF-8" | |
5. setlocale(LC_ALL, 0): "LC_CTYPE=C.UTF-8;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C" | |
6. isNonUTF8Locale(): false | |
7. isSetLocaleWorking(): true | |
8. \exec("whoami": "[redacted]" | |
9. echo $LC_CTYPE | |
10. echo $LANG | |
11. "locale -a" (implode: ";"): "C;C.utf8;POSIX;de_DE.utf8;en_GB.utf8;en_US.utf8" | |
12. \exec("locale charmap"): "ANSI_X3.4-1968" | |
13. Java binary: "[redacted]_data/appdata_och7ky5vropk/libresign/x86_64/linux/java/jdk-21.0.7+6-jre/bin/java" | |
14. Java version: "openjdk version "21.0.7" 2025-04-15 LTS" | |
15. Java INFO: "Non-UTF-8 encoding detected. This may cause issues with accented or special characters" | |
16. Java encoding: "ANSI_X3.4-1968" | |
## TESTS | |
17. putenv(LC_ALL=en_GB.UTF-8) + \exec("locale charmap"): "UTF-8" | |
18. Java INFO: "Non-UTF-8 encoding detected. This may cause issues with accented or special characters" | |
19. Java encoding: "ANSI_X3.4-1968" | |
20. Java INFO: "Non-UTF-8 encoding detected. This may cause issues with accented or special characters" | |
21. Java encoding: "ANSI_X3.4-1968" | |
## INVESTIGATION: Multi Java Settings Sets | |
22. \exec(java -XshowSettings:properties --version 2>&1): 230 lines | 3 sets | |
23. 1 => file.encoding: "UTF-8" | |
24. 1 => native.encoding: "ANSI_X3.4-1968" | |
25. 1 => stderr.encoding: "ANSI_X3.4-1968" | |
26. 1 => stdout.encoding: "ANSI_X3.4-1968" | |
27. 1 => sun.io.unicode.encoding: "UnicodeLittle" | |
28. 1 => sun.jnu.encoding: "ANSI_X3.4-1968" | |
29. 2 => file.encoding: "UTF-8" | |
30. 2 => native.encoding: "UTF-8" | |
31. 2 => stderr.encoding: "UTF-8" | |
32. 2 => stdout.encoding: "UTF-8" | |
33. 2 => sun.io.unicode.encoding: "UnicodeLittle" | |
34. 2 => sun.jnu.encoding: "UTF-8" | |
35. 3 => file.encoding: "UTF-8" | |
36. 3 => native.encoding: "UTF-8" | |
37. 3 => stderr.encoding: "UTF-8" | |
38. 3 => stdout.encoding: "UTF-8" | |
39. 3 => sun.io.unicode.encoding: "UnicodeLittle" | |
40. 3 => sun.jnu.encoding: "UTF-8" | |
### Array Diffs | |
##### "array_diff_assoc($aProps[1], $aProps[2])" | |
Array | |
( | |
[native.encoding] => ANSI_X3.4-1968 | |
[stderr.encoding] => ANSI_X3.4-1968 | |
[stdout.encoding] => ANSI_X3.4-1968 | |
[sun.jnu.encoding] => ANSI_X3.4-1968 | |
[user.country] => US | |
) | |
#### "array_diff_assoc($aProps[1], $aProps[3])" | |
Array | |
( | |
[native.encoding] => ANSI_X3.4-1968 | |
[stderr.encoding] => ANSI_X3.4-1968 | |
[stdout.encoding] => ANSI_X3.4-1968 | |
[sun.jnu.encoding] => ANSI_X3.4-1968 | |
[user.country] => US | |
) | |
#### "array_diff_assoc($aProps[2], $aProps[3])" | |
Array | |
( | |
) | |
### All Sets with "print_r()" | |
Array | |
( | |
[file.encoding] => UTF-8 | |
[file.separator] => / | |
[java.class.path =] => | |
[java.class.version] => 65.0 | |
[java.home] => [redacted]_data/appdata_och7ky5vropk/libresign/x86_64/linux/java/jdk-21.0.7+6-jre | |
[java.io.tmpdir] => /tmp | |
[java.library.path] => /usr/java/packages/lib | |
[/usr/lib64] => | |
[/lib64] => | |
[/lib] => | |
[/usr/lib] => | |
[java.runtime.name] => OpenJDK Runtime Environment | |
[java.runtime.version] => 21.0.7+6-LTS | |
[java.specification.name] => Java Platform API Specification | |
[java.specification.vendor] => Oracle Corporation | |
[java.specification.version] => 21 | |
[java.vendor] => Eclipse Adoptium | |
[java.vendor.url] => https://adoptium.net/ | |
[java.vendor.url.bug] => https://github.com/adoptium/adoptium-support/issues | |
[java.vendor.version] => Temurin-21.0.7+6 | |
[java.version] => 21.0.7 | |
[java.version.date] => 2025-04-15 | |
[java.vm.compressedOopsMode] => Zero based | |
[java.vm.info] => mixed mode, sharing | |
[java.vm.name] => OpenJDK 64-Bit Server VM | |
[java.vm.specification.name] => Java Virtual Machine Specification | |
[java.vm.specification.vendor] => Oracle Corporation | |
[java.vm.specification.version] => 21 | |
[java.vm.vendor] => Eclipse Adoptium | |
[java.vm.version] => 21.0.7+6-LTS | |
[jdk.debug] => release | |
[line.separator] => \n | |
[native.encoding] => ANSI_X3.4-1968 | |
[os.arch] => amd64 | |
[os.name] => Linux | |
[os.version] => 6.1.0-37-amd64 | |
[path.separator] => : | |
[stderr.encoding] => ANSI_X3.4-1968 | |
[stdout.encoding] => ANSI_X3.4-1968 | |
[sun.arch.data.model] => 64 | |
[sun.boot.library.path] => [redacted]_data/appdata_och7ky5vropk/libresign/x86_64/linux/java/jdk-21.0.7+6-jre/lib | |
[sun.cpu.endian] => little | |
[sun.io.unicode.encoding] => UnicodeLittle | |
[sun.java.launcher] => SUN_STANDARD | |
[sun.jnu.encoding] => ANSI_X3.4-1968 | |
[sun.management.compiler] => HotSpot 64-Bit Tiered Compilers | |
[user.country] => US | |
[user.dir] => [redacted] | |
[user.home] => [redacted]/[redacted]/ | |
[user.language] => en | |
[user.name] => [redacted] | |
[openjdk version "21.0.7" 2025-04-15 LTS] => | |
[OpenJDK Runtime Environment Temurin-21.0.7+6 (build 21.0.7+6-LTS)] => | |
[OpenJDK 64-Bit Server VM Temurin-21.0.7+6 (build 21.0.7+6-LTS, mixed mode, sharing)] => | |
) | |
Array | |
( | |
[file.encoding] => UTF-8 | |
[file.separator] => / | |
[java.class.path =] => | |
[java.class.version] => 65.0 | |
[java.home] => [redacted]_data/appdata_och7ky5vropk/libresign/x86_64/linux/java/jdk-21.0.7+6-jre | |
[java.io.tmpdir] => /tmp | |
[java.library.path] => /usr/java/packages/lib | |
[/usr/lib64] => | |
[/lib64] => | |
[/lib] => | |
[/usr/lib] => | |
[java.runtime.name] => OpenJDK Runtime Environment | |
[java.runtime.version] => 21.0.7+6-LTS | |
[java.specification.name] => Java Platform API Specification | |
[java.specification.vendor] => Oracle Corporation | |
[java.specification.version] => 21 | |
[java.vendor] => Eclipse Adoptium | |
[java.vendor.url] => https://adoptium.net/ | |
[java.vendor.url.bug] => https://github.com/adoptium/adoptium-support/issues | |
[java.vendor.version] => Temurin-21.0.7+6 | |
[java.version] => 21.0.7 | |
[java.version.date] => 2025-04-15 | |
[java.vm.compressedOopsMode] => Zero based | |
[java.vm.info] => mixed mode, sharing | |
[java.vm.name] => OpenJDK 64-Bit Server VM | |
[java.vm.specification.name] => Java Virtual Machine Specification | |
[java.vm.specification.vendor] => Oracle Corporation | |
[java.vm.specification.version] => 21 | |
[java.vm.vendor] => Eclipse Adoptium | |
[java.vm.version] => 21.0.7+6-LTS | |
[jdk.debug] => release | |
[line.separator] => \n | |
[native.encoding] => UTF-8 | |
[os.arch] => amd64 | |
[os.name] => Linux | |
[os.version] => 6.1.0-37-amd64 | |
[path.separator] => : | |
[stderr.encoding] => UTF-8 | |
[stdout.encoding] => UTF-8 | |
[sun.arch.data.model] => 64 | |
[sun.boot.library.path] => [redacted]_data/appdata_och7ky5vropk/libresign/x86_64/linux/java/jdk-21.0.7+6-jre/lib | |
[sun.cpu.endian] => little | |
[sun.io.unicode.encoding] => UnicodeLittle | |
[sun.java.launcher] => SUN_STANDARD | |
[sun.jnu.encoding] => UTF-8 | |
[sun.management.compiler] => HotSpot 64-Bit Tiered Compilers | |
[user.country] => GB | |
[user.dir] => [redacted] | |
[user.home] => [redacted]/[redacted]/ | |
[user.language] => en | |
[user.name] => [redacted] | |
[openjdk version "21.0.7" 2025-04-15 LTS] => | |
[OpenJDK Runtime Environment Temurin-21.0.7+6 (build 21.0.7+6-LTS)] => | |
[OpenJDK 64-Bit Server VM Temurin-21.0.7+6 (build 21.0.7+6-LTS, mixed mode, sharing)] => | |
) | |
Array | |
( | |
[file.encoding] => UTF-8 | |
[file.separator] => / | |
[java.class.path =] => | |
[java.class.version] => 65.0 | |
[java.home] => [redacted]_data/appdata_och7ky5vropk/libresign/x86_64/linux/java/jdk-21.0.7+6-jre | |
[java.io.tmpdir] => /tmp | |
[java.library.path] => /usr/java/packages/lib | |
[/usr/lib64] => | |
[/lib64] => | |
[/lib] => | |
[/usr/lib] => | |
[java.runtime.name] => OpenJDK Runtime Environment | |
[java.runtime.version] => 21.0.7+6-LTS | |
[java.specification.name] => Java Platform API Specification | |
[java.specification.vendor] => Oracle Corporation | |
[java.specification.version] => 21 | |
[java.vendor] => Eclipse Adoptium | |
[java.vendor.url] => https://adoptium.net/ | |
[java.vendor.url.bug] => https://github.com/adoptium/adoptium-support/issues | |
[java.vendor.version] => Temurin-21.0.7+6 | |
[java.version] => 21.0.7 | |
[java.version.date] => 2025-04-15 | |
[java.vm.compressedOopsMode] => Zero based | |
[java.vm.info] => mixed mode, sharing | |
[java.vm.name] => OpenJDK 64-Bit Server VM | |
[java.vm.specification.name] => Java Virtual Machine Specification | |
[java.vm.specification.vendor] => Oracle Corporation | |
[java.vm.specification.version] => 21 | |
[java.vm.vendor] => Eclipse Adoptium | |
[java.vm.version] => 21.0.7+6-LTS | |
[jdk.debug] => release | |
[line.separator] => \n | |
[native.encoding] => UTF-8 | |
[os.arch] => amd64 | |
[os.name] => Linux | |
[os.version] => 6.1.0-37-amd64 | |
[path.separator] => : | |
[stderr.encoding] => UTF-8 | |
[stdout.encoding] => UTF-8 | |
[sun.arch.data.model] => 64 | |
[sun.boot.library.path] => [redacted]_data/appdata_och7ky5vropk/libresign/x86_64/linux/java/jdk-21.0.7+6-jre/lib | |
[sun.cpu.endian] => little | |
[sun.io.unicode.encoding] => UnicodeLittle | |
[sun.java.launcher] => SUN_STANDARD | |
[sun.jnu.encoding] => UTF-8 | |
[sun.management.compiler] => HotSpot 64-Bit Tiered Compilers | |
[user.country] => GB | |
[user.dir] => [redacted] | |
[user.home] => [redacted]/[redacted]/ | |
[user.language] => en | |
[user.name] => [redacted] | |
[openjdk version "21.0.7" 2025-04-15 LTS] => | |
[OpenJDK Runtime Environment Temurin-21.0.7+6 (build 21.0.7+6-LTS)] => | |
[OpenJDK 64-Bit Server VM Temurin-21.0.7+6 (build 21.0.7+6-LTS, mixed mode, sharing)] => | |
) | |
2025-06-17T21:29:01+02:00 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# LibreSign: Issue Helper Script | |
* See @GH → https://github.com/LibreSign/libresign/issues/4872 | |
## SETUP | |
0. PHP > phpversion(): "8.4.8" | |
1. PHP > php_sapi_name(): "cli" | |
2. Script > $sLocale: "en_GB.UTF-8" | |
3. Script > $javaPath: "[redacted]_data/appdata_och7ky5vropk/libresign/x86_64/linux/java/jdk-21.0.7+6-jre/bin/java" | |
## CHECKS | |
4. locale_get_default(): "en_GB.UTF-8" | |
5. setlocale(LC_ALL, 0): "LC_CTYPE=C.UTF-8;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C" | |
6. isNonUTF8Locale(): false | |
7. isSetLocaleWorking(): true | |
8. \exec("whoami": "[redacted]" | |
9. echo $LC_CTYPE | |
10. echo $LANG | |
11. "locale -a" (implode: ";"): "C;C.utf8;de_DE.utf8;en_GB.utf8;en_US.utf8;POSIX" | |
12. \exec("locale charmap"): "UTF-8" | |
13. Java binary: "[redacted]_data/appdata_och7ky5vropk/libresign/x86_64/linux/java/jdk-21.0.7+6-jre/bin/java" | |
14. Java version: "openjdk version "21.0.7" 2025-04-15 LTS" | |
15. Java encoding: "UTF-8" | |
## TESTS | |
16. putenv(LC_ALL=en_GB.UTF-8) + \exec("locale charmap"): "UTF-8" | |
17. Java encoding: "UTF-8" | |
18. Java encoding: "UTF-8" | |
## INVESTIGATION: Multi Java Settings Sets | |
19. \exec(java -XshowSettings:properties --version 2>&1): 230 lines | 3 sets | |
20. 1 => file.encoding: "UTF-8" | |
21. 1 => native.encoding: "UTF-8" | |
22. 1 => stderr.encoding: "UTF-8" | |
23. 1 => stdout.encoding: "UTF-8" | |
24. 1 => sun.io.unicode.encoding: "UnicodeLittle" | |
25. 1 => sun.jnu.encoding: "UTF-8" | |
26. 2 => file.encoding: "UTF-8" | |
27. 2 => native.encoding: "UTF-8" | |
28. 2 => stderr.encoding: "UTF-8" | |
29. 2 => stdout.encoding: "UTF-8" | |
30. 2 => sun.io.unicode.encoding: "UnicodeLittle" | |
31. 2 => sun.jnu.encoding: "UTF-8" | |
32. 3 => file.encoding: "UTF-8" | |
33. 3 => native.encoding: "UTF-8" | |
34. 3 => stderr.encoding: "UTF-8" | |
35. 3 => stdout.encoding: "UTF-8" | |
36. 3 => sun.io.unicode.encoding: "UnicodeLittle" | |
37. 3 => sun.jnu.encoding: "UTF-8" | |
### Array Diffs | |
##### "array_diff_assoc($aProps[1], $aProps[2])" | |
Array | |
( | |
) | |
#### "array_diff_assoc($aProps[1], $aProps[3])" | |
Array | |
( | |
) | |
#### "array_diff_assoc($aProps[2], $aProps[3])" | |
Array | |
( | |
) | |
### All Sets with "print_r()" | |
Array | |
( | |
[file.encoding] => UTF-8 | |
[file.separator] => / | |
[java.class.path =] => | |
[java.class.version] => 65.0 | |
[java.home] => [redacted]_data/appdata_och7ky5vropk/libresign/x86_64/linux/java/jdk-21.0.7+6-jre | |
[java.io.tmpdir] => /tmp | |
[java.library.path] => /usr/java/packages/lib | |
[/usr/lib64] => | |
[/lib64] => | |
[/lib] => | |
[/usr/lib] => | |
[java.runtime.name] => OpenJDK Runtime Environment | |
[java.runtime.version] => 21.0.7+6-LTS | |
[java.specification.name] => Java Platform API Specification | |
[java.specification.vendor] => Oracle Corporation | |
[java.specification.version] => 21 | |
[java.vendor] => Eclipse Adoptium | |
[java.vendor.url] => https://adoptium.net/ | |
[java.vendor.url.bug] => https://github.com/adoptium/adoptium-support/issues | |
[java.vendor.version] => Temurin-21.0.7+6 | |
[java.version] => 21.0.7 | |
[java.version.date] => 2025-04-15 | |
[java.vm.compressedOopsMode] => Zero based | |
[java.vm.info] => mixed mode, sharing | |
[java.vm.name] => OpenJDK 64-Bit Server VM | |
[java.vm.specification.name] => Java Virtual Machine Specification | |
[java.vm.specification.vendor] => Oracle Corporation | |
[java.vm.specification.version] => 21 | |
[java.vm.vendor] => Eclipse Adoptium | |
[java.vm.version] => 21.0.7+6-LTS | |
[jdk.debug] => release | |
[line.separator] => \n | |
[native.encoding] => UTF-8 | |
[os.arch] => amd64 | |
[os.name] => Linux | |
[os.version] => 6.1.0-37-amd64 | |
[path.separator] => : | |
[stderr.encoding] => UTF-8 | |
[stdout.encoding] => UTF-8 | |
[sun.arch.data.model] => 64 | |
[sun.boot.library.path] => [redacted]_data/appdata_och7ky5vropk/libresign/x86_64/linux/java/jdk-21.0.7+6-jre/lib | |
[sun.cpu.endian] => little | |
[sun.io.unicode.encoding] => UnicodeLittle | |
[sun.java.launcher] => SUN_STANDARD | |
[sun.jnu.encoding] => UTF-8 | |
[sun.management.compiler] => HotSpot 64-Bit Tiered Compilers | |
[user.country] => GB | |
[user.dir] => [redacted]/[redacted] | |
[user.home] => [redacted]/[redacted]/ | |
[user.language] => en | |
[user.name] => [redacted] | |
[openjdk version "21.0.7" 2025-04-15 LTS] => | |
[OpenJDK Runtime Environment Temurin-21.0.7+6 (build 21.0.7+6-LTS)] => | |
[OpenJDK 64-Bit Server VM Temurin-21.0.7+6 (build 21.0.7+6-LTS, mixed mode, sharing)] => | |
) | |
Array | |
( | |
[file.encoding] => UTF-8 | |
[file.separator] => / | |
[java.class.path =] => | |
[java.class.version] => 65.0 | |
[java.home] => [redacted]_data/appdata_och7ky5vropk/libresign/x86_64/linux/java/jdk-21.0.7+6-jre | |
[java.io.tmpdir] => /tmp | |
[java.library.path] => /usr/java/packages/lib | |
[/usr/lib64] => | |
[/lib64] => | |
[/lib] => | |
[/usr/lib] => | |
[java.runtime.name] => OpenJDK Runtime Environment | |
[java.runtime.version] => 21.0.7+6-LTS | |
[java.specification.name] => Java Platform API Specification | |
[java.specification.vendor] => Oracle Corporation | |
[java.specification.version] => 21 | |
[java.vendor] => Eclipse Adoptium | |
[java.vendor.url] => https://adoptium.net/ | |
[java.vendor.url.bug] => https://github.com/adoptium/adoptium-support/issues | |
[java.vendor.version] => Temurin-21.0.7+6 | |
[java.version] => 21.0.7 | |
[java.version.date] => 2025-04-15 | |
[java.vm.compressedOopsMode] => Zero based | |
[java.vm.info] => mixed mode, sharing | |
[java.vm.name] => OpenJDK 64-Bit Server VM | |
[java.vm.specification.name] => Java Virtual Machine Specification | |
[java.vm.specification.vendor] => Oracle Corporation | |
[java.vm.specification.version] => 21 | |
[java.vm.vendor] => Eclipse Adoptium | |
[java.vm.version] => 21.0.7+6-LTS | |
[jdk.debug] => release | |
[line.separator] => \n | |
[native.encoding] => UTF-8 | |
[os.arch] => amd64 | |
[os.name] => Linux | |
[os.version] => 6.1.0-37-amd64 | |
[path.separator] => : | |
[stderr.encoding] => UTF-8 | |
[stdout.encoding] => UTF-8 | |
[sun.arch.data.model] => 64 | |
[sun.boot.library.path] => [redacted]_data/appdata_och7ky5vropk/libresign/x86_64/linux/java/jdk-21.0.7+6-jre/lib | |
[sun.cpu.endian] => little | |
[sun.io.unicode.encoding] => UnicodeLittle | |
[sun.java.launcher] => SUN_STANDARD | |
[sun.jnu.encoding] => UTF-8 | |
[sun.management.compiler] => HotSpot 64-Bit Tiered Compilers | |
[user.country] => GB | |
[user.dir] => [redacted]/[redacted] | |
[user.home] => [redacted]/[redacted]/ | |
[user.language] => en | |
[user.name] => [redacted] | |
[openjdk version "21.0.7" 2025-04-15 LTS] => | |
[OpenJDK Runtime Environment Temurin-21.0.7+6 (build 21.0.7+6-LTS)] => | |
[OpenJDK 64-Bit Server VM Temurin-21.0.7+6 (build 21.0.7+6-LTS, mixed mode, sharing)] => | |
) | |
Array | |
( | |
[file.encoding] => UTF-8 | |
[file.separator] => / | |
[java.class.path =] => | |
[java.class.version] => 65.0 | |
[java.home] => [redacted]_data/appdata_och7ky5vropk/libresign/x86_64/linux/java/jdk-21.0.7+6-jre | |
[java.io.tmpdir] => /tmp | |
[java.library.path] => /usr/java/packages/lib | |
[/usr/lib64] => | |
[/lib64] => | |
[/lib] => | |
[/usr/lib] => | |
[java.runtime.name] => OpenJDK Runtime Environment | |
[java.runtime.version] => 21.0.7+6-LTS | |
[java.specification.name] => Java Platform API Specification | |
[java.specification.vendor] => Oracle Corporation | |
[java.specification.version] => 21 | |
[java.vendor] => Eclipse Adoptium | |
[java.vendor.url] => https://adoptium.net/ | |
[java.vendor.url.bug] => https://github.com/adoptium/adoptium-support/issues | |
[java.vendor.version] => Temurin-21.0.7+6 | |
[java.version] => 21.0.7 | |
[java.version.date] => 2025-04-15 | |
[java.vm.compressedOopsMode] => Zero based | |
[java.vm.info] => mixed mode, sharing | |
[java.vm.name] => OpenJDK 64-Bit Server VM | |
[java.vm.specification.name] => Java Virtual Machine Specification | |
[java.vm.specification.vendor] => Oracle Corporation | |
[java.vm.specification.version] => 21 | |
[java.vm.vendor] => Eclipse Adoptium | |
[java.vm.version] => 21.0.7+6-LTS | |
[jdk.debug] => release | |
[line.separator] => \n | |
[native.encoding] => UTF-8 | |
[os.arch] => amd64 | |
[os.name] => Linux | |
[os.version] => 6.1.0-37-amd64 | |
[path.separator] => : | |
[stderr.encoding] => UTF-8 | |
[stdout.encoding] => UTF-8 | |
[sun.arch.data.model] => 64 | |
[sun.boot.library.path] => [redacted]_data/appdata_och7ky5vropk/libresign/x86_64/linux/java/jdk-21.0.7+6-jre/lib | |
[sun.cpu.endian] => little | |
[sun.io.unicode.encoding] => UnicodeLittle | |
[sun.java.launcher] => SUN_STANDARD | |
[sun.jnu.encoding] => UTF-8 | |
[sun.management.compiler] => HotSpot 64-Bit Tiered Compilers | |
[user.country] => GB | |
[user.dir] => [redacted]/[redacted] | |
[user.home] => [redacted]/[redacted]/ | |
[user.language] => en | |
[user.name] => [redacted] | |
[openjdk version "21.0.7" 2025-04-15 LTS] => | |
[OpenJDK Runtime Environment Temurin-21.0.7+6 (build 21.0.7+6-LTS)] => | |
[OpenJDK 64-Bit Server VM Temurin-21.0.7+6 (build 21.0.7+6-LTS, mixed mode, sharing)] => | |
) | |
2025-06-17T19:24:55+00:00 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--------- ---------- --------------------------------------------------------------------------------------------------------------------------------------------- ----- | |
Status Resource Message Tip | |
--------- ---------- --------------------------------------------------------------------------------------------------------------------------------------------- ----- | |
success java Java version: openjdk version "21.0.7" 2025-04-15 LTS | |
success java Java binary: [redacted]_data/appdata_och7ky5vropk/libresign/x86_64/linux/java/jdk-21.0.7+6-jre/bin/java | |
success pdftk PDFtk version: 3.3.3 | |
success pdftk PDFtk path: [redacted]_data/appdata_och7ky5vropk/libresign/x86_64/pdftk/pdftk.jar | |
success jsignpdf JSignPdf version: 2.3.0 | |
success jsignpdf JSignPdf path: [redacted]_data/appdata_och7ky5vropk/libresign/x86_64/jsignpdf/jsignpdf-2.3.0/JSignPdf.jar | |
success pdfsig pdfsig version: 22.12.0 | |
success pdfinfo pdfinfo version: 22.12.0 | |
--------- ---------- --------------------------------------------------------------------------------------------------------------------------------------------- ----- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment