Support » Plugin: amr ical events lists » Warning: substr() expects parameter 3 to be long

  • Resolved knaveenchand


    I use the amr-ical-events-list plugin along with event manager. The plugin was working normal until I recently discovered this error message on the calendar page on my site:

    Warning: substr() expects parameter 3 to be long, string given in /home/thecoach/public_html/wp-content/plugins/amr-ical-events-list/includes/amr-ical-events-list-main.php on line 802

    This is the link to my site where the error is appearing:

    The code on Line 801, 802, 803 is this:

    $excerpt = substr( $desc,0, // start
    				apply_filters('excerpt_length', 55))
    				.'...'; //length

    How do I remove the error message from displaying on my site. Any help will be highly appreciated.


Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author anmari


    HI it seems you have something that is adding a filter for the excerpt length and whatever it is returning is not a number.

    so when the code does

    substr ($desc, 0 , $length)

    where $length = apply_filters(‘excerpt_length’, 55);

    the “$length” is not a number, so substr gives warning.

    IN next version of my code it will detect this and ignore the filter.

    For you, either usual method: deactivate other plugins/theme till message goes away so you know what is causing it.

    or change code to this (will be in next update):

    $length = apply_filters('excerpt_length', 55);
    // in case a filter returns garbage;
    if (!is_int($length))  $length = 55;
    $excerpt = substr(
    	0, // start
    	$length) //length

    for info:


    Thanks for the response. For now, I have custom generated the event list using event manager plugin itself. Nevertheless, I have used the code you supplied on my demo site and its working well. The error message disappeared after replacing the code.


Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Warning: substr() expects parameter 3 to be long’ is closed to new replies.