Title: PHP Deprecated: class constructor name with php7
Last modified: August 30, 2016

---

# PHP Deprecated: class constructor name with php7

 *  Resolved [ShinichiN](https://wordpress.org/support/users/shinichin/)
 * (@shinichin)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/php-deprecated-class-constructor-name-with-php7/)
 * PHP Deprecated: Methods with the same name as their class will not be constructors
   in a future version of PHP; WP_Import has a deprecated constructor in /hello/
   wp-content/plugins/wordpress-importer/wordpress-importer.php on line 38
 * [https://wordpress.org/plugins/wordpress-importer/](https://wordpress.org/plugins/wordpress-importer/)

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

 *  Thread Starter [ShinichiN](https://wordpress.org/support/users/shinichin/)
 * (@shinichin)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/php-deprecated-class-constructor-name-with-php7/#post-6852225)
 * Looks like people are waiting for the new importer. Until then, if you are super
   annoyed by these errors, we can change the code manually, because it won’t be
   updated anyway.
 * [https://core.trac.wordpress.org/ticket/24373#comment:46](https://core.trac.wordpress.org/ticket/24373#comment:46)
 *  [Jon (Kenshino)](https://wordpress.org/support/users/kenshino/)
 * (@kenshino)
 * Lord Jon
 * [10 years, 5 months ago](https://wordpress.org/support/topic/php-deprecated-class-constructor-name-with-php7/#post-6852228)
 * Do read [https://make.wordpress.org/core/2015/11/18/wordpress-importer-redux/](https://make.wordpress.org/core/2015/11/18/wordpress-importer-redux/)
   as well.
 * Cheers!
 *  [BackuPs](https://wordpress.org/support/users/backups/)
 * (@backups)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/php-deprecated-class-constructor-name-with-php7/#post-6852530)
 * change line
 * 66 to
 * `public function __construct(){ /* nothing */ }`
 *  [BackuPs](https://wordpress.org/support/users/backups/)
 * (@backups)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/php-deprecated-class-constructor-name-with-php7/#post-6852531)
 * The complete fixed file wordpress-importer.php can be downloaded here.
 * [http://pastebin.com/14xJER5S](http://pastebin.com/14xJER5S)
 * It is php7 compatible and working on wp 4.4
 * It also has fixes from other threads. You can do a compare using winmerge. 🙂
 * Replace the content of that file with the content at pastebin
 * it has also fixes from (note : never tested these).
 * [https://wordpress.org/support/topic/importer-raises-errors-with-wp_debug-mode-on](https://wordpress.org/support/topic/importer-raises-errors-with-wp_debug-mode-on)
 * [https://wordpress.org/support/topic/notice-wp_get_http-is-deprecated-since-version-44](https://wordpress.org/support/topic/notice-wp_get_http-is-deprecated-since-version-44)
 *  [Rhand](https://wordpress.org/support/users/rhand/)
 * (@rhand)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/php-deprecated-class-constructor-name-with-php7/#post-6852565)
 * Thanks a lot [@backups](https://wordpress.org/support/users/backups/)! this made
   import work on PHP 7 for me.
 *  [Rhand](https://wordpress.org/support/users/rhand/)
 * (@rhand)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/php-deprecated-class-constructor-name-with-php7/#post-6852591)
 * Hmm with my current PHP 7 setup and WordPress 4.5.2 I am getting an issue with
   a warning that a method and class cannot have the same name
 *     ```
       ( ! ) Deprecated: Methods with the same name as their class will not
       be constructors in a future version of PHP; WP_Import has a deprecated constructor in
        /srv/www/sub.domain.com/current/web/app/plugins/wordpress-importer/wordpress-importer.php on line 38
       ```
   
 * So current pastie offered by BackuPs needs an update.
 *  [BackuPs](https://wordpress.org/support/users/backups/)
 * (@backups)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/php-deprecated-class-constructor-name-with-php7/#post-6852592)
 * Hi
 * what does line 66 say in your file?
 * it should say
 *  public function __construct(){ /* nothing */ }
 * and not
 *  function WP_Import() { /* nothing */ }
 *  [rtpHarry](https://wordpress.org/support/users/rtpharry/)
 * (@rtpharry)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/php-deprecated-class-constructor-name-with-php7/#post-6852593)
 * This link was posted above but not really a big deal about it:
 * > [WordPress Importer Redux](https://make.wordpress.org/core/2015/11/18/wordpress-importer-redux/)
 * You should check it out before reading any other solutions – it is a rewrite 
   of the plugin which actually works and will become the official v2 of the plugin
   when its finished.
 * This information should be pushed into the description of the official plugin
   as I ended up with a mess of data trying to figure out what was going wrong.
 *  [David](https://wordpress.org/support/users/davidnash/)
 * (@davidnash)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/php-deprecated-class-constructor-name-with-php7/#post-6852598)
 * That’s awesome, it worked immediately for me. Looks much better too.
 * The old version was just telling me it was failing but not why.
 * Thanks rtpHarry!

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

The topic ‘PHP Deprecated: class constructor name with php7’ is closed to new replies.

 * ![](https://ps.w.org/wordpress-importer/assets/icon.svg?rev=2791650)
 * [WordPress Importer](https://wordpress.org/plugins/wordpress-importer/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-importer/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-importer/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-importer/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-importer/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-importer/reviews/)

## Tags

 * [PHP7](https://wordpress.org/support/topic-tag/php7/)

 * 9 replies
 * 6 participants
 * Last reply from: [David](https://wordpress.org/support/users/davidnash/)
 * Last activity: [9 years, 9 months ago](https://wordpress.org/support/topic/php-deprecated-class-constructor-name-with-php7/#post-6852598)
 * Status: resolved