rmbinder / Mitgliedsbeitrag

Plugin Mitgliedsbeitrag für die Online-Mitgliederverwaltung Admidio
GNU General Public License v2.0
7 stars 3 forks source link

Call to undefined function bcmod() while calling tests.php #133

Open cmellwig opened 8 months ago

cmellwig commented 8 months ago

When calling tests I get a 500 Error Call to undefined function bcmod()

Tested with v5.2.1 on Admidio 4.2.14 (official docker image)

[Thu Dec 28 04:35:28.032099 2023] [php:error] [pid 62540] [client 172.20.0.4:46404] PHP Fatal error: Uncaught Error: Call to undefined function bcmod() in /opt/app-root/src/adm_plugins/membership_fee/common_function.php:1145\nStack trace:\n#0 /opt/app-root/src/adm_plugins/membership_fee/common_function.php(1100): test_iban('dexxxxxxxxxxxx...')\n#1 /opt/app-root/src/adm_plugins/membership_fee/tests.php(97): check_iban()\n#2 {main}\n thrown in /opt/app-root/src/adm_plugins/membership_fee/common_function.php on line 1145, referer: https://admidio.domain.tdl/adm_plugins/membership_fee/membership_fee.php

rmbinder commented 8 months ago

It looks like your docker is missing the PHP extension bcmath. But I can't help here because I don't know much about docker. You could temporarily deactivate the IBAN test. To do this, uncheck “Test ‘IBAN test’ activate” in Preferences - Tests.

baloo66 commented 5 months ago

@rmbinder - maybe i can help. what help is wanted?

@cmellwig - does the problem still exist? is it - as rmbinder mentioned - a docker container? did you build it by youself? do you have access to Dockerfile?

rmbinder commented 5 months ago

Like I said, I don't know much about Docker. Is it possible that the PHP extension bcmath is missing from the official Docker image?

I haven't received any other messages yet that bcmod is not defined.

cmellwig commented 5 months ago

It's the official admidio docker container. So it's very possible that the extension is missing. I'd have to check with the latest version. Are there any downsides in including the extension by default? If not a pullrequest for admidio would be more appropriate. Sorry for late reply, very busy currently

baloo66 commented 5 months ago

I see - ok, so the current admidio Docker image (more precisely: Docker images created after February 12, 2024) should contain bcmath. After switching from php:apache-bullseye to vanilla Ubuntu as the base image, the modules (and thus also php-bcmath) are installed explicitly during image creation. I think with a recent Docker image (>= 4.3.4) it should work.. But: I'll try it out as soon as I get home and then write again.

baloo66 commented 5 months ago

@cmellwig : tried it at home with admidio/admidio:v4.3.4 (and v4.3.6) - there is bcmath included (php 8.1.2 and bcmath extension is installed). So it should work (a quick php --re bcmath shows funcion bcmod is present). Hope this info helps. If you are stuck with your version of the docker image, you can easyly build a specialised version and add bcmath by yourself (requires a Dockerfile and a build step). If you want to go that way, feel free to write again (but I recommend staying at the releas train of admidio instead)...