Skip to content

Commit

Permalink
Fixes kestasjk#769 - Use spl_autoload_register instead of the depre…
Browse files Browse the repository at this point in the history
…cated `__autoload` method.
  • Loading branch information
JimMackin committed Apr 11, 2022
1 parent 1e083ce commit 7461414
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions variants/variant.php
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,7 @@ public function link() {
* [Name]Variant -> variants/[Name]/variant.php
* [Name]Variant_[Class] -> variants/[Name]/classes/[Class].php
*/
function __autoload($classname) {

spl_autoload_register(function ($classname) {
if( !( $pos=strpos($classname,'Variant') ) || $pos==0 ) return;

$variantName=substr($classname, 0, $pos);
Expand All @@ -398,6 +397,6 @@ function __autoload($classname) {
require_once(l_r('variants/'.$variantName.'/variant.php'));
else
require_once(l_r('variants/'.$variantName.'/classes/'.substr($classname, ($pos+8)).'.php'));
}
});

?>

0 comments on commit 7461414

Please sign in to comment.