Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#25481 closed defect (bug) (duplicate)

If you search, it doesn't find anything when you are logged in.

Reported by: websupporter's profile websupporter Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.7
Component: General Keywords:
Focuses: Cc:

Description

Hi,
I'm new here and hope I'll do everything allright. Well, I am just testing the new 3.7 beta and was curios about the new filter for stopwords.

Anyway, I installed 3.7 and logged in as an admin. First I was searching for 'Hello world' - and there was no result. I was digging a bit in the query.php and echoed the $this->request in line 2914:

SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND (((wp_posts.post_title LIKE '%hello%') OR (wp_posts.post_content LIKE '%hello%')) AND ((wp_posts.post_title LIKE '%world%') OR (wp_posts.post_content LIKE '%world%')))  AND wp_posts.post_type IN ('post', 'page', 'attachment') AND (wp_posts.post_status = 'publish' OR wp_posts.post_author =  AND wp_posts.post_status = 'private')  ORDER BY (CASE WHEN wp_posts.post_title LIKE '%hello world%' THEN 1 WHEN wp_posts.post_title LIKE '%hello%' AND wp_posts.post_title LIKE '%world%' THEN 2 WHEN wp_posts.post_title LIKE '%hello%' OR wp_posts.post_title LIKE '%world%' THEN 3 WHEN wp_posts.post_content LIKE '%hello world%' THEN 4 ELSE 5 END), wp_posts.post_date DESC LIMIT 0, 10

You see this statement:

(wp_posts.post_status = 'publish' OR wp_posts.post_author =  AND wp_posts.post_status = 'private')


So I went on and came to the line 2762 in which the statement gets altert when the user is logged in. There I echoed the $user_id and found out, for some reason this ID is empty, so the above statement is created.

I found out, that the $user_id is defined in 2716, but thats another part of an if-else-loop and so no longer active in line 2762. When I defined it in the right part of the if-else-loop again:

$user_id = get_current_user_id();

it worked fine.

Change History (3)

#1 @ocean90
11 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #25372.

I'm new here and hope I'll do everything allright.

You did. But the bug is already fixed in trunk.

#2 @ocean90
11 years ago

#25534 was marked as a duplicate.

#3 @SergeyBiryukov
11 years ago

  • Version changed from trunk to 3.7
Note: See TracTickets for help on using tickets.