Main menu

Forum


× Help Forum English

Call to undefined function mb_substr_count in file mod_iccalendar/helper.php

  • nonsavant
  • Topic Author
  • Junior Member
  • Junior Member
More
12 years 7 months ago #6819 by nonsavant
Hi,
Just updated to 3.3.2, and now I see this fatal PHP error:
Call to undefined function mb_substr_count in file mod_iccalendar/helper.php

It seems it's related to the PHP extension mbstring, but this extension is non-default .

Is it possible to download an older version of iCagenda that doesn't require the mbstring library?

Thank you.

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

  • Lyr!C
  • Lyr!C's Avatar
  • Administrator
  • Administrator
  • Lead Developer
More
12 years 7 months ago #6834 by Lyr!C
Hi!

You have possibility to activate mb_string in your php.ini, but this function is in general activated.

But, it's better to find a new code, to prevent this possible issue, so that's why a attached a new version of the module, if you can install, and tell me if it is solving this issue !

Keep me informed!
Best Regards,
Lyr!C

Latest version : iCagenda 4.0.17 Joomla! 4 > Joomla! 6
We recommend every user to keep iCagenda updated.
Support for iCagenda version 3.9 (the final version compatible with Joomla 3) ended on October 13, 2026
Extended security support for the iCagenda PRO 3.9 version until October 13, 2027 (to benefit from this extended support, you must have a Pro subscription: www.joomlic.com/extensions/icagenda)
Don't forget to have your Joomla!® up-to-date!

Do you like iCagenda?
I would appreciate if you could take 5 minutes to post a review on JED (Joomla Extensions Directory) .

File Attachment:

Attachments:

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

  • nonsavant
  • Topic Author
  • Junior Member
  • Junior Member
More
12 years 7 months ago #6847 by nonsavant
Thanks.

Now I see:
Fatal error: Call to undefined function mb_strtoupper() in /[snip]/modules/mod_iccalendar/helper.php on line 1654

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

  • Lyr!C
  • Lyr!C's Avatar
  • Administrator
  • Administrator
  • Lead Developer
More
12 years 7 months ago #6848 by Lyr!C

nonsavant wrote: Thanks.

Now I see:

Fatal error: Call to undefined function mb_strtoupper() in /[snip]/modules/mod_iccalendar/helper.php on line 1654


Hi!

Install module attached, i've added a test if function exists.

But edit too the file ROOT/components/com_icagenda/helpers/icmodel.php, line 2028 to 2039, and replace all mb_substr_count by substr_count.

In all cases, i truly recommended you to set your server properly to enable mbstring.
Many extensions are using mb_ functions for some useful reason. (able used of UTF-8 encoding).

And, after searching, Joomla 3 is using for example a mb_strtoupper in contentype form field, a core library function. And there's no control if it is enable on user server.
That means you will have bug with this function on Joomla 3 due to the missing of mbstring.

On a online website, you should to disable error reporting.

Note that iCagenda is using mb_strtoupper since it's first version, and no one has reporting such an issue, maybe because on all major hostings, mbstring is enabled!
Enabling mbstring should help you in the future ;-)

Best Regards,
Lyr!C

Latest version : iCagenda 4.0.17 Joomla! 4 > Joomla! 6
We recommend every user to keep iCagenda updated.
Support for iCagenda version 3.9 (the final version compatible with Joomla 3) ended on October 13, 2026
Extended security support for the iCagenda PRO 3.9 version until October 13, 2027 (to benefit from this extended support, you must have a Pro subscription: www.joomlic.com/extensions/icagenda)
Don't forget to have your Joomla!® up-to-date!

Do you like iCagenda?
I would appreciate if you could take 5 minutes to post a review on JED (Joomla Extensions Directory) .

File Attachment:

Attachments:

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

  • Lyr!C
  • Lyr!C's Avatar
  • Administrator
  • Administrator
  • Lead Developer
More
12 years 7 months ago #6849 by Lyr!C
Hi again,

Is it possible to test a second version of the module attached to this message, where i've created a new function to convert a string to uppercase in JText standard using JLanguage transliteration.

