From c3bb4245b3d911adf82c2593a52495f01f1b3f7d Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Tue, 30 Aug 2016 00:51:51 +0900 Subject: [PATCH] Register autoload as the first in the list Yii framework v1.1 has it's own autoloader and its autoloader throws an error, when it can't find class. When this library initializes, it register its own autoloader, but places it at the end of autoload queue. So when I use library with Yii 1.1, I just face an error: `include(PHPExcel_Shared_String.php): failed to open stream: No such file or directory` because Yii's autoloader runs first and tries to include class file directly. Registering our autoloader first avoid this. --- src/Autoloader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Autoloader.php b/src/Autoloader.php index 3ed00569..7bca2ef9 100644 --- a/src/Autoloader.php +++ b/src/Autoloader.php @@ -38,7 +38,7 @@ class Autoloader spl_autoload_register('__autoload'); } // Register ourselves with SPL - return spl_autoload_register([\PhpSpreadsheet\Autoloader::class, 'load']); + return spl_autoload_register([\PhpSpreadsheet\Autoloader::class, 'load'], true, true); } /**