Jump to content

Different sorting results find() vs. sort() - why?


titanium
 Share

Recommended Posts

Given three pages with the following titles:

  • Deutschland
  • Österreich
  • Schweiz

I noticed that I get different results for a sort inside a selector and an explicit sort(). See the following example: 

// A) just use selector as usual
$countries = $pages->find('parent=countries,sort=title');
foreach($countries as $country) {
	echo $country->title . "\n";
}
// result: Deutschland, Österreich, Schweiz - ok

// B) put pages in separate array and sort afterwards
$countries = $pages->find('parent=countries');
$whitelist = new PageArray;
foreach($countries as $country) {
	$whitelist->add($country);
}
$whitelist->sort('title');
foreach($whitelist as $country) {
	echo $country->title . "\n";
}
// result: Deutschland, Schweiz, Österreich - huh?

It seems to be obvious that it has something to do with the umlaut in Österreich. Maybe a bug?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...