Title: PHP7 compatibility
Last modified: November 4, 2016

---

# PHP7 compatibility

 *  [Andy Keith](https://wordpress.org/support/users/andykeith/)
 * (@andykeith)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/php7-compatibility-45/)
 * Hi,
 * We’re planning to upgrade to PHP7 soon. I’ve run the PHP Compatibility Checker
   on your plugin and it’s showing a couple of errors. Is there any chance you could
   fix these in a future release?
 * FILE: /plugins/ai-twitter-feeds/ai-twitter-feeds.php
    ——————————————————————————————-
   FOUND 2 ERRORS AFFECTING 2 LINES ——————————————————————————————- 191 | ERROR 
   | preg_replace() – /e modifier is forbidden since PHP 7.0 335 | ERROR | Use of
   deprecated PHP4 style class constructor is not supported since PHP 7 ——————————————————————————————-

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

 *  [plumski](https://wordpress.org/support/users/plumski/)
 * (@plumski)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/php7-compatibility-45/#post-8497679)
 * following this too
 *  [rseitz](https://wordpress.org/support/users/rseitz/)
 * (@rseitz)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/php7-compatibility-45/#post-8858780)
 * Our system admins didn’t wait to update us to PHP 7, so we had to scramble to
   make our WordPress Multisites work. In the ai-twitter-feeds.php file, we had 
   to change this line:
 * > $status = preg_replace(“/((http:\/\/|https:\/\/)[^ )
   >  ]+)/e”, “‘[‘. ((strlen(‘$1’)>=$linkMaxLen ? substr(‘$1′,0,$linkMaxLen).’…’:’$1′)).’](https://wordpress.org/support/topic/php7-compatibility-45/$1?output_format=md)‘”,
   > $status);
 * to this:
 * > $status = preg_replace_callback(“/((http:\/\/|https:\/\/)[^ )
   >  ]+)/”, function(
   > $m){ return ‘[‘. ((strlen(‘$1’)>=$linkMaxLen ? substr(‘$1′,0,$linkMaxLen).’…’:’$1′)).’](https://wordpress.org/support/topic/php7-compatibility-45/$1?output_format=md)‘;},
   > $status);
 * At least, the pages are working again and it isn’t throwing any errors. I hope
   the new command we added accomplishes what the old one did.
 *  [Pablo Giralt](https://wordpress.org/support/users/pablogiralt/)
 * (@pablogiralt)
 * [9 years ago](https://wordpress.org/support/topic/php7-compatibility-45/#post-9164059)
 * Following this also
 *  [Pablo Giralt](https://wordpress.org/support/users/pablogiralt/)
 * (@pablogiralt)
 * [9 years ago](https://wordpress.org/support/topic/php7-compatibility-45/#post-9164129)
 * I removed the “Use of deprecated PHP4 style class constructor is not supported
   since PHP 7” warning by following the following tutorial:
 * [https://cweiske.de/tagebuch/php4-constructors-php7.htm](https://cweiske.de/tagebuch/php4-constructors-php7.htm)

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

The topic ‘PHP7 compatibility’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/ai-twitter-feeds_bde0ed.svg)
 * [AI Twitter Feeds (Twitter widget & shortcode)](https://wordpress.org/plugins/ai-twitter-feeds/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ai-twitter-feeds/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ai-twitter-feeds/)
 * [Active Topics](https://wordpress.org/support/plugin/ai-twitter-feeds/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ai-twitter-feeds/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ai-twitter-feeds/reviews/)

## Tags

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

 * 4 replies
 * 4 participants
 * Last reply from: [Pablo Giralt](https://wordpress.org/support/users/pablogiralt/)
 * Last activity: [9 years ago](https://wordpress.org/support/topic/php7-compatibility-45/#post-9164129)
 * Status: not resolved