View Single Post
Old 12-15-2022, 05:56 AM   #1890
mariosipad
Guru
mariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watch
 
Posts: 725
Karma: 10738
Join Date: Nov 2012
Device: iPad & iPhone with Marvin 2 + 3 & Kobo Glo HD
@jajaX

Question: Is Cops compatible with php 8 ?

Answer: NO, not with the original code from https://github.com/seblucas/cops

However (YES) if you are willing to dive into the code and edit 1 line. Then COPS should work with PHP 8 (never tried with PHP 8.2).
Reference: https://github.com/seblucas/cops/issues/492

How:
1 - open file ../cops/vendor/seblucas/dot-php/doT.php
2 - change line 94
Code:
return @create_function ('$it', $func);
3 - to
Code:
return @function ($it) use ($func) {
        return eval($func);
        };
I did it like this:
Code:
        // For PHP 8 replace this line 
        //return create_function ('$it', $func);
        // with
        return function ($it) use ($func) {
        return eval($func);
        };
        // end replace
Please report back if it works for you.

Last edited by mariosipad; 01-12-2023 at 09:35 AM.
mariosipad is offline   Reply With Quote