bcit-ci / CodeIgniter

Open Source PHP Framework (originally from EllisLab)
https://codeigniter.com/
MIT License
18.27k stars 7.61k forks source link

Migrations No Longer Work in PHP 8 #6006

Closed blasto333 closed 3 years ago

blasto333 commented 3 years ago

In php 8 my migrations don't run and always end up in the following block of code. The method and class seem to be loaded. This code runs fine in PHP < 8. Did PHP 8 change something?

elseif ( ! is_callable(array($class, $method)))
{
    $this->_error_string = sprintf($this->lang->line('migration_missing_'.$method.'_method'), $class);
    return FALSE;
}
orionstar commented 3 years ago

Codeigniter 3 is not tested or optimized for PHP 8. If you prefer that version you should use CI 4. If you want to continue to use CI 3 you should stay on PHP 7.

blasto333 commented 3 years ago

It would be very difficult to migrate to Ci 4. Do you know at least why is_callable is false? I can patch it

On Wed, Dec 16, 2020 at 5:13 PM László Bóra notifications@github.com wrote:

Codeigniter 3 is not tested or optimized for PHP 8. If you prefer that version you should use CI 4. If you want to continue to use CI 3 you should stay on PHP 7.

gxgpet commented 3 years ago

Hi @blasto333,

Can you provide an example of such migration that fails under PHP 8?

orionstar commented 3 years ago

It would be very difficult to migrate to Ci 4. Do you know at least why is_callable is false? I can patch it @blasto333

PHP 8 BC

The ability to call non-static methods statically has been removed. Thus is_callable() will fail when checking for a non-static method with a classname (must check with an object instance).

One possible solution (first google result): https://github.com/elkarte/Elkarte/issues/3419

Besides of Migrations.php, you have to change CodeIgniter.php::386 (dev branch)

blasto333 commented 3 years ago

@orionstar thanks so much! Will make these patches. Is anyone else aware of any major features of PHP 8 that will cause issues in framework? If I find any other PHP 8 issues would you accept a pull request?

Since CI 4 has some big changes I have less chance of regression by modifying framework instead of upgrading to CI 4

orionstar commented 3 years ago

@blasto333

Is anyone else aware of any major features of PHP 8 that will cause issues in framework?

I'm not using PHP 8 yet so can't help you about other breaking changes.

If I find any other PHP 8 issues would you accept a pull request?

I would be happy if I could accept your pull request but I'm not a maintainer of this repo. To be honest, no maintainer left around here, this repository is abandoned since July. I'm just a user just you are. But if you create a pull request I will incorporate it to my base files just like other developers do who are regularly checking issue/prs.

blasto333 commented 3 years ago

Is this still official ci 3 repository?

-- Chris Muench

On Dec 16, 2020, at 10:16 PM, László Bóra notifications@github.com wrote:

 @blasto333

Is anyone else aware of any major features of PHP 8 that will cause issues in framework?

I'm not using PHP 8 yet so can't help you about other breaking changes.

If I find any other PHP 8 issues would you accept a pull request?

I would be happy if I could accept your pull request but I'm not a maintainer of this repo. To be honest, no maintainer left around here, this repository is abandoned since July. I'm just a user just you are. But if you create a pull request I will incorporate it to my base files just like other developers do who are regularly checking issue/prs.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

orionstar commented 3 years ago

Its an interesting question because BCIT is no longer the owner. Besides that, yes but nobody cares to maintain it. At least officially. If it bothers you I recommend the forums. There is a half year old but open thread about this https://forum.codeigniter.com/thread-76836.html

blasto333 commented 3 years ago

@orionstar https://github.com/bcit-ci/CodeIgniter/pull/6007

orionstar commented 3 years ago

@blasto333 thanks

sapics commented 3 years ago

It would be very difficult to migrate to Ci 4

@blasto333 I agree with you ;) I would like to run the test with php8 on travis, but it causes some errors.

Currently, CI3 uses phpunit4 or phpunit5 for tests, but these don't support php7.0+. https://phpunit.de/getting-started/phpunit-5.html Fortunately, CI3 tests work well with php7.0-7.4, but, php8.0 causes some errors.

So, we need to update phpunit version or use php8 supported version of phpunit5 like https://github.com/sminnee/phpunit. Updating phpunit version seems to be the recommended way, but we need to fix CI3 test program.

blasto333 commented 3 years ago

A larger concern besides getting any issues fixed will be making sure that this project becomes active again. I would think it would need to find a new home/github repo that codeigniter.com can make official. I am sure there are plenty of people that have CI 3 interest in working on PHP 8. It just seems this repository is dead.

Not sure what the official way is to get it active again but I would think there would be a lot of support.

I am by no means a framework expert but I would be happy to assist as needed.