Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

[ZF2-170][Filter] Fix trim for cyrillic characters. #1451

Merged
merged 1 commit into from

3 participants

@Maks3w
Collaborator

Build Status Apply SVN r16417

@Freeaqingme
Collaborator

Thanks!

@Freeaqingme Freeaqingme merged commit b5b146d into from
@sasezaki

.... this change is removing "u" qualifier.
But "u" qualifier comes from ZF-10891
http://framework.zend.com/issues/browse/ZF-10891
I don't know why @thomasweidner did apply this change only zf2.

This backporting wil be fix cyrillic characters.
But zenkaku space(multibyte space - Japanese special space char) will not trim.
https://gist.github.com/2881443

I hope someone will fix both ZF-10891 & cyrillic char issue correctly.

@Maks3w
Collaborator

@sasezaki Please reopen ZF2-170 with the test function and I will take a look later.

@sasezaki

@Maks3w thanks, catch up. I re-opend ZF-10891 (not ZF2-170)
http://framework.zend.com/issues/browse/ZF-10891

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 6, 2012
  1. @Maks3w

    [Filter] Fix trim for cyrillic characters.

    Maks3w authored
    Apply SVN r16417
This page is out of date. Refresh to see the latest.
View
2  library/Zend/Filter/StringTrim.php
@@ -123,6 +123,6 @@ protected function _unicodeTrim($value, $charlist = '\\\\s')
);
$pattern = '^[' . $chars . ']*|[' . $chars . ']*$';
- return preg_replace("/$pattern/usSD", '', $value);
+ return preg_replace("/$pattern/sSD", '', $value);
}
}
View
30 tests/Zend/Filter/StringTrimTest.php
@@ -22,7 +22,7 @@
namespace ZendTest\Filter;
use stdClass;
-use Zend\Filter\StringTrim as StringTrimFilter;
+use Zend\Filter\StringTrim;
/**
* @category Zend
@@ -35,20 +35,18 @@
class StringTrimTest extends \PHPUnit_Framework_TestCase
{
/**
- * Zend_Filter_StringTrim object
- *
- * @var Zend_Filter_StringTrim
+ * @var StringTrim
*/
protected $_filter;
/**
- * Creates a new Zend_Filter_StringTrim object for each test method
+ * Creates a new Zend\Filter\StringTrim object for each test method
*
* @return void
*/
public function setUp()
{
- $this->_filter = new StringTrimFilter();
+ $this->_filter = new StringTrim();
}
/**
@@ -103,7 +101,7 @@ public function testCharList()
}
/**
- * @ZF-7183
+ * @group ZF-7183
*/
public function testZF7183()
{
@@ -112,7 +110,17 @@ public function testZF7183()
}
/**
- * @ZF-7902
+ * @group ZF2-170
+ */
+ public function testZF2170()
+ {
+ $filter = $this->_filter;
+ $this->assertEquals('Расчет', $filter('Расчет'));
+ }
+
+
+ /**
+ * @group ZF-7902
*/
public function testZF7902()
{
@@ -121,7 +129,7 @@ public function testZF7902()
}
/**
- * @ZF-10891
+ * @group ZF-10891
*/
public function testZF10891()
{
@@ -131,10 +139,8 @@ public function testZF10891()
$this->assertEquals('Зенд', $filter(' Зенд'));
$trim_charlist = " \t\n\r\x0B・。";
- $filter = new StringTrimFilter($trim_charlist);
+ $filter = new StringTrim($trim_charlist);
$this->assertEquals('Зенд', $filter->filter('。 Зенд 。'));
-
-
}
public function getNonStringValues()
Something went wrong with that request. Please try again.