[wp-trac] [WordPress Trac] #23880: Minimum PHP version in Plugins

WordPress Trac noreply at wordpress.org
Mon Apr 1 05:13:14 UTC 2013


#23880: Minimum PHP version in Plugins
-----------------------------+------------------------------
 Reporter:  TJNowell         |       Owner:
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Plugins          |     Version:
 Severity:  normal           |  Resolution:
 Keywords:  close            |
-----------------------------+------------------------------
Changes (by rmccue):

 * keywords:   => close


Comment:

 Replying to [comment:29 F J Kaiser]:
 > Or even better: Tell me (or show with code) how you'd do the check for
 the following plugin.

 `a.php`:
 {{{
 /*
 Plugin Name: Foo
 */

 if (version_compare(PHP_VERSION, '5.3', '>')) {
     include 'b.php';
 }
 else {
     add_action('admin_notices', create_function('', 'Foo requires PHP 5.3
 or newer.'));
 }
 }}}

 `b.php`:
 {{{
 namespace foo;

 // Some functionality
 }}}

 It's only six lines extra to check the PHP version in your code, plus you
 can do other things in there. For example, although it's horrible
 performance-wise, you could dynamically rewrite your classes to use non-
 namespaced names. (I actually have a proof-of-concept of this lying around
 somewhere.)

 I don't think this is something core needs to worry about, given how easy
 it is to do it yourself. Recommending close.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/23880#comment:30>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list