pdfviewhelpers
pdfviewhelpers copied to clipboard
[composer] Warning: Ambiguous class resolution
PHP 7.3 composer 1.10.5
typo3/cms-core [10.4.9]
helhum/typo3-secure-web [0.2.11]
bithost-gmbh/pdfviewhelpers [2.3.4]
source/typo3conf/ext/pdfviewhelpers/Resources/Private/PHP/tcpdf/include/barcodes/datamatrix.php vendor/tecnickcom/tcpdf/include/barcodes/datamatrix.php
source/typo3conf/ext/pdfviewhelpers/Resources/Private/PHP/tcpdf/include/barcodes/pdf417.php vendor/tecnickcom/tcpdf/include/barcodes/pdf417.php
source/typo3conf/ext/pdfviewhelpers/Resources/Private/PHP/tcpdf/include/barcodes/qrcode.php vendor/tecnickcom/tcpdf/include/barcodes/qrcode.php
source/typo3conf/ext/pdfviewhelpers/Resources/Private/PHP/tcpdf/include/tcpdf_colors.php vendor/tecnickcom/tcpdf/include/tcpdf_colors.php
source/typo3conf/ext/pdfviewhelpers/Resources/Private/PHP/tcpdf/include/tcpdf_filters.php vendor/tecnickcom/tcpdf/include/tcpdf_filters.php
source/typo3conf/ext/pdfviewhelpers/Resources/Private/PHP/tcpdf/include/tcpdf_font_data.php vendor/tecnickcom/tcpdf/include/tcpdf_font_data.php
source/typo3conf/ext/pdfviewhelpers/Resources/Private/PHP/tcpdf/include/tcpdf_fonts.php vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php
source/typo3conf/ext/pdfviewhelpers/Resources/Private/PHP/tcpdf/include/tcpdf_images.php vendor/tecnickcom/tcpdf/include/tcpdf_images.php
source/typo3conf/ext/pdfviewhelpers/Resources/Private/PHP/tcpdf/include/tcpdf_static.php vendor/tecnickcom/tcpdf/include/tcpdf_static.php
source/typo3conf/ext/pdfviewhelpers/Resources/Private/PHP/tcpdf/tcpdf.php vendor/tecnickcom/tcpdf/tcpdf.php
source/typo3conf/ext/pdfviewhelpers/Resources/Private/PHP/tcpdf/tcpdf_parser.php vendor/tecnickcom/tcpdf/tcpdf_parser.php
source/typo3conf/ext/pdfviewhelpers/Resources/Private/PHP/tcpdf/tcpdf_import.php vendor/tecnickcom/tcpdf/tcpdf_import.php
source/typo3conf/ext/pdfviewhelpers/Resources/Private/PHP/tcpdf/tcpdf_barcodes_1d.php vendor/tecnickcom/tcpdf/tcpdf_barcodes_1d.php
source/typo3conf/ext/pdfviewhelpers/Resources/Private/PHP/tcpdf/tcpdf_barcodes_2d.php vendor/tecnickcom/tcpdf/tcpdf_barcodes_2d.php
@maechler If TCPDF is required by another composer package too, the files will be once in the ./vendor/ directory and once in ./typo3conf/ext/pdfviewhelpers/Resources/Private/PHP/tcpdf/. In the TER package, TCPDF must be included in the package but for composer installations, only tecnickcom/tcpdf should be defined as requirement in the composer.json file.
@xerc @aimeos Thanks for reporting this issue! I am aware of this issue, unfortunately I have not yet found a way to solve this.
The problem is that TYPO3 relies on the composer.json file for generating the autoload information even if not run in composer mode. If we removed the following line, then autoloading would not work anymore in non composer mode:
https://github.com/bithost-gmbh/pdfviewhelpers/blob/d9fa9a8726a2ade80bbed249ba31b484179ee057/composer.json#L31
At the moment I see only two options to solve this:
- Try not to use the extension that also requires
TCPDFin itscomposer.json - Fork either
EXT:pdfviewhelpersor that other package and edit thecomposer.jsonto fit your needs
If you see another option, then please let me know! I think that for v3 of pdfviewhelpers we should remove the TCPDF and FPDI source files from the extension and provide installation instructions for non composer users.
@maechler A simple solution is to leave the directories listed in the classmap empty by default and only add the source code of tcpdf and fpdi in the package uploaded to TER. We do this in the same way and use a build script that automates adding additional source code. This is an excerpt of our phing build script:
<?xml version="1.0" encoding="UTF-8"?>
<project name="Aimeos TYPO3 extension" default="update">
<target name="composer" description="Updates composer dependencies">
<delete dir="Resources/Libraries" includeemptydirs="true" />
<exec command="composer remove --no-update --working-dir ${project.basedir} typo3/cms-core typo3/cms-backend typo3/cms-extbase typo3/cms-scheduler bithost-gmbh/pdfviewhelpers sjbr/static-info-tables" checkreturn="true" logoutput="true" />
<exec command="composer update --no-dev --no-autoloader --working-dir ${project.basedir}" checkreturn="true" logoutput="true" passthru="true" />
<exec command="rm -rf Resources/Libraries/tecnickcom/" checkreturn="true" logoutput="true" />
<exec command="composer dump-autoload --working-dir ${project.basedir}" checkreturn="true" logoutput="true" />
<exec command="git checkout composer.json" checkreturn="true" logoutput="true" />
</target>
</project>
Here are 2 approaches with custom autoloaders:
using .phar: https://insight.helhum.io/post/148112375750/how-to-include-binaries-for-ter-exts
using a separate composer.json: https://gist.github.com/cedricziel/08ea469db5197e24552c
@aimeos @jonaseberle Thanks for the proposals! If anyone of you could prepare a pull request, I would be happy to include a fix into the extension. I would probably go for a custom composer.json and autoloader that is only used if we are not in composer mode. At the moment I am rather busy, but if none of you can work on this, I will do it sometime.
Will be resolved with https://github.com/bithost-gmbh/pdfviewhelpers/issues/179.