Also available in: Français

With the WordPress 4.3 version is came a big wave of new topics  about widget error on WP. Official and non-official forums are full of this kind of reaction. Indeed, WordPress decided to not support anymore the PHP 4 like constructor, as the official documentation indicated it. (it has been updated)

Use the __construct() method

Even if PHP5 still support the old syntax:

<?php
class Foo_Widget extends WP_Widget {

	function Foo_Widget() {
		$this->WP_Widget(
			'foo_widget', // Base ID
			__( 'Widget Title', 'text_domain' ), // Name
			array( 
				'description' => __( 'A Foo Widget', 'text_domain' ),
				'classname' => 'foo-widget'
			) // Args
		);
	}
}
?>

WordPress show you an error message (if you are in debug mode) to inform you to use the __construct()parent method. It’s now therefore appropriate to use that constructor:

<?php
class Foo_Widget extends WP_Widget {

	function __construct() {
		parent::__construct(
			'foo_widget', // Base ID
			__( 'Widget Title', 'text_domain' ), // Name
			array( 
				'description' => __( 'A Foo Widget', 'text_domain' ),
				'classname' => 'foo-widget'
			) // Args
		);
	}
}
?>

To your codes!