XMLRPC: ensure that empty strings are not passed as null, which will then fail isset()

Props solarissmoke.
Fixes #16980.

Built from https://develop.svn.wordpress.org/trunk@35509


git-svn-id: http://core.svn.wordpress.org/trunk@35473 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor
2015-11-04 18:08:25 +00:00
parent b026ad4b75
commit d763eb80b7
2 changed files with 8 additions and 3 deletions

View File

@@ -201,6 +201,7 @@ class IXR_Message
var $_value; var $_value;
var $_currentTag; var $_currentTag;
var $_currentTagContents; var $_currentTagContents;
var $_valueHasType = false;
// The XML parser // The XML parser
var $_parser; var $_parser;
@@ -324,6 +325,8 @@ class IXR_Message
$this->_arraystructstypes[] = 'struct'; $this->_arraystructstypes[] = 'struct';
$this->_arraystructs[] = array(); $this->_arraystructs[] = array();
break; break;
case 'value':
$this->_valueHasType = false;
} }
} }
@@ -355,8 +358,8 @@ class IXR_Message
break; break;
case 'value': case 'value':
// "If no type is indicated, the type is string." // "If no type is indicated, the type is string."
if (trim($this->_currentTagContents) != '') { if ( !$this->_valueHasType ) {
$value = (string)$this->_currentTagContents; $value = trim( $this->_currentTagContents );
$valueFlag = true; $valueFlag = true;
} }
break; break;
@@ -387,6 +390,8 @@ class IXR_Message
} }
if ($valueFlag) { if ($valueFlag) {
$this->_valueHasType = true;
if (count($this->_arraystructs) > 0) { if (count($this->_arraystructs) > 0) {
// Add value to struct or array // Add value to struct or array
if ($this->_arraystructstypes[count($this->_arraystructstypes)-1] == 'struct') { if ($this->_arraystructstypes[count($this->_arraystructstypes)-1] == 'struct') {

View File

@@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-beta2-35508'; $wp_version = '4.4-beta2-35509';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.