aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2013-08-06 16:18:01 +0200
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2013-08-06 16:19:14 +0200
commit8e17aa3c65ae08dd02aacb72eef9d5a8c60bdacb (patch)
tree9ce69914547b4bb7422c270155436f7f7ad1f862
parenta61754b26cb609a7e699b7d7e6ab321707b96377 (diff)
downloadUstring-8e17aa3c65ae08dd02aacb72eef9d5a8c60bdacb.zip
Ustring-8e17aa3c65ae08dd02aacb72eef9d5a8c60bdacb.tar.gz
Ustring-8e17aa3c65ae08dd02aacb72eef9d5a8c60bdacb.tar.bz2
Force bounds of compareTo between -1 to 1.
-rw-r--r--String.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/String.php b/String.php
index 09c2dc9..d57afcc 100644
--- a/String.php
+++ b/String.php
@@ -278,7 +278,7 @@ class String implements \ArrayAccess, \Countable, \IteratorAggregate {
public function compareTo ( $string ) {
if(false === class_exists('Collator', false))
- return strcmp($this->_string, (string) $string);
+ return min(-1, max(1, strcmp($this->_string, (string) $string)));
return static::getCollator()->compare($this->_string, $string);
}