• Resolved PeterK2003

    (@peterk2003)


    PHP Notice:
    Trying to get property of non-object in C:\\Program Files\\Apache
    Software
    Foundation\\Apache2.2\\htdocs\\wp-content\\plugins\\wordpress-https\\wordpress-https.php
    on line 232

    We are seeing a lot these entries in out error logs. Anyone else?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The code around line 232 is very buggy, in addition to causing that warning. If you just want to stop the warning, change
    $post = $post->ID;
    to
    $post and $post = $post->ID;

    If you want to fix the buggy code, and know how to read this, you can patch it. If you are using a shared SSL server, there other bugs, I can post that somewhere else. Here is the old and new code, around line 232.

    [please use a Pastebin to post large chunks of code, following forum etiquette]

    Sorry, that code is wrong. I will post a fix.

    Thread Starter PeterK2003

    (@peterk2003)

    Thanks, I will appreciate the update to the plugin.

    This is better, still a work in progress. I will post the whole file when done. Line 213.

    [please use a Pastebin to post large chunks of code, following forum etiquette]

    Sorry, pastebin coming up.

    The original one-line fix above is still good enough to quiet the warning, though. I will clean up the rest of my work and post it later if people want to try it.

    Thread Starter PeterK2003

    (@peterk2003)

    Thanks, I am not in a big hurry so I’ll wait till the code makes it way into a new release.

    Thanks again.

    Plugin Author mvied

    (@mvied)

    Kitchin,

    I really didn’t want to spend time doing this, but I thought it appropriate.

    $url_path = str_replace(parse_url($this->https_url, PHP_URL_PATH), '', $url_path); // wrong, https_url already stripped of path
    The path in the https_url is being stripped from the path found by the regular expression. Not https_url itself. The entire block you commented out works fine.

    if ($url_path == '/') { // wrong, external links can match this
    That doesn’t matter because the code that changes the link to HTTPS is this:
    $buffer = str_replace($html, str_replace($this->http_url, $this->https_url, $html), $buffer);
    Which obviously will not affect external URL’s.

    $force_ssl_admin= defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN && is_admin(); // new code
    Why would you want to force every link to a post/page in the admin panel to be HTTPS regardless of what the user selected just because they’re forcing their admin panel to be HTTPS? The idea is for the link changing to be intelligent and only change links to HTTPS that have been forced to do so.

    I’m not really sure where you were going with any of your changes other than the one line that suppresses the error, which I will implement in the next update. If the code does not appear to be working for you, please create a topic with specific examples of it not working so that I can review the ‘buggyness’ in action.

    Thanks,
    Mike

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: WordPress HTTPS] Trying to get property of non-object’ is closed to new replies.