From 75673887d1d5677b8a3516668dd145b4b4e5c818 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Wed, 4 Nov 2015 18:07:45 +0000 Subject: [PATCH] XMLRPC: ensure that empty strings are not passed as `null`, which will then fail `isset()` Props solarissmoke. Fixes #16980. git-svn-id: https://develop.svn.wordpress.org/trunk@35509 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-IXR.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/class-IXR.php b/src/wp-includes/class-IXR.php index 2fee046d41..cbb65e599a 100644 --- a/src/wp-includes/class-IXR.php +++ b/src/wp-includes/class-IXR.php @@ -201,6 +201,7 @@ class IXR_Message var $_value; var $_currentTag; var $_currentTagContents; + var $_valueHasType = false; // The XML parser var $_parser; @@ -324,6 +325,8 @@ class IXR_Message $this->_arraystructstypes[] = 'struct'; $this->_arraystructs[] = array(); break; + case 'value': + $this->_valueHasType = false; } } @@ -355,8 +358,8 @@ class IXR_Message break; case 'value': // "If no type is indicated, the type is string." - if (trim($this->_currentTagContents) != '') { - $value = (string)$this->_currentTagContents; + if ( !$this->_valueHasType ) { + $value = trim( $this->_currentTagContents ); $valueFlag = true; } break; @@ -387,6 +390,8 @@ class IXR_Message } if ($valueFlag) { + $this->_valueHasType = true; + if (count($this->_arraystructs) > 0) { // Add value to struct or array if ($this->_arraystructstypes[count($this->_arraystructstypes)-1] == 'struct') {