Warning: Parameter 2 to MLAQuery
-
I’m using MLA v2.51 on a PHP 7 staging site.
While everything looks OK, I get this error when I open Assistant from the Media menu.
Warning: Parameter 2 to MLAQuery::mla_query_posts_search_filter() expected to be a reference, value given in /home/prodport/staging/1/wp-includes/class-wp-hook.php on line 298
I don’t get the error on any of the other menu options.
Is there something I need to do?
-
Thanks for your report. I have done a preliminary investigation and I cannot reproduce your symptoms on my system. The
MLAQuery::mla_query_posts_search_filter()function is a filter that hooks'posts_search'. In WordPress itself there is only one place that apply the filter (in/wp-includes/class-wp-query.php), and this call passes the second argument by reference.It is possible that you have some other plugin or theme function that calls this filter in a different way. If you can give me more information on your site’s plugins and theme I can investigate further. If you have a way to get a “stack trace” showing the origin of the filter call that would be excellent. Any additional information you can provide would be helpful. Thanks for your understanding and for your interest in the plugin.
Is there an easy way to do a “stack trace”? I’m happy to try to do one for you as it seems the most efficient way. This is on a staging server if that helps.
The easiest way to get a trace is to install and activate this excellent plugin:
https://ww.wp.xz.cn/plugins/query-monitor/
The Query Monitor plugin is an invaluable addition to any testing server/environment. Once it’s activated you will see some numbers up in the admin bar. When you access Media/Assistant the numbers should turn red to indicate a PHP Warning message was generated. Click on the red area, then on “Warnings(1)). You should see the message and a “Call Stack” in the right-hand part of the screen that gives you the information needed to figure out where the call(s) come from. Good luck with your testing.
I’m seeing this as well. This is the call stack:
apply_filters_ref_array('posts_search') wp-includes/class-wp-query.php:1995 WP_Query->get_posts() wp-includes/class-wp-query.php:3238 WP_Query->query() wp-includes/class-wp-query.php:3347 WP_Query->__construct() wp-content/plugins/media-library-assistant/includes/class-mla-data-query.php:1144 MLAQuery::_execute_list_table_query() wp-content/plugins/media-library-assistant/includes/class-mla-data-query.php:364 MLAQuery::mla_count_list_table_items() wp-content/plugins/media-library-assistant/includes/class-mla-list-table.php:1965 MLA_List_Table->prepare_items() wp-content/plugins/media-library-assistant/includes/class-mla-main.php:1494 MLA::mla_render_admin_page() wp-includes/class-wp-hook.php:298 do_action('media_page_mla-menu') wp-admin/admin.php:222Thanks, @adrianb, for your update and especially for posting the call stack; very helpful.
I did some research and it looks like this problem is specific to PHP version 7.1. I am running PHP 7.0 and cannot reproduce the problem on my system.
I also found similar problems already reported in WordPress Trac, such as:
Not working “wp_default_styles” on PHP 7.1.0
I have uploaded a new MLA Development Version dated 20170408 which I believe avoids the problem. You can find the Development Version here:
https://downloads.wp.xz.cn/plugin/media-library-assistant.zip
It would be great if you could install the Development Version and let me know if it solves the problem. Also, please confirm that you are running PHP 7.1.x or tell me exactly which PHP version you are using. Thanks for your help with this issue.
Yes, I’m using PHP 7.1.3 and yes, the the Development Version solved it!
-
This reply was modified 9 years, 2 months ago by
AdrianB.
I had the same error and the build seems to have resolved the issue.
1) Is this build ok to use on a live site?
2) When will you post a new release build?Thanks!
Thanks for your report and for giving the Development Version a workout. Thanks as well for your questions.
The Development Version(s) I post to the repository are always intended to be as reliable as the current MLA version, with bug fixes and some enhancements added in response to support forum topics. You can always find the changes I’ve made at the top of the “== Changelog ==” section of the
readme.txtfile in the root directory.You can look through the changes and make your own assessment of the merits of deploying the Development Version to your live site. I believe that the changes from MLA v2.51 to the current Development Version are small and localized; the risks are small. Of course, if you do find a problem I will fix it as soon as I can.
My current plan is to release an update by the end of May. I don’t plan any significant new features or code changes in the next update.
I have released MLA v2.53, which contains the fix for this problem. I am marking the topic resolved, but please update it if the problem returns.
-
This reply was modified 9 years, 2 months ago by
The topic ‘Warning: Parameter 2 to MLAQuery’ is closed to new replies.