Viewing 29 posts - 1 through 29 (of 29 total)
  • Author
    Posts
  • #976441

    Hi i get the follow error:
    Warning: Use of undefined constant __return_true – assumed ‘__return_true’ (this will throw an Error in a future version of PHP) in /webadres.com/wp-content/themes/enfold/config-templatebuilder/avia-shortcodes/product_snippets/product_snippet_review.php on line 80

    any idea what it could be cos i disabled already some plugins but still got this error

    #976929

    Hey Mike,

    Which version of php are you running? Which version of Enfold are you running?

    Best regards,
    Victoria

    #976938

    enfold: 4.4.1
    php: 7.2

    i have other sites whit enfold on same host so using same php version they are working fine

    #976941

    it has someting to do whit the review tab if i remove it the error is gone

    #976964

    Hi Mike,

    Please disable the WordPress debug by adding this in the wp-config.php

    
    define( 'WP_DEBUG', false );
    

    If you need further assistance please let us know.
    Best regards,
    Victoria

    #977146

    was already there

    #977211

    Hi,

    Can you please re-upload all the folders, through FTP by deleting the old theme and let us know if that would fix the problem?

    Best regards,
    Basilis

    #977553

    reuploaded the whole theme still same error only if i remove the review tab then the error is gone

    #977590

    i changed to php version 5.6 then the error is gone so something has to do whit the php version

    #978006

    Hi Mike,

    So the error is gone or do you still need help?

    Best regards,
    Victoria

    #978103

    No its not gone cos if i switch back to PHP 7.2 its back..

    #978616

    Hi,

    I have consulted our Engineers, can you please make sure you are running the latest version?

    Best regards,
    Basilis

    #979299

    yes i do.

    enfold: 4.4.1
    php: 7.2

    #980116

    Hi Mike,

    Can you try to replace __return_true of

    add_filter('comments_open', __return_true);

    to use a function instead that returns a value of true.
    Hope this would help.

    Best regards,
    Nikko

    #980809

    i need it to put in functions.php of the theme right?

    then i get:

    #981095

    Hi Mike,

    I might not have explained it clearly, first edit product_snippet_review.php on line 80 and you should find this code:

    add_filter('comments_open', __return_true);

    replace it with:

    add_filter('comments_open', 'fn_true');

    then at the bottom of functions.php add this:

    function fn_true() {
      return true;
    }

    let us know if this helps.

    Best regards,
    Nikko

    #981178

    That is working the error is gone.

    i did try in another website adding the review section in avia and also gives same error to be sure it isnt only this website fault or a plugin conflict

    #981225

    Hi Mike,

    It’s not really the fault of website, but I think the changes within php version 7.2 does not allow the __return_true function, which is defined in the wordpress core.
    So the only alternative is to create a function that just returns a true value and use it.

    Best regards,
    Nikko

    #981286

    Ok thx, but do u fix this in a new version or do i need to adjust this to every update i get of enfold?

    #981908

    Hi Mike,

    It should be fixed in the future releases of Enfold.
    For the meantime, the solution is using this method.

    Best regards,
    Nikko

    #1027387

    This havent been fixed, I still get this error.

    #1027962

    Hi Chowdhury,

    I used Enfold in a nginx web server that uses php 7.2.9 and I’m not getting any issues.
    Can you give us a link to your site?

    Best regards,
    Nikko

    #1028003

    I just updated and can inform that it isnt resolved ive the same errors again u can check the previous pages again to c the error.
    i am running php version 7.2

    #1028210

    I just did the old suggestion again and error is gone cos my custommer dont want a broken site but the problem still exist if i default the theme!

    first edit product_snippet_review.php on line 80 and you should find this code:

    add_filter('comments_open', __return_true);

    replace it with:

    add_filter('comments_open', 'fn_true');

    then at the bottom of functions.php add this:

    function fn_true() {
    return true;
    }

    • This reply was modified 6 years ago by Mike.
    #1029179

    Hi Mike,

    Did this resolve your issue?

    Best regards,
    Victoria

    #1042393

    This solution resolved the issue for sure, but it’s not been fixed in the enfold 4.5.1.
    However, just after making this change, in every few hours I am getting the error – PHP message: PHP Warning: count(): Parameter must be an array or an object that implements Countable in …/wp-includes/post-template.php on line 284

    #1044527

    Hi Chowdhury,

    To be honest I’m not really sure what’s causing it.
    __return_true and __return_false are built in wordpress, you can check it here: https://codex.wordpress.org/Function_Reference/_return_true and here: https://codex.wordpress.org/Function_Reference/_return_false
    maybe you can try to switch to a default wordpress theme and check if these warnings still shows or maybe some server configurations that needs to be adjusted.

    Best regards,
    Nikko

    #1056835

    Ich hatte den selben Fehler seit dem update auf php7.2

    Ich habe
    add_filter(‘example_filter’, __return_false);

    ersetzt mit
    add_filter(‘example_filter’, ‘__return_false’);

    Jetzt funktioniert es. Vielleicht hilft es für Euch.

    #1057081

    Hallo fertilizer,

    Please open a new thread and include admin login details in private so that we can have a closer look at your site.

    LG,
    Rikard

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