[wp-trac] [WordPress Trac] #41038: Possible ambiguity with parameters for posts_request filter

WordPress Trac noreply at wordpress.org
Wed Jun 14 03:56:15 UTC 2017


#41038: Possible ambiguity with parameters for posts_request filter
----------------------------+-----------------------------
 Reporter:  dunar21         |      Owner:
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Query           |    Version:  4.8
 Severity:  normal          |   Keywords:
  Focuses:  administration  |
----------------------------+-----------------------------
 I received the below listed error in my server logs relative to
 Relevanssi's plugin.

 The Relevanssi dev provided these links indicating that he though there
 are indeed two parameters:

 https://core.trac.wordpress.org/browser/tags/4.8/src/wp-includes/class-wp-
 query.php#L2752

 https://developer.wordpress.org/reference/hooks/posts_request/

 Maybe there is something I am missing, but in the source code, only one
 parameter (an array) is being sent with the hook, while the hook notes
 indicate two parameters.

 Also, in the code reference, the syntax indicates two parameters, but the
 description of parameters indicates only one (either a string or an
 instance of WP_Query.

 There seems to be discrepancy here. The source code is clearly passing an
 array as a parameter, the only parameter, unless the hook parsing
 algorithm separates array parameters into individual one.

 It could definitely be that I am missing something here, but just in case
 I am not, I will notify you guys of the issue.


 2017/06/13
 15:39:27 [error] 121306#0: *78296689 FastCGI sent in stderr: “PHP
 message: PHP Fatal error: Uncaught ArgumentCountError: Too few
 arguments to function relevanssi_prevent_default_request(), 1 passed in
 …/public/wp-includes/class-wp-hook.php on line
 298 and exactly 2 expected in
 …/public/wp-content/plugins/relevanssi/lib/common.php:447
 Stack trace:
 #0 …/public/wp-includes/class-wp-hook.php(298):
 relevanssi_prevent_default_request(‘SELECT wp_posts…’)
 #1 …/public/wp-includes/plugin.php(203): WP_Hook->apply_filters(‘SELECT
 wp_posts…’, Array)
 #2

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41038>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list