aMember conflict – PHP Fatal error: Cannot redeclare __e()

Home Forums BulletProof Security Pro aMember conflict – PHP Fatal error: Cannot redeclare __e()

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1275
    Timbo
    Participant

    Hello everyone!
    I just bought BulletProof Security Pro, very good stuff I must say. Unfortunately though, I have run into a conflict on my site *solved though*.
    I’m running aMember Pro (membership management, content protection), and it seems it has declared a function that is also declared by BPS Pro – “__e()” (located in Class.php). This is causing a Fatal Error, see error output below:

    PHP Fatal error:  Cannot redeclare __e() (previously declared in /var/www/html/members/library/Am/App.php:1193) in /var/www/html/wp-content/plugins/bulletproof-security/includes/class.php on line 90

    aMember Version: 4.2.14.3b7ee0a
    BPS Pro Version: 5.5
    I’m not an expert by any means, but I presume the function is merely used for error display, perhaps formatting?
    As aMember used to be completely separate from WordPress, I presume this has now come to light a result of a feature in aMember which allows you to wrap your WordPress theme around the aMember member side pages, an effort to integrate aMember more seamlessly into WordPress. This (I imagine) combines a lot of the WordPress code with the aMember code, thus the conflict only on aMember pages.
    Anyway, I searched all the aMember code for any instances of “__e” which returned 319 matches, sigh… I searched BPS Pro and found only one other instance, in activation.php. So, the obvious choice was to manually change the function name and associated reference in BPS Pro to remove the conflict.
    I changed it from “__e” to “___e” (an extra “_” if you missed it). Obviously I don’t want to make this change every time I update BPS Pro, so would it be possible for someone with the appropriate powers to change this function name in future versions?
    Many thanks!
    Edit: ARQ (or some other self preservation feature) is doing it’s job too well! It keeps restoring class.php to the original haha. What do I do now…?
    -Timbo

    #1277
    AITpro Admin
    Keymaster

    Actually thank you for catching this.  This is an “unfinished” function that never got a “real” unique name since Development in that class.php file was put on hold a long time ago and we went a much better direction.  The function does not do anything at this point so I will go ahead and comment it out for pending later Development.

    Go to Quarantine and use the Quarantine File Restore Option to restore the edited class.php file.

    The standard procedural steps for ARQ are below if you are editing a large number of website files or if you are installing or updating files.  If you want to exclude the plugins folder from being checked by ARQ then see this Topic >>> http://forum.ait-pro.com/forums/topic/autorestore-quarantine-exclude-plugins-folder-and-themes-folder/

    AutoRestore/Quarantine (ARQ Infinity) is a real time file monitor that monitors all of your website files for any changes.

    When updating plugins, installing new plugins, deleting plugins or updating, installing and deleting themes follow these simple procedural steps for AutoRestore/Quarantine (ARQ).  And of course manually editing files.

    1. Turn off ARQ
    2. Install / update / upgrade plugins or themes
    3. Click the 4 Backup Files buttons (you actually ONLY need to click the wp-content Backup Files button – when in doubt click all 4 Backup Files buttons)
    4. Turn ARQ back On.

    #1281
    Timbo
    Participant

    I might be new at this, but I’m pretty sure I disabled ARQ and it continued to restore the class.php file…?

    When I first noticed my changes has been rolled back, I checked the Quarantine list and couldn’t see class.php, so I simply disabled ARQ and tried again, but (I thought, I’m second guessing myself now) it still restored the file. This is why I thought BPS Pro may have another form of self preservation?

    Anyway, I ended up chowning the file to another user so apache wouldn’t have the permissions to update it. Obviously this is not ideal, and if you’re sure disabling ARQ would stop it from being restored, I’ll chown it back and give it another shot with excludes etc.

    Thanks for your prompt reply.

    -Timbo

    #1282
    AITpro Admin
    Keymaster

    When you say “disabled ARQ” do you mean you turned ARQ Off?  If so, did you click the AutoRestore wp-content Backup Files button before turning ARQ back On?

    The fact that you’re not seeing the class.php file in Quarantine is a problem.  Do have a DSO / Apache Module Server?  There are a lot of additional configuration/setup steps you will have to do for a DSO configured Server as opposed to a typical CGI suPHP configured Server.  Let me know if you have a DSO Server.  Did you happen to look at this Topic >>> http://forum.ait-pro.com/forums/topic/bulletproof-security-pro-compatibility-check-upgrading-from-bps-free-to-bps-pro/

    #1293
    Timbo
    Participant

    Haha, looks like I have a lot to clarify…

    Firstly, our site is still in development, which allows me some flexibility when implementing these things.

    Yes, I am running a DSO configured server, dedicated hosting, single website. I did read the compatibility link you’ve suggested above and I watched the extended install video.

    I only installed BPS Pro yesterday, so I’m still finding my way around, but I thought the DSO issue was only related to F-Lock? As a result I have set all the options for “Lock / Unlock” files to “DSO – 644 File Permission”, and set “F-Lock: File Lock / Unlock Status” to “Turn Off Displayed Alerts” under the “Monitoring and Alerting Options”. I have setup the “Plugin Firewall Security Mode” as per the extended installation video.

    I presume that is all correct?

    Regarding “disabled ARQ”, yes, I mean I selected “Turn off ARQ Cron”, then clicked “Save ARQ Cron Options”.

    During my own testing I have deliberately and inadvertently triggered quarantining of files, and they have appeared in the “Quarantine” list. I have restored and deleted these files without a problem.

    During testing today I have done the following:

    1) Turned off the ARQ Cron

    2) Deleted all 4 backups

    3) chowned class.php back to the appropriate user

    Within minutes, the class.php was restored the to original!? I even changed class-BAK.php in the hopes it was being compared to that file, or using that file to restore over the top.

    I FTP’d into the server and looked in the following directory:

    /wp-content/bps-backup/autorestore/wp-content/plugins/bulletproof-security/includes

    And low and behold the class.php file is there!? I then went to “AutoRestore” and clicked “Show Backup Files” for “wp-content Files”, which also listed the class.php file, I clicked “Delete Backup Files” under “wp-content Files”, which did in fact delete class.php (both viewing via FTP and the web interface).

    A few minutes later, boom, it’s back! It has overwritten the my changed class.php and it is back in the “wp-content Files” backup (when view either by FTP or the “Show Backup Files” button).

    And yes, ARQ is definitely off. I can see “AutoRestore/Quarantine Cron is Turned Off and Scheduled Cron Jobs Have Been Removed.” on the “AutoRestore” page, and “AutoRestore/Quarantine Status: Off” in the header.

    I have just tested again, and as soon as I make the modification to class.php, boom, the file is created in the “wp-content Files” backup. As soon as I make the modification and the backed up class.php appears, I click “Delete Backup Files”, but it seems the file has already been restored…

    Very strange… In the mean time, I will chown it to another user.

    Haha, it really wants the class.php backed up. I’ve now chowned class.php to another user, modified it, now the change is sticking, which is good. As predicted, the class.php is created in the “wp-content Files” backup again, but if I click “Delete Backup Files”, the file just gets recreated straight away, click “Delete Backup Files” again, the file is still there/recreated!?

    As mentioned, ARQ Cron is still off and there are no files in quarantine or in the quarantine log.

    Edit: I just thought I should mention that I think I have resolved any issues with DSO as everything on the “Security Status” page is green :), and I walked through the extended installation video without a problem.

    -Timbo

    #1296
    AITpro Admin
    Keymaster

    Regarding DSO.  I am very, very cautious about dealing with DSO Servers because some folks have some crazy DSO configurations.  Most folks do not, but like I said I approach DSO like it is a poisonous snake until I know it is not going to bite me.  LOL

    Oops yeah I forgot all about this since it was done ages ago.  The class.php file is a “special” file that should never by manually edited because of what it is doing with Hard Excluding Dynamic folders and there are some failsafe coding checks to ensure that a catastrophic error does not occur when upgrading BPS Pro.  

    The class.php file has its own self-restoring coding checks to avoid a catastrophic error – the catastrophic error would be this – let’s say you have created several Excluded folders filters and you upgrade BPS Pro.  If your existing class.php file does NOT instantly replace the new class.php file on BPS Pro upgrade installation then all of the files in those excluded folders/filters would immediately start being autorestored and quarantined.

    Since other files are working normally and the issue is isolated to the class.php file then this is the issue/problem that is occurring.

    So logically how you would get out of this never ending loop would be this.

    Turn Off AutoRestore.

    Delete this file /wp-content/bps-backup/master-backups/class.php

    Delete this file /wp-content/bps-backup/autorestore/wp-content/plugins/bulletproof-security/includes/class.php

    Manually edit both the class.php and class-BAK.php file.

    Go to AutoRestore and click the wp-content Backup Files button.

    Turn AutoRestore back On.

    The next version of BPS Pro will have the __e function commented out, but of course I will now have to create an additional function that will fix the old class.php and class-BAK.php files because of the self-restoring coding for the class.php file.

    #1299
    Timbo
    Participant

    Ah, master-backups!

    I just modified class.php in “/wp-content/bps-backup/master-backups/”, now it is restoring my version.

    Thanks for your help!

    -Timbo

    #1300
    AITpro Admin
    Keymaster

    Great!  And sorry about not remembering that right away.  😉  BPS Pro has become a small city of code at this stage of Development so it completely slipped my mind.

    #1301
    Timbo
    Participant

    No problem!

    I think it’s more than made up for by the fact that you are so available and active in the forum!

    -Timbo

    #1302
    AITpro Admin
    Keymaster

    Thanks man!  I cannot tell you how much I love BuddyPress and the Global Unified Search Plugin – Both TOTALLY ROCK!!!!  Trying to find previous questions and answers on a standard WordPress site was a nightmare.  😉

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