Opened 11 months ago
Closed 5 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: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 6.8 |
| Component: | Posts, Post Types | Keywords: | has-patch reporter-feedback |
| Focuses: | Cc: |
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.
11 months ago
#1
- Keywords has-patch added; needs-patch removed
This ticket was mentioned in Slack in #core-test by oglekler. View the logs.
10 months ago
#4
@
10 months ago
- Keywords needs-testing removed
- Version set to 6.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
- Server: nginx/1.26.1
- Database: mysqli (Server: 8.0.16 / Client: mysqlnd 8.2.23)
- Browser: Chrome 138.0.0.0
- OS: Windows 10/11
- Theme: Twenty Seventeen 3.9
- MU Plugins: None activated
- Plugins:
- Test Reports 1.2.0
Steps to Reproduce
- Create a post with content and an excerpt.
- View search results or archive page.
- See the full content appearing.
- Apply the patch from the ticket.
- 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.
#5
follow-up:
↓ 6
@
10 months ago
- Keywords needs-testing added
@dilip2615 your test report appears to be for a different ticket?
#6
in reply to:
↑ 5
@
10 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:
↓ 8
@
10 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
@
10 months ago
Replying to mindctrl:
Okay Thanks for the information sorry about my conversation I will check more.
#9
@
8 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
@
5 months ago
- Keywords needs-testing removed
- Milestone Awaiting Review deleted
- Resolution set to maybelater
- Status changed from new to closed
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.
Track ticket : https://core.trac.wordpress.org/ticket/63656