Open BrianHenryIE opened 3 years ago
Fixed in #125
Hi @BrianHenryIE, I'm using Mozart 0.7.1 and also having issues using it with mPDF:
Fatal error: Uncaught Error: Argument 1 passed to Dep\Mpdf\ServiceFactory::getServices() must be an instance of Dep\Mpdf\Dep\Mpdf, instance of Dep\Mpdf\Mpdf given, called in /Plugin/mozart/dependencies/Mpdf/Mpdf.php on line 1063 in /Plugin/mozart/dependencies/Mpdf/ServiceFactory.php on line 30
I tried applying the changes of the commits 26e4f9d and 29ccf74 in #125 to the file NamespaceReplacer.php but this is causing another issue:
PHP Warning: require(/Plugin/mozart/dependencies/Mpdf/../data/upperCase.php): failed to open stream: No such file or directory in /Plugin/mozart/dependencies/Mpdf/Mpdf.php on line 1117
This file only exists in vendor/mpdf/mpdf/data and is not copied to the mozart/dependencies directory.
I appreciate any help!
You need a couple of lines in your composer post-install-cmd
script to copy the files in. Something like:
"mkdir -p ./Plugin/mozart/dependencies/Mpdf/data; cp -R vendor/mpdf/mpdf/data ./Plugin/mozart/dependencies/Mpdf/",
"mkdir -p ./Plugin/mozart/dependencies/Mpdf/ttfonts; cp -R fonts/*.ttf ./Plugin/mozart/dependencies/Mpdf/"
I've stopped using Mozart though. I forked it to https://github.com/BrianHenryIE/strauss. I think there are further MPDF issues that I needed to fix.
I'm using Mpdf and its namespace and main class name are the same.
With:
In
mozart/dep/Mpdf/ServiceFactory.php:36
:We're in the correct namespace already so the prefixing there is unnecessary (and PHP crashes when the code is run).
I mentioned this in a comment on #84 but reverting #84 would introduce its own problem.
Any advice on what negative/positive look-ahead/look-behind might help would be great. It is a valid place to do a replacement.
Failing test for
NamespaceReplacerTest.php
: