Title: PHP 7 deprecated constructors
Last modified: August 31, 2016

---

# PHP 7 deprecated constructors

 *  [Kerfred](https://wordpress.org/support/users/kerfred/)
 * (@kerfred)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/php-7-deprecated-constructors/)
 * Hello,
 * First, I want to congratulate for this great plugin.
 * Just to inform you that I just upgraded to PHP 7, and I get:
 * >  Deprecated: Methods with the same name as their class will not be constructors
   > in a future version of PHP; wp_native_dashboard has a deprecated constructor
   > in /wp-content/plugins/wp-native-dashboard/wp-native-dashboard.php on line 
   > 103
   > Deprecated: Methods with the same name as their class will not be constructors
   > in a future version of PHP; wp_native_dashboard_automattic has a deprecated
   > constructor in /wp-content/plugins/wp-native-dashboard/automattic.php on line
   > 15
   > Deprecated: Methods with the same name as their class will not be constructors
   > in a future version of PHP; wp_native_dashboard_langswitcher has a deprecated
   > constructor in /wp-content/plugins/wp-native-dashboard/langswitcher.php on 
   > line 9
 * Carry on the great work.
 * [https://wordpress.org/plugins/wp-native-dashboard/](https://wordpress.org/plugins/wp-native-dashboard/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Jer Clarke](https://wordpress.org/support/users/jeremyclarke/)
 * (@jeremyclarke)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/php-7-deprecated-constructors/#post-6981221)
 * +1 this is a real problem with an easy fix!
 * PHP7 is going to explode in popularity now that the new Ubuntu LTS version supports
   it, so being compatible is important.
 * All you need to do to fix this is change the constructor method for classes to
   use `__construct()` instead of the class name, e.g.:
 * wp-native-dashboard.php line 103:
 *     ```
       class wp_native_dashboard {
       //	function wp_native_dashboard() {
       	function __construct() {
       ```
   
 * automattic.php line 15:
 *     ```
       class wp_native_dashboard_automattic {
       //	function wp_native_dashboard_automattic($tagged, $root_tagged) {
       	function __construct($tagged, $root_tagged) {
       ```
   
 * langswitcher.php line 9:
 *     ```
       class wp_native_dashboard_langswitcher {
       //	function wp_native_dashboard_langswitcher($plugin_url, $as_head, $as_admin_bar) {
       	function _construct($plugin_url, $as_head, $as_admin_bar) {
       ```
   
 * This has long been the best way to declare classes, but PHP7 now makes it a requirement
   to silence warnings in the logs.
 * Thanks to the author if you can patch this! If not hope others find my patches
   useful!
 *  [Jer Clarke](https://wordpress.org/support/users/jeremyclarke/)
 * (@jeremyclarke)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/php-7-deprecated-constructors/#post-6981225)
 * Found another one in `loginselector.php`:
 *     ```
       class wp_native_dashboard_loginselector {
       //	function wp_native_dashboard_loginselector($permit_template_tags) {
       	function __construct($permit_template_tags) {
       ```
   
 *  [Viljami Kuosmanen](https://wordpress.org/support/users/zuige/)
 * (@zuige)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/php-7-deprecated-constructors/#post-8323064)
 * Somebody just forked this plugin and made sure it works on PHP7.
 * [https://github.com/redandbluefi/wp-native-dashboard](https://github.com/redandbluefi/wp-native-dashboard)
 * Man I wish someone could update this upstream from the fork.
 *  [Jer Clarke](https://wordpress.org/support/users/jeremyclarke/)
 * (@jeremyclarke)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/php-7-deprecated-constructors/#post-8324836)
 * I emailed the author directly to point to this thread and ask for an update 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘PHP 7 deprecated constructors’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-native-dashboard_d8d8d8.svg)
 * [WP Native Dashboard](https://wordpress.org/plugins/wp-native-dashboard/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-native-dashboard/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-native-dashboard/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-native-dashboard/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-native-dashboard/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-native-dashboard/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [Jer Clarke](https://wordpress.org/support/users/jeremyclarke/)
 * Last activity: [9 years, 7 months ago](https://wordpress.org/support/topic/php-7-deprecated-constructors/#post-8324836)
 * Status: not resolved