From 97fc82a8795cbe9db48abc9974c22844350ff940 Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Thu, 12 May 2016 20:23:28 +0000 Subject: [PATCH] Widgets: Make `WP_Widget` a real abstract class. This removes the `die()` call from `WP_Widget::widget()` and converts it to an abstract method. `WP_Widgets` (later renamed to `WP_Widget`) was introduced in [10764] where the minimum PHP requirement was 4.3, thus no `abstract` was available. Props johnbillion. Fixes #35981. Built from https://develop.svn.wordpress.org/trunk@37425 git-svn-id: http://core.svn.wordpress.org/trunk@37391 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-widget.php | 10 +++++----- wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/wp-includes/class-wp-widget.php b/wp-includes/class-wp-widget.php index 0653dee9d7..f22b5aa29d 100644 --- a/wp-includes/class-wp-widget.php +++ b/wp-includes/class-wp-widget.php @@ -16,8 +16,9 @@ * * @since 2.8.0 * @since 4.4.0 Moved to its own file from wp-includes/widgets.php + * @abstract */ -class WP_Widget { +abstract class WP_Widget { /** * Root ID for all widgets of this type. @@ -96,14 +97,13 @@ class WP_Widget { * * @since 2.8.0 * @access public + * @abstract * * @param array $args Display arguments including 'before_title', 'after_title', * 'before_widget', and 'after_widget'. * @param array $instance The settings for the particular instance of the widget. */ - public function widget( $args, $instance ) { - die('function WP_Widget::widget() must be over-ridden in a sub-class.'); - } + abstract public function widget( $args, $instance ); /** * Updates a particular instance of a widget. @@ -169,7 +169,7 @@ class WP_Widget { * @access public * * @see __construct() - * + * * @param string $id_base Optional Base ID for the widget, lowercase and unique. If left empty, * a portion of the widget's class name will be used Has to be unique. * @param string $name Name for the widget displayed on the configuration page. diff --git a/wp-includes/version.php b/wp-includes/version.php index 1ac8355782..e178eebf14 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.6-alpha-37424'; +$wp_version = '4.6-alpha-37425'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.