sprain / php-swiss-qr-bill

A PHP library to create Swiss QR bills | QR-Rechnung in PHP erstellen
MIT License
278 stars 81 forks source link

example_scor.php fires Call to undefined function kmukku\phpIso11649\bcmod() #256

Closed dkameleon closed 3 months ago

dkameleon commented 3 months ago

I tried example_scor.php with output as HTML, but faced an issue:

Uncaught Error: Call to undefined function kmukku\phpIso11649\bcmod() in [ROOT]/vendor/kmukku/php-iso11649/src/phpIso11649.php:47 Stack trace:

0 [ROOT]/vendor/kmukku/php-iso11649/src/phpIso11649.php(54): kmukku\phpIso11649\phpIso11649->calculateRfChecksum()

1 [ROOT]/vendor/sprain/swiss-qr-bill/src/Reference/RfCreditorReferenceGenerator.php(41): kmukku\phpIso11649\phpIso11649->generateRfReference()

2 [ROOT]/vendor/sprain/swiss-qr-bill/src/Reference/RfCreditorReferenceGenerator.php(23): Sprain\SwissQrBill\Reference\RfCreditorReferenceGenerator->doGenerate()

3 [SITE]/classes/finances/ClassOwlQrBill.php(59): Sprain\SwissQrBill\Reference\RfCreditorReferenceGenerator::generate()

This is what I have installed recently:

kmukku/php-iso11649 1.6 ISO 11649 creditor reference library for php sprain/swiss-qr-bill v4.10 A PHP library to create Swiss QR bills

sprain commented 3 months ago

The function bcmod() is part of the PHP bcmath extension. This extension is likely missing from your PHP installation.

You can check by running php -m on your console and see if bcmath is listed there. You can also run composer check-platform-reqs to check if your setup matches the requirements defined by the libraries you use.

If not, you either need to recompile PHP with the required extensions, or get in touch with your hoster for help. Any support regarding this topic would be beyond of what we can do here.

If you still think the issue comes from this library, please provide the output from the two commands mentioned above.

dkameleon commented 3 months ago

Here is composer check-platform-reqs output i got before installing bcmath: image As you can see, nothing related to bcmath requirement, despite it was missed.

But after installing bcmath it started working as it suppose to. Thank you! I was confused with namespaced path to kmukku\phpIso11649\bcmod() and thought it is some internal function.