Opened 8 years ago
Closed 8 years ago
#39564 closed defect (bug) (fixed)
Notice: Undefined index: item_spacing in /var/www/html/wordpress/wp-includes/class-walker-page.php on line 106
Reported by: | jrswgtr | Owned by: | dd32 |
---|---|---|---|
Milestone: | 4.7.3 | Priority: | normal |
Severity: | normal | Version: | 4.7 |
Component: | Menus | Keywords: | has-patch commit fixed-major |
Focuses: | Cc: |
Description
I get this notice while trying to generate a sitemap with the page walker.
Notice: Undefined index: item_spacing in /var/www/html/wordpress/wp-includes/class-walker-page.php on line 106
Attachments (3)
Change History (21)
#1
@
8 years ago
- Component changed from General to Menus
- Milestone changed from Awaiting Review to 4.7.2
#2
@
8 years ago
Actually, I am no able to reproduce this issue. @jrswgtr please provide me the steps to reproduce the issue.
#4
@
8 years ago
Thanks @jrswgtr for reporting this.
I am able to replicate this notice at lines 106, 56, 199 and 81.
#5
@
8 years ago
- Keywords has-patch needs-testing added
@ketuchetan Try by adding this code into your functions.php. Make sure you have made Debugging on from your wp-config.php. You can also check by any debugging plugin.
function test_page_walker() { $walker_page = new Walker_Page(); echo '<ul>'.$walker_page->walk(get_pages(), 0).'</ul>'; // 0 means display all levels. } add_action( 'init', 'test_page_walker' );
#6
@
8 years ago
Hi, @ketuchetan
I saw that your patch is duplicate. Can you explain why? :-) I think you should have a better solution than the previous patch. :-)
#7
follow-up:
↓ 9
@
8 years ago
@bhargavbhandari90 There is no any changes but you can see my patch I have created patch from the /src/ directory of development repository.
This ticket was mentioned in Slack in #core by chetansatasiya. View the logs.
8 years ago
#9
in reply to:
↑ 7
@
8 years ago
Replying to ketuchetan:
@bhargavbhandari90 There is no any changes but you can see my patch I have created patch from the /src/ directory of development repository.
Thanks, I appreciate the effort. The grunt patch
command is really good at picking up sub-directories and will prompt if needs be. While helpful, refreshes like these are unnecessary.
#10
follow-up:
↓ 13
@
8 years ago
- Resolution set to fixed
- Status changed from accepted to closed
In 39949:
#11
@
8 years ago
- Keywords commit fixed-major added; needs-testing removed
- Resolution fixed deleted
- Status changed from closed to reopened
Reopening for backporting to 4.7 branch.
This ticket was mentioned in Slack in #core by jeffpaul. View the logs.
8 years ago
#15
follow-up:
↓ 16
@
8 years ago
@peterwilsoncc in [39949] I note that the logic has now changed from the 4.6 behaviour in the event that the item_spacing
arg is not provided - it'll default to discard
in that case now.
Should this have been if ( ! isset(...) || 'preserve' ...
?
#16
in reply to:
↑ 15
@
8 years ago
Replying to dd32:
@peterwilsoncc in [39949] I note that the logic has now changed from the 4.6 behaviour in the event that the
item_spacing
arg is not provided - it'll default todiscard
in that case now.
Should this have been
if ( ! isset(...) || 'preserve' ...
?
That's a good catch.
It looks like the behaviour has changed when the walker is called directly rather than via wp_list_pages()
and related functions. I'm inclined to leave it as it's an edge case and, arguably, ill advised.
#17
@
8 years ago
It looks like the behaviour has changed when the walker is called directly rather than via wp_list_pages() and related functions. I'm inclined to leave it as it's an edge case and, arguably, ill advised.
I'm inclined to agree, the only thing that I can think of is the case where you've extended the Walker with a custom class. However, in that case you should still be using wp_list_pages()
and passing the walker
arg.
I'm fine with leaving this as-is then.
Introduced in [38523].