Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LibreSign Conflicts with Pico CMS #3795

Closed
smolinde opened this issue Oct 20, 2024 · 9 comments · Fixed by #3808
Closed

LibreSign Conflicts with Pico CMS #3795

smolinde opened this issue Oct 20, 2024 · 9 comments · Fixed by #3808
Labels
bug Something isn't working

Comments

@smolinde
Copy link

Describe the bug
When having Pico CMS enabled, opening either LibreSign admin or app page results in a HTTP 500 error.

To Reproduce
Steps to reproduce the behavior:

  • Open Nextcloud
  • Have Pico CMS enabled
  • In Administration Settings, open LibreSign
  • Page displays HTTP 500 error

Expected behavior
LibreSign and Pico CMS should work independently and don't conflict with each other.

Environment information (please complete the following information):

  • OS: Ubuntu 24.04.1 LTS, Raspberry Pi 5 (aarch64)
  • Browser: Opera Version: 114.0.5282.102, Safari on iOS 18.0.1
  • LibreSign Version 10.0.2
  • Pico CMS Version 1.0.21
  • Nextcloud Server Version 30.0.1.2
  • Logs:
{"reqId":"tuw7XMyfsRkhEe0pT8k5","level":3,"time":"2024-10-20T13:48:32+00:00","remoteAddr":"XXX.XXX.XXX.XXX","user":"REMOVED","app":"PHP","method":"GET","url":"/settings/admin/libresign","message":"Cannot redeclare twig_cycle() (previously declared in /var/www/nextcloud/apps/libresign/vendor/twig/twig/src/Resources/core.php:20) at /var/www/nextcloud/apps/cms_pico/vendor/twig/twig/src/Extension/CoreExtension.php#333","userAgent":"Mozilla/5.0 (iPhone; CPU iPhone OS 18_0_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0.1 Mobile/15E148 Safari/604.1","version":"30.0.1.2","data":{"app":"PHP"}}
{"reqId":"xd1BTL17fnVMbBKlWkU6","level":3,"time":"2024-10-20T13:48:33+00:00","remoteAddr":"XXX.XXX.XXX.XXX","user":"REMOVED","app":"PHP","method":"GET","url":"/settings/admin/libresign","message":"Cannot redeclare twig_cycle() (previously declared in /var/www/nextcloud/apps/libresign/vendor/twig/twig/src/Resources/core.php:20) at /var/www/nextcloud/apps/cms_pico/vendor/twig/twig/src/Extension/CoreExtension.php#333","userAgent":"Mozilla/5.0 (iPhone; CPU iPhone OS 18_0_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0.1 Mobile/15E148 Safari/604.1","version":"30.0.1.2","data":{"app":"PHP"}}
{"reqId":"vo2ScxgIUKnaOTZS8ibQ","level":3,"time":"2024-10-20T13:48:34+00:00","remoteAddr":"XXX.XXX.XXX.XXX","user":"REMOVED","app":"PHP","method":"GET","url":"/settings/admin/libresign","message":"Cannot redeclare twig_cycle() (previously declared in /var/www/nextcloud/apps/libresign/vendor/twig/twig/src/Resources/core.php:20) at /var/www/nextcloud/apps/cms_pico/vendor/twig/twig/src/Extension/CoreExtension.php#333","userAgent":"Mozilla/5.0 (iPhone; CPU iPhone OS 18_0_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0.1 Mobile/15E148 Safari/604.1","version":"30.0.1.2","data":{"app":"PHP"}}
{"reqId":"Sao4lXsYA2TPybT2BnKu","level":3,"time":"2024-10-20T13:49:34+00:00","remoteAddr":"XXX.XXX.XXX.XXX","user":"REMOVED","app":"PHP","method":"GET","url":"/apps/libresign/","message":"Cannot redeclare twig_cycle() (previously declared in /var/www/nextcloud/apps/libresign/vendor/twig/twig/src/Resources/core.php:20) at /var/www/nextcloud/apps/cms_pico/vendor/twig/twig/src/Extension/CoreExtension.php#333","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 OPR/114.0.0.0","version":"30.0.1.2","data":{"app":"PHP"}}
{"reqId":"jjKt4lzSexKF0oAdORwT","level":3,"time":"2024-10-20T13:51:53+00:00","remoteAddr":"XXX.XXX.XXX.XXX","user":"REMOVED","app":"PHP","method":"GET","url":"/apps/libresign/","message":"Cannot redeclare twig_cycle() (previously declared in /var/www/nextcloud/apps/libresign/vendor/twig/twig/src/Resources/core.php:20) at /var/www/nextcloud/apps/cms_pico/vendor/twig/twig/src/Extension/CoreExtension.php#333","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 OPR/114.0.0.0","version":"30.0.1.2","data":{"app":"PHP"}}
{"reqId":"7C90WyVKT3K35DhxOlgF","level":3,"time":"2024-10-20T13:52:05+00:00","remoteAddr":"XXX.XXX.XXX.XXX","user":"REMOVED","app":"PHP","method":"GET","url":"/settings/admin/libresign","message":"Cannot redeclare twig_cycle() (previously declared in /var/www/nextcloud/apps/libresign/vendor/twig/twig/src/Resources/core.php:20) at /var/www/nextcloud/apps/cms_pico/vendor/twig/twig/src/Extension/CoreExtension.php#333","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 OPR/114.0.0.0","version":"30.0.1.2","data":{"app":"PHP"}}
{"reqId":"crz13IMcTBXaAEtSr0bu","level":3,"time":"2024-10-20T13:52:41+00:00","remoteAddr":"XXX.XXX.XXX.XXX","user":"REMOVED","app":"PHP","method":"GET","url":"/settings/admin/libresign","message":"Cannot redeclare twig_cycle() (previously declared in /var/www/nextcloud/apps/libresign/vendor/twig/twig/src/Resources/core.php:20) at /var/www/nextcloud/apps/cms_pico/vendor/twig/twig/src/Extension/CoreExtension.php#333","userAgent":"Mozilla/5.0 (iPhone; CPU iPhone OS 18_0_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0.1 Mobile/15E148 Safari/604.1","version":"30.0.1.2","data":{"app":"PHP"}}
{"reqId":"VegEpIG8R5Dn6jDhc1b5","level":3,"time":"2024-10-20T13:52:49+00:00","remoteAddr":"XXX.XXX.XXX.XXX","user":"REMOVED","app":"PHP","method":"GET","url":"/settings/admin/libresign","message":"Cannot redeclare twig_cycle() (previously declared in /var/www/nextcloud/apps/libresign/vendor/twig/twig/src/Resources/core.php:20) at /var/www/nextcloud/apps/cms_pico/vendor/twig/twig/src/Extension/CoreExtension.php#333","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 OPR/114.0.0.0","version":"30.0.1.2","data":{"app":"PHP"}}
{"reqId":"iAvxjDNuMzEJzu953VXF","level":3,"time":"2024-10-20T13:53:13+00:00","remoteAddr":"XXX.XXX.XXX.XXX","user":"REMOVED","app":"PHP","method":"GET","url":"/settings/admin/libresign","message":"Cannot redeclare twig_cycle() (previously declared in /var/www/nextcloud/apps/libresign/vendor/twig/twig/src/Resources/core.php:20) at /var/www/nextcloud/apps/cms_pico/vendor/twig/twig/src/Extension/CoreExtension.php#333","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 OPR/114.0.0.0","version":"30.0.1.2","data":{"app":"PHP"}}

