Open Ponce opened 3 years ago
Same issues. Any way to fix this? or is this a major issue?
The (1st?) error is a deprecated function in php 8 "create_function" on line 94 of doT.php.
The fix should be something like this:
Old:
return @create_function ('$it', $func);
New:
return @function ($it) use ($func) {
eval($func);
};
However on php 7 (don't have 8 yet) this does not work (it should?) and there is no error (in my setup), so I do not know what goes wrong (not much of a programmer myself).
Anyone with php knowledge who can fix this for us?
Tried
The (1st?) error is a deprecated function in php 8 "create_function" on line 94 of doT.php.
The fix should be something like this: Old:
return @create_function ('$it', $func);
New:
return @function ($it) use ($func) { eval($func); };
However on php 7 (don't have 8 yet) this does not work (it should?) and there is no error (in my setup), so I do not know what goes wrong (not much of a programmer myself).
Tried on php 8. There's also no error, and no page.
I fiddled with it (I don't actually know php), and the following replacement code worked for me with PHP 8:
return function ($it) use ($func) {
return eval($func);
};
Apparently the security implications of using eval() was the reason create_function() was deprecated (it used it internally, and it's a bit astonishing it took php this long to get rid of such a thing), so seemingly re-creating create_function() using eval() above doesn't feel great! But here we are. Good to have my COPS alive again.
@timtoo
What a difference a RETURN makes! And works (for me so far) without the @! Maybe needs more testing......
Must have overlooked that permutation (no clue about php either). ;-)
Thank you!
It also seems to work with php 7.4 for me (don't have 8 installed).
Included in #522 and release 1.2.0 at https://github.com/mikespub-org/seblucas-cops
cops' index.php with php 8.0.0 produces a blank page and I got this in my php errors log:
seems like create_function has been deprecated with php-7.2 and removed in 8.0.0 together with much other deprecated stuff.