• Resolved mezzomedia

    (@mezzomedia)


    Dear Wordfence team,

    The latest version of Wordfence (7.5.11) seems to be causing the following PHP error with multiple sites (all on the same server):
    Call to undefined function WordfenceLS\fsockopen()

    Caused by /wp-content/plugins/wordfence/modules/login-security/classes/controller/time.php in WordfenceLS\Controller_Time::ntp_time at line 106.

    Line 106:
    $socket = @fsockopen('udp://' . $s, 123, $err_no, $err_str, 1);

    Hopefully this can be fixed in a future version.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support wfpeter

    (@wfpeter)

    Hi @mezzomedia, thanks for sharing this with us.

    I’ve not seen other reports of this since the latest Wordfence update, and when looking around I’ve not seen this mentioned for a number of years in our archives.

    WordPress uses the Requests library for http/https, which can fall back to fsockopen() if cURL isn’t installed. However, if you weren’t seeing this before the update then it’s unlikely you don’t have cURL, but there could be a possibility that it has stopped working and your web server requires a restart.

    If you’re unable to restart the server from your hosting control panel or via the command line then you may need to reach out to your host to do this. Does the issue continue afterwards?

    If so, are these messages showing in your server/PHP error logs or actually on pages when you’re clicking around your site?

    Thanks,

    Peter.

    Thread Starter mezzomedia

    (@mezzomedia)

    Hi Peter,

    Thanks for the clear and helpful suggestions.

    Unfortunately I am seeing this on multiple websites on my server. I have double checked this for at least one website, and noticed in both phpinfo() and with curl_version() that cURL support is enabled.

    Note that both the PHP setting allow_furl_open and function for fsockopen() are disabled for this website, because of security reasons. But I couldn’t find any mention of these in the Wordfence requirements.

    In other words: yes, I can access restart and configure everything on the server myself. But no, cURL is enabled, so if I would be following your explanation cURL shouldn’t be the culprit here.

    I decided to search through the Wordfence plugin code, and noticed that the file/line I mentioned in my initial post is actually the only occurrence of fsockopen(). So there doesn’t seem to be a function/method named fsockopen() defined in the WordfenceLS namespace. Which would mean the PHP error is indeed a correct error.

    Furthermore, if the intention was to use the global PHP function fsockopen() I believe the function should be preceded with a “\”, as in \fsockopen(). As explained in https://www.php.net/manual/en/language.namespaces.fallback.php

    Does that make sense? And do you agree?
    Or is there something I am missing?

    Cheers!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Call to undefined function WordfenceLS\fsockopen()’ is closed to new replies.