17.x on top of an existing Tiki <= 16.x instance, // loading the autoload from the vendor folder will cause issues. // We check for some core libraries (ZendFramework, Smarty and Adodb), if they are all present in the // vendor folder we will consider that there is a old vendor folder, and skip loading the autoload.php unless // there is a file called do_not_clean.txt inside the vendor folder (we will only check the file exists) if ( file_exists(__DIR__ . '/../../vendor/do_not_clean.txt') || ! ( // check the existence of critical files denoting a legacy vendor folder (file_exists(__DIR__ . '/../../vendor/zendframework/zend-config/src/Config.php') //ZF2 || file_exists(__DIR__ . '/../../vendor/bombayworks/zendframework1/library/Zend/Config.php')) //ZF1 && (file_exists(__DIR__ . '/../../vendor/smarty/smarty/libs/Smarty.class.php') //Smarty || file_exists(__DIR__ . '/../../vendor/smarty/smarty/distribution/libs/Smarty.class.php')) //Smarty && file_exists(__DIR__ . '/../../vendor/adodb/adodb/adodb.inc.php') //Adodb ) ) { $autoloader = require_once __DIR__ . '/../../vendor/autoload.php'; // Autoload extension packages libs foreach (\Tiki\Package\ExtensionManager::getEnabledPackageExtensions(false) as $package) { if (is_dir($package['path'] . '/lib/') && strpos($package['path'], 'vendor_custom') === false) { $autoloader->addPsr4(str_replace('/', '\\', $package['name']) . '\\', $package['path'] . '/lib/'); } } } } // vendor libraries managed by the user, packaged (if any) if (is_dir(__DIR__ . '/../../vendor_custom')) { foreach (new DirectoryIterator(__DIR__ . '/../../vendor_custom') as $fileInfo) { if (! $fileInfo->isDir() || $fileInfo->isDot()) { continue; } if (file_exists($fileInfo->getPathname() . '/autoload.php')) { require_once $fileInfo->getPathname() . '/autoload.php'; // Autoload extension packages libs $packagePath = $fileInfo->getPathname(); if (is_dir($packagePath . '/lib/') && $composerJson = json_decode(file_get_contents($packagePath . '/composer.json'), true)) { $packageName = $composerJson['name'] ?? ''; if ($packageName && \Tiki\Package\ExtensionManager::isExtension($packageName, $packagePath) && \Tiki\Package\ExtensionManager::isEnabled($packageName)) { $autoloader->addPsr4(str_replace('/', '\\', $packageName) . '\\', $packagePath . '/lib/'); } } } } } spl_autoload_register('Tiki\PSR12Migration\Autoload::autoloadAlias'); spl_autoload_register('Tiki_Autoload::autoload'); /** * set how Tiki will report Errors * @param $errno * @param $errstr * @param $errfile * @param $errline */ function tiki_error_handling($errno, $errstr, $errfile, $errline) { global $prefs, $phpErrors; TikiLib::lib('errortracking')->handleError($errno, $errstr, $errfile, $errline); if (0 === (error_reporting() & $errno)) { // This error was triggered when evaluating an expression prepended by the at sign (@) error control operator, but since we are in a custom error handler, we have to ignore it manually. // See http://ca3.php.net/manual/en/language.operators.errorcontrol.php#98895 and http://php.net/set_error_handler return; } // FIXME: Optionally return false so errors are still logged $err[E_ERROR] = 'E_ERROR'; $err[E_CORE_ERROR] = 'E_CORE_ERROR'; $err[E_USER_ERROR] = 'E_USER_ERROR'; $err[E_COMPILE_ERROR] = 'E_COMPILE_ERROR'; $err[E_WARNING] = 'E_WARNING'; $err[E_CORE_WARNING] = 'E_CORE_WARNING'; $err[E_USER_WARNING] = 'E_USER_WARNING'; $err[E_COMPILE_WARNING] = 'E_COMPILE_WARNING'; $err[E_PARSE] = 'E_PARSE'; $err[E_STRICT] = 'E_STRICT'; $err[E_NOTICE] = 'E_NOTICE'; $err[E_USER_NOTICE] = 'E_USER_NOTICE'; $err[E_DEPRECATED] = 'E_DEPRECATED'; $err[E_USER_DEPRECATED] = 'E_USER_DEPRECATED'; global $tikipath; $errfile = str_replace($tikipath, '', $errfile); switch ($errno) { case E_ERROR: case E_CORE_ERROR: case E_USER_ERROR: case E_COMPILE_ERROR: case E_WARNING: case E_CORE_WARNING: case E_USER_WARNING: case E_COMPILE_WARNING: case E_PARSE: case E_RECOVERABLE_ERROR: $type = 'ERROR'; break; case E_STRICT: case E_NOTICE: case E_USER_NOTICE: case E_DEPRECATED: case E_USER_DEPRECATED: if (! defined('THIRD_PARTY_LIBS_PATTERN') || ! preg_match(THIRD_PARTY_LIBS_PATTERN, $errfile)) { if (! empty($prefs['smarty_notice_reporting']) && $prefs['smarty_notice_reporting'] != 'y' && strstr($errfile, '.tpl.php')) { return; } } $type = 'NOTICE'; break; default: return; } $back = "