Opened 4 weeks ago
Closed 4 weeks ago
#62972 closed defect (bug) (fixed)
Fatal error in twentyfourteen_paging_nav()
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.8 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Bundled Theme | Keywords: | |
Focuses: | Cc: |
Description (last modified by )
You get the following error when you access the home page with GET variables in the array format. Example:
/?test[]=1
Fatal error: Uncaught TypeError: urlencode(): Argument #1 ($string) must be of type string, array given in /wp-content/themes/twentyfourteen/inc/template-tags.php:50
Stack trace: #0 [internal function]: urlencode(Array) #1 /wp-content/themes/twentyfourteen/inc/template-tags.php(50): array_map('urlencode', Array) #2 /wp-content/themes/twentyfourteen/index.php(46): twentyfourteen_paging_nav() #3 /wp-includes/template-loader.php(106): include('/Users/...') #4 /wp-blog-header.php(19): require_once('/test...') #5 /index.php(17): require('/test...') #6 {main} thrown in /wp-content/themes/twentyfourteen/inc/template-tags.php on line 50
This error occurs because twentyfourteen_paging_nav() does not expect array variables.
A possible fix for this would be replacing array_map( 'urlencode', $query_args )
with urlencode_deep( $query_args )
.
Attachments (3)
Change History (12)
#1
@
4 weeks ago
- Component changed from Themes to Bundled Theme
- Description modified (diff)
- Version trunk deleted
#3
@
4 weeks ago
@pratiklondhe Maybe that is because you don't have enough number of posts. If you have 11 or more posts to show, twentyfourteen_paging_nav()
will be used and the error will occur.
#4
@
4 weeks ago
@takayukister , Yes, after adding 12 posts and testing again, I could replicate the issue.
I've implemented the changes you suggested, which appear to have resolved the error. Attaching the patch for review.
#5
@
4 weeks ago
- Milestone changed from Awaiting Review to 6.8
- Owner set to audrasjb
- Status changed from new to reviewing
Thanks for the ticket, moving this to milestone 6.8.
#7
@
4 weeks ago
Hey, @rinkalpagdar. Thanks for attempting to reproduce this!
Ideally, the homepage should display a list of posts. Could you check the backend settings by navigating to Settings → Reading → "Your homepage displays"
and confirm that it's set to "Your latest posts"
instead of a static page?
#8
@
4 weeks ago
Test Report
Description
This report validates whether the indicated patch works as expected.
Patch tested: https://core.trac.wordpress.org/attachment/ticket/62972/62972.diff
Environment
- WordPress: 6.8-alpha-59274-src
- PHP: 8.2.25
- Server: nginx/1.27.2
- Database: mysqli (Server: 8.0.40 / Client: mysqlnd 8.2.25)
- Browser: Chrome 133.0.0.0
- OS: macOS
- Theme: Twenty Fourteen 4.1
- MU Plugins: None activated
- Plugins:
- Test Reports 1.2.0
Actual Results
- ✅ Issue resolved with patch.
hi, @takayukister , I tried to replicate this on fresh WP install and twentyfourteen theme but couldn't, I am able to access the homepage even withe the
?test[]=1
get parameter without error, is there some steps I am missing here ?ps : attached a video of how I tested