Make WordPress Core

Opened 14 months ago

Closed 8 months ago

#63656 closed defect (bug) (maybelater)

get_page_by_path $post_type supports string and array but the check in the loop is checking by string

Reported by: salimali Owned by:
Priority: normal Milestone:
Component: Posts, Post Types Version: 6.8
Severity: normal Keywords: has-patch reporter-feedback
Cc: Focuses:

Description

In the get_page_by_path function, $post_type supports string and array, but the check in the loop is checking by string https://github.com/WordPress/wordpress-develop/blob/6.8.1/src/wp-includes/post.php#L6135, which throws PHP Warning: Array to string conversion in /var/www/html/wp-includes/post.php on line 6135. Example below:

<?php
$page = get_page_by_path('/parent/child/', OBJECT, array('page'));

Change History (10)

This ticket was mentioned in PR #9190 on WordPress/wordpress-develop by @vipulgupta003.


14 months ago
#1

  • Keywords has-patch added; needs-patch removed

This ticket was mentioned in Slack in #core-test by oglekler. View the logs.


13 months ago

#3 @oglekler
13 months ago

  • Keywords needs-testing added
  • Version 6.8

#4 @dilip2615
13 months ago

  • Keywords needs-testing removed
  • Version6.8

Patch Testing

Description

Tested the patch for Ticket #63656: Twenty Seventeen theme should use the_excerpt() instead of the_content() on search and archive pages.

Environment

  • WordPress: 6.8.1
  • PHP: 8.2.23
  • Theme: Twenty Seventeen
  • Plugins: Test Reports 1.2.0

Steps to Reproduce

  1. Create a post with content and an excerpt.
  2. View search results or archive page.
  3. See the full content appearing.
  4. Apply the patch from the ticket.
  5. View again → now only the excerpt appears.

Expected Results

✅ Excerpt should be shown on archive/search pages.

Actual Results

✅ Excerpt is shown. Patch works as expected.

Additional Notes

No layout/design issues. Works well with existing posts.

Version 0, edited 13 months ago by dilip2615 (next)

#5 follow-up: @mindctrl
13 months ago

  • Keywords needs-testing added

@dilip2615 your test report appears to be for a different ticket?

#6 in reply to: ↑ 5 @dilip2615
13 months ago

Replying to mindctrl:No testing for this current ticket.

@dilip2615 your test report appears to be for a different ticket?

#7 follow-up: @mindctrl
13 months ago

@dilip2615 your test report refers to "Twenty Seventeen theme should use the_excerpt() instead of the_content() on search and archive pages.", but that is not what this ticket is about.

This ticket is about get_page_by_path throwing PHP warnings.

#8 in reply to: ↑ 7 @dilip2615
13 months ago

Replying to mindctrl:

Okay Thanks for the information sorry about my conversation I will check more.

#9 @mindctrl
11 months ago

  • Keywords reporter-feedback added

@salimali thanks for the report. Can you provide steps on how you encountered the PHP notices? The attached PR looks correct, but I'd like to understand how the error is/was triggered in WP.

#10 @SirLouen
8 months ago

  • Keywords needs-testing removed
  • Milestone Awaiting Review
  • Resolutionmaybelater
  • Status newclosed

Given that several months have passed without additional information about the ticket, as @mindctrl asked, I think it's time to close this as maybelater, as it is unclear how to reproduce it and there has been no follow up by @salimali

@salimali please feel free to comment whenever you see this and provide additional information on how to reproduce it, and I will be happy to test it and review the patch accordingly.

Note: See TracTickets for help on using tickets.