The ticket is located at http://tracker.phpbb.com/browse/PHPBB3-9682
The proposed patch can be found at http://github.com/naderman/phpbb3/compa ... to-loading
Since we are going to use object orientation a lot more, we naturally have more class definitions, which will not always need to be loaded. Autoloading provides a simple yet sufficiently efficient mechanism to avoid many conditional file inclusions. They also avoid the (unecessary) call to a class loading function. To use autoloading a convention for naming class needs to be established.
I propose that phpBB class name lookups follow these rules:
- All classes are prefixed with phpbb_
- All classes reside in includes/ or a subdirectory thereof
- Directories must not contain underscores
- The class name is separated into parts by underscores, the parts are checked from first to last, until one is found which is not a directory, all remaining parts make up the file name. If no parts are left, the last directory name is used.
Code: Select all
directory structure:
includes/
class_name.php
dir/
class_name.php
dir.php
subdir/
class_name.php
Code: Select all
phpbb_class_name -> includes/class_name.php
phpbb_dir_class_name -> includes/dir/class_name.php
phpbb_dir -> includes/dir/dir.php
phpbb_dir_subdir_class_name -> includes/dir/subdir/class_name.php
Code will not be changed to use autoloading, but it will rather only be used for new classes where applicable.