danielstjules/Stringy

Warning: mb_regex_encoding()

travisfont opened this issue · 3 comments

Warning: mb_regex_encoding(): Unknown encoding "" - \Stringy\src\Stringy.php on line 970

Receiving this error when an instance is cloned. Such as:

require_once 'Stringy/src/Stringy.php';

use Stringy\Stringy as Stringy;

final S extends Stringy
{
    public function __construct()
    {
        return clone new Stringy;
    }
}

echo S::create('Camel-Case')->camelize();

Any suggestions?

Note, I have mbstring enable.

You're not passing any args to the constructor?

<?php
require_once 'Stringy/src/Stringy.php';
use Stringy\Stringy as Stringy;

final class S extends Stringy
{

}

echo S::create('Camel-Case')->camelize();

Or an alternative:

<?php

require_once 'Stringy/src/Stringy.php';
use Stringy\Stringy as Stringy;

final class S extends Stringy
{
    public function __construct($str = '', $encoding = null)
    {
        parent::__construct($str, $encoding);
    }
}

echo S::create('Camel-Case')->camelize();

Thank you!

Np! :)