[wp-trac] [WordPress Trac] #36926: Autoloading: Introduce compatibility shim for spl_autoload_register

WordPress Trac noreply at wordpress.org
Mon Jun 6 01:21:30 UTC 2016


#36926: Autoloading: Introduce compatibility shim for spl_autoload_register
-------------------------+------------------
 Reporter:  rmccue       |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  4.6
Component:  General      |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:
-------------------------+------------------
Changes (by rmccue):

 * keywords:  has-patch 2nd-opinion => has-patch


Comment:

 Added an is_callable check to `__autoload` to ensure we don't generate
 excess warnings. I didn't add the `is_array` check, because a) if you
 directly change that, you've voided your warranty, and b) someone might
 want to replace it with an array-like object or something, and I don't
 think there's a need to be super strict.

 While this isn't absolutely optimal (I'd be concerned about performance
 with `is_callable` usually), this is only a shim for 5.2, so I don't think
 performance matters. If you need more performant code, use 5.6+ (ideally,
 PHP 7).

 I think this is ready for commit.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36926#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list