flightphp / core

An extensible micro-framework for PHP
https://docs.flightphp.com
MIT License
2.63k stars 407 forks source link

PHP 8.1 not supported #460

Closed BaseMax closed 9 months ago

BaseMax commented 2 years ago

# php8.1 --version

PHP 8.1.0 (cli) (built: Nov 25 2021 20:22:03) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.0, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.0, Copyright (c), by Zend Technologies

PHP Fatal error: During inheritance of ArrayAccess: Uncaught ErrorException: Return type of flight\util\Collection::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/chroot/home/test/root/include/flight/util/Collection.php:102

Errors:

Fatal error: During inheritance of ArrayAccess: Uncaught ErrorException: Return type of flight\util\Collection::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/chroot/home/test/root/include/flight/util/Collection.php:102 Stack trace: #0 /var/chroot/home/test/root/include/flight/util/Collection.php(15): flight\Engine->handleError() #1 /var/chroot/home/test/root/include/flight/core/Loader.php(194): require('...') #2 /var/chroot/home/test/root/include/flight/net/Request.php(147): flight\core\Loader::loadClass() #3 /var/chroot/home/test/root/include/flight/core/Loader.php(125): flight\net\Request->__construct() #4 /var/chroot/home/test/root/include/flight/core/Loader.php(81): flight\core\Loader->newInstance() #5 /var/chroot/home/test/root/include/flight/Engine.php(101): flight\core\Loader->load() #6 /var/chroot/home/test/root/include/flight/Engine.php(311): flight\Engine->__call() #7 /var/chroot/home/test/root/include/flight/core/Dispatcher.php(198): flight\Engine->_start() #8 /var/chroot/home/test/root/include/flight/core/Dispatcher.php(144): flight\core\Dispatcher::invokeMethod() #9 /var/chroot/home/test/root/include/flight/core/Dispatcher.php(49): flight\core\Dispatcher::execute() #10 /var/chroot/home/test/root/include/flight/Engine.php(92): flight\core\Dispatcher->run() #11 /var/chroot/home/test/root/include/flight/core/Dispatcher.php(198): flight\Engine->__call() #12 /var/chroot/home/test/root/include/flight/Flight.php(77): flight\core\Dispatcher::invokeMethod() #13 /var/chroot/home/test/root/index.php(70): Flight::__callStatic() #14 {main} in /var/chroot/home/test/root/include/flight/util/Collection.php on line 15

Same source/project work with PHP 8.0.14. but not with PHP 8.1.

Best, M.

magikstm commented 2 years ago

Which version of Flight are you using?

BaseMax commented 2 years ago

Which version of Flight are you using?

Hi, Can I check version number from source files? Which file?

P.S: I currently on the phone. Will check source files tomorrow.

magikstm commented 2 years ago

Usually it can be checked in the composer.json file. It depends how you package your application though.

wivaku commented 2 years ago

for me: works fine with v2, this error indeed appears when using v1.

FelipoAntonoff commented 2 years ago

Use Flight PHP version 2 for PHP 8, use version 1 only for older versions of PHP.

krmu commented 9 months ago

@n0nag0n also fixed.

n0nag0n commented 9 months ago

Thanks @krmu