<commit_before><?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/zf2 for the canonical source repository
 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 * @package   Zend_Filter
 */

namespace Zend\Filter;

use Traversable;
use Zend\Stdlib\ErrorHandler;

/**
 * @category   Zend
 * @package    Zend_Filter
 */
abstract class AbstractFilter implements FilterInterface
{
    /**
     * Filter options
     *
     * @var array
     */
    protected $options = array();

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

    /**
     * @return bool
     */
    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();
        }<commit_msg>Fixed issue when PREG_BAD_UTF8_OFFSET_ERROR is defined but Unicode support is not enabled on PCRE<commit_after><?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/zf2 for the canonical source repository
 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 * @package   Zend_Filter
 */

namespace Zend\Filter;

use Traversable;
use Zend\Stdlib\ErrorHandler;

/**
 * @category   Zend
 * @package    Zend_Filter
 */
abstract class AbstractFilter implements FilterInterface
{
    /**
     * Filter options
     *
     * @var array
     */
    protected $options = array();

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

    /**
     * @return bool
     */
    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();
        }
{'fraction_non_alphanumeric': 0.12402496099843993, 'fraction_numerical': 0.009750390015600624, 'mean_word_length': 2.494550408719346, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7542929', 'n_tokens_mistral': 780, 'n_tokens_neox': 755, 'n_words': 181}