Additional context
I am aware of the fact that Pico CMS is deprecated and is not developed anymore. However, it would be still great if I could use both at the same time. When I try to re-enable Pico CMS, I get:
Error: This app cannot be enabled because it makes the server unstable

@smolinde smolinde added the bug Something isn't working label Oct 20, 2024
@vitormattos
Copy link
Member

vitormattos commented Oct 21, 2024

Hi @smolinde could you check if this PR fix your scenario?

You can do this applying the changes of this PR at your environment and checking if when you open LibreSign settings will work fine.

@smolinde
Copy link
Author

I have cloned from the fix branch into the apps directory of my NC installation, however I get the following message:
App "LibreSign" cannot be installed because it is not compatible with this version of the server.

@smolinde
Copy link
Author

smolinde commented Oct 21, 2024

I handled this issue by simply overwriting MinVersion to 30 in appinfo/info.xml. However, when I now try to activate the app via OCC command, I receive:

An unhandled exception has been thrown:
Error: Failed opening required '/var/www/nextcloud/apps/libresign/composer/../vendor/autoload.php' (include_path='/var/www/nextcloud/apps/news/vendor/pear/net_url2:/var/www/nextcloud/3rdparty/pear/archive_tar:/var/www/nextcloud/3rdparty/pear/console_getopt:/var/www/nextcloud/3rdparty/pear/pear-core-minimal/src:/var/www/nextcloud/3rdparty/pear/pear_exception:/var/www/nextcloud/apps') in /var/www/nextcloud/apps/libresign/composer/autoload.php:9
Stack trace:
#0 /var/www/nextcloud/lib/private/legacy/OC_App.php(118): require_once()
#1 /var/www/nextcloud/lib/private/AppFramework/Bootstrap/Coordinator.php(76): OC_App::registerAutoloading()
#2 /var/www/nextcloud/lib/private/AppFramework/Bootstrap/Coordinator.php(52): OC\AppFramework\Bootstrap\Coordinator->registerApps()
#3 /var/www/nextcloud/lib/private/Installer.php(95): OC\AppFramework\Bootstrap\Coordinator->runLazyRegistration()
#4 /var/www/nextcloud/core/Command/App/Enable.php(93): OC\Installer->installApp()
#5 /var/www/nextcloud/core/Command/App/Enable.php(63): OC\Core\Command\App\Enable->enableApp()
#6 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(298): OC\Core\Command\App\Enable->execute()
#7 /var/www/nextcloud/3rdparty/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run()
#8 /var/www/nextcloud/3rdparty/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()
#9 /var/www/nextcloud/3rdparty/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#10 /var/www/nextcloud/lib/private/Console/Application.php(183): Symfony\Component\Console\Application->run()
#11 /var/www/nextcloud/console.php(87): OC\Console\Application->run()
#12 /var/www/nextcloud/occ(11): require_once('...')
#13 {main}

