From d3c8716519ea5075576858b9c934fc8a65bc4d53 Mon Sep 17 00:00:00 2001 From: Eric Rasmussen Date: Wed, 11 Dec 2019 16:46:30 -0600 Subject: [PATCH] Remove fallback for __autoload spl_autoload_register is present in PHP since 5.1.2 defining function __autoload causes fatal error in PHP 7.2 --- src/SimpleCAS/Autoload.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/SimpleCAS/Autoload.php b/src/SimpleCAS/Autoload.php index b26f5a0..08b9a48 100644 --- a/src/SimpleCAS/Autoload.php +++ b/src/SimpleCAS/Autoload.php @@ -31,19 +31,15 @@ function SimpleCAS_Autoload($class) } // set up __autoload -if (function_exists('spl_autoload_register')) { - if (!($_____t = spl_autoload_functions()) || !in_array('SimpleCAS_Autoload', spl_autoload_functions())) { - spl_autoload_register('SimpleCAS_Autoload'); - if (function_exists('__autoload') && ($_____t === false)) { - // __autoload() was being used, but now would be ignored, add - // it to the autoload stack - spl_autoload_register('__autoload'); - } +if (!($_____t = spl_autoload_functions()) || !in_array('SimpleCAS_Autoload', spl_autoload_functions())) { + spl_autoload_register('SimpleCAS_Autoload'); + if (function_exists('__autoload') && ($_____t === false)) { + // __autoload() was being used, but now would be ignored, add + // it to the autoload stack + spl_autoload_register('__autoload'); } - unset($_____t); -} elseif (!function_exists('__autoload')) { - function __autoload($class) { return SimpleCAS_Autoload($class); } } +unset($_____t); // set up include_path if it doesn't register our current location $____paths = explode(PATH_SEPARATOR, get_include_path());