• Resolved cricmetric

    (@cricmetric)


    I just updated the WordPress on my website to 3.6.1. At the same time, I also updated Tablepress to 1.1.1. After both the updates, I am seeing a problem with the loading of some of the blog posts that have Tablepress tables on the website.

    Here is a page that loads correctly: http://www.cricmetric.com/blog/2013/09/amit-mishras-claim-about-leg-spinners-is-not-quite-true/ . Basically, all those posts where the tablepress tables are small and do not use pagination, load correctly.

    However, those posts where the tablepress tables are fairly big (~300 rows), and use pagination, the page fails to load. An example is http://www.cricmetric.com/blog/2013/06/ipl-2013-player-rankings/, it eventually ends up showing the following error message:

    Fatal error: (*****) Maximum execution time of 60 seconds exceeded in <path to home directory>/blog/wp-includes/compat.php on line 0

    Has anyone encountered such a problem with tablepress before?

    Thanks
    Shashi

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi,

    thanks for your post, and sorry for the trouble.

    To be honest, I don’t really know what could be causing this. It looks like the site is stored on some MIT servers, correct? Or are you maybe including/loading something from an MIT server, that maybe could have a time-out?
    Can you maybe try to find out more from the server admin or the server error log?

    The fact that the execution time is exceeded makes me think that you are running into an infinite loop somewhere. Do you maybe have Shortcodes in the tables?

    Regards,
    Tobias

    Thread Starter cricmetric

    (@cricmetric)

    Hi Tobias,

    Thanks a lot for your quick response. The site is indeed hosted on the MIT web server. I will try to have a look at the server error log to see what the problem might be.

    I am facing the same problem when I try to go the admin panel of Tablepress. As far as I know, I am not using shortcode in the tables, and the plugin was working fine without any problems before the wordpress/tablepress upgrade. Do you think having big tables in tablepres might be the cause of the problems?

    Thanks very much,
    Shashi

    Hi Shashi,

    thanks for the update!

    Yes, large tables could create problems (and with large I mean several thousand rows here). However, I have then never seen this exact error, but only error about the PHP Memory Limit being reached, and not the execution time limit. Also, it is weird that the error message points to a WordPress core file.
    And if the size of the tables would be a problem, you’d most like have run into trouble while importing those tables earlier.

    Regards,
    Tobias

    Thread Starter cricmetric

    (@cricmetric)

    OK so I finally found the solution of the problem. I think the problem is specific to the new version of WordPress, in particular with a script file called compat.php. As per its description, “WordPress implementation for PHP functions either missing from older PHP versions or not included by default.”

    There is a function in this script called _mb_substr(), which seems to be some sort of a substring function, and it is called every time a table from tablepress is loaded. I am not sure what the purpose of this function is – seems to take care of UTF-8 characters. Anyway, inside the function there are the following set of statements which were causing trouble:

    preg_match_all( ‘/./us’, $str, $match );
    $chars = is_null( $length )? array_slice( $match[0], $start ) : array_slice( $match[0], $start, $length );
    return implode( ”, $chars );

    To test what is really happening, I added a print $str command before the preg_match_all statement. For the page that was causing problem – it produced a really huge output, that almost crashed my browser. Seems all of the content of the table was being passed as $str to the _mb_substr function. And within this function, this huge string is split into individual characters, and then stitched back together. No wonder it resulted in a time-out error.

    My solution is to replace all that mumbo-jumbo by a simple substring command, and that takes care of the problem. Since I am not using any UTF-8 characters in my blog (and don’t plan to), so I hope I will be safe.

    Thanks a lot again for your help!

    Shashi

    Hi,

    wow, that sounds weird…
    To be honest, I have no idea why this happens, and TablePress does not use that mb_substr function actually…
    Now, you are right, that this is used by WordPress to deal with certain UTF8 issues, so using substr() as a replacement should work fine in your case.

    The better fix however should be to install the mb module to the PHP installation on the server. WordPress will then not attempt to use the functions in compat.php, so that this issue should also disappear, without you having to mess with editing WP core files.

    Regards,
    Tobias

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin Tablepress] Some posts with tablepress tables not loading’ is closed to new replies.