@vitormattos
Copy link
Member

Don't clone from the fix branch. This branch is made to Nextcloud 31. Only get the changes that I made and apply over your file. This changes:

https://github.com/LibreSign/libresign/pull/3808/files

You can apply handmade changing the file lib/Handler/FooterHandler.php or downloading the newest version of this file and overriding the same file at your environment.

Pay attention to make a backup of original file before, to be possible do a rollback of this change if you got an strange behavior.

@smolinde
Copy link
Author

smolinde commented Oct 22, 2024

I tried your suggestion, now the problem is that the Pico CMS webpage responds HTTP error 500. Logs are almost equal to what libresign threw:

{"reqId":"6Uuab7SvV3FRo0kxxXUE","level":3,"time":"2024-10-22T14:48:34+00:00","remoteAddr":"XXX.XXX.XXX.XXX","user":"REMOVED","app":"PHP","method":"GET","url":"/apps/files/","message":"Cannot redeclare twig_cycle() (previously declared in /var/www/nextcloud/apps/libresign/vendor/twig/twig/src/Resources/core.php:20) at /var/www/nextcloud/apps/cms_pico/vendor/twig/twig/src/Extension/CoreExtension.php#333","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 OPR/114.0.0.0","version":"30.0.1.2","data":{"app":"PHP"}}
{"reqId":"5edjznY23AqR69M7zqur","level":3,"time":"2024-10-22T15:00:06+00:00","remoteAddr":"XXX.XXX.XXX.XXX","user":"REMOVED","app":"PHP","method":"GET","url":"/index.php/apps/cms_pico/pico/about/sub","message":"Cannot redeclare twig_cycle() (previously declared in /var/www/nextcloud/apps/libresign/vendor/twig/twig/src/Resources/core.php:20) at /var/www/nextcloud/apps/cms_pico/vendor/twig/twig/src/Extension/CoreExtension.php#333","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 OPR/114.0.0.0","version":"30.0.1.2","data":{"app":"PHP"}}
{"reqId":"h3Rw4O5YzT6UkbKoaVbW","level":3,"time":"2024-10-22T15:00:15+00:00","remoteAddr":"XXX.XXX.XXX.XXX","user":"REMOVED","app":"PHP","method":"GET","url":"/index.php/apps/cms_pico/pico/impressum","message":"Cannot redeclare twig_cycle() (previously declared in /var/www/nextcloud/apps/libresign/vendor/twig/twig/src/Resources/core.php:20) at /var/www/nextcloud/apps/cms_pico/vendor/twig/twig/src/Extension/CoreExtension.php#333","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 OPR/114.0.0.0","version":"30.0.1.2","data":{"app":"PHP"}}

