chamilo-lms icon indicating copy to clipboard operation
chamilo-lms copied to clipboard

Cannot generate PDF Certifcate

Open Arricdev opened this issue 1 year ago • 8 comments

Describe A clear and concise description of what the bug is.

After migrating to 1.11.28 When I try to download a certificate in PDF i Get an error 500

generating html certificate is OK

Was working in 1.11.26

To Reproduce Steps to reproduce the behavior:

  1. Go to 'https://yourwebsite/certificates/index.php?id=XXX&user_id=XXX&action=export
  2. See error

logs

Wed Nov 06 11:51:30.968799 2024] [proxy_fcgi:error] [pid 3934032] [client 127.0.0.1:52186] AH01071: Got error 'PHP message: PHP Fatal error: Uncaught LogicException: To filter with a CSS selector, install the CssSelector component ("composer require symfony/css-selector"). Or use filterXpath instead. in path-to-chamilo/vendor/symfony/dom-crawler/Crawler.php:1296\nStack trace:\n#0 path-to-chamilo/vendor/symfony/dom-crawler/Crawler.php(791): Symfony\Component\DomCrawler\Crawler->createCssSelectorConverter()\n#1 path-to-chamilo/main/inc/lib/pdf.lib.php(345): Symfony\Component\DomCrawler\Crawler->filter()\n#2 path-to-chamilo/certificates/index.php(84): PDF->html_to_pdf()\n#3 {main}\n thrown in path-to-chamilo/vendor/symfony/dom-crawler/Crawler.php on line 1296', referer: https://yourwebsite/certificates/index.php?id=xxx&user_id=xxxxx&action=export

Expected behavior A clear and concise description of what you expected to happen.

PDF Download

Arricdev avatar Nov 06 '24 11:11 Arricdev

Similar a https://github.com/chamilo/chamilo-lms/issues/3774 download the /vendor folder from the url https://github.com/chamilo/chamilo-lms/releases/download/v1.11.28/chamilo-1.11.28.zip and replaces the contents of the /vendor folder locally

The error you're seeing indicates that the CssSelector component from Symfony is missing, which is necessary for filtering with a CSS selector. Here's how to fix it:

Install the CssSelector component: Open a terminal in your project directory and run the following command to install the component rm composer.lock rm -rf web/ vendor/ composer clear-cache composer update

Kaneda-1 avatar Nov 06 '24 12:11 Kaneda-1

Thanks for your answer,

I already got the vendor/ dir when I migrated but the component seems to be missing.

Does that work if I install the component with composer on a QA server and then copy vendor/ dir ? This would generate less downtime

Arricdev avatar Nov 06 '24 12:11 Arricdev

Ok, it worked , thank you. Maybe it would be great to update the release ?

Arricdev avatar Nov 06 '24 14:11 Arricdev

Yes, we are working on a new release for within a few days.

ywarnier avatar Nov 06 '24 15:11 ywarnier

Sorry for the long delay. Really working on closing all these issues now. I cannot reproduce the issue, so I'm assuming it was either some local configuration or the issue has already been fixed through some other bug report. Closing.

ywarnier avatar Jun 06 '25 21:06 ywarnier

Hi, This issue is not resolved with 1.11.32 , css-selector is still not in the vendor folder of the release, need to do composer update to have it.

$ pwd /xxxxx/chamilo-1.11.32/vendor/symfony $ ls asset framework-bundle routing cache http-foundation security cache-contracts http-kernel security-acl class-loader intl security-bundle config options-resolver serializer console polyfill-ctype service-contracts debug polyfill-iconv stopwatch dependency-injection polyfill-intl-icu templating doctrine-bridge polyfill-intl-idn translation dom-crawler polyfill-intl-normalizer twig-bridge event-dispatcher polyfill-mbstring twig-bundle expression-language polyfill-php80 validator filesystem polyfill-util var-exporter finder process yaml form property-access

Arricdev avatar Jul 03 '25 08:07 Arricdev

Re-opening on request by @Arricdev in #6424

ywarnier avatar Sep 10 '25 08:09 ywarnier

This issue was reported again on 20/10/2025 So to be revised for release 1.11.34

NicoDucou avatar Oct 20 '25 08:10 NicoDucou