mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-05-29 15:44:27 +00:00
Widgets: Prevent infinite loop in PHP8+ if the URL for the widget instance is incorrectly defined
This checks to make sure $link isn't empty before attempting to manipulate it. A simple test to demonstrate this can be seen at https://3v4l.org/PgSZg. Unit tests for both what already works and what is fixed by this change. Props hellofromTonya, dd32, peterwilsoncc. Fixes #53278. git-svn-id: https://develop.svn.wordpress.org/trunk@51107 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -50,7 +50,7 @@ class WP_Widget_RSS extends WP_Widget {
|
||||
}
|
||||
|
||||
$url = ! empty( $instance['url'] ) ? $instance['url'] : '';
|
||||
while ( stristr( $url, 'http' ) !== $url ) {
|
||||
while ( ! empty( $url ) && stristr( $url, 'http' ) !== $url ) {
|
||||
$url = substr( $url, 1 );
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ class WP_Widget_RSS extends WP_Widget {
|
||||
$title = strip_tags( $rss->get_title() );
|
||||
}
|
||||
$link = strip_tags( $rss->get_permalink() );
|
||||
while ( stristr( $link, 'http' ) !== $link ) {
|
||||
while ( ! empty( $link ) && stristr( $link, 'http' ) !== $link ) {
|
||||
$link = substr( $link, 1 );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user