Skip to content

Commit efe02a3

Browse files
committed
Fix TypeError for count() function (requires Countable|array not string) in xmlrpc.inc
1 parent 266bf5d commit efe02a3

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

mailscanner/lib/xmlrpc/xmlrpc.inc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2227,7 +2227,7 @@ class xmlrpcmsg
22272227
print "<PRE>---GOT---\n" . htmlentities($data) . "\n---END---\n</PRE>";
22282228
}
22292229

2230-
if ($data == '') {
2230+
if ($data === '') {
22312231
error_log('XML-RPC: ' . __METHOD__ . ': no response received from server.');
22322232
$r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_data'], $GLOBALS['xmlrpcstr']['no_data']);
22332233
return $r;
@@ -2326,7 +2326,7 @@ class xmlrpcmsg
23262326
xml_set_default_handler($parser, 'xmlrpc_dh');
23272327

23282328
// first error check: xml not well formed
2329-
if (!xml_parse($parser, $data, count($data))) {
2329+
if (!xml_parse($parser, $data, $data !== '')) {
23302330
// thanks to Peter Kocks <[email protected]>
23312331
if ((xml_get_current_line_number($parser)) == 1) {
23322332
$errstr = 'XML error at line 1, check URL';
@@ -3179,7 +3179,7 @@ function php_xmlrpc_decode_xml($xml_val, $options = array())
31793179
xml_set_element_handler($parser, 'xmlrpc_se_any', 'xmlrpc_ee');
31803180
xml_set_character_data_handler($parser, 'xmlrpc_cd');
31813181
xml_set_default_handler($parser, 'xmlrpc_dh');
3182-
if (!xml_parse($parser, $xml_val, 1)) {
3182+
if (!xml_parse($parser, $xml_val, true)) {
31833183
$errstr = sprintf('XML error: %s at line %d, column %d',
31843184
xml_error_string(xml_get_error_code($parser)),
31853185
xml_get_current_line_number($parser), xml_get_current_column_number($parser));
@@ -3241,7 +3241,7 @@ function decode_chunked($buffer)
32413241
$chunkend = strpos($buffer, "\r\n", $chunkstart + $chunk_size);
32423242

32433243
// just in case we got a broken connection
3244-
if ($chunkend == false) {
3244+
if ($chunkend === false) {
32453245
$chunk = substr($buffer, $chunkstart);
32463246
// append chunk-data to entity-body
32473247
$new .= $chunk;
@@ -3258,10 +3258,11 @@ function decode_chunked($buffer)
32583258
// read chunk-size and crlf
32593259
$chunkstart = $chunkend + 2;
32603260

3261-
$chunkend = strpos($buffer, "\r\n", $chunkstart) + 2;
3262-
if ($chunkend == false) {
3261+
$pos = strpos($buffer, "\r\n", $chunkstart);
3262+
if ($pos === false) {
32633263
break; //just in case we got a broken connection
32643264
}
3265+
$chunkend = $pos + 2;
32653266
$temp = substr($buffer, $chunkstart, $chunkend - $chunkstart);
32663267
$chunk_size = hexdec(trim($temp));
32673268
$chunkstart = $chunkend;

0 commit comments

Comments
 (0)