Closed ddur closed 7 years ago
Actually, first one (above) is false positive. Anyway, I would replace
// remove zeroes from beginning of numbers
for($i=0;$i<strlen($Num1);$i++) if(@$Num1{$i}!='0') {$Num1=substr($Num1,$i);break;}
for($i=0;$i<strlen($Num2);$i++) if(@$Num2{$i}!='0') {$Num2=substr($Num2,$i);break;}
with
// check if they're both non-zero
if(preg_match("/^0+$/",$Num1)||preg_match("/^0+$/",$Num2)) return (0);
// remove zeroes from beginning of numbers
$Num1=preg_replace("/^0+/",'',$Num1);
$Num2=preg_replace("/^0+/",'',$Num2);
Hi @ddur , thank you for your proposal.
Well for the first one, how about this:
// remove zeroes from beginning of numbers
$Num1=preg_replace("/^0+/",'',$Num1);
$Num2=preg_replace("/^0+/",'',$Num2);
// check if they're both non-zero
if (empty($Num1) || empty($Num2)) return 0;
And about the second one, $HTTP_RAW_POST_DATA
is assigned as a global variable in xmlrpc.php
. This is a kind of fallback for compatibility.
// A bug in PHP < 5.2.2 makes $HTTP_RAW_POST_DATA not set by default,
// but we can do it ourself.
if ( !isset( $HTTP_RAW_POST_DATA ) ) {
$HTTP_RAW_POST_DATA = file_get_contents( 'php://input' );
}
So I think we can safely use its value when the request comes to xmlrpc.php
.
Anyway, I'll keep this issue until I finish to improve those in the next release. Thanks.
I see, php-compatibility-checker is not very reliable. Just string matching. But is only one I found. Unfortunately, most of WordPress users will never go deep into the code to check for "false positives". Your plugin will be marked as php7 incompatible, except for few "enlightened" ones. :)
Hi @ddur,
I'll take care of this issue to make you feel at ease.
Fixed in 13ec764
https://wordpress.org/plugins/php-compatibility-checker/