• Resolved petercasier

    (@petercasier)


    I run the latest WP Mobile Detector on several sites, and get PHP errors in the error_log when someone accesses the blog from a mobile (while the pages DO seem to load well on the mobile):

    [19-Jan-2011 21:01:09] PHP Warning:  DOMDocument::loadHTML() [<a href='domdocument.loadhtml'>domdocument.loadhtml</a>]: Unexpected end tag : p in Entity, line: 102 in /home/green/public_html/wp-content/plugins/wp-mobile-detector/functions.php on line 213

    Any idea what could cause this, or where I can look to solve the problem?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter petercasier

    (@petercasier)

    Hmmm.. allow me to answer my own query :-S

    There seem to be a whole series of repetitive errors:

    Unexpected end tag : p in Entity, line: 109
    ID searchform already defined in Entity, line: 111
    ID search already defined in Entity, line: 112
    Attribute class redefined in Entity, line: 141
    htmlParseEntityRef: expecting ‘;’ in Entity, line: 148

    It seems these are parse errors which are generated when reading the original HTML file.

    The “ID searchform” and “ID search” were generated as the mobile theme “Jester” by default defined a search form, and I had already a search form in the side column too, so it found a duplicate.

    I guess I now have to look for an end tag p without a begin tag and which %%% attribute class has been redefined.

    Is there any way to define the PHP warnings NOT to be logged when the mobile theme is loaded? I don’t want my disk to clog up with HTML parsing problems (apart from the fact that it slows down the loading of the blog on mobiles).

    Thread Starter petercasier

    (@petercasier)

    I seem to be mostly talking to myself here, but this is the workaround I found:

    At the very top of the /plugins/wp-mobile-detector/functions.php replace the following:

    <?php
    /*
    Validate the mobile theme
    */

    with

    <?php
    error_reporting(E_ERROR | E_PARSE);
    /*
    Validate the mobile theme
    */

    This avoids PHP “warning” errors to be logged into the error_log

    ** The best solution however would be to actually embed functions.php line 213 with (error off) and (error on) as it reads the HTML code. Most bloggers won’t have access/control over some errors, and it is not a good idea to have PHP warnings logged each time a mobile page is loaded.

    P.

    My apologies petercasier, I have been busy and not checking this page.

    What version of PHP are you running? This might be caused by not supporting the DOMDocument class.

    Thanks.

    Thread Starter petercasier

    (@petercasier)

    Hi.. running PHP 5.3.2

    I think if there is any HTML error in the doc read in /plugins/wp-mobile-detector/functions.php on line 213, then there is a PHP warning generated.

    The mobile plugin actually works beautifully, except for the nuissance of the error_log file getting filled with PHP warnings (which is a nuissance and slows down things when there is a lot of mobile access).

    tnx for looking into this.

    Yeah, that class comes with PHP5, so if it is generating warnings, there is nothing I can do.

    I don’t want to put PHP configuration settings in the plugin as that could cause other unforeseen issues.

    I would deal with this issue by changing the way the server logs PHP errors or by putting it in a WordPress config file.

    I am also getting this error message and my log file is growing large with it.

    : DOMDocument::loadHTML() [domdocument.loadhtml]: Unexpected end tag : style in Entity, line: 246
    /wp-content/plugins/wp-mobile-detector/functions.php on line 226
    [20-Apr-2011 23:54:33] PHP Warning: DOMDocument::loadHTML() [domdocument.loadhtml]: Attribute class redefined in Entity, line: 151 in /wp-content/plugins/wp-mobile-detector/functions.php on line 187

    I removed my site details in the above code.

    Is there a fix for this. ?

    My server is running PHP 5.2.9 and MySQL version 5.1.48 and i am on a VPS with Inmotion Hosting.

    In the “wp-content/plugins/wp-mobile-detector/functions.php” file place “error_reporting(0);” at the very top of the file.

    This should fix this.

    Hi,

    @websitezcom, I have tried to install and run the plugin on several occasions but each time I check my site from my Blackberry handset I get an error:404 and my site cannot be viewed..?

    I’d be so greatful if I could get my site mobile and any help with this would be very much appreciated!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: WP Mobile Detector] PHP errors’ is closed to new replies.