Missing bcmath problem on IBAN entry

More
8 years 1 month ago #32326 by silke
Dear Adrien,

for VMVendor 3.5.1 I see a problem with the new IBAN feature when bcmath is missing (at an older PHP 5.4.20 test system):
Code:
Fatal error: Call to undefined function bcmod() in (...)/components/com_vmvendor/controllers/editprofile.php on line 634
which is refering to the following lines
Code:
if(bcmod($NewString, '97') == 1) { return TRUE; } else{ return FALSE; }
To resolve the potential error, you could e.g. include a conditioned function definition (following a suggestion on php.net/manual/de/function.bcmod.php by Andrius Baranauskas and Laurynas Butkus)
Code:
if (!function_exists('bcmod')) { function bcmod( $x, $y ) { // how many numbers to take at once? carefull not to exceed (int) $take = 5; $mod = ''; do { $a = (int)$mod.substr( $x, 0, $take ); $x = substr( $x, $take ); $mod = $a % $y; } while ( strlen($x) ); return (int)$mod; } }
(Please note: I did not re-check the bcmod function defined).

Best regards,
Silke
The following user(s) said Thank You: nordmograph

Please Log in or Create an account to join the conversation.

More
8 years 1 month ago #32327 by nordmograph
Very nice SIlke, thank you for this investigation and workaround (impressive 12 y/o post :) ) but
according to this page you refer to php.net/manual/de/function.bcmod.php
bcmod is supposed to be supported since PHP4 so why doesn't your 5.4.20 dosn't have it ?
Any idea ?

- Need help? Post the URL of the related page (eventualy as confidential info), it will help solve your issue faster.
- An error, notice or warning? report the exact message including the line number
- If you get a white page , enable error reporting and / or check your server error logs.

Please Log in or Create an account to join the conversation.

More
8 years 1 month ago - 8 years 1 month ago #32329 by silke
Dear Adrien,
I agree, bcmath should be standard in most distributions and this is so far the only mashine with a lack of support for it.
It is the php5 / apache2-mod_php5 package on distribution with a two year old
Code:
openSUSE 13.1 (x86_64)
Best regards,
Silke
Edit: It is a separate package to install...:
Code:
# zypper install php5-bcmath # rcapache2 restart
Last edit: 8 years 1 month ago by silke. Reason: added the required apache restart / reload

Please Log in or Create an account to join the conversation.

More
8 years 1 month ago - 8 years 1 month ago #32331 by silke
Dear Adrien,

a follow up issue:
To check the function after bcmath installation I recreated the old source code and went to the edit profile form again to remove the IBAN (in order to enter it in a second attempt again).
Though I read a success message on update, the following form call does show the IBAN still in place.

Please check your db update / delete routine for the IBAN.

Best regards,
Silke
Last edit: 8 years 1 month ago by silke.

Please Log in or Create an account to join the conversation.

More
8 years 1 month ago #32332 by nordmograph
Nice catch, this is fixed in 3.5.1b

- Need help? Post the URL of the related page (eventualy as confidential info), it will help solve your issue faster.
- An error, notice or warning? report the exact message including the line number
- If you get a white page , enable error reporting and / or check your server error logs.
The following user(s) said Thank You: silke

Please Log in or Create an account to join the conversation.

More
8 years 1 month ago #32333 by silke
Yepp, I verified:
1) The IBAN can be removed now (VMVendor 3.5.1b).
2) The call to bcmod() does work after installing the php5-bcmath package and restarting apache (the condtional bcmath definition is not included in release 3.5.1b).

Best regards,
Silke

Please Log in or Create an account to join the conversation.

Time to create page: 0.332 seconds
Powered by Kunena Forum
Disclaimer: Nordmograph is not affiliated with or endorsed by The Joomla! Project™. Any products and services provided through this site are not supported or warrantied by The Joomla! Project or Open Source Matters, Inc. Use of the Joomla!® name, symbol, logo and related trademarks is permitted under a limited license granted by Open Source Matters, Inc.