Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge branch 'feature/3495' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
weierophinney committed Jan 21, 2013
2 parents 8db3bda + 6bd21e4 commit 0da8a0e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 21 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"zendframework/zend-i18n": "Zend\\I18n component",
"zendframework/zend-servicemanager": "Zend\\ServiceManager component",
"zendframework/zend-uri": "Zend\\Uri component for UriNormalize filter",
"zendframework/zend-validator": "Zend\\Validator component"
"zendframework/zend-validator": "Zend\\Validator component",
"zendframework/zend-stdlib": "Zend\\Stdlib component"
},
"extra": {
"branch-alias": {
Expand Down
20 changes: 3 additions & 17 deletions src/AbstractFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace Zend\Filter;

use Traversable;
use Zend\Stdlib\ErrorHandler;
use Zend\Stdlib\StringUtils;

/**
* @category Zend
Expand All @@ -26,27 +26,13 @@ abstract class AbstractFilter implements FilterInterface
*/
protected $options = array();

/**
* Is PCRE is compiled with UTF-8 and Unicode support
*
* @var bool
**/
protected static $hasPcreUnicodeSupport = null;

/**
* @return bool
* @deprecated Since 2.1.0
*/
public static function hasPcreUnicodeSupport()
{
if (static::$hasPcreUnicodeSupport === null) {
static::$hasPcreUnicodeSupport = false;
ErrorHandler::start();
if (defined('PREG_BAD_UTF8_OFFSET_ERROR') && preg_match('/\pL/u', 'a') == 1) {
static::$hasPcreUnicodeSupport = true;
}
ErrorHandler::stop();
}
return static::$hasPcreUnicodeSupport;
return StringUtils::hasPcreUnicodeSupport();
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/Digits.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

namespace Zend\Filter;

use Zend\Stdlib\StringUtils;

/**
* @category Zend
* @package Zend_Filter
Expand All @@ -26,7 +28,7 @@ class Digits extends AbstractFilter
*/
public function filter($value)
{
if (!static::hasPcreUnicodeSupport()) {
if (!StringUtils::hasPcreUnicodeSupport()) {
// POSIX named classes are not supported, use alternative 0-9 match
$pattern = '/[^0-9]/';
} elseif (extension_loaded('mbstring')) {
Expand Down
4 changes: 3 additions & 1 deletion src/Word/CamelCaseToSeparator.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

namespace Zend\Filter\Word;

use Zend\Stdlib\StringUtils;

/**
* @category Zend
* @package Zend_Filter
Expand All @@ -24,7 +26,7 @@ class CamelCaseToSeparator extends AbstractSeparator
*/
public function filter($value)
{
if (self::hasPcreUnicodeSupport()) {
if (StringUtils::hasPcreUnicodeSupport()) {
$pattern = array('#(?<=(?:\p{Lu}))(\p{Lu}\p{Ll})#', '#(?<=(?:\p{Ll}|\p{Nd}))(\p{Lu})#');
$replacement = array($this->separator . '\1', $this->separator . '\1');
} else {
Expand Down
4 changes: 3 additions & 1 deletion src/Word/SeparatorToCamelCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

namespace Zend\Filter\Word;

use Zend\Stdlib\StringUtils;

/**
* @category Zend
* @package Zend_Filter
Expand All @@ -27,7 +29,7 @@ public function filter($value)
// a unicode safe way of converting characters to \x00\x00 notation
$pregQuotedSeparator = preg_quote($this->separator, '#');

if (self::hasPcreUnicodeSupport()) {
if (StringUtils::hasPcreUnicodeSupport()) {
$patterns = array(
'#(' . $pregQuotedSeparator.')(\p{L}{1})#u',
'#(^\p{Ll}{1})#u',
Expand Down

0 comments on commit 0da8a0e

Please sign in to comment.