Feature request: Class autoloading

Get help with using the PHP Secure Communications Library.

Moderator: Nuxius

Forum rules
The purpose of this forum is to provide support for phpseclib, a pure PHP SSH / SFTP / RSA library.

Posts by new users are held in a moderation queue and are not publicly visible until the post is approved.

Feature request: Class autoloading

Postby loproc » Wed Jul 18, 2012 9:37 am

Hi

Thought it would be nice if you checked if classes could be autoloaded before including them... For instance:
Code: Select all
require_once('Net/SSH2.php');

could be replaced by:
Code: Select all
if (!class_exists('Net_SSH2')) require_once('Net/SSH2.php');


The call to class_exists would return true if the class can be autoloaded, hence not running require_once...
loproc
Traveler
 
Posts: 1
Joined: Wed Jul 04, 2012 8:12 am

Re: Feature request: Class autoloading

Postby TerraFrost » Wed Jul 18, 2012 3:25 pm

It should already be doing that? From SFTP.php:

https://github.com/phpseclib/phpseclib/ ... TP.php#L57

Code: Select all
/**
 * Include Net_SSH2
 */
if (!class_exists('Net_SSH2')) {
    require_once('Net/SSH2.php');
}
TerraFrost
Legendary Guard
 
Posts: 12218
Joined: Wed Dec 04, 2002 6:37 am


Return to phpseclib support

Who is online

Users browsing this forum: Bing [Bot] and 1 guest