#40542 closed defect (bug) (fixed)
Undefined index in strip_fragment_from_url function
Reported by: | betterstudio | Owned by: | DrewAPicture |
---|---|---|---|
Milestone: | 4.9 | Priority: | normal |
Severity: | normal | Version: | 4.4 |
Component: | Canonical | Keywords: | has-patch dev-feedback |
Focuses: | Cc: |
Description
There is undefined index in strip_fragment_from_url function for
$parsed_url['path']
path should be checked to be available. Simple check needed:
if ( ! empty( $parsed_url['path'] ) )
file: wp-includes/canonical.php line 570
Attachments (1)
Change History (8)
#1
@
7 years ago
- Component changed from General to Canonical
- Keywords reporter-feedback added
- Version changed from trunk to 4.4
#2
@
7 years ago
Hi @ocean90
I can't remember it now because i saw it 6 week ago in one of our customers site!
It does not matter! You can check this code: {{{#!php
<?php
strip_fragment_from_url( 'http://betterstudio.com' );
}}}
That function will make a warning!
Notice: Undefined index: path in .../wp.dev/wp-includes/canonical.php on line 570
#4
@
7 years ago
- Keywords has-patch dev-feedback added; needs-patch removed
In the function the other array index are checked except this one so as suggested on the ticket this will avoid problems :-)
This ticket was mentioned in Slack in #core by mte90. View the logs.
7 years ago
Note: See
TracTickets for help on using
tickets.
Hello @betterstudio, welcome to WordPress Trac!
So far
strip_fragment_from_url()
is only used inredirect_canonical()
. What URL are you trying to access to get this warning?