Another problem is that when I open the LibreSign app, although CFSSL configured and configuration check shows success for every component, it asks to finish setup. See screenshots below:

image

image

@vitormattos
Copy link
Member

The minimum version of PHP to Nextcloud 31 will be 8.1:
https://github.com/nextcloud/server/blob/master/lib/versioncheck.php#L9

The minimum version of Twig without this function is 8.2. I can't remove for now this package from LibreSign side because is used to render the footer template of PDF.

Have a possible workaround using the package https://github.com/humbug/php-scoper to implement a scope to Twig project because the function twig_cycle haven't scope but this case together with Pico CMS is a very edge case and will take time from our team now. Another point is that Pico CMS haven't maintainer and isn't officially compatible with newest maintained versions of Nextcloud Server.

If you wish to talk more about enterprise support to LibreSign and other Nextcloud apps, we also can pay attention to Pico CMS and work to update this app to newest version of Nextcloud server, you can talk about this with our sales team: [email protected]

Another problem is that when I open the LibreSign app, although CFSSL configured and configuration check shows success for every component, it asks to finish setup. See screenshots below:

I suggest to register this in a new issue specific to this subject. For now I recommend to use OpenSSL to use less binaries dependencies.

@smolinde
Copy link
Author

I somehow fiddled around and got CFSSL to work, so no issue necessary. However, in my scenario I cannot get rid of Pico CMS, this is critical. I suggest you to include somewhere in the documentation that the app will not work with Pico CMS installed, and as an alternative people can use Certificate24, which is the exact alternative for LibreSign. Nevertheless, thank you for your time, probably this issue can be closed or marked as feature-request.

@vitormattos
Copy link
Member

Certificate24 don't do the same as LibreSign because LibreSign is totally open source. Certificate24 is only a client and need to have a license key to work and send all of your data from signature flow to this address: api.certificate24.com.

Look this screenshot of Certificate24 settings:

Screenshot_20241023_082751

Looking at organization of this app at GitHub, I didn't found the source code of API server side.

@vitormattos
Copy link
Member

On the other side...

By using LibreSign, you ensure that all your data ever will be exclusively on your server, without sharing anything with third parties. We value your privacy and security; your data should always be just yours.

Our commitment is to keep LibreSign as open-source software, without blocking any features you may need with license keys. We believe that the freedom to use our software is essential for everyone.

I solved the issue with PicoCMS by replacing the Twig template engine with Plates, which is used to customize the footer.

All our work is maintained by a team that loves open source softwares. I dedicated over two days to studying and finding a solution to this issue. Every contribution, no matter how small sounds, need time to be implemented. If you wish to contribute with us in the development of LibreSign, consider supporting us through GitHub Sponsors or any other way you prefer.

Together, we can continue to build a future where privacy and freedom are priorities. Your participation is very important for us to move forward. Come be a part of this journey with us!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 4. to release
Development

Successfully merging a pull request may close this issue.

2 participants