Skip to content

Commit 27e8295

Browse files
committed
Fix: Fix a PHP notice "spl_autoload_register(): Argument #2 has been ignored" in PHP 8.
1 parent d1f8b2a commit 27e8295

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## 1.3.1 - 2022/02/03
4+
- Fixed a notice "spl_autoload_register(): Argument #2 has been ignored" in PHP 8.
5+
- Fixed undefined warnings.
6+
37
## 1.3.0 - 2022/02/22
48
- Added the ability to specify a comment header of a specified file.
59
- Added the autoloader utility class.

source/Utility/AutoLoad.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ class AutoLoad {
2828
*/
2929
public function __construct( array $aClasses ) {
3030
$this->aClasses = $aClasses;
31-
spl_autoload_register( array( $this, 'replyToIncludeClass' ), false );
31+
if ( version_compare(PHP_VERSION, '8.0.0', '>=') ) {
32+
spl_autoload_register( array( $this, 'replyToIncludeClass' ) );
33+
} else {
34+
spl_autoload_register( array( $this, 'replyToIncludeClass' ), false );
35+
}
3236
}
3337

3438
/**

0 commit comments

Comments
 (0)