WordPress.org

Ready to get started?Download WordPress

Forums

WordPress database error (6 posts)

  1. hipfox
    Member
    Posted 7 years ago #

    I'm using the "Postie" plugin on my blog and for some reason, there are some posts which are just getting deleted without getting posted on the blog via email.

    When I try to configure the "Postie" plugin by running it manually, I get the following error message:

    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's Good Tonight In Temp', '', 'publish', 'open', 'open', '', 'personals-wats-good' at line 4]

    INSERT IGNORE INTO wp_posts
    (post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type)
    VALUES

    any idea what I'm doing wrong?

    BTW, the plugin was working flawlessly until a couple days ago when I changed hosts now it only works intermittently .

    Any help offered would be greatly appreciated!

  2. hipfox
    Member
    Posted 7 years ago #

    just checked my error log for WP database error...

    here's the message:

    [Sun Dec 10 02:16:06 2006] [error] PHP Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/rnjonjo/public_html/wp-content/plugins/postie/get_mail.php:2) in /home/rnjonjo/public_html/wp-content/plugins/dd-formmailer-plugin.php on line 2

    any idea on what that means?

    any help offered would be greatly appreciated!

  3. hipfox
    Member
    Posted 7 years ago #

    ^ ^ ^
    bump...

  4. thisisjohn
    Member
    Posted 7 years ago #

    Hi,
    I've just experienced this too and quickly realised that it's due to the presence of an apostrophe in the title, which messes with the database INSERT statement somewhere in core, I suspect. There probably is a wrapper function that should be used that isn't in this plug-in?

    Anyway, this is my hunch and hope this leads to someone more knowledgeable of the plug-in / core code to resolve the problem?

    -John

  5. thisisjohn
    Member
    Posted 7 years ago #

    OK, I think I've found a fix:
    1/ open 'postie-functions.php' in /wp-content/plugins/postie
    2/ edit the following on line 56:
    CHANGE
    'post_title' => $subject,
    TO
    'post_title' => preg_replace("/'/","\'",$subject),

    It works for me! :)

    -John

  6. aio
    Member
    Posted 7 years ago #

    Yeah I did the above too. It only worked for some issues. I still had the issue on http://advertising-info.org/ so I started throubleshooting some more. It has cost me about 10 hours to find what the issue was. Finally I found it (it's a bug in the standard wordpress code and it is up to 2.0.5 so I got to report this to the wp coders as well):

    In class-pop3.php (in /wp-includes/) there is the following line in the function "get":

    while ( !ereg("^\.\r\n",$line))

    This is incorrect! What happens I think is the following: if a certain message had a "." on a newline (I think this may happen for instance if the "." was just cut-off by the the max lenght of the line and was therefore placed on the next line, or when someone just placed a dot on a line and then a \r\n return/newline.)

    To fix this issue: swap the above to this:

    while (!feof($fp))

    While in fact this will not do much (I do not think that the mail server will actually report an end-of-file) the following piece of the "get" function will now kick-in;

    if(empty($line)) { break; }

    And stop reading from the mail server when the end of the message was reached.

    So the actual issue was that the mail server was unable to delete the message as the message was not completely read and was still being processed. That is where the error "Oops POP3 delete: Command Failed []\n" comes from (it cannot delete the message since it is still open and it will not give an error ("[]") because it cannot do (delete) what the postie-functions.php is asking it to do (delete the messsage).

    I tested this on the message that was failing (line 52 had just a "." on it) and it worked!

    If you want to test for yourself if this is the issue you are having, simply change the code in class-pop3.php to the following:

    while (!feof($fp))
    {

    $MsgArray[$count] = $line;
    $count++;
    $line = fgets($fp,$buffer);
    echo "Read mail line".$count.": ".$line."\n";
    if(empty($line)) {
    echo "Read mail line - Break Issued\n";
    break; }
    }

    This will output all the lines while reading from the mail server (you can see the output of this by manually runing postie from the options in WP)

    Hope this helps!

Topic Closed

This topic has been closed to new replies.

About this Topic