mirror of
https://github.com/fzaninotto/Faker.git
synced 2025-03-22 08:19:52 +01:00
Added some multi-byte related fixes.
This commit is contained in:
parent
f735772deb
commit
a9d87ecf72
@ -53,7 +53,7 @@ class Generator
|
||||
*/
|
||||
public function parse($string)
|
||||
{
|
||||
return preg_replace_callback('/\{\{\s?(\w+)\s?\}\}/', array($this, 'callFormatWithMatches'), $string);
|
||||
return preg_replace_callback('/\{\{\s?(\w+)\s?\}\}/u', array($this, 'callFormatWithMatches'), $string);
|
||||
}
|
||||
|
||||
protected function callFormatWithMatches($matches)
|
||||
|
@ -136,8 +136,8 @@ class Base
|
||||
*/
|
||||
public static function numerify($string = '###')
|
||||
{
|
||||
$string = preg_replace_callback('/\#/', 'static::randomDigit', $string);
|
||||
$string = preg_replace_callback('/\%/', 'static::randomDigitNotNull', $string);
|
||||
$string = preg_replace_callback('/\#/u', 'static::randomDigit', $string);
|
||||
$string = preg_replace_callback('/\%/u', 'static::randomDigitNotNull', $string);
|
||||
|
||||
return $string;
|
||||
}
|
||||
@ -150,7 +150,7 @@ class Base
|
||||
*/
|
||||
public static function lexify($string = '????')
|
||||
{
|
||||
return preg_replace_callback('/\?/', 'static::randomLetter', $string);
|
||||
return preg_replace_callback('/\?/u', 'static::randomLetter', $string);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,7 +29,7 @@ class Internet extends \Faker\Provider\Base
|
||||
{
|
||||
$format = static::randomElement(static::$emailFormats);
|
||||
|
||||
return preg_replace('/\s/', '', $this->generator->parse($format));
|
||||
return preg_replace('/\s/u', '', $this->generator->parse($format));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -37,7 +37,7 @@ class Internet extends \Faker\Provider\Base
|
||||
*/
|
||||
public final function safeEmail()
|
||||
{
|
||||
return preg_replace('/\s/', '', $this->userName() . '@' . static::safeEmailDomain());
|
||||
return preg_replace('/\s/u', '', $this->userName() . '@' . static::safeEmailDomain());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -45,7 +45,7 @@ class Internet extends \Faker\Provider\Base
|
||||
*/
|
||||
public function freeEmail()
|
||||
{
|
||||
return preg_replace('/\s/', '', $this->userName() . '@' . static::freeEmailDomain());
|
||||
return preg_replace('/\s/u', '', $this->userName() . '@' . static::freeEmailDomain());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,7 +53,7 @@ class Internet extends \Faker\Provider\Base
|
||||
*/
|
||||
public function companyEmail()
|
||||
{
|
||||
return preg_replace('/\s/', '', $this->userName() . '@' . $this->domainName());
|
||||
return preg_replace('/\s/u', '', $this->userName() . '@' . $this->domainName());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -103,7 +103,7 @@ class Internet extends \Faker\Provider\Base
|
||||
$company = $this->generator->format('company');
|
||||
$companyElements = explode(' ', $company);
|
||||
$company = $companyElements[0];
|
||||
$company = preg_replace('/\W/', '', $company);
|
||||
$company = preg_replace('/\W/u', '', $company);
|
||||
|
||||
return static::toLower($company);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ class Internet extends \Faker\Provider\Internet
|
||||
$company = $this->generator->format('company');
|
||||
$companyElements = explode(' ', $company);
|
||||
$company = $companyElements[0];
|
||||
$company = preg_replace('/\W/', '', $company);
|
||||
$company = preg_replace('/\W/u', '', $company);
|
||||
|
||||
return $company;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ class Internet extends \Faker\Provider\Internet
|
||||
$company = $this->generator->format('company');
|
||||
$companyElements = explode(' ', $company);
|
||||
$company = $companyElements[0];
|
||||
$company = preg_replace('/\W/', '', $company);
|
||||
$company = preg_replace('/\W/u', '', $company);
|
||||
|
||||
return static::toLower(static::toAscii($company));
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ class Internet extends \Faker\Provider\Internet
|
||||
$company = $this->generator->format('company');
|
||||
$companyElements = explode(' ', $company);
|
||||
$company = $companyElements[0];
|
||||
$company = preg_replace('/\W/', '', $company);
|
||||
$company = preg_replace('/\W/u', '', $company);
|
||||
|
||||
return static::toLower(static::toAscii($company));
|
||||
}
|
||||
|
@ -58,8 +58,8 @@ class Address extends \Faker\Provider\en_US\Address
|
||||
{
|
||||
$string = static::randomElement(static::$postcode);
|
||||
|
||||
$string = preg_replace_callback('/\#/', 'static::randomDigit', $string);
|
||||
$string = preg_replace_callback('/\?/', 'static::randomPostcodeLetter', $string);
|
||||
$string = preg_replace_callback('/\#/u', 'static::randomDigit', $string);
|
||||
$string = preg_replace_callback('/\?/u', 'static::randomPostcodeLetter', $string);
|
||||
|
||||
return static::toUpper($string);
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ class Internet extends \Faker\Provider\Internet
|
||||
$company = $this->generator->format('company');
|
||||
$companyElements = explode(' ', $company);
|
||||
$company = $companyElements[0];
|
||||
$company = preg_replace('/\W/', '', $company);
|
||||
$company = preg_replace('/\W/u', '', $company);
|
||||
|
||||
return static::toLower(static::toAscii($company));
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ class Internet extends \Faker\Provider\Internet
|
||||
$company = $this->generator->format('company');
|
||||
$companyElements = explode(' ', $company);
|
||||
$company = $companyElements[0];
|
||||
$company = preg_replace('/\W/', '', $company);
|
||||
$company = preg_replace('/\W/u', '', $company);
|
||||
|
||||
return static::toLower(static::toAscii($company));
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ class Internet extends \Faker\Provider\Internet
|
||||
$company = $this->generator->format('company');
|
||||
$companyElements = explode(' ', $company);
|
||||
$company = $companyElements[0];
|
||||
$company = preg_replace('/\W/', '', $company);
|
||||
$company = preg_replace('/\W/u', '', $company);
|
||||
|
||||
return static::toLower(static::toAscii($company));
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ class Internet extends \Faker\Provider\Internet
|
||||
$company = $this->generator->format('company');
|
||||
$companyElements = explode(' ', $company);
|
||||
$company = $companyElements[0];
|
||||
$company = preg_replace('/,/', '', $company);
|
||||
$company = preg_replace('/,/u', '', $company);
|
||||
|
||||
return $company;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user