If your test is successful, this could be a new feature i will propose to add in Joomla 3 core ;-)

Thank you!

Lyr!C

Latest version : iCagenda 4.0.17 Joomla! 4 > Joomla! 6
We recommend every user to keep iCagenda updated.
Support for iCagenda version 3.9 (the final version compatible with Joomla 3) ended on October 13, 2026
Extended security support for the iCagenda PRO 3.9 version until October 13, 2027 (to benefit from this extended support, you must have a Pro subscription: www.joomlic.com/extensions/icagenda)
Don't forget to have your Joomla!® up-to-date!

Do you like iCagenda?
I would appreciate if you could take 5 minutes to post a review on JED (Joomla Extensions Directory) .

File Attachment:

Attachments:

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

  • nonsavant
  • Topic Author
  • Junior Member
  • Junior Member
More
12 years 7 months ago #6865 by nonsavant
Hi,

I understand what you're saying about mbstring, and I will try (again!) to convince the website owner to move to proper hosting.

The result for both of your most recent suggestions above was:
Fatal error: Call to undefined function mb_substr() in /var/www/html/energiegenossenschaft/components/com_icagenda/helpers/icmodel.php on line 4437

And don't worry, I just turn on the error reporting temporarily to get the error message :)

Thank you for your help so far!

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

  • Lyr!C
  • Lyr!C's Avatar
  • Administrator
  • Administrator
  • Lead Developer
More
12 years 7 months ago #6867 by Lyr!C
If fact, mb_"function" gives the possibility to encode in UTF8 to keep sure it is working properly.

So, when you find this :
$text = mb_substr($text, 0, 100, 'UTF-8');

You can do this (but may not work properly depending of your language):
$text = substr($text, 0, 100);

But, if you just turn off error reporting for such function, this will return a bug for such function (in that case, for add to cal feature (this line 4434 about Google calendar).

I will add in future release, for each mb_ functions called, a checking, and an alternative, but the best is to have mb_string activated (this can generally be changed and edited in php.ini file of your hosting).

I will think of adding a function with an alert message admin side, to inform and alert the user when mb_string is not activated.

Lyr!C

Latest version : iCagenda 4.0.17 Joomla! 4 > Joomla! 6
We recommend every user to keep iCagenda updated.
Support for iCagenda version 3.9 (the final version compatible with Joomla 3) ended on October 13, 2026
Extended security support for the iCagenda PRO 3.9 version until October 13, 2027 (to benefit from this extended support, you must have a Pro subscription: www.joomlic.com/extensions/icagenda)
Don't forget to have your Joomla!® up-to-date!

Do you like iCagenda?
I would appreciate if you could take 5 minutes to post a review on JED (Joomla Extensions Directory) .

File Attachment:

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

  • Lyr!C
  • Lyr!C's Avatar
  • Administrator
  • Administrator
  • Lead Developer
More
12 years 7 months ago #6868 by Lyr!C
To have an example on why UTF8 encoding is important and useful :

If you do this code for the string 'cakeæøå' when you want to return the first 5 characters,


If you do substr('cakeæøå',0,5);

This will return:

cake�


If you do mb_substr('cakeæøå',0,5,'UTF-8');

This will return:

cakeæ


And so, no breaking of 'æ' character!

;-)

Latest version : iCagenda 4.0.17 Joomla! 4 > Joomla! 6
We recommend every user to keep iCagenda updated.
Support for iCagenda version 3.9 (the final version compatible with Joomla 3) ended on October 13, 2026
Extended security support for the iCagenda PRO 3.9 version until October 13, 2027 (to benefit from this extended support, you must have a Pro subscription: www.joomlic.com/extensions/icagenda)
Don't forget to have your Joomla!® up-to-date!

Do you like iCagenda?
I would appreciate if you could take 5 minutes to post a review on JED (Joomla Extensions Directory) .

File Attachment:

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

Moderators: Lyr!C
Time to create page: 0.069 seconds

Follow Us

Create your Joomla templates with Template Creator CK

acymailing logo new