Skip to content
Snippets Groups Projects
Commit a4ee5754 authored by Chris Leppanen's avatar Chris Leppanen
Browse files

Issue #2145211 by moonray: Fixed UTF strings get truncated.

parent c7d42dcf
Branches
No related tags found
No related merge requests found
......@@ -77,6 +77,9 @@ class XPathQueryParserTest extends UnitTestBase {
$this->assertEqual($parser->getQuery(), "/*/__default__:article[@id='2']/*[self::__default__:title or self::__default__:short]");
$parser = new XPathQueryParser('not(/asdfasfd/asdfasf//asdfasdf) | /asdfasf/sadfasf/@asdf');
$this->assertEqual($parser->getQuery(), 'not(/__default__:asdfasfd/__default__:asdfasf//__default__:asdfasdf) | /__default__:asdfasf/__default__:sadfasf/@asdf');
$parser = new XPathQueryParser('Ülküdak');
$this->assertEqual($parser->getQuery(), '__default__:Ülküdak');
}
}
......@@ -85,7 +85,7 @@ class XPathQueryParser {
protected function start() {
for ($i = 0; $i < drupal_strlen($this->query); $i++) {
$this->i = $i;
$c = $this->query[$i];
$c = drupal_substr($this->query, $i, 1);
if ($c === '"' || $c === "'") {
$this->handleQuote($c);
......@@ -158,12 +158,12 @@ class XPathQueryParser {
return;
}
if ($c === ':' && $this->query[$this->i + 1] === ':') {
if ($c === ':' && drupal_substr($this->query, $this->i + 1, 1) === ':') {
$this->axis = $this->word;
}
if ($c === ':' && $this->query[$this->i - 1] !== ':' &&
$this->query[$this->i + 1] !== ':') {
if ($c === ':' && drupal_substr($this->query, $this->i - 1, 1) !== ':' &&
drupal_substr($this->query, $this->i + 1, 1) !== ':') {
$this->output .= $this->word;
$this->skipNextWord = TRUE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment