comparison function is deprecated
- This topic has 9 replies, 3 voices, and was last updated 3 months, 2 weeks ago by
Tobias Haas.
-
AuthorPosts
-
December 30, 2024 at 11:26 PM #47264
Tobias Haas
ParticipantHey MB Team,
I discovered this today in the Query Monitor - can you please fix it - thank you very muchDeprecated uasort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero
wp-content/plugins/meta-box-aio/vendor/elightup/twig/Twig/Extension/CoreExtension.php:940 uasort() wp-content/plugins/meta-box-aio/vendor/elightup/twig/Twig/Extension/CoreExtension.php:940 elightup_twig_sort_filter() wp-content/plugins/meta-box-aio/vendor/elightup/twig/Twig/Environment.php(358) : eval()'d code:42 __TwigTemplate_6f2d1548ff5e8e282c5e5fdbd4135f74->doDisplay() wp-content/plugins/meta-box-aio/vendor/elightup/twig/Twig/Template.php:394 eLightUp\Twig\Template->displayWithErrorHandling() wp-content/plugins/meta-box-aio/vendor/elightup/twig/Twig/Template.php:367 eLightUp\Twig\Template->display() wp-content/plugins/meta-box-aio/vendor/elightup/twig/Twig/Template.php:379 eLightUp\Twig\Template->render() wp-content/plugins/meta-box-aio/vendor/elightup/twig/Twig/TemplateWrapper.php:40 eLightUp\Twig\TemplateWrapper->render() wp-content/plugins/meta-box-aio/vendor/elightup/twig/Twig/Environment.php:277 eLightUp\Twig\Environment->render() wp-content/plugins/meta-box-aio/vendor/meta-box/mb-views/src/Renderer.php:72 MBViews\Renderer->render() wp-content/plugins/meta-box-aio/vendor/meta-box/mb-views/src/Shortcode.php:28 MBViews\Shortcode->render() wp-includes/shortcodes.php:434 do_shortcode_tag() wp-includes/shortcodes.php:434 preg_replace_callback() wp-includes/shortcodes.php:273 do_shortcode() wp-content/themes/bricks/includes/elements/shortcode.php:96 Bricks\Element_Shortcode->render() wp-content/themes/bricks/includes/elements/base.php:2591 Bricks\Element->init() wp-content/themes/bricks/includes/frontend.php:629 Bricks\Frontend::render_element() wp-content/themes/bricks/includes/elements/container.php:929 Bricks\Element_Container->render() wp-content/themes/bricks/includes/elements/base.php:2591 Bricks\Element->init() wp-content/themes/bricks/includes/frontend.php:629 Bricks\Frontend::render_element() wp-content/themes/bricks/includes/frontend.php:770 Bricks\Frontend::render_data() wp-content/themes/bricks/includes/frontend.php:1017 Bricks\Frontend::render_content() wp-content/themes/bricks/page.php:7
December 31, 2024 at 11:47 PM #47276Peter
ModeratorHello Tobias,
Which is the PHP version that you are using? According to the stack trace, the Bricks theme is included in the error message. Can you please also deactivate this theme and check the issue again?
January 2, 2025 at 1:47 AM #47279Tobias Haas
ParticipantPHP 8.3.10
Bricks 1.12-betaJanuary 2, 2025 at 1:06 PM #47281Tan Nguyen
ParticipantDear Tobias,
Thanks for your information, I have added into a backlog and gonna fix it as soon as I can.
Cheers!
January 2, 2025 at 5:10 PM #47285Tan Nguyen
ParticipantDear Tobias,
I have checked further and see that the call stack ultimately call
uasort()
function, therefore, the caller should sastifie theuasort()
, meaning the 2nd parameter should be numeric value.However, since you are using Bricks, it could be from there. As currently we don't have full context right now, can you please send me your input data like field you are using and settings you have saved so I can replicate and fix it if we could do in our end?
Cheers!
January 2, 2025 at 7:26 PM #47287Tobias Haas
Participant{% set group = attribute(site, 'fc-koenigsfeld') %} {% set erste_mannschaft = attribute(group, 'erste_mannschaft') %} {% set erste_mannschaft = (erste_mannschaft|length > 1) ? (erste_mannschaft|sort((a, b) => a.date_nextmatch_erste.timestamp > b.date_nextmatch_erste.timestamp) |filter(v => v.date_nextmatch_erste.timestamp > mb.microtime(true))) : erste_mannschaft %} {% if erste_mannschaft|length > 0 %} {% set erste_mannschaft = erste_mannschaft|first %} <p class="fck-next">Nächstes Spiel</p> <div class="fck-next-match"> <div class="fck-team-block"> <p class="fck-team-name">{{ erste_mannschaft.heimmannschaft_erste.title }}</p> {{ _self.logo(erste_mannschaft.heimmannschaft_erste) }} </div> <span class="fck-vs-nextgame">vs</span> <div class="fck-team-block"> <p class="fck-team-name">{{ erste_mannschaft.auswaerts_erste.title }}</p> {{ _self.logo(erste_mannschaft.auswaerts_erste) }} </div> </div> <div class="fck-match-data"> <div class="fck-match-data__inner"> <p>// {{ erste_mannschaft.Liga_erste.label }}</p> <p>// {{ erste_mannschaft.date_nextmatch_erste.timestamp|date("d.m.Y") }} um {{ erste_mannschaft.date_nextmatch_erste.timestamp|date("H:i") }} Uhr</p> <p>// {{ mb.rwmb_meta('adresse_sportplatz', null, erste_mannschaft.heimmannschaft_erste.ID) }}</p> </div> </div> {% else %} <div class="fck-match-data"> <div class="fck-match-data__inner"> <p style="text-align:center">Aktuell sind keine Spiele geplant...</p> </div> </div> {% endif %} {% macro logo(post, size = 'medium') %} <img class="fck-team-logo" src="{{ post.thumbnail[size].url }}" alt="{{ post.alt }}" title="{{ post.title }}"> {% endmacro %}
Is this enought? Lemme know if you need more informations
January 3, 2025 at 9:07 AM #47293Tan Nguyen
ParticipantDear Tobias,
I can see you are returning boolean from this expression
sort((a, b) => a.date_nextmatch_erste.timestamp > b.date_nextmatch_erste.timestamp)
Since PHP 8 requires returning numeric value instead, you will need to return -1, 0, 1 respective to the sort data. You can use the spaceship operator like so:
sort((a, b) => a.date_nextmatch_erste.timestamp <=> b.date_nextmatch_erste.timestamp)
Let me know if the issue is resolved.
January 3, 2025 at 7:00 PM #47296Tobias Haas
ParticipantHey Tan,
Thank you very much! This fixed the problem.January 3, 2025 at 7:04 PM #47297Tobias Haas
ParticipantHere's another one
Deprecated Creation of dynamic property SWP_Meta_Box_Integration_Updater::$beta is deprecated wp-content/plugins/searchwp-meta-box-integration/vendor/updater.php:46 SWP_Meta_Box_Integration_Updater->__construct() wp-content/plugins/searchwp-meta-box-integration/searchwp-meta-box-integration.php:486 searchwp_meta_box_integration_update_check() wp-includes/class-wp-hook.php:324 do_action('admin_init') wp-admin/admin.php:175
January 3, 2025 at 7:09 PM #47299Tobias Haas
Participantnevermind! i ask the SearchWP Team. thanks
-
AuthorPosts
- You must be logged in to reply to this topic.