Support

Home Forums Event Espresso Premium PDF Invoice Download Error

PDF Invoice Download Error

Posted: February 26, 2015 at 9:29 am


clrc

February 26, 2015 at 9:29 am

Hi There,

I’m getting this error showing when I try to have an invoice downloaded:

Fatal error: Cannot redeclare mb_substr() (previously declared in /var/www/html/clrc.org/wp-includes/compat.php:17) in /var/www/html/clrc.org/wp-content/plugins/event-espresso-core-reg/core/third_party_libs/dompdf/include/functions.inc.php on line 374

I found this thread about the same error, but am not sure if this is an appropriate solution:

https://eventespresso.com/topic/error-when-clicking-on-invoice-post-registration/

Running latest wp and EE4


Josh

  • Support Staff

February 26, 2015 at 11:59 am

Hi Matthew,

In wp-includes/compat.php it has this:

if ( !function_exists('mb_substr') ):
	function mb_substr( $str, $start, $length=null, $encoding=null ) {
		return _mb_substr($str, $start, $length, $encoding);
	}
endif;

It looks like the above code is running before the dompdf code runs, which isn’t something we normally see.

Can you try added a !function_exists check to the mb_substr function /event-espresso-core-reg/core/third_party_libs/dompdf/include/functions.inc.php that starts on line 374? It will look like this after you add the check:

if ( !function_exists('mb_substr') ):
  function mb_substr($string, $start, $length = null, $encoding = 'iso-8859-1') {
    if ( is_null($length) )
      return substr($string, $start);
    else
      return substr($string, $start, $length);
  }
endif;

If the above fixes this for you, we can add the check in the next update.


Josh

  • Support Staff

February 27, 2015 at 12:09 pm

Hi Matthew,

We went ahead and looked into this some more and found that if a server does not have PHP’s mbstring extension installed, the function in compat.php ends up loading, and leads to the error message you are seeing.

So we added a fix that prevents the error, and it’s included in Event Espresso 4.6.12.p. You’ll get an update notification if you go to Event Espresso > General Settings, save the settings page, then go to your WordPress plugins page.

The support post ‘PDF Invoice Download Error’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso