Support » Plugin: BackWPup - WordPress Backup Plugin » Conflict with Amazon SES SDK

  • I have started using Amazon SES to send emails. I’ve used the Amazon SDK because manually signing messages using ‘Signature version 4’ is just too hard.

    Unfortunately, my version of the SDK clashes with yours. I don’t use the ‘S3’ option in BackWPUp so I first tried using the backwpup_register_destination filter to remove the ‘S3’ destination but BackWPUp still loads its version of the SDK. It does this through Composer in backwpup.php regardless of whether S3 is used, or not.

    I’ve managed to get around the issue – mostly – by using prepend=true in my version of spl_autoload_register so my version of the SDK classes get loaded first.

    However, there’s a residual issue because you (via Composer) unconditionally load vendor/aws/aws-sdk-php/src/functions.php in vendor/autoload.php. Your version of functions.php is older than the one I use and doesn’t contain a function that is required by SES. I therefore have to use the one from my SDK which causes a clash with function constantly() – the first function defined by both versions.

    I can force PHP to use the later version by putting the plugin containing my code into ‘must use’ plugins, but it still causes tons of errors in my error log. As a hack, I’ve replaced your version of functions.php with an empty file (I can’t delete it without bringing the entire web site down).

    I see you are investigating using a scoping mechanism to eliminate conflicts of this nature – which would be great but it might not resolve the functions.php issue.

    One solution might be to selectively load functions (and maybe class registrations) instead of doing it unconditionally. We could then use the backwpup_register_destination filter to exclude the vendor libraries/services we don’t need. That wouldn’t help people who want to use two versions of a library at the same time, but it would be a simple fix for people like me who don’t need your version.

    Andy

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support duongcuong96

    (@duongcuong96)

    Hello @andyhenderson
    I just want to thank you for the many detailed reports and suggestions in the past and for the current library conflict issue. Your opinion for BackWPUp is always in-depth and really really valuable to us to improve how BackWPUp should works!

    About your thought on the library conflict, I already forward your suggestion to our team a few weeks ago.

    Thank you again, your opinions for improving BackWPUp always most welcomed <3

    Thread Starter AndyHenderson

    (@andyhenderson)

    Least I can do in return for you providing a reliable backup solution for several volunteer-run charities I’m involved with.

    Let me know if I can help with testing,

    Andy

    Hey there,

    just wanted to chip in since I have encountered the same issue when using “The Newsletter Plugin” in conjunction with its “Amazon SES” add-on.

    BackWPup generates a fatal error when trying to send out a newsletter and this is what the plugin author commented:

    Hi, the problem is this: wp backup loads the amazon SDK on every page loads, but not the full SDK as should be done, just part of it. To send with amazon ses we need to load the amazon sdk which cannot be done since wp backup has already partially loaded it (and the sdk raises an error).

    I am using BackWPup to send backups to a remote S3 destination so I need both plugins to interact with the SDK and cannot disable the loading in any one of these.

    Looking forward to seeing this addressed and many thanks for the backup-plugin, otherwise very fond of it đŸ™‚

    Also happy to assist with testing!

    Regards,
    Henning

    Thread Starter AndyHenderson

    (@andyhenderson)

    To be fair to Inpsyde, “wp backup loads the amazon SDK on every page loads, but not the full SDK as should be done” is arguable. The SDK uses spl_autoload_register to build a mapping table of function calls to the .php files that implement those functions. That means .php files are loaded dynamically only when they are needed. In my view, that’s how it should be done otherwise the overhead of the entire AWS SDK loading for every page would be considerable. In my case, the overhead is nothing at all because I don’t use the AWS bits of BackWpUp – so I’m pleased that’s how it works. Sorry, it’s a problem for you, though.

    The PHP developers recognise the issue, which is inherent in PHP, and have introduced namespaces to address the issue. I would suggest that any plug-in developer wishing to use the SDK should implement their own namespace (at first glance, I think this could be done programmatically). Even better if Amazon included that capability in the SDK itself.

    The whole issue is reminiscent of “DLL hell” which plagued Windows systems for many years.

    Andy

    leanderbraunschweig

    (@leanderbraunschweig)

    @duongcuong96 Any updates on this? Still getting errors when both plugins are active…

    I’m having the exact same issue. Newsletter and their use of SES conflicts with BackWPup. Any solution in sight yet?

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.