[wp-trac] [WordPress Trac] #48046: Add array cast before count() in class-wp-xml-server.php
WordPress Trac
noreply at wordpress.org
Mon Sep 16 07:06:23 UTC 2019
#48046: Add array cast before count() in class-wp-xml-server.php
--------------------------+-----------------------------
Reporter: bitcomplex | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Keywords: needs-patch
Focuses: |
--------------------------+-----------------------------
{{{#!php
<?php
/**
* Checks if the method received at least the minimum number of
arguments.
*
* @since 3.4.0
*
* @param string|array $args Sanitize single string or array of
strings.
* @param int $count Minimum number of arguments.
* @return bool if `$args` contains at least $count arguments.
*/
protected function minimum_args( $args, $count ) {
if ( count( $args ) < $count ) {
$this->error = new IXR_Error( 400, __(
'Insufficient arguments passed to this XML-RPC method.' ) );
return false;
}
return true;
}
}}}
There should be an array-cast of $args prior to the call to count(). If
$args is a string you'll get **Warning: count(): Parameter must be an
array or an object that implements Countable** if running php 7.3 ...
--
Ticket URL: <https://core.trac.wordpress.org/ticket/48046>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list