Skip to content

Commit

Permalink
- cleaned up some type matching / definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepultz committed Oct 1, 2023
1 parent 7d304fa commit c4a167f
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 26 deletions.
11 changes: 6 additions & 5 deletions Net/DNS2.php
Original file line number Diff line number Diff line change
Expand Up @@ -858,16 +858,16 @@ public static function expandIPv6($_address)
/**
* sends a standard Net_DNS2_Packet_Request packet
*
* @param Net_DNS2_Packet $request a Net_DNS2_Packet_Request object
* @param boolean $use_tcp true/false if the function should
* @param Net_DNS2_Packet_Request $request a Net_DNS2_Packet_Request object
* @param boolean $use_tcp true/false if the function should
* use TCP for the request
*
* @return Net_DNS2_Packet_Response
* @throws Net_DNS2_Exception
* @access protected
*
*/
protected function sendPacket(Net_DNS2_Packet $request, $use_tcp)
protected function sendPacket(Net_DNS2_Packet_Request $request, $use_tcp)
{
//
// get the data from the packet
Expand Down Expand Up @@ -1039,10 +1039,11 @@ protected function sendPacket(Net_DNS2_Packet $request, $use_tcp)
/**
* cleans up a failed socket and throws the given exception
*
* @param string $_proto the protocol of the socket
* @param integer $_proto the protocol of the socket
* @param string $_ns the name server to use for the request
* @param string $_error the error message to throw at the end of the function
* @param integer $_error the error message to throw at the end of the function
*
* @return void
* @throws Net_DNS2_Exception
* @access private
*
Expand Down
1 change: 1 addition & 0 deletions Net/DNS2/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public function add(Net_DNS2_RR $rr)
*
* @param string $keyname the key name to use for the TSIG RR
* @param string $signature the key to sign the request.
* @param string $algorithm the algorithm to use for the request.
*
* @return boolean
* @access public
Expand Down
4 changes: 2 additions & 2 deletions Net/DNS2/RR/APL.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected function rrFromString(array $rdata)
];

$address = $this->_trimZeros(
$i['address_family'], $i['afd_part']
intval($i['address_family']), $i['afd_part']
);

$i['afd_length'] = count(explode('.', $address));
Expand Down Expand Up @@ -217,7 +217,7 @@ protected function rrGet(Net_DNS2_Packet &$packet)
);

foreach ($address as $b) {
$data .= chr($b);
$data .= chr(intval($b));
}
break;
case 2:
Expand Down
2 changes: 1 addition & 1 deletion Net/DNS2/RR/EUI48.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ protected function rrGet(Net_DNS2_Packet &$packet)
$a = explode('-', $this->address);
foreach ($a as $b) {

$data .= chr(hexdec($b));
$data .= chr(intval(hexdec($b)));
}

$packet->offset += 6;
Expand Down
2 changes: 1 addition & 1 deletion Net/DNS2/RR/EUI64.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ protected function rrGet(Net_DNS2_Packet &$packet)
$a = explode('-', $this->address);
foreach ($a as $b) {

$data .= chr(hexdec($b));
$data .= chr(intval(hexdec($b)));
}

$packet->offset += 8;
Expand Down
20 changes: 10 additions & 10 deletions Net/DNS2/RR/LOC.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,19 @@ protected function rrFromString(array $rdata)
//
// latitude
//
$latdeg = $x[1];
$latmin = (isset($x[3])) ? $x[3] : 0;
$latsec = (isset($x[5])) ? $x[5] : 0;
$latdeg = floatval($x[1]);
$latmin = floatval((isset($x[3])) ? $x[3] : 0);
$latsec = floatval((isset($x[5])) ? $x[5] : 0);
$lathem = strtoupper($x[6]);

$this->latitude = $this->_dms2d($latdeg, $latmin, $latsec, $lathem);

//
// longitude
//
$londeg = $x[7];
$lonmin = (isset($x[9])) ? $x[9] : 0;
$lonsec = (isset($x[11])) ? $x[11] : 0;
$londeg = floatval($x[7]);
$lonmin = floatval((isset($x[9])) ? $x[9] : 0);
$lonsec = floatval((isset($x[11])) ? $x[11] : 0);
$lonhem = strtoupper($x[12]);

$this->longitude = $this->_dms2d($londeg, $lonmin, $lonsec, $lonhem);
Expand Down Expand Up @@ -339,10 +339,10 @@ private function _precsizeAtoN($prec)
/**
* convert lat/lng in deg/min/sec/hem to decimal value
*
* @param integer $deg the degree value
* @param integer $min the minutes value
* @param integer $sec the seconds value
* @param string $hem the hemisphere (N/E/S/W)
* @param float $deg the degree value
* @param float $min the minutes value
* @param float $sec the seconds value
* @param string $hem the hemisphere (N/E/S/W)
*
* @return float the decinmal value
* @access private
Expand Down
4 changes: 2 additions & 2 deletions Net/DNS2/RR/RRSIG.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ protected function rrGet(Net_DNS2_Packet &$packet)
$this->algorithm,
$this->labels,
$this->origttl,
gmmktime($e[4], $e[5], $e[6], $e[2], $e[3], $e[1]),
gmmktime($i[4], $i[5], $i[6], $i[2], $i[3], $i[1]),
gmmktime(intval($e[4]), intval($e[5]), intval($e[6]), intval($e[2]), intval($e[3]), intval($e[1])),
gmmktime(intval($i[4]), intval($i[5]), intval($i[6]), intval($i[2]), intval($i[3]), intval($i[1])),
$this->keytag
);

Expand Down
6 changes: 3 additions & 3 deletions Net/DNS2/RR/SIG.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ protected function rrGet(Net_DNS2_Packet &$packet)
$this->algorithm,
$this->labels,
$this->origttl,
gmmktime($e[4], $e[5], $e[6], $e[2], $e[3], $e[1]),
gmmktime($i[4], $i[5], $i[6], $i[2], $i[3], $i[1]),
gmmktime(intval($e[4]), intval($e[5]), intval($e[6]), intval($e[2]), intval($e[3]), intval($e[1])),
gmmktime(intval($i[4]), intval($i[5]), intval($i[6]), intval($i[2]), intval($i[3]), intval($i[1])),
$this->keytag
);

Expand All @@ -267,7 +267,7 @@ protected function rrGet(Net_DNS2_Packet &$packet)
$data .= $name;
}

$data .= chr('0');
$data .= chr(0);

//
// if the signature is empty, and $this->private_key is an instance of a
Expand Down
4 changes: 2 additions & 2 deletions tests/Tests_Net_DNS2_ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ public function testCompression()
//
// build the hashes
//
$a = md5(print_r($request_authority, 1));
$b = md5(print_r($response_authority, 1));
$a = md5(print_r($request_authority, true));
$b = md5(print_r($response_authority, true));

//
// the new hashes should match.
Expand Down

0 comments on commit c4a167f

Please sign in to comment.