Support » Plugin: ManageWP Worker » Requires of "pluggable.php" kills pluggable functionnality

  • Resolved Sylvain Deaure

    (@sylvaindeaure)


    Hi,

    In current (4.0.4) version of the worker plugin, there are several inclusion of pluggable.php, or calls to requirePluggable(), that do the same.

    Please be aware that this is a bad WP practice, as it kills all pluggable functions that may be defined by other plugins.
    If a function from pluggable.php is needed but not yet loaded, then the hook is not right and comes too soon.

    When manually requiring pluggable.php, no pluggable can be subsequently defined. So any plugin that uses them can’t work
    (for instance, plugins that redefine wp_mail to use another transport agent such as smtp , amazon ses aso…)

    Please review the code and remove those calls.

    https://wordpress.org/plugins/worker/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hy Sylvain,

    I’m Milos, a ManageWP developer.
    This functionality is there only for select few cases – specifically when using ManageWP backup and restore functionality, which is functional even if the WordPress installation gets broken due to a theme or plugin update, and you want to restore your website to a previous state. It is never used in normal requests.

    Please tell me if you have any further inquiries.

    Best regards,
    Milos Colakovic

    Well,

    I didn’t precisely check in what context the file is included,
    but several users of my wp-ses plugin found that some plugins are broking the wp_mail pluggable function.
    One popular plugin has been identified and updated since.

    By checking some sample sites, I found that in certain cases, your plugin is the only one left requiring this file.

    So, I’m pretty sure pluggable.php is included when it shoudn’t, because my plugin logs wp_mail as already defined by pluggable.php when your plugin is active.
    This is something that should have been introduced by some recent update, because they worked well together some times ago.

    As far as WP is concerned, pluggable.php should never have to be required manually.
    Either it’s already loaded by the WP core , and no need for require,
    Either it’s too early for being available, and forcing a require can only break the pluggable functionnality that other plugins do setup.

    Hi,

    For us to include pluggable.php two conditions must be met:
    1. The HTTP request must be sent explicitly from https://managewp.com. That means it should never be included in regular requests, while ManageWP Worker is active in the background.
    2. The request must be related to backup/restore functinality. Other actions are executed on init hook with the priority of 9999.

    In those cases, the request is handled by the plugin, and it is terminated after sending the response to ManageWP.

    However, if you have noticed a case in which the ManageWP Worker plugin includes pluggable.php in a case not described above, that is definitely not intended. Do you by any chance have error logs related to redefinition of the wp_mail function?

    Best regards,
    Milos Colakovic

    Hi,

    Thanks for the answer.
    Yeah, I understand it’s not intended 🙂

    I can not test all plugins combinations, so I do rely on voluntary clients with the problem to test and provide logs.

    I added custom logs within my plugin, to see why wp_mail couldn’t be defined.
    Some cases included another plugins rewriting wp-mail.
    Finding which one was easy with php5 reflection functions.

    When pluggable.php is required, it’s not that easy, because the log shows “wp_mail already defined in pluggable.php”, and not which plugin did require that file.

    However, I saw cases of clients wp install, where the plugin loggued this, unable to redefine wp_mail.
    In that cases :
    – Your plugin was the only one left referencing pluggable.php
    – deactivating your worker does indeed seem to fix the problem.

    So I guess pluggable.php is indeed required by mistake in other cases than those you mention.
    (I saw a function requirePluggable(), one just before a call to wp_mail, but also at least 2 manual requires of pluggable.php in your code)

    I’m still try to collect more feedback from various users.
    For now, all I can do is ask them to deactivate your plugin: that fixes the issue but does not make them happy, as you can guess 🙂

    Hi Sylvain,

    There was indeed a bug on our side, and we just pushed a fix. Thank you for notifying us 🙂
    The conflict shouldn’t happen anymore, but we would like to check if everything is working as it should, so we didn’t increment the version number yet. Could you advise your clients to re-download the latest ManageWP Worker plugin version if the conflict happens to them?

    Thanks for the update.

    I asked those who contacted me to try that, but I think you should update the version anyway to force update of your plugin.

    It could not be worse, and will help those who are exposed to the problem but didn’t tell, as well as those who run many wp with manageWP and a non default mail agent (not just my plugin).

    Plugin Author Vladimir Prelovac

    (@freediver)

    Closed.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Requires of "pluggable.php" kills pluggable functionnality’ is closed to new replies.