Closed GoogleCodeExporter closed 9 years ago
WITH ERROR ===================== public function request($input = '', $contentType = ''){ $this->input = empty($input) ? file_get_contents('php://input') : $input; $contentType = empty($contentType) ? $this->params['contentType'] : $contentType; $decodedInput = ''; // XML if ($this->forceFormat == 'XML' || $contentType == 'application/vnd.syncml+xml') { $decodedInput = $this->input; } // WBXML else if ($this->forceFormat == 'WBXML' || $contentType == 'application/vnd.syncml+wbxml') { // <- ERROR (On Nokia 6230i $contentType = "application/vnd.syncml+wbxml; UTF-8") $this->wbxmlHelper = new WbxmlHelper(); $decodedInput = $this->wbxmlHelper->decode($this->input); $this->wbxml = TRUE; if (!WBXML_USE_EXTERNAL) { // PHP-based decoder has a bug with CDATA, so we need to overcome this manually if (preg_match_all('/\<Data\>(.+?)\<\/Data\>/s', $decodedInput, $matches)) { foreach ($matches[1] as $key => $item) { if (preg_match('/[^a-zA-Z0-9\*\-\+\/\_\!\.\:\=]/', $item) && @simplexml_load_string($item) === FALSE) { $matches[1][$key] = '<![CDATA[' . $item . ']]>'; } $matches[1][$key] = '<Data>' . $matches[1][$key] . '</Data>'; } $decodedInput = str_replace($matches[0], $matches[1], $decodedInput); } } } //.... WITHOUT ERROR ===================== public function request($input = '', $contentType = ''){ $this->input = empty($input) ? file_get_contents('php://input') : $input; $contentType = empty($contentType) ? $this->params['contentType'] : $contentType; $decodedInput = ''; // XML if ($this->forceFormat == 'XML' || $contentType == 'application/vnd.syncml+xml') { $decodedInput = $this->input; } // WBXML //else if ($this->forceFormat == 'WBXML' || $contentType == 'application/vnd.syncml+wbxml') { // <- ERROR else if ($this->forceFormat == 'WBXML' || stripos($contentType, 'application/vnd.syncml+wbxml') !== FALSE) { // <- OK $this->wbxmlHelper = new WbxmlHelper(); $decodedInput = $this->wbxmlHelper->decode($this->input); $this->wbxml = TRUE; if (!WBXML_USE_EXTERNAL) { // PHP-based decoder has a bug with CDATA, so we need to overcome this manually if (preg_match_all('/\<Data\>(.+?)\<\/Data\>/s', $decodedInput, $matches)) { foreach ($matches[1] as $key => $item) { if (preg_match('/[^a-zA-Z0-9\*\-\+\/\_\!\.\:\=]/', $item) && @simplexml_load_string($item) === FALSE) { $matches[1][$key] = '<![CDATA[' . $item . ']]>'; } $matches[1][$key] = '<Data>' . $matches[1][$key] . '</Data>'; } $decodedInput = str_replace($matches[0], $matches[1], $decodedInput); } } } //....
Original issue reported on code.google.com by and...@hisinfo.org on 17 Mar 2010 at 10:38
and...@hisinfo.org
Fixed in rev.41
Original comment by artico.b...@gmail.com on 17 Mar 2010 at 11:48
artico.b...@gmail.com
Original issue reported on code.google.com by
and...@hisinfo.org
on 17 Mar 2010 at 10:38