PluginProbe
WP-Stateless – Google Cloud Storage / trunk
WP-Stateless – Google Cloud Storage vtrunk
4.4.3 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.3.0 2.3.1 2.3.2 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.2.0 3.2.1 3.2.2 All 62 releases
← All changes | lib/classes/class-logger.php +15 -3 2.2.3trunk View file →
@@ -132,10 +132,10 @@
132 132 * constructor
133 133 */
134 134 private function __construct() {
135 135 $this->_php_version = phpversion();
136 - $this->_timestamp = $this->_php_version >= 5.1 ? $_SERVER[ 'REQUEST_TIME' ] : time();
137 - $this->_json[ 'request_uri' ] = $_SERVER[ 'REQUEST_URI' ];
136 + $this->_timestamp = $this->_php_version >= 5.1 ? sanitize_text_field($_SERVER[ 'REQUEST_TIME' ]) : time();
137 + $this->_json[ 'request_uri' ] = sanitize_text_field($_SERVER[ 'REQUEST_URI' ]);
138 138 }
139 139
140 140 /**
141 141 * gets instance of this class
@@ -387,9 +387,21 @@
387 387 * @param array $data
388 388 * @return string
389 389 */
390 390 protected function _encode( $data ) {
391 - return base64_encode( utf8_encode( json_encode( $data ) ) );
391 + if ( function_exists('mb_convert_encoding') ) {
392 + $encoded = json_encode($data);
393 +
394 + if ( $encoded !== false ) {
395 + $utf8 = mb_convert_encoding($encoded, 'UTF-8', 'UTF-8');
396 +
397 + if ($utf8 !== false) {
398 + return base64_encode($utf8);
399 + }
400 + }
401 + }
402 +
403 + return false;
392 404 }
393 405
394 406 /**
395 407 * adds a setting