-
AuthorPosts
-
June 22, 2018 at 6:55 pm #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 80any idea what it could be cos i disabled already some plugins but still got this error
June 23, 2018 at 12:34 pm #976929Hey Mike,
Which version of php are you running? Which version of Enfold are you running?
Best regards,
VictoriaJune 23, 2018 at 1:17 pm #976938enfold: 4.4.1
php: 7.2i have other sites whit enfold on same host so using same php version they are working fine
June 23, 2018 at 1:25 pm #976941it has someting to do whit the review tab if i remove it the error is gone
June 23, 2018 at 2:23 pm #976964Hi 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,
VictoriaJune 24, 2018 at 2:07 pm #977146was already there
June 24, 2018 at 8:56 pm #977211Hi,
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,
BasilisJune 25, 2018 at 4:05 pm #977553reuploaded the whole theme still same error only if i remove the review tab then the error is gone
June 25, 2018 at 6:17 pm #977590i changed to php version 5.6 then the error is gone so something has to do whit the php version
June 26, 2018 at 4:39 pm #978006Hi Mike,
So the error is gone or do you still need help?
Best regards,
VictoriaJune 26, 2018 at 7:33 pm #978103No its not gone cos if i switch back to PHP 7.2 its back..
June 27, 2018 at 11:50 pm #978616Hi,
I have consulted our Engineers, can you please make sure you are running the latest version?
Best regards,
BasilisJune 29, 2018 at 12:05 pm #979299yes i do.
enfold: 4.4.1
php: 7.2July 2, 2018 at 3:25 pm #980116Hi 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,
NikkoJuly 3, 2018 at 11:36 pm #980809i need it to put in functions.php of the theme right?
then i get:
July 4, 2018 at 11:28 am #981095Hi 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,
NikkoJuly 4, 2018 at 1:36 pm #981178That 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
July 4, 2018 at 2:36 pm #981225Hi 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,
NikkoJuly 4, 2018 at 4:43 pm #981286Ok thx, but do u fix this in a new version or do i need to adjust this to every update i get of enfold?
July 6, 2018 at 8:58 am #981908Hi Mike,
It should be fixed in the future releases of Enfold.
For the meantime, the solution is using this method.Best regards,
NikkoOctober 29, 2018 at 7:08 am #1027387This havent been fixed, I still get this error.
October 30, 2018 at 12:10 pm #1027962Hi 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,
NikkoOctober 30, 2018 at 1:39 pm #1028003I 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.2October 30, 2018 at 8:24 pm #1028210I 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, 1 month ago by Mike.
November 2, 2018 at 3:39 pm #1029179Hi Mike,
Did this resolve your issue?
Best regards,
VictoriaDecember 8, 2018 at 8:45 am #1042393This 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 284December 12, 2018 at 10:15 pm #1044527Hi 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,
NikkoJanuary 21, 2019 at 6:03 pm #1056835Ich 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.
January 22, 2019 at 7:35 am #1057081Hallo 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 -
AuthorPosts
- You must be logged in to reply to this topic.