Non-static method MS_Rule_Shortcode_Model::debug_protect_content_shortcode() called statically

Hi!

I'd like to report a bug: Membership 2 Pro is throwing a PHP Depricated error: Non-static method MS_Rule_Shortcode_Model::debug_protect_content_shortcode() should not be called statically.

I've been able to trace it back to the fact that debug_protect_content_shortcode on line 261 in the file "plugins/membership/app/rule/shortcode/class-ms-rule-shortcode-model.php" is not defined as being static. Thus the error. So either the method should be defined as static, or the way it is being called should be changed.

Thoughts?

  • Adam Czajczyk

    Hello Jen @ BBS,

    I hope you're well today and thank you for your question!

    The "deprecated warning" doesn't indicate an actual bug but it's rather an information for developers that a certain "feature" is deprecated and while it's still working, it will be removed in future. In this case it means that with one of the future PHP releases it will not be possible to call non-static functions statically. It shouldn't affect plugin performance for now, though.

    That being said, I fully agree that even then, it shouldn't be there. However, I noticed that you're currently running the 1.0.3.5 version of the Membership 2 Pro plugin which is not up to date. Could you please update Membership 2 Pro to the most recent version and see if the issue is still reported then?

    Let me know if update solves that for you, please.

    Best regards,
    Adam

  • David @ BBS

    Czesc Adam!

    Thanks for the quick reply. You're correct, it's not a major bug, but figured I'd point it out. From my experience, it's usually better to get those notices fixed before they become obsolete and things end up breaking. :wink:

    As for your note regarding the version of Membership 2 Pro, the test site is the only one I didn't get around to updating prior to our chat. My local development and the live site were already running 1.1.1 and exhibited the same behavior. Just updated the test site as well. So the deprecated warning still persists.

    Best regards,
    David

  • David @ BBS

    Hi Predrag,

    I've been able to pin down the issue to being related to the [ms-protect-content] shortcode. You can see it in action on the My Account page:
    http://test.broadwaybabysitters.com/account/

    Here's the code that's used in the content of that page:

    [ms-membership-account show_profile="no" membership_title="My Membership"]
    
    [ms-protect-content id="306,323,368,370,1470,1550,1551,1552,1556,1557,1761,1779" silent="yes"]
    Some text.
    [/ms-protect-content]
    
    [ms-protect-content id="367,1553,1554" silent="yes"]
    Different text.
    [/ms-protect-content]
    
    [ms-protect-content id="367,1553,1554,306,323,368,370,1470,1550,1551,1552,1556,1557,1761,1779" silent="yes"]
    <h2>Quick Links</h2>
    <ul class="quicklinks">
     	<li><a href="https://local.broadwaybabysitters.com/profile">View My Profile</a></li>
     	<li><a href="https://local.broadwaybabysitters.com/edit-profile/">Edit My Profile</a></li>
     	<li><a href="https://local.broadwaybabysitters.com/find-a-sitter/">Find a Sitter</a></li>
     	<li><a href="https://local.broadwaybabysitters.com/all-sitters/">Browse All Sitters</a></li>
     	<li><a href="https://local.broadwaybabysitters.com/audition-drop-off/">Audition Drop Off</a></li>
    </ul>
    [/ms-protect-content]

    I've tested that removing all three of the [ms-protect-content] sections removes the warning. If a single [ms-protect-content] is there, it triggers the warning.

    Let me know if you're able to replicate the issue.

  • Predrag Dubajic

    Hi David,

    I tried adding the same thing on my installation, with replacing the ID's of course, but I'm afraid that I still couldn't see the issue there.

    Could you send us your FPT or cPanel login details together with WP admin for this site so we can investigate it there?
    I see that this is a test site, so is it ok if we do some tests with default WP theme and by disabling your other plugins?

    You can send us your details using our contact form https://premium.wpmudev.org/contact/#i-have-a-different-question and the template below:

    Subject: "Attn: Predrag Dubajic"
    - Site login url
    - WordPress admin username
    - WordPress admin password
    - FTP credentials (host/username/password)
    - cPanel credentials (host/username/password)
    - Link back to this thread for reference
    - Any other relevant urls/info

    Best regards,
    Predrag

  • Predrag Dubajic

    Hi David,

    Thanks for sending those in, and due to your email I finally figured out what the missing link is.
    I don't see those notices on your on my installation with debug enabled, I actually need to use Query Monitor to see it, and now do see it on my installation as well.

    I have forwarded all the info to our developers and created a bug report.

    Thanks for sticking with me while figuring this out :slight_smile:

    Best regards,
    Predrag