core icon indicating copy to clipboard operation
core copied to clipboard

PHP 8.1 not supported

Open BaseMax opened this issue 2 years ago • 5 comments

# 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.

BaseMax avatar Jan 04 '22 20:01 BaseMax

Which version of Flight are you using?

magikstm avatar Jan 04 '22 21:01 magikstm

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.

BaseMax avatar Jan 04 '22 22:01 BaseMax

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

magikstm avatar Jan 04 '22 23:01 magikstm

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

wivaku avatar Jan 06 '22 15:01 wivaku

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

FelipoAntonoff avatar Jan 09 '22 23:01 FelipoAntonoff

@n0nag0n also fixed.

krmu avatar Jan 03 '24 20:01 krmu

Thanks @krmu

n0nag0n avatar Jan 03 '24 21:01 n0nag0n