View Single Post
Old 12-20-2022, 01:02 PM   #1891
jajaX
Junior Member
jajaX began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Jul 2022
Device: samsung galaxy Z fold 2 5G
Smile

Quote:
Originally Posted by mariosipad View Post
@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) {
        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.
Hi,

sorry for my bad english, i use a translator.

Thank you for your answer.
I tried to modify as indicated but I still found myself in front of a blank page.

I've downgraded to php 7.4.33 for now.
jajaX is offline   Reply With Quote