PHP 7.4.21 fixes part 2

This commit is contained in:
ArkQuark 2022-06-16 20:54:07 +03:00
parent e93e81222a
commit 7877b4fe94
10 changed files with 23 additions and 23 deletions

View file

@ -281,7 +281,7 @@ class PocketMinecraftServer{
if(defined("NO_THREADS")){ if(defined("NO_THREADS")){
return false; return false;
} }
if(isset($this->asyncThread->output{5})){ if(isset($this->asyncThread->output[5])){
$offset = 0; $offset = 0;
$ID = Utils::readInt(substr($this->asyncThread->output, $offset, 4)); $ID = Utils::readInt(substr($this->asyncThread->output, $offset, 4));
$offset += 4; $offset += 4;

View file

@ -201,26 +201,26 @@ class NetherReactorBlock extends SolidBlock{
switch($char){ switch($char){
case "G": case "G":
if($this->level->getBlock(new Vector3($x + $offsetX, $y + $yOffset, $z + $offsetZ))->getID() === GOLD_BLOCK){ if($this->level->getBlock(new Vector3($x + $offsetX, $y + $yOffset, $z + $offsetZ))->getID() === GOLD_BLOCK){
continue; continue 2;
} }
return false; return false;
case "C": case "C":
if($this->level->getBlock(new Vector3($x + $offsetX, $y + $yOffset, $z + $offsetZ))->getID() === COBBLESTONE){ if($this->level->getBlock(new Vector3($x + $offsetX, $y + $yOffset, $z + $offsetZ))->getID() === COBBLESTONE){
continue; continue 2;
} }
return false; return false;
case "R": case "R":
if($this->level->getBlock(new Vector3($x + $offsetX, $y + $yOffset, $z + $offsetZ))->getID() === NETHER_REACTOR){ if($this->level->getBlock(new Vector3($x + $offsetX, $y + $yOffset, $z + $offsetZ))->getID() === NETHER_REACTOR){
continue; continue 2;
} }
return false; return false;
case " ": case " ":
if($this->level->getBlock(new Vector3($x + $offsetX, $y + $yOffset, $z + $offsetZ))->getID() === 0){ if($this->level->getBlock(new Vector3($x + $offsetX, $y + $yOffset, $z + $offsetZ))->getID() === 0){
continue; continue 2;
} }
return false; return false;
default: default:
continue; continue 2;
} }
++$offsetX; ++$offsetX;
} }

View file

@ -92,9 +92,9 @@ class RailBlock extends FlowableBlock{
} }
foreach($deltaY as $y){ foreach($deltaY as $y){
$v3 = new Vector3( $v3 = new Vector3(
$rail.getFloorX() + $blocks[1][0], $rail->getFloorX() + $blocks[1][0],
$rail.getFloorY() + $y, $rail->getFloorY() + $y,
$rail.getFloorZ() + $blocks[1][1] $rail->getFloorZ() + $blocks[1][1]
); );
$idToConnect = $rail->level->getBlock(v3.getFloorX(), v3.getFloorY(), v3.getFloorZ())->getID(); $idToConnect = $rail->level->getBlock(v3.getFloorX(), v3.getFloorY(), v3.getFloorZ())->getID();
$metaToConnect = $rail->level->getBlock(v3.getFloorX(), v3.getFloorY(), v3.getFloorZ())->getMetadata(); $metaToConnect = $rail->level->getBlock(v3.getFloorX(), v3.getFloorY(), v3.getFloorZ())->getMetadata();

View file

@ -168,21 +168,21 @@ class RCONInstance extends Thread{
if($this->{"status".$n} !== -1 and $this->stop !== true){ if($this->{"status".$n} !== -1 and $this->stop !== true){
if($this->{"status".$n} === 0 and $this->{"timeout".$n} < microtime(true)){ //Timeout if($this->{"status".$n} === 0 and $this->{"timeout".$n} < microtime(true)){ //Timeout
$this->{"status".$n} = -1; $this->{"status".$n} = -1;
continue; continue 2;
} }
$p = $this->readPacket($client, $size, $requestID, $packetType, $payload); $p = $this->readPacket($client, $size, $requestID, $packetType, $payload);
if($p === false){ if($p === false){
$this->{"status".$n} = -1; $this->{"status".$n} = -1;
continue; continue 2;
}elseif($p === null){ }elseif($p === null){
continue; continue 2;
} }
switch($packetType){ switch($packetType){
case 3: //Login case 3: //Login
if($this->{"status".$n} !== 0){ if($this->{"status".$n} !== 0){
$this->{"status".$n} = -1; $this->{"status".$n} = -1;
continue; continue 2;
} }
if($payload === $this->password){ if($payload === $this->password){
@socket_getpeername($client, $addr, $port); @socket_getpeername($client, $addr, $port);
@ -194,13 +194,13 @@ class RCONInstance extends Thread{
}else{ }else{
$this->{"status".$n} = -1; $this->{"status".$n} = -1;
$this->writePacket($client, -1, 2, ""); $this->writePacket($client, -1, 2, "");
continue; continue 2;
} }
break; break;
case 2: //Command case 2: //Command
if($this->{"status".$n} !== 1){ if($this->{"status".$n} !== 1){
$this->{"status".$n} = -1; $this->{"status".$n} = -1;
continue; continue 2;
} }
if(strlen($payload) > 0){ if(strlen($payload) > 0){
$this->cmd = ltrim($payload); $this->cmd = ltrim($payload);

View file

@ -165,6 +165,6 @@ abstract class RakNetDataPacket extends stdClass{
} }
protected function feof(){ protected function feof(){
return !isset($this->buffer{$this->offset}); return !isset($this->buffer[$this->offset]);
} }
} }

View file

@ -68,7 +68,7 @@ class RakNetParser{
private function feof(){ private function feof(){
return !isset($this->buffer{$this->offset}); return !isset($this->buffer[$this->offset]);
} }
private function parse(){ private function parse(){

View file

@ -45,7 +45,7 @@ class NBT{
} }
private function feof(){ private function feof(){
return !isset($this->binary{$this->offset}); return !isset($this->binary[$this->offset]);
} }
public function write($bin){ public function write($bin){

View file

@ -265,7 +265,7 @@ class Utils{
public static function readDataArray($str, $len = 10, &$offset = null){ public static function readDataArray($str, $len = 10, &$offset = null){
$data = array(); $data = array();
$offset = 0; $offset = 0;
for($i = 1; $i <= $len and isset($str{$offset}); ++$i){ for($i = 1; $i <= $len and isset($str[$offset]); ++$i){
$l = Utils::readTriad(substr($str, $offset, 3)); $l = Utils::readTriad(substr($str, $offset, 3));
$offset += 3; $offset += 3;
$data[] = substr($str, $offset, $l); $data[] = substr($str, $offset, $l);
@ -290,7 +290,7 @@ class Utils{
$secureValue = ""; $secureValue = "";
$rounds = 0; $rounds = 0;
$drop = 0; $drop = 0;
while(!isset($output{$length - 1})){ while(!isset($output[$length - 1])){
//some entropy, but works ^^ //some entropy, but works ^^
$weakEntropy = array( $weakEntropy = array(
is_array($startEntropy) ? implode($startEntropy):$startEntropy, is_array($startEntropy) ? implode($startEntropy):$startEntropy,

View file

@ -39,7 +39,7 @@ class AsyncMultipleQueue extends Thread{
return $len; return $len;
} }
$offset = 0; $offset = 0;
while(!isset($str{$len - 1})){ while(!isset($str[$len - 1])){
if(isset($this->input[$offset])){ if(isset($this->input[$offset])){
$str .= $this->input[$offset]; $str .= $this->input[$offset];
++$offset; ++$offset;
@ -51,7 +51,7 @@ class AsyncMultipleQueue extends Thread{
public function run(){ public function run(){
while($this->stop === false){ while($this->stop === false){
if(isset($this->input{5})){ //len 6 min if(isset($this->input[5])){ //len 6 min
$rID = Utils::readInt($this->get(4)); $rID = Utils::readInt($this->get(4));
switch(Utils::readShort($this->get(2), false)){ switch(Utils::readShort($this->get(2), false)){
case ASYNC_CURL_GET: case ASYNC_CURL_GET:

View file

@ -603,7 +603,7 @@ class NetherReactorStructure{
case " ": case " ":
$block = $level->getBlock(new Vector3($x - 8 + $offsetX, $y - 1 + $layerCount, $z - 8 + $offsetZ))->getID(); $block = $level->getBlock(new Vector3($x - 8 + $offsetX, $y - 1 + $layerCount, $z - 8 + $offsetZ))->getID();
if($block == 0){ if($block == 0){
continue; continue 2;
} }
$level->setBlockRaw(new Vector3($x - 8 + $offsetX, $y - 1 + $layerCount, $z - 8 + $offsetZ), new AirBlock()); $level->setBlockRaw(new Vector3($x - 8 + $offsetX, $y - 1 + $layerCount, $z - 8 + $offsetZ), new AirBlock());
break; break;